@kaizen/components 1.50.0 → 1.52.0

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.
Files changed (206) hide show
  1. package/dist/cjs/Button/GenericButton/GenericButton.cjs +89 -82
  2. package/dist/cjs/Button/GenericButton/GenericButton.module.scss.cjs +2 -1
  3. package/dist/cjs/ButtonGroup/ButtonGroup.cjs +4 -4
  4. package/dist/cjs/Filter/FilterButton/FilterButtonRemovable/FilterButtonRemovable.cjs +2 -2
  5. package/dist/cjs/GuidanceBlock/GuidanceBlock.cjs +2 -2
  6. package/dist/cjs/KaizenProvider/KaizenProvider.cjs +1 -1
  7. package/dist/cjs/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.cjs +11 -2
  8. package/dist/cjs/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.cjs +1 -2
  9. package/dist/cjs/RichTextEditor/RichTextEditor/subcomponents/ToggleIconButton/ToggleIconButton.cjs +2 -2
  10. package/dist/cjs/Table/Table.cjs +2 -2
  11. package/dist/cjs/Tabs/subcomponents/Tab.cjs +20 -14
  12. package/dist/cjs/TitleBlockZen/TitleBlockZen.cjs +1 -1
  13. package/dist/cjs/__overlays__/Focusable/v3/Focusable.cjs +33 -0
  14. package/dist/cjs/__overlays__/Focusable/v3/Focusable.module.scss.cjs +6 -0
  15. package/dist/cjs/__overlays__/Tooltip/v1/Tooltip.module.scss.cjs +21 -0
  16. package/dist/cjs/__overlays__/Tooltip/v1/index.cjs +8 -0
  17. package/dist/cjs/__overlays__/Tooltip/v3/OverlayArrow.cjs +32 -0
  18. package/dist/cjs/__overlays__/Tooltip/v3/OverlayArrow.module.scss.cjs +7 -0
  19. package/dist/cjs/__overlays__/Tooltip/v3/Tooltip.cjs +59 -0
  20. package/dist/cjs/__overlays__/Tooltip/v3/Tooltip.module.scss.cjs +8 -0
  21. package/dist/cjs/__overlays__/Tooltip/v3/TooltipTrigger.cjs +24 -0
  22. package/dist/cjs/__utilities__/ReversedColors/v3/ReversedColors.cjs +23 -0
  23. package/dist/cjs/index.cjs +2 -2
  24. package/dist/cjs/overlaysV1.cjs +4 -0
  25. package/dist/cjs/overlaysV2.cjs +4 -0
  26. package/dist/cjs/overlaysV3.cjs +15 -0
  27. package/dist/cjs/reactAriaComponentsV3.cjs +11 -0
  28. package/dist/cjs/reactAriaV3.cjs +11 -0
  29. package/dist/cjs/utilitiesV3.cjs +5 -0
  30. package/dist/cjs/utils/mergeClassNames.cjs +33 -0
  31. package/dist/esm/Button/GenericButton/GenericButton.mjs +90 -82
  32. package/dist/esm/Button/GenericButton/GenericButton.module.scss.mjs +2 -1
  33. package/dist/esm/ButtonGroup/ButtonGroup.mjs +1 -1
  34. package/dist/esm/Filter/FilterButton/FilterButtonRemovable/FilterButtonRemovable.mjs +1 -1
  35. package/dist/esm/GuidanceBlock/GuidanceBlock.mjs +1 -1
  36. package/dist/esm/KaizenProvider/KaizenProvider.mjs +1 -1
  37. package/dist/esm/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.mjs +11 -2
  38. package/dist/esm/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.mjs +1 -2
  39. package/dist/esm/RichTextEditor/RichTextEditor/subcomponents/ToggleIconButton/ToggleIconButton.mjs +1 -1
  40. package/dist/esm/Table/Table.mjs +1 -1
  41. package/dist/esm/Tabs/subcomponents/Tab.mjs +21 -15
  42. package/dist/esm/TitleBlockZen/TitleBlockZen.mjs +1 -1
  43. package/dist/esm/__overlays__/Focusable/v3/Focusable.mjs +24 -0
  44. package/dist/esm/__overlays__/Focusable/v3/Focusable.module.scss.mjs +4 -0
  45. package/dist/esm/__overlays__/Tooltip/v1/Tooltip.module.scss.mjs +19 -0
  46. package/dist/esm/__overlays__/Tooltip/v1/index.mjs +6 -0
  47. package/dist/esm/__overlays__/Tooltip/v3/OverlayArrow.mjs +24 -0
  48. package/dist/esm/__overlays__/Tooltip/v3/OverlayArrow.module.scss.mjs +5 -0
  49. package/dist/esm/__overlays__/Tooltip/v3/Tooltip.mjs +46 -0
  50. package/dist/esm/__overlays__/Tooltip/v3/Tooltip.module.scss.mjs +6 -0
  51. package/dist/esm/__overlays__/Tooltip/v3/TooltipTrigger.mjs +16 -0
  52. package/dist/esm/__utilities__/ReversedColors/v3/ReversedColors.mjs +14 -0
  53. package/dist/esm/index.mjs +1 -1
  54. package/dist/esm/overlaysV1.mjs +1 -0
  55. package/dist/esm/overlaysV2.mjs +1 -0
  56. package/dist/esm/overlaysV3.mjs +4 -0
  57. package/dist/esm/reactAriaComponentsV3.mjs +1 -0
  58. package/dist/esm/reactAriaV3.mjs +1 -0
  59. package/dist/esm/utilitiesV3.mjs +1 -0
  60. package/dist/esm/utils/mergeClassNames.mjs +25 -0
  61. package/dist/styles.css +19 -16
  62. package/dist/types/Button/GenericButton/GenericButton.d.ts +2 -1
  63. package/dist/types/ButtonGroup/ButtonGroup.d.ts +1 -1
  64. package/dist/types/Container/Container.d.ts +1 -1
  65. package/dist/types/Content/Content.d.ts +1 -1
  66. package/dist/types/DateInput/DateInput/DateInput.d.ts +1 -1
  67. package/dist/types/DatePicker/subcomponents/DateInputField/DateInputField.d.ts +1 -1
  68. package/dist/types/Filter/FilterButton/subcomponents/FilterButtonBase/FilterButtonBase.d.ts +1 -1
  69. package/dist/types/Filter/FilterDatePicker/subcomponents/DateInputField/DateInputField.d.ts +1 -1
  70. package/dist/types/GuidanceBlock/GuidanceBlock.d.ts +1 -1
  71. package/dist/types/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.d.ts +2 -2
  72. package/dist/types/Notification/subcomponents/GenericNotification/GenericNotification.d.ts +1 -1
  73. package/dist/types/Select/Select.d.ts +3 -3
  74. package/dist/types/__future__/Select/Select.d.ts +2 -2
  75. package/dist/types/__future__/Select/subcomponents/SelectToggle/SelectToggle.d.ts +2 -2
  76. package/dist/types/__overlays__/Focusable/v3/Focusable.d.ts +6 -0
  77. package/dist/types/__overlays__/Focusable/v3/index.d.ts +1 -0
  78. package/dist/types/__overlays__/Tooltip/v1/index.d.ts +8 -0
  79. package/dist/types/{Tooltip → __overlays__/Tooltip/v1}/utils/isSemanticElement.d.ts +2 -2
  80. package/dist/types/__overlays__/Tooltip/v2/index.d.ts +1 -0
  81. package/dist/types/__overlays__/Tooltip/v3/OverlayArrow.d.ts +7 -0
  82. package/dist/types/__overlays__/Tooltip/v3/Tooltip.d.ts +32 -0
  83. package/dist/types/__overlays__/Tooltip/v3/TooltipTrigger.d.ts +19 -0
  84. package/dist/types/__overlays__/Tooltip/v3/index.d.ts +2 -0
  85. package/dist/types/__overlays__/v1.d.ts +1 -0
  86. package/dist/types/__overlays__/v2.d.ts +1 -0
  87. package/dist/types/__overlays__/v3.d.ts +2 -0
  88. package/dist/types/__react-aria-components__/index.d.ts +1 -0
  89. package/dist/types/__react-aria__/index.d.ts +1 -0
  90. package/dist/types/__utilities__/ReversedColors/v3/ReversedColors.d.ts +7 -0
  91. package/dist/types/__utilities__/ReversedColors/v3/index.d.ts +1 -0
  92. package/dist/types/__utilities__/v3.d.ts +1 -0
  93. package/dist/types/index.d.ts +1 -1
  94. package/dist/types/utils/getNodeText.d.ts +1 -2
  95. package/dist/types/utils/mergeClassNames.d.ts +8 -0
  96. package/package.json +8 -3
  97. package/src/Button/Button/Button.module.scss +33 -23
  98. package/src/Button/GenericButton/GenericButton.tsx +135 -91
  99. package/src/Button/utils/_mixins.scss +1 -1
  100. package/src/ButtonGroup/ButtonGroup.tsx +1 -1
  101. package/src/ButtonGroup/_docs/ButtonGroup.stickersheet.stories.tsx +1 -1
  102. package/src/Filter/FilterButton/FilterButtonRemovable/FilterButtonRemovable.tsx +1 -1
  103. package/src/GuidanceBlock/GuidanceBlock.tsx +1 -1
  104. package/src/KaizenProvider/KaizenProvider.tsx +5 -7
  105. package/src/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.tsx +14 -4
  106. package/src/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.tsx +1 -1
  107. package/src/Notification/subcomponents/GenericNotification/GenericNotification.tsx +1 -1
  108. package/src/RichTextEditor/RichTextEditor/subcomponents/ToggleIconButton/ToggleIconButton.tsx +1 -1
  109. package/src/Table/Table.tsx +1 -1
  110. package/src/Tabs/_docs/Tabs.stories.tsx +1 -1
  111. package/src/Tabs/subcomponents/Tab.tsx +27 -21
  112. package/src/TitleBlockZen/TitleBlockZen.module.scss +0 -14
  113. package/src/TitleBlockZen/TitleBlockZen.tsx +1 -1
  114. package/src/TitleBlockZen/_docs/TitleBlockZen.stories.tsx +54 -0
  115. package/src/__overlays__/Focusable/v3/Focusable.module.scss +3 -0
  116. package/src/__overlays__/Focusable/v3/Focusable.tsx +37 -0
  117. package/src/__overlays__/Focusable/v3/_docs/ApiSpecification.mdx +38 -0
  118. package/src/__overlays__/Focusable/v3/_docs/Focusable.stories.tsx +24 -0
  119. package/src/__overlays__/Focusable/v3/index.ts +1 -0
  120. package/src/{Tooltip → __overlays__/Tooltip/v1}/Tooltip.module.scss +1 -1
  121. package/src/__overlays__/Tooltip/v1/_docs/Tooltip.mdx +139 -0
  122. package/src/{Tooltip → __overlays__/Tooltip/v1}/_docs/Tooltip.stickersheet.stories.tsx +1 -1
  123. package/src/{Tooltip → __overlays__/Tooltip/v1}/_docs/Tooltip.stories.tsx +2 -2
  124. package/src/__overlays__/Tooltip/v1/index.ts +7 -0
  125. package/src/{Tooltip → __overlays__/Tooltip/v2}/_docs/Tooltip.mdx +2 -4
  126. package/src/__overlays__/Tooltip/v2/_docs/Tooltip.stories.tsx +49 -0
  127. package/src/__overlays__/Tooltip/v2/index.ts +1 -0
  128. package/src/__overlays__/Tooltip/v3/OverlayArrow.module.scss +43 -0
  129. package/src/__overlays__/Tooltip/v3/OverlayArrow.tsx +34 -0
  130. package/src/__overlays__/Tooltip/v3/Tooltip.module.scss +67 -0
  131. package/src/__overlays__/Tooltip/v3/Tooltip.tsx +101 -0
  132. package/src/__overlays__/Tooltip/v3/TooltipTrigger.tsx +30 -0
  133. package/src/__overlays__/Tooltip/v3/_docs/ApiSpecification.mdx +163 -0
  134. package/src/__overlays__/Tooltip/v3/_docs/Tooltip.docs.stories.tsx +203 -0
  135. package/src/__overlays__/Tooltip/v3/_docs/Tooltip.mdx +182 -0
  136. package/src/__overlays__/Tooltip/v3/_docs/Tooltip.spec.stories.tsx +219 -0
  137. package/src/__overlays__/Tooltip/v3/_docs/Tooltip.stickersheet.stories.tsx +46 -0
  138. package/src/__overlays__/Tooltip/v3/_docs/Tooltip.stories.tsx +72 -0
  139. package/src/__overlays__/Tooltip/v3/_docs/assets/tooltip_anatomy.png +0 -0
  140. package/src/__overlays__/Tooltip/v3/_docs/assets/tooltip_placement.png +0 -0
  141. package/src/__overlays__/Tooltip/v3/_docs/assets/tooltip_trigger_1.png +0 -0
  142. package/src/__overlays__/Tooltip/v3/_docs/assets/tooltip_trigger_2.png +0 -0
  143. package/src/__overlays__/Tooltip/v3/_docs/assets/tooltip_trigger_3.png +0 -0
  144. package/src/__overlays__/Tooltip/v3/_docs/assets/tooltip_variant.png +0 -0
  145. package/src/__overlays__/Tooltip/v3/_docs/assets/tooltip_when_to_use.png +0 -0
  146. package/src/__overlays__/Tooltip/v3/index.ts +2 -0
  147. package/src/__overlays__/v1.ts +1 -0
  148. package/src/__overlays__/v2.ts +2 -0
  149. package/src/__overlays__/v3.ts +2 -0
  150. package/src/__react-aria-components__/index.ts +1 -0
  151. package/src/__react-aria__/index.ts +1 -0
  152. package/src/__utilities__/ReversedColors/v3/ReversedColors.tsx +20 -0
  153. package/src/__utilities__/ReversedColors/v3/index.ts +1 -0
  154. package/src/__utilities__/v3.ts +1 -0
  155. package/src/index.ts +1 -1
  156. package/src/types/cssVariables.d.ts +7 -0
  157. package/src/utils/mergeClassNames.ts +32 -0
  158. package/v1/overlays/package.json +5 -0
  159. package/v2/overlays/package.json +5 -0
  160. package/v3/overlays/package.json +5 -0
  161. package/v3/react-aria/package.json +5 -0
  162. package/v3/react-aria-components/package.json +5 -0
  163. package/dist/cjs/Tooltip/Tooltip.module.scss.cjs +0 -21
  164. package/dist/esm/Tooltip/Tooltip.module.scss.mjs +0 -19
  165. package/dist/types/AvatarGroup/_docs/example-data.d.ts +0 -8
  166. package/dist/types/BrandMoment/_docs/ExampleHeaders.d.ts +0 -3
  167. package/dist/types/Calendar/_docs/controls/defaultMonthControls.d.ts +0 -2
  168. package/dist/types/Calendar/_docs/controls/weekStartsOnControls.d.ts +0 -2
  169. package/dist/types/DatePicker/_docs/controls/datePickerLocaleControls.d.ts +0 -2
  170. package/dist/types/DatePicker/_docs/controls/disabledDayMatchersControls.d.ts +0 -2
  171. package/dist/types/Filter/FilterBar/context/types.d.ts +0 -28
  172. package/dist/types/Filter/FilterDatePicker/_docs/controls/disabledDaysControls.d.ts +0 -2
  173. package/dist/types/Filter/FilterDatePicker/_docs/controls/validationControls.d.ts +0 -2
  174. package/dist/types/Filter/FilterDateRangePicker/_docs/controls/disabledDaysControls.d.ts +0 -2
  175. package/dist/types/Filter/FilterDateRangePicker/_docs/controls/validationControls.d.ts +0 -2
  176. package/dist/types/Filter/FilterMultiSelect/_docs/MockData.d.ts +0 -10
  177. package/dist/types/Filter/FilterSelect/_docs/mockData.d.ts +0 -6
  178. package/dist/types/Filter/_docs/controls/renderTriggerControls.d.ts +0 -2
  179. package/dist/types/Menu/_docs/MenuContentExample.d.ts +0 -8
  180. package/dist/types/Menu/_docs/examples.d.ts +0 -11
  181. package/dist/types/Modal/_docs/controls.d.ts +0 -11
  182. package/dist/types/MultiSelect/MultiSelect.d.ts +0 -23
  183. package/dist/types/MultiSelect/subcomponents/MultiSelectOptions/MultiSelectOptions.d.ts +0 -13
  184. package/dist/types/Tooltip/index.d.ts +0 -1
  185. package/dist/types/Workflow/_docs/controls/controls.d.ts +0 -2
  186. package/dist/types/Workflow/_docs/controls/index.d.ts +0 -1
  187. package/dist/types/__future__/Select/_docs/mockData.d.ts +0 -6
  188. package/dist/types/__future__/Select/types.d.ts +0 -22
  189. package/dist/types/__future__/Workflow/_docs/controls/controls.d.ts +0 -2
  190. package/dist/types/__future__/Workflow/_docs/controls/index.d.ts +0 -1
  191. package/src/Tooltip/index.ts +0 -1
  192. /package/dist/cjs/{Tooltip → __overlays__/Tooltip/v1}/Tooltip.cjs +0 -0
  193. /package/dist/cjs/{Tooltip → __overlays__/Tooltip/v1}/subcomponents/AppearanceAnim.cjs +0 -0
  194. /package/dist/cjs/{Tooltip → __overlays__/Tooltip/v1}/utils/isSemanticElement.cjs +0 -0
  195. /package/dist/esm/{Tooltip → __overlays__/Tooltip/v1}/Tooltip.mjs +0 -0
  196. /package/dist/esm/{Tooltip → __overlays__/Tooltip/v1}/subcomponents/AppearanceAnim.mjs +0 -0
  197. /package/dist/esm/{Tooltip → __overlays__/Tooltip/v1}/utils/isSemanticElement.mjs +0 -0
  198. /package/dist/types/{Tooltip → __overlays__/Tooltip/v1}/Tooltip.d.ts +0 -0
  199. /package/dist/types/{Tooltip → __overlays__/Tooltip/v1}/subcomponents/AppearanceAnim.d.ts +0 -0
  200. /package/src/{Tooltip → __overlays__/Tooltip/v1}/Tooltip.spec.tsx +0 -0
  201. /package/src/{Tooltip → __overlays__/Tooltip/v1}/Tooltip.tsx +0 -0
  202. /package/src/{Tooltip → __overlays__/Tooltip/v1}/_variables.scss +0 -0
  203. /package/src/{Tooltip → __overlays__/Tooltip/v1}/subcomponents/AppearanceAnim.spec.tsx +0 -0
  204. /package/src/{Tooltip → __overlays__/Tooltip/v1}/subcomponents/AppearanceAnim.tsx +0 -0
  205. /package/src/{Tooltip → __overlays__/Tooltip/v1}/utils/isSemanticElement.spec.tsx +0 -0
  206. /package/src/{Tooltip → __overlays__/Tooltip/v1}/utils/isSemanticElement.tsx +0 -0
@@ -1,13 +1,15 @@
1
1
  import React, {
2
2
  ComponentType,
3
- forwardRef,
3
+ FocusEvent,
4
+ MouseEvent,
4
5
  Ref,
6
+ forwardRef,
5
7
  useImperativeHandle,
6
8
  useRef,
7
- MouseEvent,
8
- FocusEvent,
9
9
  } from "react"
10
10
  import classnames from "classnames"
11
+ import { useFocusable, useLink } from "react-aria"
12
+ import { LinkContext, useContextProps } from "react-aria-components"
11
13
  import { Badge, BadgeAnimated } from "~components/Badge"
12
14
  import { LoadingSpinner } from "~components/Loading"
13
15
  import styles from "./GenericButton.module.scss"
@@ -71,6 +73,7 @@ export type RenderProps = GenericButtonProps & {
71
73
  directionalLink?: boolean
72
74
  paginationLink?: boolean
73
75
  isActive?: boolean
76
+ "aria-describedby"?: string
74
77
  }
75
78
 
76
79
  export type ButtonRef = { focus: () => void }
@@ -135,6 +138,7 @@ export const GenericButton = forwardRef(
135
138
  ref: Ref<ButtonRef | undefined>
136
139
  ) => {
137
140
  const buttonRef = useRef<HTMLButtonElement | HTMLAnchorElement>()
141
+ const wrapperRef = useRef<HTMLSpanElement>(null)
138
142
  useImperativeHandle(ref, () => ({
139
143
  focus: (): void => {
140
144
  buttonRef.current?.focus()
@@ -152,27 +156,22 @@ export const GenericButton = forwardRef(
152
156
  ...otherProps,
153
157
  }
154
158
 
155
- const determineButtonRenderer = (): JSX.Element => {
156
- if (props.component) {
157
- return renderCustomComponent(props.component, props)
158
- }
159
-
160
- if (props.href && !props.disabled && !props.working) {
161
- return renderLink(props, buttonRef as Ref<HTMLAnchorElement>)
162
- }
163
-
164
- return renderButton(props, buttonRef as Ref<HTMLButtonElement>)
159
+ if (props.component) {
160
+ return renderCustomComponent(props.component, props, wrapperRef)
165
161
  }
166
162
 
167
163
  return (
168
164
  <span
165
+ ref={wrapperRef}
169
166
  className={classnames(
170
167
  styles.container,
171
168
  props.fullWidth && styles.fullWidth
172
169
  )}
173
170
  aria-live={"workingLabel" in props ? "polite" : undefined}
174
171
  >
175
- {determineButtonRenderer()}
172
+ {props.href && !props.disabled && !props.working
173
+ ? renderLink(props, buttonRef as Ref<HTMLAnchorElement>)
174
+ : renderButton(props, buttonRef as Ref<HTMLButtonElement>)}
176
175
  </span>
177
176
  )
178
177
  }
@@ -182,24 +181,56 @@ GenericButton.displayName = "GenericButton"
182
181
 
183
182
  const renderCustomComponent = (
184
183
  CustomComponent: ComponentType<CustomButtonProps>,
185
- props: RenderProps
184
+ props: RenderProps,
185
+ ref: Ref<HTMLSpanElement>
186
186
  ): JSX.Element => {
187
- const { id, disabled, href, onClick, onFocus, onBlur, ...rest } = props
188
- const customProps = getCustomProps(rest)
187
+ const passedInProps = {
188
+ id: props.id,
189
+ className: buttonClass(props),
190
+ disabled: props.disabled,
191
+ href: props.href,
192
+ onClick: props.onClick,
193
+ onFocus: props.onFocus,
194
+ onBlur: props.onBlur,
195
+ "aria-label": generateAriaLabel(props),
196
+ ...getCustomProps(props),
197
+ }
198
+
199
+ const [contextProps, contextRef] = useContextProps(
200
+ passedInProps,
201
+ ref,
202
+ // @ts-expect-error we're using span ref on link context, but that's ok because we need only sizing
203
+ LinkContext
204
+ )
205
+ // @ts-expect-error
206
+ // @todo: Make a wrapper and take it out of Button
207
+ const { linkProps } = useLink(contextProps, contextRef)
208
+
209
+ // Unset this because the one defined in buttonProps shows
210
+ // focus-visible styles on click, in future we'll style using [data-focus-visible] which is consistent across browsers
211
+ delete linkProps.onPointerDown
212
+
189
213
  return (
190
- <CustomComponent
191
- id={id}
192
- className={buttonClass(props)}
193
- disabled={disabled}
194
- href={href}
195
- onClick={onClick}
196
- onFocus={onFocus}
197
- onBlur={onBlur}
198
- aria-label={generateAriaLabel(props)}
199
- {...customProps}
214
+ <span
215
+ ref={contextRef}
216
+ className={classnames(
217
+ styles.container,
218
+ props.fullWidth && styles.fullWidth
219
+ )}
220
+ aria-live={"workingLabel" in props ? "polite" : undefined}
200
221
  >
201
- {renderContent(props)}
202
- </CustomComponent>
222
+ <CustomComponent
223
+ {...contextProps}
224
+ {...linkProps}
225
+ aria-describedby={
226
+ props["aria-describedby"] === null
227
+ ? undefined
228
+ : linkProps["aria-describedby"]
229
+ }
230
+ >
231
+ {renderContent(props)}
232
+ </CustomComponent>
233
+ </span>
203
234
  )
204
235
  }
205
236
 
@@ -207,51 +238,52 @@ const renderButton = (
207
238
  props: RenderProps,
208
239
  ref: Ref<HTMLButtonElement>
209
240
  ): JSX.Element => {
210
- const {
211
- id,
212
- disabled,
213
- onClick,
214
- onMouseDown,
215
- type,
216
- disableTabFocusAndIUnderstandTheAccessibilityImplications,
217
- onFocus,
218
- onBlur,
219
- form,
220
- formAction,
221
- formMethod,
222
- formEncType,
223
- formTarget,
224
- formNoValidate,
225
- ...rest
226
- } = props
227
- const customProps = getCustomProps(rest)
241
+ const disableActions = props.disabled || props.working
242
+ const passedInProps: React.DetailedHTMLProps<
243
+ React.ButtonHTMLAttributes<HTMLButtonElement>,
244
+ HTMLButtonElement
245
+ > = {
246
+ id: props.id,
247
+ disabled: props.disabled,
248
+ onClick: !disableActions ? props.onClick : undefined,
249
+ onMouseDown: !disableActions ? props.onMouseDown : undefined,
250
+ type: props.type,
251
+ onFocus: props.onFocus,
252
+ onBlur: props.onBlur,
253
+ form: props.form,
254
+ formAction: props.formAction,
255
+ formMethod: props.formMethod,
256
+ formEncType: props.formEncType,
257
+ formTarget: props.formTarget,
258
+ formNoValidate: props.formNoValidate,
259
+ className: buttonClass(props),
260
+ "aria-label": generateAriaLabel(props),
261
+ "aria-disabled": props.disabled || props.working ? true : undefined,
262
+ tabIndex: props.disableTabFocusAndIUnderstandTheAccessibilityImplications
263
+ ? -1
264
+ : undefined,
265
+ ...getCustomProps(props),
266
+ }
267
+
268
+ // we're using useFocusable instead of useButton because at this stage we want to hook only to focusable.
269
+ // Not standardize button behavior as we're currently relying on some weird native behaviours (like onClick firing on enter key press) see https://react-spectrum.adobe.com/blog/building-a-button-part-1.html
270
+ // @ts-ignore
271
+ const { focusableProps } = useFocusable(passedInProps, ref)
228
272
 
229
273
  return (
274
+ // eslint-disable-next-line react/button-has-type
230
275
  <button
231
- // eslint-disable-next-line react/button-has-type
232
- type={type}
233
- id={id}
234
- disabled={disabled}
235
- className={buttonClass(props)}
236
- onClick={onClick}
237
- onFocus={onFocus}
238
- onBlur={onBlur}
239
- onMouseDown={(e): void => onMouseDown && onMouseDown(e)}
240
- aria-label={generateAriaLabel(props)}
241
- aria-disabled={disabled || props.working ? true : undefined}
242
- form={form}
243
- formAction={formAction}
244
- formMethod={formMethod}
245
- formEncType={formEncType}
246
- formTarget={formTarget}
247
- formNoValidate={formNoValidate}
248
- tabIndex={
249
- disableTabFocusAndIUnderstandTheAccessibilityImplications
250
- ? -1
251
- : undefined
276
+ {...passedInProps}
277
+ {...focusableProps}
278
+ aria-describedby={
279
+ props["aria-describedby"] === null
280
+ ? undefined
281
+ : props["aria-describedby"] || focusableProps["aria-describedby"]
252
282
  }
283
+ // Unset this because the one defined in buttonProps shows
284
+ // focus-visible styles on click
285
+ onPointerDown={undefined}
253
286
  ref={ref}
254
- {...customProps}
255
287
  >
256
288
  {renderContent(props)}
257
289
  </button>
@@ -262,34 +294,44 @@ const renderLink = (
262
294
  props: RenderProps,
263
295
  ref: Ref<HTMLAnchorElement>
264
296
  ): JSX.Element => {
265
- const {
266
- id,
267
- href,
268
- onClick,
269
- newTabAndIUnderstandTheAccessibilityImplications,
270
- onFocus,
271
- onBlur,
272
- ...rest
273
- } = props
274
- const customProps = getCustomProps(rest)
275
-
276
- const target = newTabAndIUnderstandTheAccessibilityImplications
297
+ const target = props.newTabAndIUnderstandTheAccessibilityImplications
277
298
  ? "_blank"
278
299
  : "_self"
279
300
 
301
+ const passedInProps: React.DetailedHTMLProps<
302
+ React.AnchorHTMLAttributes<HTMLAnchorElement>,
303
+ HTMLAnchorElement
304
+ > = {
305
+ id: props.id,
306
+ href: props.href,
307
+ target,
308
+ rel: target === "_blank" ? "noopener noreferrer" : undefined,
309
+ className: buttonClass(props),
310
+ onClick: props.onClick,
311
+ onFocus: props.onFocus,
312
+ onBlur: props.onBlur,
313
+ "aria-label": generateAriaLabel(props),
314
+ ...getCustomProps(props),
315
+ }
316
+
317
+ // we're using useFocusable instead of useLink because at this stage we want to hook only to focusable.
318
+ // Not standardize button behavior as we're currently relying on some weird native behaviours (like onClick firing on enter key press) see https://react-spectrum.adobe.com/blog/building-a-button-part-1.html
319
+ // @ts-ignore
320
+ const { focusableProps } = useFocusable(passedInProps, ref)
321
+
280
322
  return (
281
323
  <a
282
- id={id}
283
- href={href}
284
- target={target}
285
- rel={target === "_blank" ? "noopener noreferrer" : undefined}
286
- className={buttonClass(props)}
287
- onClick={onClick}
288
- onFocus={onFocus}
289
- onBlur={onBlur}
324
+ {...passedInProps}
325
+ {...focusableProps}
326
+ aria-describedby={
327
+ props["aria-describedby"] === null
328
+ ? undefined
329
+ : props["aria-describedby"] || focusableProps["aria-describedby"]
330
+ }
331
+ // Unset this because the one defined in linkProps shows
332
+ // focus-visible styles on click
333
+ onPointerDown={undefined}
290
334
  ref={ref}
291
- aria-label={generateAriaLabel(props)}
292
- {...customProps}
293
335
  >
294
336
  {renderContent(props)}
295
337
  </a>
@@ -301,6 +343,8 @@ const buttonClass = (props: RenderProps): string => {
301
343
  return classnames(
302
344
  styles.button,
303
345
  isDefault && styles.default,
346
+ // @ts-ignore
347
+ (props.disabled || props["aria-disabled"]) && styles.disabled,
304
348
  props.primary && styles.primary,
305
349
  props.destructive && styles.destructive,
306
350
  props.secondary && styles.secondary,
@@ -2,7 +2,7 @@
2
2
  $background-color: undefined,
3
3
  $border-color: undefined
4
4
  ) {
5
- &:not(:disabled) {
5
+ &:not(.disabled, .working) {
6
6
  &:hover,
7
7
  &:active,
8
8
  &:focus-visible {
@@ -4,7 +4,7 @@ import {
4
4
  FilterButtonBase,
5
5
  FilterButtonBaseProps,
6
6
  } from "~components/Filter/FilterButton/subcomponents/FilterButtonBase"
7
- import { Tooltip, TooltipProps } from "~components/Tooltip"
7
+ import { Tooltip, TooltipProps } from "~components/__overlays__/Tooltip/v1"
8
8
  import { OverrideClassName } from "~types/OverrideClassName"
9
9
  import styles from "./ButtonGroup.module.scss"
10
10
 
@@ -1,7 +1,7 @@
1
1
  import React from "react"
2
2
  import { Meta } from "@storybook/react"
3
3
  import { FilterButtonBase } from "~components/Filter/FilterButton/subcomponents/FilterButtonBase"
4
- import { Tooltip } from "~components/Tooltip"
4
+ import { Tooltip } from "~components/__overlays__/Tooltip/v1"
5
5
  import {
6
6
  StickerSheet,
7
7
  StickerSheetStory,
@@ -2,7 +2,7 @@ import React, { forwardRef } from "react"
2
2
  import { ButtonGroup, ButtonGroupProps } from "~components/ButtonGroup"
3
3
  import { FilterTriggerRef } from "~components/Filter/Filter"
4
4
  import { ClearIcon } from "~components/Icon"
5
- import { Tooltip } from "~components/Tooltip"
5
+ import { Tooltip } from "~components/__overlays__/Tooltip/v1"
6
6
  import { DataAttributes } from "~types/DataAttributes"
7
7
  import { isRefObject } from "~utils/isRefObject"
8
8
  import { FilterButton, FilterButtonProps } from "../FilterButton"
@@ -6,7 +6,7 @@ import { Heading, HeadingProps } from "~components/Heading"
6
6
  import { ArrowForwardIcon } from "~components/Icon"
7
7
  import { SceneProps, SpotProps } from "~components/Illustration"
8
8
  import { Text } from "~components/Text"
9
- import { Tooltip, TooltipProps } from "~components/Tooltip"
9
+ import { Tooltip, TooltipProps } from "~components/__overlays__/Tooltip/v1"
10
10
  import { VariantType } from "./types"
11
11
  import styles from "./GuidanceBlock.module.scss"
12
12
 
@@ -27,13 +27,11 @@ export const KaizenProvider = ({
27
27
 
28
28
  return (
29
29
  <OptionalIntlProvider locale={locale}>
30
- <>
31
- <ToastNotificationProvider>
32
- {notificationsList}
33
- {children}
34
- </ToastNotificationProvider>
35
- <FontDefinitions />
36
- </>
30
+ <ToastNotificationProvider>
31
+ {notificationsList}
32
+ {children}
33
+ </ToastNotificationProvider>
34
+ <FontDefinitions />
37
35
  </OptionalIntlProvider>
38
36
  )
39
37
  }
@@ -1,10 +1,11 @@
1
- import React, { useContext } from "react"
1
+ import React, { ReactNode, useContext } from "react"
2
2
  import { StaticIntlProvider } from "@cultureamp/i18n-react-intl"
3
+ import { I18nProvider } from "react-aria"
3
4
  import { IntlContext } from "react-intl"
4
5
 
5
6
  type Props = {
6
7
  locale: string
7
- children: React.ReactElement
8
+ children: ReactNode
8
9
  }
9
10
  export const OptionalIntlProvider = ({
10
11
  locale,
@@ -12,8 +13,17 @@ export const OptionalIntlProvider = ({
12
13
  }: Props): JSX.Element => {
13
14
  const parent = useContext(IntlContext)
14
15
 
15
- if (parent) return children
16
- return <StaticIntlProvider locale={locale}>{children}</StaticIntlProvider>
16
+ if (parent) {
17
+ // we always wrap with react-aria provider as we have no way checking if parent is wrapped (useLocale returns default value if not)
18
+ // but it's not a big deal as we'll consume the defined locale anyways so no effect on children
19
+ return <I18nProvider locale={parent.locale}>{children}</I18nProvider>
20
+ }
21
+
22
+ return (
23
+ <StaticIntlProvider locale={locale}>
24
+ <I18nProvider locale={locale}>{children}</I18nProvider>
25
+ </StaticIntlProvider>
26
+ )
17
27
  }
18
28
 
19
29
  OptionalIntlProvider.displayName = "OptionalIntlProvider"
@@ -3,7 +3,7 @@ import classnames from "classnames"
3
3
  import { ClearButton } from "~components/ClearButton"
4
4
  import { FieldMessageProps } from "~components/FieldMessage"
5
5
  import { ChevronDownIcon, ChevronUpIcon } from "~components/Icon"
6
- import { RemovableTag } from "~components/__future__/Tag"
6
+ import { RemovableTag } from "~components/__future__"
7
7
  import { OverrideClassName } from "~types/OverrideClassName"
8
8
  import { MultiSelectOption } from "../../types"
9
9
  import styles from "./MultiSelectToggle.module.scss"
@@ -18,7 +18,7 @@ export type GenericNotificationProps = {
18
18
  noBottomMargin?: boolean
19
19
  forceMultiline?: boolean
20
20
  headingProps?: HeadingProps
21
- } & OverrideClassName<HTMLAttributes<HTMLDivElement>>
21
+ } & Omit<OverrideClassName<HTMLAttributes<HTMLDivElement>>, "style">
22
22
 
23
23
  export const GenericNotification = ({
24
24
  type,
@@ -1,6 +1,6 @@
1
1
  import React from "react"
2
2
  import classnames from "classnames"
3
- import { Tooltip } from "~components/Tooltip"
3
+ import { Tooltip } from "~components/__overlays__/Tooltip/v1"
4
4
  import { OverrideClassName } from "~types/OverrideClassName"
5
5
  import { ToggleIconButtonMoods } from "./types"
6
6
  import styles from "./ToggleIconButton.module.scss"
@@ -7,7 +7,7 @@ import {
7
7
  SortAscendingIcon,
8
8
  SortDescendingIcon,
9
9
  } from "~components/Icon"
10
- import { Tooltip } from "~components/Tooltip"
10
+ import { Tooltip } from "~components/__overlays__/Tooltip/v1"
11
11
  import { OverrideClassName } from "~types/OverrideClassName"
12
12
  import styles from "./Table.module.scss"
13
13
 
@@ -3,7 +3,7 @@ import { Meta, StoryObj } from "@storybook/react"
3
3
  import { Button } from "~components/Button"
4
4
  import { Card } from "~components/Card"
5
5
  import { Text } from "~components/Text"
6
- import { Tabs, TabList, Tab, TabPanels, TabPanel } from "../index"
6
+ import { Tab, TabList, TabPanel, TabPanels, Tabs } from "../index"
7
7
 
8
8
  const meta = {
9
9
  title: "Components/Tabs",
@@ -1,11 +1,13 @@
1
1
  import React, {
2
2
  HTMLAttributes,
3
3
  ReactNode,
4
- useState,
5
4
  SyntheticEvent,
5
+ useRef,
6
+ useState,
6
7
  } from "react"
7
8
  import { Tab as ReachTab } from "@reach/tabs"
8
9
  import classnames from "classnames"
10
+ import { useFocusable } from "react-aria"
9
11
  import { Badge } from "~components/Badge"
10
12
  import { OverrideClassName } from "~types/OverrideClassName"
11
13
  import styles from "./Tab.module.scss"
@@ -44,34 +46,38 @@ export const Tab = (props: TabProps): JSX.Element => {
44
46
  classNameOverride,
45
47
  ...restProps
46
48
  } = props
49
+ const ref = useRef<HTMLButtonElement>(null)
47
50
  const [isHovered, setIsHovered] = useState<boolean>(false)
48
51
  const [isFocused, setIsFocused] = useState<boolean>(false)
49
52
  const showActiveBadge = isSelected || isHovered || isFocused
50
53
 
51
- const onFocus = (event: SyntheticEvent): void => {
52
- setIsFocused(true)
53
- props.onFocus?.(event)
54
+ const tabProps = {
55
+ disabled,
56
+ className: classnames(
57
+ styles.tab,
58
+ classNameOverride,
59
+ isSelected && styles.selected
60
+ ),
61
+ onFocus: (event: SyntheticEvent): void => {
62
+ setIsFocused(true)
63
+ props.onFocus?.(event)
64
+ },
65
+ onBlur: (event: SyntheticEvent): void => {
66
+ setIsFocused(false)
67
+ props.onBlur?.(event)
68
+ },
69
+ onMouseEnter: (): void => setIsHovered(true),
70
+ onMouseLeave: (): void => setIsHovered(false),
71
+ ...restProps,
54
72
  }
55
73
 
56
- const onBlur = (event: SyntheticEvent): void => {
57
- setIsFocused(false)
58
- props.onBlur?.(event)
59
- }
74
+ const { focusableProps } = useFocusable(tabProps, ref)
75
+
76
+ // Reach is setting and managing tabIndex for us here, so we remove it from the focusableProps (also it needs to be non-defined, undefined is not enough)
77
+ delete focusableProps.tabIndex
60
78
 
61
79
  return (
62
- <ReachTab
63
- disabled={disabled}
64
- className={classnames(
65
- styles.tab,
66
- classNameOverride,
67
- isSelected && styles.selected
68
- )}
69
- onFocus={onFocus}
70
- onBlur={onBlur}
71
- onMouseEnter={(): void => setIsHovered(true)}
72
- onMouseLeave={(): void => setIsHovered(false)}
73
- {...restProps}
74
- >
80
+ <ReachTab ref={ref} {...tabProps} {...focusableProps}>
75
81
  {children}
76
82
  {badge && (
77
83
  <span className={styles.badge}>
@@ -171,17 +171,7 @@ $tab-container-height-medium-and-small-collapsed: 0;
171
171
  .titleTextOverride.titleTextOverride {
172
172
  padding: 4px 0;
173
173
 
174
- @media (max-width: $breadcrumb-breakpoint-width) {
175
- font-family: $typography-heading-2-font-family;
176
- font-weight: $typography-heading-2-font-weight;
177
- font-size: $typography-heading-2-font-size;
178
- line-height: $typography-heading-2-line-height;
179
- letter-spacing: $typography-heading-2-letter-spacing;
180
- }
181
-
182
174
  @include title-block-under-1366 {
183
- font-family: $typography-heading-2-font-family;
184
- font-weight: $typography-heading-2-font-weight;
185
175
  font-size: $typography-heading-2-font-size;
186
176
  line-height: $typography-heading-2-line-height;
187
177
  letter-spacing: $typography-heading-2-letter-spacing;
@@ -190,8 +180,6 @@ $tab-container-height-medium-and-small-collapsed: 0;
190
180
 
191
181
  .hasLongTitle & {
192
182
  @include title-block-under-1366 {
193
- font-family: $typography-heading-3-font-family;
194
- font-weight: $typography-heading-3-font-weight;
195
183
  font-size: $typography-heading-3-font-size;
196
184
  line-height: $typography-heading-3-line-height;
197
185
  letter-spacing: $typography-heading-3-letter-spacing;
@@ -200,8 +188,6 @@ $tab-container-height-medium-and-small-collapsed: 0;
200
188
  }
201
189
 
202
190
  @include title-block-medium-and-small {
203
- font-family: $typography-heading-4-font-family;
204
- font-weight: $typography-heading-4-font-weight;
205
191
  font-size: $typography-heading-4-font-size;
206
192
  line-height: $typography-heading-4-line-height;
207
193
  letter-spacing: $typography-heading-4-letter-spacing;
@@ -329,7 +329,7 @@ export const TitleBlockZen = ({
329
329
  <div className={styles.titleAndSubtitleInner}>
330
330
  <div className={styles.title}>
331
331
  <Heading
332
- variant="heading-1"
332
+ variant="composable-header-title"
333
333
  color={isReversed(variant) ? "white" : "dark"}
334
334
  classNameOverride={styles.titleTextOverride}
335
335
  data-automation-id={titleAutomationId}
@@ -98,6 +98,60 @@ export const Playground: Story = {
98
98
  },
99
99
  }
100
100
 
101
+ export const Viewports: Story = {
102
+ parameters: {
103
+ viewport: {
104
+ viewports: {
105
+ default: {
106
+ name: "Above or equal to 1366",
107
+ styles: { width: "1366px", height: "800px" },
108
+ type: "desktop",
109
+ },
110
+ under1366: {
111
+ name: "Under 1366",
112
+ styles: { width: "1365px", height: "800px" },
113
+ type: "desktop",
114
+ },
115
+ mediumSmall: {
116
+ name: "Medium and small",
117
+ styles: { width: "1079px", height: "800px" },
118
+ type: "desktop",
119
+ },
120
+ },
121
+ defaultViewport: "default",
122
+ },
123
+ chromatic: {
124
+ disable: false,
125
+ viewports: [1079, 1365, 1366],
126
+ },
127
+ },
128
+ }
129
+
130
+ export const HasLongTitle: Story = {
131
+ parameters: {
132
+ viewport: {
133
+ viewports: {
134
+ default: {
135
+ name: "Above or equal to 1366",
136
+ styles: { width: "1366px", height: "800px" },
137
+ type: "desktop",
138
+ },
139
+ under1366: {
140
+ name: "Under 1366",
141
+ styles: { width: "1365px", height: "800px" },
142
+ type: "desktop",
143
+ },
144
+ },
145
+ defaultViewport: "default",
146
+ },
147
+ chromatic: {
148
+ disable: false,
149
+ viewports: [1365, 1366],
150
+ },
151
+ },
152
+ args: { title: "A long title with over thirty characters" },
153
+ }
154
+
101
155
  export const StickerSheetDefault: Story = {
102
156
  parameters: {
103
157
  docs: {
@@ -0,0 +1,3 @@
1
+ .focusableWrapper {
2
+ display: inline-flex;
3
+ }