@spaced-out/ui-design-system 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.3.6](https://github.com/spaced-out/ui-design-system/compare/v0.3.5...v0.3.6) (2024-11-27)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * added role=group for weekdayPicker ([#294](https://github.com/spaced-out/ui-design-system/issues/294)) ([bf61f70](https://github.com/spaced-out/ui-design-system/commit/bf61f7034a557b7adee858be10f990aed93d6b50))
11
+
12
+ ### [0.3.5](https://github.com/spaced-out/ui-design-system/compare/v0.3.4...v0.3.5) (2024-11-27)
13
+
14
+
15
+ ### Features
16
+
17
+ * [GDS-445, GDS-467] Add 'description' prop to TimelineItem component and pass event as second argument in checkbox onChange handler ([#290](https://github.com/spaced-out/ui-design-system/issues/290)) ([f8e234b](https://github.com/spaced-out/ui-design-system/commit/f8e234bcb3d8dcd9b1a619aa90678fe21678f937))
18
+ * weekdayname inside weekday picker ([#293](https://github.com/spaced-out/ui-design-system/issues/293)) ([ccdc996](https://github.com/spaced-out/ui-design-system/commit/ccdc996edff4f5775723f3226e938761aaf6da8c))
19
+
5
20
  ### [0.3.4](https://github.com/spaced-out/ui-design-system/compare/v0.3.3...v0.3.4) (2024-11-22)
6
21
 
7
22
 
@@ -30,12 +30,12 @@ const Checkbox = /*#__PURE__*/React.forwardRef((_ref, forwardRef) => {
30
30
  } = _ref;
31
31
  const checkboxInput = /*#__PURE__*/React.createRef();
32
32
  React.useImperativeHandle(forwardRef, () => checkboxInput.current);
33
- const handleOnClick = () => {
33
+ const handleOnClick = event => {
34
34
  if (!disabled) {
35
35
  onChange && onChange({
36
36
  value,
37
37
  checked: !checked
38
- });
38
+ }, event);
39
39
  }
40
40
  };
41
41
  React.useEffect(() => {
@@ -29,7 +29,10 @@ export type CheckboxProps = {
29
29
  focused?: boolean,
30
30
  disabled?: boolean,
31
31
  error?: boolean,
32
- onChange?: ({value: string, checked: boolean}) => mixed,
32
+ onChange?: (
33
+ {value: string, checked: boolean},
34
+ ?SyntheticEvent<HTMLElement>,
35
+ ) => mixed,
33
36
  align?: GroupAlign,
34
37
  classNames?: ClassNames,
35
38
  tabIndex?: number,
@@ -61,13 +64,16 @@ export const Checkbox: React$AbstractComponent<
61
64
  const checkboxInput = React.createRef<HTMLInputElement>();
62
65
  React.useImperativeHandle(forwardRef, () => checkboxInput.current);
63
66
 
64
- const handleOnClick = () => {
67
+ const handleOnClick = (event) => {
65
68
  if (!disabled) {
66
69
  onChange &&
67
- onChange({
68
- value,
69
- checked: !checked,
70
- });
70
+ onChange(
71
+ {
72
+ value,
73
+ checked: !checked,
74
+ },
75
+ event,
76
+ );
71
77
  }
72
78
  };
73
79
 
@@ -80,15 +80,22 @@
80
80
  flex-direction: column;
81
81
  margin-bottom: spaceMedium;
82
82
 
83
- & .timelineItemTitle {
84
- justify-content: var(--justify);
83
+ & .timelineItemInfo {
84
+ display: flex;
85
+ flex-direction: column;
86
+ justify-content: center;
87
+ align-items: var(--align);
88
+ min-height: size26;
85
89
  }
86
90
  }
87
91
 
88
92
  .timelineItemTitle {
93
+ composes: bodyMedium from '../../styles/typography.module.css';
94
+ }
95
+
96
+ .timelineItemDescription {
89
97
  composes: bodySmall from '../../styles/typography.module.css';
90
98
  composes: secondary from '../../styles/typography.module.css';
91
- min-height: size26;
92
99
  }
93
100
 
94
101
  .timelineItemCardWrapper {
@@ -25,6 +25,7 @@ const TimelineItem_ = (_ref, ref) => {
25
25
  children,
26
26
  iconColor = _typography.TEXT_COLORS.information,
27
27
  classNames,
28
+ description,
28
29
  orientation = _Timeline.ORIENTATION.left,
29
30
  parentComponent,
30
31
  enableCardWrapper = true
@@ -56,13 +57,14 @@ const TimelineItem_ = (_ref, ref) => {
56
57
  }, /*#__PURE__*/React.createElement("div", {
57
58
  className: _TimelineModule.default.border
58
59
  }))), /*#__PURE__*/React.createElement("div", {
59
- style: {
60
- '--justify': orientation === 'left' ? 'flex-start' : 'flex-end'
61
- },
62
60
  className: _TimelineModule.default.timelineItemEventDetails
61
+ }, /*#__PURE__*/React.createElement("div", {
62
+ className: _TimelineModule.default.timelineItemInfo
63
63
  }, /*#__PURE__*/React.createElement("div", {
64
64
  className: (0, _classify.classify)(_TimelineModule.default.timelineItemTitle, classNames?.title)
65
- }, title), /*#__PURE__*/React.createElement(_ConditionalWrapper.ConditionalWrapper, {
65
+ }, title), description ? /*#__PURE__*/React.createElement("div", {
66
+ className: (0, _classify.classify)(_TimelineModule.default.timelineItemDescription, classNames?.description)
67
+ }, description) : null), /*#__PURE__*/React.createElement(_ConditionalWrapper.ConditionalWrapper, {
66
68
  condition: enableCardWrapper,
67
69
  wrapper: children => /*#__PURE__*/React.createElement(_Card.Card, {
68
70
  paddingTop: _Card.PADDING_SIZES.small,
@@ -19,6 +19,7 @@ type ClassNames = $ReadOnly<{
19
19
  icon?: string,
20
20
  title?: string,
21
21
  wrapper?: string,
22
+ description?: string,
22
23
  }>;
23
24
 
24
25
  export type TimelineItemProps = {
@@ -29,6 +30,7 @@ export type TimelineItemProps = {
29
30
  iconType?: IconType,
30
31
  iconColor?: ColorTypes,
31
32
  classNames?: ClassNames,
33
+ description?: React.Node,
32
34
  orientation?: Orientation,
33
35
  parentComponent?: React.Node,
34
36
  enableCardWrapper?: boolean,
@@ -43,6 +45,7 @@ const TimelineItem_ = (
43
45
  children,
44
46
  iconColor = TEXT_COLORS.information,
45
47
  classNames,
48
+ description,
46
49
  orientation = ORIENTATION.left,
47
50
  parentComponent,
48
51
  enableCardWrapper = true,
@@ -78,14 +81,21 @@ const TimelineItem_ = (
78
81
  <div className={css.border} />
79
82
  </div>
80
83
  </div>
81
- <div
82
- style={{
83
- '--justify': orientation === 'left' ? 'flex-start' : 'flex-end',
84
- }}
85
- className={css.timelineItemEventDetails}
86
- >
87
- <div className={classify(css.timelineItemTitle, classNames?.title)}>
88
- {title}
84
+ <div className={css.timelineItemEventDetails}>
85
+ <div className={css.timelineItemInfo}>
86
+ <div className={classify(css.timelineItemTitle, classNames?.title)}>
87
+ {title}
88
+ </div>
89
+ {description ? (
90
+ <div
91
+ className={classify(
92
+ css.timelineItemDescription,
93
+ classNames?.description,
94
+ )}
95
+ >
96
+ {description}
97
+ </div>
98
+ ) : null}
89
99
  </div>
90
100
  <ConditionalWrapper
91
101
  condition={enableCardWrapper}
@@ -63,7 +63,12 @@ const DayButton = _ref => {
63
63
  "aria-label": `Select ${day.label}`,
64
64
  tabIndex: isDisabled || readOnly ? -1 : 0,
65
65
  role: "checkbox"
66
- }, day.label);
66
+ }, day.secondaryLabel && /*#__PURE__*/React.createElement("div", {
67
+ className: (0, _classify.default)(_WeekdayPickerModule.default.secondaryLabel, {
68
+ [_WeekdayPickerModule.default.secondaryLabelSelected]: isSelected,
69
+ [_WeekdayPickerModule.default.secondaryLabelDisabled]: isDisabled
70
+ })
71
+ }, day.secondaryLabel), day.label);
67
72
  };
68
73
  const WeekdayPicker = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
69
74
  let {
@@ -110,7 +115,8 @@ const WeekdayPicker = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
110
115
  className: (0, _classify.default)(_WeekdayPickerModule.default.weekdayPickerContainer, classNames.wrapper, {
111
116
  [_WeekdayPickerModule.default.weekdayReadOnly]: readOnly
112
117
  }),
113
- "aria-label": ariaLabel
118
+ "aria-label": ariaLabel,
119
+ role: "group"
114
120
  }, !!label && /*#__PURE__*/React.createElement("div", {
115
121
  className: (0, _classify.default)(_WeekdayPickerModule.default.weekdayLabel, classNames.label)
116
122
  }, label), /*#__PURE__*/React.createElement("div", {
@@ -36,6 +36,7 @@ type WeekdayPickerSize = $Values<typeof WEEKDAY_PICKER_SIZE>;
36
36
  type Weekday = {
37
37
  key: string,
38
38
  label: string,
39
+ secondaryLabel?: string,
39
40
  };
40
41
 
41
42
  export type WeekdayPickerProps = {
@@ -94,6 +95,16 @@ const DayButton = ({
94
95
  tabIndex={isDisabled || readOnly ? -1 : 0}
95
96
  role="checkbox"
96
97
  >
98
+ {day.secondaryLabel && (
99
+ <div
100
+ className={classify(css.secondaryLabel, {
101
+ [css.secondaryLabelSelected]: isSelected,
102
+ [css.secondaryLabelDisabled]: isDisabled,
103
+ })}
104
+ >
105
+ {day.secondaryLabel}
106
+ </div>
107
+ )}
97
108
  {day.label}
98
109
  </UnstyledButton>
99
110
  );
@@ -165,6 +176,7 @@ export const WeekdayPicker: React$AbstractComponent<
165
176
  [css.weekdayReadOnly]: readOnly,
166
177
  })}
167
178
  aria-label={ariaLabel}
179
+ role="group"
168
180
  >
169
181
  {!!label && (
170
182
  <div className={classify(css.weekdayLabel, classNames.label)}>
@@ -1,5 +1,4 @@
1
- @value (
2
- colorTextSecondary,
1
+ @value (colorTextSecondary,
3
2
  colorFillSecondary,
4
3
  colorButtonFillTertiaryHovered,
5
4
  colorTextPrimary,
@@ -10,13 +9,12 @@
10
9
  colorFillDisabled,
11
10
  colorFocusPrimary,
12
11
  colorBackgroundSecondary,
13
- colorGrayLightest
14
- ) from '../../styles/variables/_color.css';
12
+ colorGrayLightest) from '../../styles/variables/_color.css';
15
13
 
16
- @value (spaceXXSmall,spaceXSmall,spaceSmall) from '../../styles/variables/_space.css';
17
- @value (size42,size34) from '../../styles/variables/_size.css';
14
+ @value (spaceXXSmall, spaceXSmall, spaceSmall) from '../../styles/variables/_space.css';
15
+ @value (size8, size42, size34) from '../../styles/variables/_size.css';
18
16
 
19
- @value (borderRadiusSmall,borderWidthNone,borderWidthTertiary) from '../../styles/variables/_border.css';
17
+ @value (borderRadiusSmall, borderWidthNone, borderWidthTertiary) from '../../styles/variables/_border.css';
20
18
 
21
19
  .weekdayPickerContainer {
22
20
  display: flex;
@@ -32,6 +30,7 @@
32
30
  .weekdayButton {
33
31
  composes: formLabelSmall from '../../styles/typography.module.css';
34
32
  composes: motionEaseInEaseOut from '../../styles/animation.module.css';
33
+ flex-direction: column;
35
34
  display: flex;
36
35
  align-items: center;
37
36
  justify-content: center;
@@ -63,6 +62,10 @@
63
62
  composes: buttonTextSmall from '../../styles/typography.module.css';
64
63
  height: size34;
65
64
  width: size34;
65
+
66
+ .secondaryLabel {
67
+ font-size: size8;
68
+ }
66
69
  }
67
70
 
68
71
  .weekdayButtonSelected {
@@ -73,6 +76,11 @@
73
76
  &:focus-visible {
74
77
  background-color: colorButtonFillPrimaryHovered;
75
78
  color: colorTextInversePrimary;
79
+
80
+ .secondaryLabel {
81
+ background-color: colorButtonFillPrimaryHovered;
82
+ color: colorTextInversePrimary;
83
+ }
76
84
  }
77
85
  }
78
86
 
@@ -83,6 +91,28 @@
83
91
  cursor: not-allowed;
84
92
  }
85
93
 
94
+ .secondaryLabel {
95
+ composes: bodySmall from '../../styles/typography.module.css';
96
+ color: colorTextSecondary;
97
+
98
+ /* Added a transition to .secondaryLabel for smoother and immediate style updates
99
+ during hover or focus-visible states of .secondaryLabelSelected. This ensures the
100
+ change feels intentional, even if there’s a minor rendering delay. */
101
+ transition: background-color 0.1s, color 0.1s, font-size 0.1s;
102
+ }
103
+
104
+ .secondaryLabelSelected {
105
+ background-color: colorButtonFillPrimaryEnabled;
106
+ color: colorTextInversePrimary;
107
+ }
108
+
109
+ .secondaryLabelDisabled {
110
+ background-color: colorFillDisabled;
111
+ color: colorTextDisabled;
112
+ pointer-events: none;
113
+ cursor: not-allowed;
114
+ }
115
+
86
116
  .weekdayLabel {
87
117
  composes: formLabelSmall from '../../styles/typography.module.css';
88
118
  color: colorTextSecondary;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {