Skip to content

Commit

Permalink
feat(sdds-*): add required to DatePicker & Range
Browse files Browse the repository at this point in the history
  • Loading branch information
TitanKuzmich committed Nov 27, 2024
1 parent 0661109 commit 44871d6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
11 changes: 10 additions & 1 deletion packages/sdds-cs/src/components/DatePicker/DatePicker.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const config = {
${tokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing);
${tokens.labelInnerLineHeight}: var(--plasma-typo-body-xs-line-height);
${tokens.indicatorColor}: var(--surface-negative);
${tokens.textFieldBorderColor}: var(--outline-solid-primary);
${tokens.textFieldBorderColorHover}: var(--outline-solid-primary-hover);
${tokens.textFieldBorderColorFocus}: var(--outline-accent);
Expand Down Expand Up @@ -97,7 +99,7 @@ export const config = {
${tokens.leftContentMargin}: 0 0 0 0.75rem;
${tokens.rightContentMargin}: 0;
${tokens.labelOffset}: 0 0 0.5rem 0;
${tokens.labelOffset}: 0.5rem;
${tokens.labelInnerPadding}: 0.3125rem 0 0 0;
${tokens.contentLabelInnerPadding}: 1.0625rem 0 0.3125rem 0;
Expand All @@ -108,6 +110,13 @@ export const config = {
${tokens.labelLetterSpacing}: var(--plasma-typo-body-s-letter-spacing);
${tokens.labelLineHeight}: var(--plasma-typo-body-s-line-height);
${tokens.indicatorSize}: 0.375rem;
${tokens.indicatorSizeOuter}: 0.375rem;
${tokens.indicatorPlacement}: 0 0 0 0;
${tokens.indicatorOuterPlacement}: 0.3125rem auto auto -0.6875rem;
${tokens.indicatorPlacementRight}: 0 0 auto auto;
${tokens.indicatorOuterPlacementRight}: 0.25rem -0.625rem auto auto;
${tokens.textFieldHeight}: 2.5rem;
${tokens.textFieldBorderRadius}: 0.625rem;
${tokens.textFieldBorderWidth}: 0.125rem;
Expand Down
12 changes: 12 additions & 0 deletions packages/sdds-cs/src/components/DatePicker/DatePicker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const sizes = ['s'];
const views = ['default'];
const dividers = ['none', 'dash', 'icon'];
const labelPlacements = ['outer', 'inner'];
const requiredPlacements = ['left', 'right'];

const meta: Meta = {
title: 'Controls/DatePicker',
Expand Down Expand Up @@ -58,6 +59,13 @@ const meta: Meta = {
type: 'select',
},
},
requiredPlacement: {
options: requiredPlacements,
control: {
type: 'select',
},
if: { arg: 'required', truthy: true },
},
},
};

Expand Down Expand Up @@ -127,6 +135,8 @@ export const Default: StoryObj<StoryPropsDefault> = {
min: new Date(2024, 1, 1),
max: new Date(2024, 12, 29),
maskWithFormat: false,
required: false,
requiredPlacement: 'right',
disabled: false,
readOnly: false,
textBefore: '',
Expand Down Expand Up @@ -258,6 +268,8 @@ export const Range: StoryObj<StoryPropsRange> = {
min: new Date(2024, 1, 1),
max: new Date(2024, 12, 29),
maskWithFormat: false,
required: false,
requiredPlacement: 'right',
disabled: false,
readOnly: false,
enableContentLeft: true,
Expand Down
11 changes: 10 additions & 1 deletion packages/sdds-cs/src/components/Range/Range.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const config = {
${tokens.labelColor}: var(--text-primary);
${tokens.leftHelperColor}: var(--text-secondary);
${tokens.indicatorColor}: var(--surface-negative);
${tokens.textFieldColor}: var(--text-primary);
${tokens.textFieldPlaceholderColor}: var(--text-secondary);
${tokens.textFieldPlaceholderColorFocus}: var(--text-tertiary);
Expand Down Expand Up @@ -49,7 +51,7 @@ export const config = {
${tokens.leftContentMargin}: 0 0.375rem 0 0.75rem;
${tokens.rightContentMargin}: 0;
${tokens.labelOffset}: 0 0 0.5rem 0;
${tokens.labelOffset}: 0.5rem;
${tokens.labelFontFamily}: var(--plasma-typo-body-s-font-family);
${tokens.labelFontStyle}: var(--plasma-typo-body-s-font-style);
Expand All @@ -58,6 +60,13 @@ export const config = {
${tokens.labelLetterSpacing}: var(--plasma-typo-body-s-letter-spacing);
${tokens.labelLineHeight}: var(--plasma-typo-body-s-line-height);
${tokens.indicatorSize}: 0.375rem;
${tokens.indicatorSizeOuter}: 0.375rem;
${tokens.indicatorPlacement}: 0 0 0 0;
${tokens.indicatorOuterPlacement}: 0.3125rem auto auto -0.6875rem;
${tokens.indicatorPlacementRight}: 0 0 auto auto;
${tokens.indicatorOuterPlacementRight}: 0.25rem -0.625rem auto auto;
${tokens.textFieldHeight}: 2.5rem;
${tokens.textFieldBorderRadius}: 0.625rem;
${tokens.textFieldBorderWidth}: 0.125rem;
Expand Down

0 comments on commit 44871d6

Please sign in to comment.