@cloudscape-design/components 3.0.1408 → 3.0.1410

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 (204) hide show
  1. package/autosuggest/index.d.ts.map +1 -1
  2. package/autosuggest/index.js +1 -1
  3. package/autosuggest/index.js.map +1 -1
  4. package/autosuggest/internal.d.ts +8 -1
  5. package/autosuggest/internal.d.ts.map +1 -1
  6. package/autosuggest/internal.js +2 -2
  7. package/autosuggest/internal.js.map +1 -1
  8. package/autosuggest/styles.css.js +3 -3
  9. package/autosuggest/styles.scoped.css +5 -3
  10. package/autosuggest/styles.selectors.js +3 -3
  11. package/button-dropdown/filter.d.ts +1 -1
  12. package/button-dropdown/filter.d.ts.map +1 -1
  13. package/cards/index.js +1 -1
  14. package/cards/index.js.map +1 -1
  15. package/container/internal.d.ts +3 -2
  16. package/container/internal.d.ts.map +1 -1
  17. package/container/internal.js +2 -2
  18. package/container/internal.js.map +1 -1
  19. package/container/use-sticky-header.d.ts +0 -14
  20. package/container/use-sticky-header.d.ts.map +1 -1
  21. package/container/use-sticky-header.js +9 -92
  22. package/container/use-sticky-header.js.map +1 -1
  23. package/copy-to-clipboard/internal.d.ts.map +1 -1
  24. package/copy-to-clipboard/internal.js +2 -16
  25. package/copy-to-clipboard/internal.js.map +1 -1
  26. package/copy-to-clipboard/styles.css.js +10 -10
  27. package/copy-to-clipboard/styles.scoped.css +19 -19
  28. package/copy-to-clipboard/styles.selectors.js +10 -10
  29. package/flashbar/collapsible-flashbar.d.ts +1 -0
  30. package/flashbar/collapsible-flashbar.d.ts.map +1 -1
  31. package/flashbar/collapsible-flashbar.js +10 -4
  32. package/flashbar/collapsible-flashbar.js.map +1 -1
  33. package/flashbar/flash.d.ts +6 -0
  34. package/flashbar/flash.d.ts.map +1 -1
  35. package/flashbar/flash.js +6 -6
  36. package/flashbar/flash.js.map +1 -1
  37. package/flashbar/internal-interfaces.d.ts +11 -1
  38. package/flashbar/internal-interfaces.d.ts.map +1 -1
  39. package/flashbar/internal-interfaces.js.map +1 -1
  40. package/flashbar/non-collapsible-flashbar.d.ts.map +1 -1
  41. package/flashbar/non-collapsible-flashbar.js +8 -1
  42. package/flashbar/non-collapsible-flashbar.js.map +1 -1
  43. package/flashbar/styles.css.js +50 -50
  44. package/flashbar/styles.scoped.css +184 -161
  45. package/flashbar/styles.selectors.js +50 -50
  46. package/icon/generated/icons.d.ts +4 -0
  47. package/icon/generated/icons.d.ts.map +1 -1
  48. package/icon/generated/icons.js +14 -0
  49. package/icon/generated/icons.js.map +1 -1
  50. package/icon/styles.css.js +44 -43
  51. package/icon/styles.scoped.css +109 -107
  52. package/icon/styles.selectors.js +44 -43
  53. package/icon-provider/interfaces.d.ts +1 -1
  54. package/icon-provider/interfaces.d.ts.map +1 -1
  55. package/icon-provider/interfaces.js.map +1 -1
  56. package/input/internal.d.ts +1 -1
  57. package/input/internal.d.ts.map +1 -1
  58. package/input/internal.js +4 -2
  59. package/input/internal.js.map +1 -1
  60. package/input/styles.css.js +45 -44
  61. package/input/styles.scoped.css +102 -94
  62. package/input/styles.selectors.js +45 -44
  63. package/internal/base-component/styles.scoped.css +1 -1
  64. package/internal/components/autosuggest-input/index.d.ts +5 -0
  65. package/internal/components/autosuggest-input/index.d.ts.map +1 -1
  66. package/internal/components/autosuggest-input/index.js +22 -61
  67. package/internal/components/autosuggest-input/index.js.map +1 -1
  68. package/internal/components/autosuggest-input/inline-tokens.d.ts +1 -0
  69. package/internal/components/autosuggest-input/inline-tokens.d.ts.map +1 -1
  70. package/internal/components/autosuggest-input/inline-tokens.js +4 -2
  71. package/internal/components/autosuggest-input/inline-tokens.js.map +1 -1
  72. package/internal/components/autosuggest-input/styles.css.js +11 -33
  73. package/internal/components/autosuggest-input/styles.scoped.css +15 -233
  74. package/internal/components/autosuggest-input/styles.selectors.js +11 -33
  75. package/internal/components/autosuggest-input/use-token-overflow.d.ts +7 -11
  76. package/internal/components/autosuggest-input/use-token-overflow.d.ts.map +1 -1
  77. package/internal/components/autosuggest-input/use-token-overflow.js +16 -29
  78. package/internal/components/autosuggest-input/use-token-overflow.js.map +1 -1
  79. package/internal/components/option/index.d.ts.map +1 -1
  80. package/internal/components/option/index.js +2 -2
  81. package/internal/components/option/index.js.map +1 -1
  82. package/internal/components/option/styles.css.js +19 -18
  83. package/internal/components/option/styles.scoped.css +39 -33
  84. package/internal/components/option/styles.selectors.js +19 -18
  85. package/internal/components/radio-button/index.d.ts +1 -1
  86. package/internal/components/radio-button/index.d.ts.map +1 -1
  87. package/internal/components/radio-button/index.js.map +1 -1
  88. package/internal/components/radio-button/styles.css.js +7 -7
  89. package/internal/components/radio-button/styles.scoped.css +36 -12
  90. package/internal/components/radio-button/styles.selectors.js +7 -7
  91. package/internal/components/sortable-area/index.d.ts.map +1 -1
  92. package/internal/components/sortable-area/index.js +34 -4
  93. package/internal/components/sortable-area/index.js.map +1 -1
  94. package/internal/components/sortable-area/keyboard-sensor/index.js +1 -1
  95. package/internal/components/sortable-area/keyboard-sensor/index.js.map +1 -1
  96. package/{table → internal/components/sticky-header}/sticky-scrolling.d.ts +1 -6
  97. package/internal/components/sticky-header/sticky-scrolling.d.ts.map +1 -0
  98. package/{table → internal/components/sticky-header}/sticky-scrolling.js +2 -7
  99. package/internal/components/sticky-header/sticky-scrolling.js.map +1 -0
  100. package/internal/components/sticky-header/use-cells-resize-observer.d.ts +1 -0
  101. package/internal/components/sticky-header/use-cells-resize-observer.d.ts.map +1 -0
  102. package/internal/components/sticky-header/use-cells-resize-observer.js +39 -0
  103. package/internal/components/sticky-header/use-cells-resize-observer.js.map +1 -0
  104. package/internal/components/sticky-header/use-header-stuck.d.ts +7 -0
  105. package/internal/components/sticky-header/use-header-stuck.d.ts.map +1 -0
  106. package/internal/components/sticky-header/use-header-stuck.js +35 -0
  107. package/internal/components/sticky-header/use-header-stuck.js.map +1 -0
  108. package/internal/components/sticky-header/use-sticky-header-copy.d.ts +19 -0
  109. package/internal/components/sticky-header/use-sticky-header-copy.d.ts.map +1 -0
  110. package/{table/use-sticky-header.js → internal/components/sticky-header/use-sticky-header-copy.js} +7 -8
  111. package/internal/components/sticky-header/use-sticky-header-copy.js.map +1 -0
  112. package/internal/components/sticky-header/use-sticky-position.d.ts +27 -0
  113. package/internal/components/sticky-header/use-sticky-position.d.ts.map +1 -0
  114. package/internal/components/sticky-header/use-sticky-position.js +57 -0
  115. package/internal/components/sticky-header/use-sticky-position.js.map +1 -0
  116. package/internal/environment.js +2 -2
  117. package/internal/environment.json +2 -2
  118. package/internal/manifest.json +1 -1
  119. package/manifest.json +2 -2
  120. package/multiselect/index.d.ts.map +1 -1
  121. package/multiselect/index.js +1 -1
  122. package/multiselect/index.js.map +1 -1
  123. package/multiselect/internal.d.ts +12 -1
  124. package/multiselect/internal.d.ts.map +1 -1
  125. package/multiselect/internal.js +10 -6
  126. package/multiselect/internal.js.map +1 -1
  127. package/multiselect/styles.css.js +5 -5
  128. package/multiselect/styles.scoped.css +17 -5
  129. package/multiselect/styles.selectors.js +5 -5
  130. package/package.json +1 -1
  131. package/radio-button/styles.css.js +1 -1
  132. package/radio-button/styles.scoped.css +1 -25
  133. package/radio-button/styles.selectors.js +1 -1
  134. package/radio-group/internal.d.ts +7 -1
  135. package/radio-group/internal.d.ts.map +1 -1
  136. package/radio-group/internal.js +2 -2
  137. package/radio-group/internal.js.map +1 -1
  138. package/radio-group/styles.css.js +5 -5
  139. package/radio-group/styles.scoped.css +7 -6
  140. package/radio-group/styles.selectors.js +5 -5
  141. package/segmented-control/internal-segmented-control.d.ts +4 -1
  142. package/segmented-control/internal-segmented-control.d.ts.map +1 -1
  143. package/segmented-control/internal-segmented-control.js +3 -3
  144. package/segmented-control/internal-segmented-control.js.map +1 -1
  145. package/segmented-control/internal.d.ts +11 -1
  146. package/segmented-control/internal.d.ts.map +1 -1
  147. package/segmented-control/internal.js +3 -2
  148. package/segmented-control/internal.js.map +1 -1
  149. package/segmented-control/segment.d.ts +2 -0
  150. package/segmented-control/segment.d.ts.map +1 -1
  151. package/segmented-control/segment.js +4 -2
  152. package/segmented-control/segment.js.map +1 -1
  153. package/segmented-control/styles.css.js +31 -31
  154. package/segmented-control/styles.scoped.css +119 -82
  155. package/segmented-control/styles.selectors.js +31 -31
  156. package/select/index.d.ts.map +1 -1
  157. package/select/index.js +1 -1
  158. package/select/index.js.map +1 -1
  159. package/select/internal.d.ts +8 -0
  160. package/select/internal.d.ts.map +1 -1
  161. package/select/internal.js +5 -5
  162. package/select/internal.js.map +1 -1
  163. package/select/parts/filter.d.ts +1 -1
  164. package/select/parts/filter.d.ts.map +1 -1
  165. package/select/parts/styles.css.js +22 -21
  166. package/select/parts/styles.scoped.css +28 -24
  167. package/select/parts/styles.selectors.js +22 -21
  168. package/select/parts/trigger.d.ts +6 -0
  169. package/select/parts/trigger.d.ts.map +1 -1
  170. package/select/parts/trigger.js +4 -4
  171. package/select/parts/trigger.js.map +1 -1
  172. package/select/styles.css.js +3 -3
  173. package/select/styles.scoped.css +14 -3
  174. package/select/styles.selectors.js +3 -3
  175. package/styling/autosuggest.scss +1 -0
  176. package/styling/flashbar.scss +127 -0
  177. package/styling/multiselect.scss +80 -0
  178. package/styling/radio-group.scss +1 -0
  179. package/styling/segmented-control.scss +111 -0
  180. package/styling/select.scss +80 -0
  181. package/table/resizer/styles.css.js +17 -17
  182. package/table/resizer/styles.scoped.css +30 -29
  183. package/table/resizer/styles.selectors.js +17 -17
  184. package/table/sticky-header.d.ts.map +1 -1
  185. package/table/sticky-header.js +8 -2
  186. package/table/sticky-header.js.map +1 -1
  187. package/table/styles.css.js +37 -37
  188. package/table/styles.scoped.css +47 -47
  189. package/table/styles.selectors.js +37 -37
  190. package/table/use-column-widths.d.ts.map +1 -1
  191. package/table/use-column-widths.js +4 -16
  192. package/table/use-column-widths.js.map +1 -1
  193. package/toggle/internal.d.ts.map +1 -1
  194. package/toggle/internal.js +1 -1
  195. package/toggle/internal.js.map +1 -1
  196. package/token-group/internal.d.ts +5 -0
  197. package/token-group/internal.d.ts.map +1 -1
  198. package/token-group/internal.js +2 -2
  199. package/token-group/internal.js.map +1 -1
  200. package/table/sticky-scrolling.d.ts.map +0 -1
  201. package/table/sticky-scrolling.js.map +0 -1
  202. package/table/use-sticky-header.d.ts +0 -5
  203. package/table/use-sticky-header.d.ts.map +0 -1
  204. package/table/use-sticky-header.js.map +0 -1
@@ -1,6 +1,15 @@
1
1
  import React from 'react';
2
+ import { StyleClassNames as InputStyleClassNames } from '../input/internal';
2
3
  import { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';
4
+ import { StyleClassNames as TokenStyleClassNames } from '../token/internal';
3
5
  import { MultiselectProps } from './interfaces';
6
+ export interface StyleClassNames {
7
+ trigger?: string;
8
+ inlineLabel?: string;
9
+ filter?: InputStyleClassNames;
10
+ dropdown?: string;
11
+ token?: TokenStyleClassNames;
12
+ }
4
13
  declare const InternalMultiselect: React.ForwardRefExoticComponent<MultiselectProps & {
5
14
  filteringType: import("../dropdown/interfaces").OptionsFilteringType;
6
15
  statusType: import("../types/dropdown-status").DropdownStatusProps.StatusType;
@@ -8,5 +17,7 @@ declare const InternalMultiselect: React.ForwardRefExoticComponent<MultiselectPr
8
17
  selectedOptions: ReadonlyArray<MultiselectProps.Option>;
9
18
  keepOpen: boolean;
10
19
  hideTokens: boolean;
11
- } & InternalBaseComponentProps & React.RefAttributes<MultiselectProps.Ref>>;
20
+ } & InternalBaseComponentProps & {
21
+ styleClassNames?: StyleClassNames;
22
+ } & React.RefAttributes<MultiselectProps.Ref>>;
12
23
  export default InternalMultiselect;
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAchD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAW3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAahD,QAAA,MAAM,mBAAmB;;;;;;;2EAuPxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAOhD,OAAO,EAAE,eAAe,IAAI,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAQ5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAS3F,OAAO,EAAE,eAAe,IAAI,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAchD,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC9B;AAID,QAAA,MAAM,mBAAmB;;;;;;;;sBAdH,eAAe;8CA8QpC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -22,7 +22,7 @@ import { composeDropdownContent } from '../select/utils/dropdown-customization';
22
22
  import InternalTokenGroup from '../token-group/internal';
23
23
  import { useMultiselect } from './use-multiselect';
24
24
  import styles from './styles.css.js';
25
- const InternalMultiselect = React.forwardRef(({ options, filteringType, filteringPlaceholder, filteringAriaLabel, filteringClearAriaLabel, ariaRequired, placeholder, disabled, readOnly, ariaLabel, inlineLabelText, selectedOptions, deselectAriaLabel, tokenLimit, i18nStrings, virtualScroll, inlineTokens, hideTokens, expandToViewport, tokenLimitShowFewerAriaLabel, tokenLimitShowMoreAriaLabel, __internalRootRef, autoFocus, enableSelectAll, renderOption, renderDropdownHeader, renderDropdownFooter, dropdownRole, dropdownAriaDescribedby, ...restProps }, externalRef) => {
25
+ const InternalMultiselect = React.forwardRef(({ options, filteringType, filteringPlaceholder, filteringAriaLabel, filteringClearAriaLabel, ariaRequired, placeholder, disabled, readOnly, ariaLabel, inlineLabelText, selectedOptions, deselectAriaLabel, tokenLimit, i18nStrings, virtualScroll, inlineTokens, hideTokens, expandToViewport, tokenLimitShowFewerAriaLabel, tokenLimitShowMoreAriaLabel, __internalRootRef, autoFocus, enableSelectAll, renderOption, renderDropdownHeader, renderDropdownFooter, dropdownRole, dropdownAriaDescribedby, styleClassNames, ...restProps }, externalRef) => {
26
26
  var _a;
27
27
  const baseProps = getBaseProps(restProps);
28
28
  const formFieldContext = useFormFieldContext(restProps);
@@ -75,11 +75,15 @@ const InternalMultiselect = React.forwardRef(({ options, filteringType, filterin
75
75
  };
76
76
  const customDropdownHeader = renderDropdownHeader === null || renderDropdownHeader === void 0 ? void 0 : renderDropdownHeader(dropdownContentProps);
77
77
  const customDropdownFooter = renderDropdownFooter === null || renderDropdownFooter === void 0 ? void 0 : renderDropdownFooter(dropdownContentProps);
78
- const filter = (React.createElement(Filter, { clearAriaLabel: filteringClearAriaLabel, filteringType: filteringType, placeholder: filteringPlaceholder, ariaLabel: filteringAriaLabel, ariaRequired: ariaRequired, value: filteringValue, ...multiselectProps.getFilterProps() }));
78
+ const filter = (React.createElement(Filter, { clearAriaLabel: filteringClearAriaLabel, filteringType: filteringType, placeholder: filteringPlaceholder, ariaLabel: filteringAriaLabel, ariaRequired: ariaRequired, value: filteringValue, styleClassNames: styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.filter, ...multiselectProps.getFilterProps() }));
79
79
  const triggerRef = useRef(null);
80
80
  const [triggerWidth, setTriggerWidth] = useState(null);
81
- useResizeObserver(() => triggerRef.current, entry => entry.borderBoxWidth > 0 && setTriggerWidth(entry.borderBoxWidth));
82
- const trigger = (React.createElement(Trigger, { ref: triggerRef, placeholder: placeholder, disabled: disabled, readOnly: readOnly, triggerProps: multiselectProps.getTriggerProps(disabled, autoFocus), selectedOption: null, selectedOptions: selectedOptions, triggerVariant: showTokensInline ? 'tokens' : 'placeholder', isOpen: multiselectProps.isOpen, groupedControlProps: groupedControlProps, inlineLabelText: inlineLabelText, ...formFieldContext, controlId: controlId, ariaLabelledby: joinStrings(formFieldContext.ariaLabelledby, ariaLabelId) }));
81
+ useResizeObserver(() => triggerRef.current, entry => setTriggerWidth(entry.borderBoxWidth));
82
+ const trigger = (React.createElement(Trigger, { ref: triggerRef, placeholder: placeholder, disabled: disabled, readOnly: readOnly, triggerProps: multiselectProps.getTriggerProps(disabled, autoFocus), selectedOption: null, selectedOptions: selectedOptions, triggerVariant: showTokensInline ? 'tokens' : 'placeholder', isOpen: multiselectProps.isOpen, groupedControlProps: groupedControlProps, inlineLabelText: inlineLabelText, styleClassNames: {
83
+ trigger: styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.trigger,
84
+ inlineLabel: styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.inlineLabel,
85
+ token: styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.token,
86
+ }, ...formFieldContext, controlId: controlId, ariaLabelledby: joinStrings(formFieldContext.ariaLabelledby, ariaLabelId) }));
83
87
  const tokens = selectedOptions.map(option => ({
84
88
  label: option.label,
85
89
  disabled,
@@ -115,12 +119,12 @@ const InternalMultiselect = React.forwardRef(({ options, filteringType, filterin
115
119
  hasOptions.current = hasOptions.current || options.length > 0;
116
120
  return (React.createElement(ResetGroupedControlContext, null,
117
121
  React.createElement("div", { ...baseProps, ref: __internalRootRef, className: clsx(styles.root, baseProps.className), ...multiselectProps.getWrapperProps() },
118
- React.createElement(Dropdown, { ...dropdownProps, ariaLabelledby: dropdownProps.ariaRole ? joinStrings(ariaLabelId, controlId) : undefined, ariaDescribedby: dropdownProps.ariaRole
122
+ React.createElement(Dropdown, { ...dropdownProps, styleClassNames: { container: styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.dropdown }, ariaLabelledby: dropdownProps.ariaRole ? joinStrings(ariaLabelId, controlId) : undefined, ariaDescribedby: dropdownProps.ariaRole
119
123
  ? joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby)
120
124
  : undefined, open: multiselectProps.isOpen, minWidth: getDropdownMinWidth({ expandToViewport: effectiveExpandToViewport, triggerWidth }), maxWidth: getBreakpointValue('xxs'), trigger: trigger, header: dropdownHeader, footer: dropdownFooter, expandToViewport: effectiveExpandToViewport,
121
125
  // Forces dropdown position recalculation when new options are loaded
122
126
  contentKey: hasOptions.current.toString(), content: React.createElement(ListComponent, { renderOption: renderOption, listBottom: !dropdownStatus.isSticky ? (React.createElement(DropdownFooter, { content: multiselectProps.isOpen ? dropdownStatus.content : null, id: footerId })) : null, menuProps: { ...multiselectProps.getMenuProps(), ariaRequired }, getOptionProps: multiselectProps.getOptionProps, filteredOptions: multiselectProps.filteredOptions, filteringValue: filteringValue, ref: multiselectProps.scrollToIndex, hasDropdownStatus: dropdownStatus.content !== null, checkboxes: true, useInteractiveGroups: true, screenReaderContent: multiselectProps.announcement, highlightType: multiselectProps.highlightType, firstOptionSticky: hasFilteredOptions && enableSelectAll, isMultiSelect: true }) }),
123
- showTokens && (React.createElement(InternalTokenGroup, { ...multiselectProps.getTokenProps(), className: styles.tokens, alignment: "horizontal", limit: tokenLimit, items: tokens, i18nStrings: tokenGroupI18nStrings, limitShowMoreAriaLabel: tokenLimitShowMoreAriaLabel, limitShowFewerAriaLabel: tokenLimitShowFewerAriaLabel, disableOuterPadding: true, readOnly: readOnly, isItemReadOnly: item => item._readOnly })),
127
+ showTokens && (React.createElement(InternalTokenGroup, { ...multiselectProps.getTokenProps(), className: styles.tokens, alignment: "horizontal", limit: tokenLimit, items: tokens, i18nStrings: tokenGroupI18nStrings, limitShowMoreAriaLabel: tokenLimitShowMoreAriaLabel, limitShowFewerAriaLabel: tokenLimitShowFewerAriaLabel, disableOuterPadding: true, readOnly: readOnly, isItemReadOnly: item => item._readOnly, styleClassNames: { token: styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.token } })),
124
128
  React.createElement(ScreenreaderOnly, { id: ariaLabelId }, ariaLabel || inlineLabelText))));
125
129
  });
126
130
  export default InternalMultiselect;
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE/F,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,gBAAgB,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACjH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,0CAA0C,CAAC;AAGhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAC5C,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,WAAW,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,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AE,QAAQ,GAAI,CACnG,CAAC,CAAC,CAAC,IAAI,EAEV,SAAS,EAAE,EAAE,GAAG,gBAAgB,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,EAC/D,cAAc,EAAE,gBAAgB,CAAC,cAAc,EAC/C,eAAe,EAAE,gBAAgB,CAAC,eAAe,EACjD,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,gBAAgB,CAAC,aAAa,EACnC,iBAAiB,EAAE,cAAc,CAAC,OAAO,KAAK,IAAI,EAClD,UAAU,EAAE,IAAI,EAChB,oBAAoB,EAAE,IAAI,EAC1B,mBAAmB,EAAE,gBAAgB,CAAC,YAAY,EAClD,aAAa,EAAE,gBAAgB,CAAC,aAAa,EAC7C,iBAAiB,EAAE,kBAAkB,IAAI,eAAe,EACxD,aAAa,EAAE,IAAI,GACnB,GAEJ;YAED,UAAU,IAAI,CACb,oBAAC,kBAAkB,OACb,gBAAgB,CAAC,aAAa,EAAE,EACpC,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,qBAAqB,EAClC,sBAAsB,EAAE,2BAA2B,EACnD,uBAAuB,EAAE,4BAA4B,EACrD,mBAAmB,EAAE,IAAI,EACzB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,IAAI,CAAC,EAAE,CAAE,IAAsB,CAAC,SAAS,GACzD,CACH;YAED,oBAAC,gBAAgB,IAAC,EAAE,EAAE,WAAW,IAAG,SAAS,IAAI,eAAe,CAAoB,CAChF,CACqB,CAC9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport Dropdown from '../dropdown/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { getBreakpointValue } from '../internal/breakpoints';\nimport DropdownFooter from '../internal/components/dropdown-footer/index.js';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { ResetGroupedControlContext, useGroupedControlContext } from '../internal/context/control-group-context';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { warnOnUnsupportedGroupedControlProps } from '../internal/grouped-control/dev-warnings';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { SomeRequired } from '../internal/types';\nimport { getDropdownMinWidth } from '../internal/utils/get-dropdown-min-width';\nimport { joinStrings } from '../internal/utils/strings';\nimport Filter from '../select/parts/filter';\nimport PlainList from '../select/parts/plain-list';\nimport Trigger from '../select/parts/trigger';\nimport VirtualList from '../select/parts/virtual-list';\nimport { composeDropdownContent } from '../select/utils/dropdown-customization';\nimport { TokenGroupProps } from '../token-group/interfaces';\nimport InternalTokenGroup from '../token-group/internal';\nimport { MultiselectProps } from './interfaces';\nimport { useMultiselect } from './use-multiselect';\n\nimport styles from './styles.css.js';\n\ntype InternalMultiselectProps = SomeRequired<\n MultiselectProps,\n 'options' | 'selectedOptions' | 'filteringType' | 'statusType' | 'keepOpen' | 'hideTokens'\n> &\n InternalBaseComponentProps;\n\ntype ExtendedToken = TokenGroupProps.Item & { _readOnly: boolean };\n\nconst InternalMultiselect = React.forwardRef(\n (\n {\n options,\n filteringType,\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n ariaRequired,\n placeholder,\n disabled,\n readOnly,\n ariaLabel,\n inlineLabelText,\n selectedOptions,\n deselectAriaLabel,\n tokenLimit,\n i18nStrings,\n virtualScroll,\n inlineTokens,\n hideTokens,\n expandToViewport,\n tokenLimitShowFewerAriaLabel,\n tokenLimitShowMoreAriaLabel,\n __internalRootRef,\n autoFocus,\n enableSelectAll,\n renderOption,\n renderDropdownHeader,\n renderDropdownFooter,\n dropdownRole,\n dropdownAriaDescribedby,\n ...restProps\n }: InternalMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n const groupedControlProps = useGroupedControlContext();\n const i18n = useInternalI18n('multiselect');\n\n const isGrouped = !!groupedControlProps.position;\n\n warnOnUnsupportedGroupedControlProps({\n isGrouped,\n componentName: 'Multiselect',\n invalid: formFieldContext.invalid,\n warning: formFieldContext.warning,\n readOnly,\n inlineTokens,\n expandToViewport,\n });\n\n // When rendered inside a control group, tokens are always shown inline in the\n // trigger regardless of the `inlineTokens` prop, since there is no room to\n // display tokens below the control within a group.\n const showTokensInline = inlineTokens || isGrouped;\n\n // When grouped, the dropdown is portaled regardless of the public\n // `expandToViewport` prop so it escapes the control slot's stacking context\n // and paints over the group's inline label (which the focus ring stays under).\n const effectiveExpandToViewport = expandToViewport || isGrouped;\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const ariaLabelId = useUniqueId('multiselect-ariaLabel-');\n const footerId = useUniqueId('multiselect-footer-');\n\n const [filteringValue, setFilteringValue] = useState('');\n const multiselectProps = useMultiselect({\n options,\n selectedOptions,\n filteringType,\n disabled,\n deselectAriaLabel,\n controlId,\n ariaLabelId,\n footerId,\n filteringValue,\n setFilteringValue,\n externalRef,\n enableSelectAll,\n i18nStrings,\n dropdownRole,\n dropdownAriaDescribedby,\n ...restProps,\n });\n\n const dropdownContentProps: MultiselectProps.DropdownContentProps = {\n filterText: filteringValue,\n closeDropdown: multiselectProps.closeDropdown,\n };\n const customDropdownHeader = renderDropdownHeader?.(dropdownContentProps);\n const customDropdownFooter = renderDropdownFooter?.(dropdownContentProps);\n\n const filter = (\n <Filter\n clearAriaLabel={filteringClearAriaLabel}\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n {...multiselectProps.getFilterProps()}\n />\n );\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [triggerWidth, setTriggerWidth] = useState<number | null>(null);\n useResizeObserver(\n () => triggerRef.current,\n entry => entry.borderBoxWidth > 0 && setTriggerWidth(entry.borderBoxWidth)\n );\n\n const trigger = (\n <Trigger\n ref={triggerRef}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n triggerProps={multiselectProps.getTriggerProps(disabled, autoFocus)}\n selectedOption={null}\n selectedOptions={selectedOptions}\n triggerVariant={showTokensInline ? 'tokens' : 'placeholder'}\n isOpen={multiselectProps.isOpen}\n groupedControlProps={groupedControlProps}\n inlineLabelText={inlineLabelText}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, ariaLabelId)}\n />\n );\n\n const tokens: Array<ExtendedToken> = selectedOptions.map(option => ({\n label: option.label,\n disabled,\n labelTag: option.labelTag,\n description: option.description,\n iconAlt: option.iconAlt,\n iconName: option.iconName,\n iconUrl: option.iconUrl,\n iconSvg: option.iconSvg,\n tags: option.tags,\n dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel?.(option), format =>\n format({ option__label: option.label ?? '' })\n ),\n _readOnly: !!option.disabled,\n }));\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const showTokens = !hideTokens && !showTokensInline && tokens.length > 0;\n\n const tokenGroupI18nStrings: TokenGroupProps.I18nStrings = {\n limitShowFewer: i18nStrings?.tokenLimitShowFewer,\n limitShowMore: i18nStrings?.tokenLimitShowMore,\n };\n\n const dropdownStatus = multiselectProps.dropdownStatus;\n const dropdownProps = multiselectProps.getDropdownProps();\n const hasFilteredOptions = multiselectProps.filteredOptions.length > 0;\n\n const statusFooter = dropdownStatus.isSticky ? (\n <DropdownFooter content={multiselectProps.isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null;\n const { header: dropdownHeader, footer: dropdownFooter } = composeDropdownContent({\n filter,\n customDropdownHeader,\n customDropdownFooter,\n statusFooter,\n dropdownHeaderClass: styles['dropdown-header'],\n dropdownFooterClass: styles['dropdown-footer'],\n });\n\n const hasOptions = useRef(options.length > 0);\n hasOptions.current = hasOptions.current || options.length > 0;\n\n return (\n <ResetGroupedControlContext>\n <div\n {...baseProps}\n ref={__internalRootRef}\n className={clsx(styles.root, baseProps.className)}\n {...multiselectProps.getWrapperProps()}\n >\n <Dropdown\n {...dropdownProps}\n ariaLabelledby={dropdownProps.ariaRole ? joinStrings(ariaLabelId, controlId) : undefined}\n ariaDescribedby={\n dropdownProps.ariaRole\n ? joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby)\n : undefined\n }\n open={multiselectProps.isOpen}\n minWidth={getDropdownMinWidth({ expandToViewport: effectiveExpandToViewport, triggerWidth })}\n maxWidth={getBreakpointValue('xxs')} // AWSUI-19898\n trigger={trigger}\n header={dropdownHeader}\n footer={dropdownFooter}\n expandToViewport={effectiveExpandToViewport}\n // Forces dropdown position recalculation when new options are loaded\n contentKey={hasOptions.current.toString()}\n content={\n <ListComponent\n renderOption={renderOption}\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={multiselectProps.isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n menuProps={{ ...multiselectProps.getMenuProps(), ariaRequired }}\n getOptionProps={multiselectProps.getOptionProps}\n filteredOptions={multiselectProps.filteredOptions}\n filteringValue={filteringValue}\n ref={multiselectProps.scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n checkboxes={true}\n useInteractiveGroups={true}\n screenReaderContent={multiselectProps.announcement}\n highlightType={multiselectProps.highlightType}\n firstOptionSticky={hasFilteredOptions && enableSelectAll}\n isMultiSelect={true}\n />\n }\n />\n\n {showTokens && (\n <InternalTokenGroup\n {...multiselectProps.getTokenProps()}\n className={styles.tokens}\n alignment=\"horizontal\"\n limit={tokenLimit}\n items={tokens}\n i18nStrings={tokenGroupI18nStrings}\n limitShowMoreAriaLabel={tokenLimitShowMoreAriaLabel}\n limitShowFewerAriaLabel={tokenLimitShowFewerAriaLabel}\n disableOuterPadding={true}\n readOnly={readOnly}\n isItemReadOnly={item => (item as ExtendedToken)._readOnly}\n />\n )}\n\n <ScreenreaderOnly id={ariaLabelId}>{ariaLabel || inlineLabelText}</ScreenreaderOnly>\n </div>\n </ResetGroupedControlContext>\n );\n }\n);\n\nexport default InternalMultiselect;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE/F,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,gBAAgB,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACjH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,0CAA0C,CAAC;AAGhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAC5C,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,WAAW,MA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qB,EAClC,sBAAsB,EAAE,2BAA2B,EACnD,uBAAuB,EAAE,4BAA4B,EACrD,mBAAmB,EAAE,IAAI,EACzB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,IAAI,CAAC,EAAE,CAAE,IAAsB,CAAC,SAAS,EACzD,eAAe,EAAE,EAAE,KAAK,EAAE,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,KAAK,EAAE,GAClD,CACH;YAED,oBAAC,gBAAgB,IAAC,EAAE,EAAE,WAAW,IAAG,SAAS,IAAI,eAAe,CAAoB,CAChF,CACqB,CAC9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport Dropdown from '../dropdown/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { StyleClassNames as InputStyleClassNames } from '../input/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { getBreakpointValue } from '../internal/breakpoints';\nimport DropdownFooter from '../internal/components/dropdown-footer/index.js';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { ResetGroupedControlContext, useGroupedControlContext } from '../internal/context/control-group-context';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { warnOnUnsupportedGroupedControlProps } from '../internal/grouped-control/dev-warnings';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { SomeRequired } from '../internal/types';\nimport { getDropdownMinWidth } from '../internal/utils/get-dropdown-min-width';\nimport { joinStrings } from '../internal/utils/strings';\nimport Filter from '../select/parts/filter';\nimport PlainList from '../select/parts/plain-list';\nimport Trigger from '../select/parts/trigger';\nimport VirtualList from '../select/parts/virtual-list';\nimport { composeDropdownContent } from '../select/utils/dropdown-customization';\nimport { StyleClassNames as TokenStyleClassNames } from '../token/internal';\nimport { TokenGroupProps } from '../token-group/interfaces';\nimport InternalTokenGroup from '../token-group/internal';\nimport { MultiselectProps } from './interfaces';\nimport { useMultiselect } from './use-multiselect';\n\nimport styles from './styles.css.js';\n\ntype InternalMultiselectProps = SomeRequired<\n MultiselectProps,\n 'options' | 'selectedOptions' | 'filteringType' | 'statusType' | 'keepOpen' | 'hideTokens'\n> &\n InternalBaseComponentProps & {\n styleClassNames?: StyleClassNames;\n };\n\n// Style API v2\nexport interface StyleClassNames {\n trigger?: string;\n inlineLabel?: string;\n filter?: InputStyleClassNames;\n dropdown?: string;\n token?: TokenStyleClassNames;\n}\n\ntype ExtendedToken = TokenGroupProps.Item & { _readOnly: boolean };\n\nconst InternalMultiselect = React.forwardRef(\n (\n {\n options,\n filteringType,\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n ariaRequired,\n placeholder,\n disabled,\n readOnly,\n ariaLabel,\n inlineLabelText,\n selectedOptions,\n deselectAriaLabel,\n tokenLimit,\n i18nStrings,\n virtualScroll,\n inlineTokens,\n hideTokens,\n expandToViewport,\n tokenLimitShowFewerAriaLabel,\n tokenLimitShowMoreAriaLabel,\n __internalRootRef,\n autoFocus,\n enableSelectAll,\n renderOption,\n renderDropdownHeader,\n renderDropdownFooter,\n dropdownRole,\n dropdownAriaDescribedby,\n styleClassNames,\n ...restProps\n }: InternalMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n const groupedControlProps = useGroupedControlContext();\n const i18n = useInternalI18n('multiselect');\n\n const isGrouped = !!groupedControlProps.position;\n\n warnOnUnsupportedGroupedControlProps({\n isGrouped,\n componentName: 'Multiselect',\n invalid: formFieldContext.invalid,\n warning: formFieldContext.warning,\n readOnly,\n inlineTokens,\n expandToViewport,\n });\n\n // When rendered inside a control group, tokens are always shown inline in the\n // trigger regardless of the `inlineTokens` prop, since there is no room to\n // display tokens below the control within a group.\n const showTokensInline = inlineTokens || isGrouped;\n\n // When grouped, the dropdown is portaled regardless of the public\n // `expandToViewport` prop so it escapes the control slot's stacking context\n // and paints over the group's inline label (which the focus ring stays under).\n const effectiveExpandToViewport = expandToViewport || isGrouped;\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const ariaLabelId = useUniqueId('multiselect-ariaLabel-');\n const footerId = useUniqueId('multiselect-footer-');\n\n const [filteringValue, setFilteringValue] = useState('');\n const multiselectProps = useMultiselect({\n options,\n selectedOptions,\n filteringType,\n disabled,\n deselectAriaLabel,\n controlId,\n ariaLabelId,\n footerId,\n filteringValue,\n setFilteringValue,\n externalRef,\n enableSelectAll,\n i18nStrings,\n dropdownRole,\n dropdownAriaDescribedby,\n ...restProps,\n });\n\n const dropdownContentProps: MultiselectProps.DropdownContentProps = {\n filterText: filteringValue,\n closeDropdown: multiselectProps.closeDropdown,\n };\n const customDropdownHeader = renderDropdownHeader?.(dropdownContentProps);\n const customDropdownFooter = renderDropdownFooter?.(dropdownContentProps);\n\n const filter = (\n <Filter\n clearAriaLabel={filteringClearAriaLabel}\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n styleClassNames={styleClassNames?.filter}\n {...multiselectProps.getFilterProps()}\n />\n );\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [triggerWidth, setTriggerWidth] = useState<number | null>(null);\n useResizeObserver(\n () => triggerRef.current,\n entry => setTriggerWidth(entry.borderBoxWidth)\n );\n\n const trigger = (\n <Trigger\n ref={triggerRef}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n triggerProps={multiselectProps.getTriggerProps(disabled, autoFocus)}\n selectedOption={null}\n selectedOptions={selectedOptions}\n triggerVariant={showTokensInline ? 'tokens' : 'placeholder'}\n isOpen={multiselectProps.isOpen}\n groupedControlProps={groupedControlProps}\n inlineLabelText={inlineLabelText}\n styleClassNames={{\n trigger: styleClassNames?.trigger,\n inlineLabel: styleClassNames?.inlineLabel,\n token: styleClassNames?.token,\n }}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, ariaLabelId)}\n />\n );\n\n const tokens: Array<ExtendedToken> = selectedOptions.map(option => ({\n label: option.label,\n disabled,\n labelTag: option.labelTag,\n description: option.description,\n iconAlt: option.iconAlt,\n iconName: option.iconName,\n iconUrl: option.iconUrl,\n iconSvg: option.iconSvg,\n tags: option.tags,\n dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel?.(option), format =>\n format({ option__label: option.label ?? '' })\n ),\n _readOnly: !!option.disabled,\n }));\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const showTokens = !hideTokens && !showTokensInline && tokens.length > 0;\n\n const tokenGroupI18nStrings: TokenGroupProps.I18nStrings = {\n limitShowFewer: i18nStrings?.tokenLimitShowFewer,\n limitShowMore: i18nStrings?.tokenLimitShowMore,\n };\n\n const dropdownStatus = multiselectProps.dropdownStatus;\n const dropdownProps = multiselectProps.getDropdownProps();\n const hasFilteredOptions = multiselectProps.filteredOptions.length > 0;\n\n const statusFooter = dropdownStatus.isSticky ? (\n <DropdownFooter content={multiselectProps.isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null;\n const { header: dropdownHeader, footer: dropdownFooter } = composeDropdownContent({\n filter,\n customDropdownHeader,\n customDropdownFooter,\n statusFooter,\n dropdownHeaderClass: styles['dropdown-header'],\n dropdownFooterClass: styles['dropdown-footer'],\n });\n\n const hasOptions = useRef(options.length > 0);\n hasOptions.current = hasOptions.current || options.length > 0;\n\n return (\n <ResetGroupedControlContext>\n <div\n {...baseProps}\n ref={__internalRootRef}\n className={clsx(styles.root, baseProps.className)}\n {...multiselectProps.getWrapperProps()}\n >\n <Dropdown\n {...dropdownProps}\n styleClassNames={{ container: styleClassNames?.dropdown }}\n ariaLabelledby={dropdownProps.ariaRole ? joinStrings(ariaLabelId, controlId) : undefined}\n ariaDescribedby={\n dropdownProps.ariaRole\n ? joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby)\n : undefined\n }\n open={multiselectProps.isOpen}\n minWidth={getDropdownMinWidth({ expandToViewport: effectiveExpandToViewport, triggerWidth })}\n maxWidth={getBreakpointValue('xxs')} // AWSUI-19898\n trigger={trigger}\n header={dropdownHeader}\n footer={dropdownFooter}\n expandToViewport={effectiveExpandToViewport}\n // Forces dropdown position recalculation when new options are loaded\n contentKey={hasOptions.current.toString()}\n content={\n <ListComponent\n renderOption={renderOption}\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={multiselectProps.isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n menuProps={{ ...multiselectProps.getMenuProps(), ariaRequired }}\n getOptionProps={multiselectProps.getOptionProps}\n filteredOptions={multiselectProps.filteredOptions}\n filteringValue={filteringValue}\n ref={multiselectProps.scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n checkboxes={true}\n useInteractiveGroups={true}\n screenReaderContent={multiselectProps.announcement}\n highlightType={multiselectProps.highlightType}\n firstOptionSticky={hasFilteredOptions && enableSelectAll}\n isMultiSelect={true}\n />\n }\n />\n\n {showTokens && (\n <InternalTokenGroup\n {...multiselectProps.getTokenProps()}\n className={styles.tokens}\n alignment=\"horizontal\"\n limit={tokenLimit}\n items={tokens}\n i18nStrings={tokenGroupI18nStrings}\n limitShowMoreAriaLabel={tokenLimitShowMoreAriaLabel}\n limitShowFewerAriaLabel={tokenLimitShowFewerAriaLabel}\n disableOuterPadding={true}\n readOnly={readOnly}\n isItemReadOnly={item => (item as ExtendedToken)._readOnly}\n styleClassNames={{ token: styleClassNames?.token }}\n />\n )}\n\n <ScreenreaderOnly id={ariaLabelId}>{ariaLabel || inlineLabelText}</ScreenreaderOnly>\n </div>\n </ResetGroupedControlContext>\n );\n }\n);\n\nexport default InternalMultiselect;\n"]}
@@ -1,10 +1,10 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_f8g6q_8dwf3_9",
5
- "embedded": "awsui_embedded_f8g6q_8dwf3_41",
6
- "tokens": "awsui_tokens_f8g6q_8dwf3_74",
7
- "dropdown-header": "awsui_dropdown-header_f8g6q_8dwf3_78",
8
- "dropdown-footer": "awsui_dropdown-footer_f8g6q_8dwf3_84"
4
+ "root": "awsui_root_f8g6q_avh76_21",
5
+ "embedded": "awsui_embedded_f8g6q_avh76_53",
6
+ "tokens": "awsui_tokens_f8g6q_avh76_86",
7
+ "dropdown-header": "awsui_dropdown-header_f8g6q_avh76_90",
8
+ "dropdown-footer": "awsui_dropdown-footer_f8g6q_avh76_96"
9
9
  };
10
10
 
@@ -6,7 +6,19 @@
6
6
  /* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
7
7
  /* Style used for links in slots/components that are text heavy, to help links stand out among
8
8
  surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
9
- .awsui_root_f8g6q_8dwf3_9:not(#\9) {
9
+ @property --awsui-style-placeholder-color {
10
+ syntax: "*";
11
+ inherits: false;
12
+ }
13
+ /* awsui:style-api-slot name=trigger tokens=placeholder-color properties=color, background, border, border-radius, box-shadow, padding, font-family, font-size, font-weight */
14
+ /* awsui:style-api-description slot=trigger kind=slot name=trigger text=The trigger button, which is also the field box. Pass a different class for the states you control (`invalid`, `warning`, `disabled`, `readOnly`); use `:hover` and `:focus` for interaction states. */
15
+ /* awsui:style-api-description slot=trigger kind=property name=color text=The placeholder is styled with `--awsui-style-placeholder-color`. */
16
+ /* awsui:style-api-description slot=trigger kind=property name=box-shadow text=Also draws the focus ring under `:focus`. */
17
+ /* awsui:style-api-slot name=inlineLabel tokens= properties=color, background, font-family, font-size, font-weight */
18
+ /* awsui:style-api-slot name=filter component=input */
19
+ /* awsui:style-api-slot name=dropdown component=dropdown slot=container */
20
+ /* awsui:style-api-slot name=token component=token */
21
+ .awsui_root_f8g6q_avh76_21:not(#\9) {
10
22
  border-collapse: separate;
11
23
  border-spacing: 0;
12
24
  box-sizing: border-box;
@@ -38,7 +50,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
38
50
  -moz-osx-font-smoothing: auto;
39
51
  }
40
52
 
41
- .awsui_embedded_f8g6q_8dwf3_41:not(#\9) {
53
+ .awsui_embedded_f8g6q_avh76_53:not(#\9) {
42
54
  border-collapse: separate;
43
55
  border-spacing: 0;
44
56
  box-sizing: border-box;
@@ -71,16 +83,16 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
71
83
  display: contents;
72
84
  }
73
85
 
74
- .awsui_tokens_f8g6q_8dwf3_74:not(#\9) {
86
+ .awsui_tokens_f8g6q_avh76_86:not(#\9) {
75
87
  margin-block-start: var(--space-scaled-xs-65ylh6, 8px);
76
88
  }
77
89
 
78
- .awsui_dropdown-header_f8g6q_8dwf3_78:not(#\9) {
90
+ .awsui_dropdown-header_f8g6q_avh76_90:not(#\9) {
79
91
  inline-size: 100%;
80
92
  position: relative;
81
93
  z-index: 4;
82
94
  }
83
95
 
84
- .awsui_dropdown-footer_f8g6q_8dwf3_84:not(#\9) {
96
+ .awsui_dropdown-footer_f8g6q_avh76_96:not(#\9) {
85
97
  inline-size: 100%;
86
98
  }
@@ -2,10 +2,10 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_f8g6q_8dwf3_9",
6
- "embedded": "awsui_embedded_f8g6q_8dwf3_41",
7
- "tokens": "awsui_tokens_f8g6q_8dwf3_74",
8
- "dropdown-header": "awsui_dropdown-header_f8g6q_8dwf3_78",
9
- "dropdown-footer": "awsui_dropdown-footer_f8g6q_8dwf3_84"
5
+ "root": "awsui_root_f8g6q_avh76_21",
6
+ "embedded": "awsui_embedded_f8g6q_avh76_53",
7
+ "tokens": "awsui_tokens_f8g6q_avh76_86",
8
+ "dropdown-header": "awsui_dropdown-header_f8g6q_avh76_90",
9
+ "dropdown-footer": "awsui_dropdown-footer_f8g6q_avh76_96"
10
10
  };
11
11
 
package/package.json CHANGED
@@ -380,7 +380,7 @@
380
380
  "./internal/base-theme/styles.css.js",
381
381
  "./internal/base-component/styles.css.js"
382
382
  ],
383
- "version": "3.0.1408",
383
+ "version": "3.0.1410",
384
384
  "repository": {
385
385
  "type": "git",
386
386
  "url": "https://github.com/cloudscape-design/components.git"
@@ -1,6 +1,6 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "radio-button": "awsui_radio-button_zdbjz_13z6o_34"
4
+ "radio-button": "awsui_radio-button_zdbjz_p13zo_10"
5
5
  };
6
6
 
@@ -6,32 +6,8 @@
6
6
  /* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
7
7
  /* Style used for links in slots/components that are text heavy, to help links stand out among
8
8
  surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
9
- @property --awsui-style-fill-color {
10
- syntax: "*";
11
- inherits: false;
12
- }
13
- @property --awsui-style-border-color {
14
- syntax: "*";
15
- inherits: false;
16
- }
17
- @property --awsui-style-indicator-color {
18
- syntax: "*";
19
- inherits: false;
20
- }
21
- @property --awsui-style-focus-ring-color {
22
- syntax: "*";
23
- inherits: false;
24
- }
25
- @property --awsui-style-focus-ring-width {
26
- syntax: "*";
27
- inherits: false;
28
- }
29
- @property --awsui-style-focus-ring-radius {
30
- syntax: "*";
31
- inherits: false;
32
- }
33
9
  /* awsui:style-api-slot name=control tokens=fill-color, border-color, indicator-color, focus-ring-color, focus-ring-width, focus-ring-radius properties= */
34
- .awsui_radio-button_zdbjz_13z6o_34:not(#\9) {
10
+ .awsui_radio-button_zdbjz_p13zo_10:not(#\9) {
35
11
  border-collapse: separate;
36
12
  border-spacing: 0;
37
13
  box-sizing: border-box;
@@ -2,6 +2,6 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "radio-button": "awsui_radio-button_zdbjz_13z6o_34"
5
+ "radio-button": "awsui_radio-button_zdbjz_p13zo_10"
6
6
  };
7
7
 
@@ -1,5 +1,11 @@
1
1
  import React from 'react';
2
+ import { StyleClassNames as RadioButtonStyleClassNames } from '../internal/components/radio-button';
2
3
  import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
3
4
  import { RadioGroupProps } from './interfaces';
4
- declare const InternalRadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & InternalBaseComponentProps & React.RefAttributes<RadioGroupProps.Ref>>;
5
+ export interface StyleClassNames {
6
+ radioButton?: RadioButtonStyleClassNames;
7
+ }
8
+ declare const InternalRadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & InternalBaseComponentProps & {
9
+ styleClassNames?: StyleClassNames;
10
+ } & React.RefAttributes<RadioGroupProps.Ref>>;
5
11
  export default InternalRadioGroup;
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/radio-group/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAQ/C,QAAA,MAAM,kBAAkB,0HA+EvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/radio-group/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAoB,EAAE,eAAe,IAAI,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAIjH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAY/C,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,0BAA0B,CAAC;CAC1C;AAED,QAAA,MAAM,kBAAkB;sBARF,eAAe;6CAyFpC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -12,13 +12,13 @@ import useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-gro
12
12
  import analyticsSelectors from './analytics-metadata/styles.css.js';
13
13
  import styles from './styles.css.js';
14
14
  import testUtilStyles from './test-classes/styles.css.js';
15
- const InternalRadioGroup = React.forwardRef(({ name, value, items, ariaLabel, ariaRequired, ariaControls, onChange, readOnly, __internalRootRef, style, direction, ...props }, ref) => {
15
+ const InternalRadioGroup = React.forwardRef(({ name, value, items, ariaLabel, ariaRequired, ariaControls, onChange, readOnly, __internalRootRef, style, direction, styleClassNames, ...props }, ref) => {
16
16
  const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(props);
17
17
  const baseProps = getBaseProps(props);
18
18
  const generatedName = useUniqueId('awsui-radio-');
19
19
  const [radioButtonRef, radioButtonRefIndex] = useRadioGroupForwardFocus(ref, items, value);
20
20
  return (React.createElement("div", { role: "radiogroup", "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, "aria-required": ariaRequired, "aria-controls": ariaControls, "aria-readonly": readOnly ? 'true' : undefined, ...baseProps, className: clsx(baseProps.className, testUtilStyles.root, styles['radio-group'], direction === 'horizontal' && styles['horizontal-group']), ref: __internalRootRef }, items &&
21
- items.map((item, index) => (React.createElement(RadioButton, { key: item.value, ref: index === radioButtonRefIndex ? radioButtonRef : undefined, className: clsx(styles.radio, item.description && styles['radio--has-description'], direction === 'horizontal' && styles.horizontal, item.value === value && analyticsSelectors.selected), checked: item.value === value, name: name || generatedName, value: item.value, description: item.description, disabled: item.disabled, onSelect: () => fireNonCancelableEvent(onChange, { value: item.value }), controlId: item.controlId, readOnly: readOnly, style: style, ...getAnalyticsMetadataAttribute(!item.disabled && !readOnly
21
+ items.map((item, index) => (React.createElement(RadioButton, { key: item.value, ref: index === radioButtonRefIndex ? radioButtonRef : undefined, className: clsx(styles.radio, item.description && styles['radio--has-description'], direction === 'horizontal' && styles.horizontal, item.value === value && analyticsSelectors.selected), checked: item.value === value, name: name || generatedName, value: item.value, description: item.description, disabled: item.disabled, onSelect: () => fireNonCancelableEvent(onChange, { value: item.value }), controlId: item.controlId, readOnly: readOnly, style: style, styleClassNames: styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.radioButton, ...getAnalyticsMetadataAttribute(!item.disabled && !readOnly
22
22
  ? {
23
23
  detail: {
24
24
  position: `${index + 1}`,
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/radio-group/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,yBAAyB,MAAM,6CAA6C,CAAC;AAKpF,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAI1D,MAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CACzC,CACE,EACE,IAAI,EACJ,KAAK,EACL,KAAK,EACL,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,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IAAI,CAAC,KAAK,KAAK,KAAK,EAC7B,IAAI,EAAE,IAAI,IAAI,aAAa,EAC3B,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,EACvE,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,KACR,6BAA6B,CAC/B,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ;gBACzB,CAAC,CAAC;oBACE,MAAM,EAAE;wBACN,QAAQ,EAAE,GAAG,KAAK,GAAG,CAAC,EAAE;wBACxB,KAAK,EAAE,IAAI,CAAC,KAAK;qBAC+C;iBACnE;gBACH,CAAC,CAAC,EAAE,CACP,IAEA,IAAI,CAAC,KAAK,CACC,CACf,CAAC,CACA,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport RadioButton from '../internal/components/radio-button';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-group';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { GeneratedAnalyticsMetadataRadioGroupSelect } from './analytics-metadata/interfaces';\nimport { RadioGroupProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ntype InternalRadioGroupProps = RadioGroupProps & InternalBaseComponentProps;\n\nconst InternalRadioGroup = React.forwardRef(\n (\n {\n name,\n value,\n items,\n ariaLabel,\n ariaRequired,\n ariaControls,\n onChange,\n readOnly,\n __internalRootRef,\n style,\n direction,\n ...props\n }: InternalRadioGroupProps,\n ref: React.Ref<RadioGroupProps.Ref>\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(props);\n const baseProps = getBaseProps(props);\n const generatedName = useUniqueId('awsui-radio-');\n\n const [radioButtonRef, radioButtonRefIndex] = useRadioGroupForwardFocus(ref, items, value);\n\n return (\n <div\n role=\"radiogroup\"\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-required={ariaRequired}\n aria-controls={ariaControls}\n aria-readonly={readOnly ? 'true' : undefined}\n {...baseProps}\n className={clsx(\n baseProps.className,\n testUtilStyles.root,\n styles['radio-group'],\n direction === 'horizontal' && styles['horizontal-group']\n )}\n ref={__internalRootRef}\n >\n {items &&\n items.map((item, index) => (\n <RadioButton\n key={item.value}\n ref={index === radioButtonRefIndex ? radioButtonRef : undefined}\n className={clsx(\n styles.radio,\n item.description && styles['radio--has-description'],\n direction === 'horizontal' && styles.horizontal,\n item.value === value && analyticsSelectors.selected\n )}\n checked={item.value === value}\n name={name || generatedName}\n value={item.value}\n description={item.description}\n disabled={item.disabled}\n onSelect={() => fireNonCancelableEvent(onChange, { value: item.value })}\n controlId={item.controlId}\n readOnly={readOnly}\n style={style}\n {...getAnalyticsMetadataAttribute(\n !item.disabled && !readOnly\n ? {\n detail: {\n position: `${index + 1}`,\n value: item.value,\n } as Partial<GeneratedAnalyticsMetadataRadioGroupSelect['detail']>,\n }\n : {}\n )}\n >\n {item.label}\n </RadioButton>\n ))}\n </div>\n );\n }\n);\n\nexport default InternalRadioGroup;\n"]}
1
+ {"version":3,"file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AAC,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ;gBACzB,CAAC,CAAC;oBACE,MAAM,EAAE;wBACN,QAAQ,EAAE,GAAG,KAAK,GAAG,CAAC,EAAE;wBACxB,KAAK,EAAE,IAAI,CAAC,KAAK;qBAC+C;iBACnE;gBACH,CAAC,CAAC,EAAE,CACP,IAEA,IAAI,CAAC,KAAK,CACC,CACf,CAAC,CACA,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport RadioButton, { StyleClassNames as RadioButtonStyleClassNames } from '../internal/components/radio-button';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useRadioGroupForwardFocus from '../internal/hooks/forward-focus/radio-group';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { GeneratedAnalyticsMetadataRadioGroupSelect } from './analytics-metadata/interfaces';\nimport { RadioGroupProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ntype InternalRadioGroupProps = RadioGroupProps &\n InternalBaseComponentProps & {\n styleClassNames?: StyleClassNames;\n };\n\n// Style API v2\nexport interface StyleClassNames {\n radioButton?: RadioButtonStyleClassNames;\n}\n\nconst InternalRadioGroup = React.forwardRef(\n (\n {\n name,\n value,\n items,\n ariaLabel,\n ariaRequired,\n ariaControls,\n onChange,\n readOnly,\n __internalRootRef,\n style,\n direction,\n styleClassNames,\n ...props\n }: InternalRadioGroupProps,\n ref: React.Ref<RadioGroupProps.Ref>\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(props);\n const baseProps = getBaseProps(props);\n const generatedName = useUniqueId('awsui-radio-');\n\n const [radioButtonRef, radioButtonRefIndex] = useRadioGroupForwardFocus(ref, items, value);\n\n return (\n <div\n role=\"radiogroup\"\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-required={ariaRequired}\n aria-controls={ariaControls}\n aria-readonly={readOnly ? 'true' : undefined}\n {...baseProps}\n className={clsx(\n baseProps.className,\n testUtilStyles.root,\n styles['radio-group'],\n direction === 'horizontal' && styles['horizontal-group']\n )}\n ref={__internalRootRef}\n >\n {items &&\n items.map((item, index) => (\n <RadioButton\n key={item.value}\n ref={index === radioButtonRefIndex ? radioButtonRef : undefined}\n className={clsx(\n styles.radio,\n item.description && styles['radio--has-description'],\n direction === 'horizontal' && styles.horizontal,\n item.value === value && analyticsSelectors.selected\n )}\n checked={item.value === value}\n name={name || generatedName}\n value={item.value}\n description={item.description}\n disabled={item.disabled}\n onSelect={() => fireNonCancelableEvent(onChange, { value: item.value })}\n controlId={item.controlId}\n readOnly={readOnly}\n style={style}\n styleClassNames={styleClassNames?.radioButton}\n {...getAnalyticsMetadataAttribute(\n !item.disabled && !readOnly\n ? {\n detail: {\n position: `${index + 1}`,\n value: item.value,\n } as Partial<GeneratedAnalyticsMetadataRadioGroupSelect['detail']>,\n }\n : {}\n )}\n >\n {item.label}\n </RadioButton>\n ))}\n </div>\n );\n }\n);\n\nexport default InternalRadioGroup;\n"]}
@@ -1,10 +1,10 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "radio-group": "awsui_radio-group_1mabk_16b73_9",
5
- "horizontal-group": "awsui_horizontal-group_1mabk_16b73_40",
6
- "radio": "awsui_radio_1mabk_16b73_9",
7
- "horizontal": "awsui_horizontal_1mabk_16b73_40",
8
- "radio--has-description": "awsui_radio--has-description_1mabk_16b73_54"
4
+ "radio-group": "awsui_radio-group_1mabk_1sbpk_10",
5
+ "horizontal-group": "awsui_horizontal-group_1mabk_1sbpk_41",
6
+ "radio": "awsui_radio_1mabk_1sbpk_10",
7
+ "horizontal": "awsui_horizontal_1mabk_1sbpk_41",
8
+ "radio--has-description": "awsui_radio--has-description_1mabk_1sbpk_55"
9
9
  };
10
10
 
@@ -6,7 +6,8 @@
6
6
  /* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
7
7
  /* Style used for links in slots/components that are text heavy, to help links stand out among
8
8
  surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
9
- .awsui_radio-group_1mabk_16b73_9:not(#\9) {
9
+ /* awsui:style-api-slot name=radioButton component=radio-button */
10
+ .awsui_radio-group_1mabk_1sbpk_10:not(#\9) {
10
11
  border-collapse: separate;
11
12
  border-spacing: 0;
12
13
  box-sizing: border-box;
@@ -37,24 +38,24 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
37
38
  -webkit-font-smoothing: auto;
38
39
  -moz-osx-font-smoothing: auto;
39
40
  }
40
- .awsui_radio-group_1mabk_16b73_9:not(#\9):not(.awsui_horizontal-group_1mabk_16b73_40) {
41
+ .awsui_radio-group_1mabk_1sbpk_10:not(#\9):not(.awsui_horizontal-group_1mabk_1sbpk_41) {
41
42
  display: block;
42
43
  }
43
- .awsui_radio-group_1mabk_16b73_9.awsui_horizontal-group_1mabk_16b73_40:not(#\9) {
44
+ .awsui_radio-group_1mabk_1sbpk_10.awsui_horizontal-group_1mabk_1sbpk_41:not(#\9) {
44
45
  display: flex;
45
46
  align-items: flex-start;
46
47
  flex-wrap: wrap;
47
48
  gap: var(--space-scaled-l-kalwlg, 20px);
48
49
  }
49
50
 
50
- .awsui_radio_1mabk_16b73_9 + .awsui_radio_1mabk_16b73_9:not(#\9):not(.awsui_horizontal_1mabk_16b73_40) {
51
+ .awsui_radio_1mabk_1sbpk_10 + .awsui_radio_1mabk_1sbpk_10:not(#\9):not(.awsui_horizontal_1mabk_1sbpk_41) {
51
52
  margin-block-start: var(--space-scaled-xxs-54nfiu, 4px);
52
53
  }
53
54
 
54
- .awsui_radio--has-description_1mabk_16b73_54 + .awsui_radio_1mabk_16b73_9:not(#\9):not(.awsui_horizontal_1mabk_16b73_40) {
55
+ .awsui_radio--has-description_1mabk_1sbpk_55 + .awsui_radio_1mabk_1sbpk_10:not(#\9):not(.awsui_horizontal_1mabk_1sbpk_41) {
55
56
  margin-block-start: var(--space-scaled-xs-65ylh6, 8px);
56
57
  }
57
58
 
58
- .awsui_radio_1mabk_16b73_9.awsui_horizontal_1mabk_16b73_40:not(#\9) {
59
+ .awsui_radio_1mabk_1sbpk_10.awsui_horizontal_1mabk_1sbpk_41:not(#\9) {
59
60
  max-inline-size: calc(16 * var(--space-scaled-xxl-pn6ur6, 32px));
60
61
  }
@@ -2,10 +2,10 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "radio-group": "awsui_radio-group_1mabk_16b73_9",
6
- "horizontal-group": "awsui_horizontal-group_1mabk_16b73_40",
7
- "radio": "awsui_radio_1mabk_16b73_9",
8
- "horizontal": "awsui_horizontal_1mabk_16b73_40",
9
- "radio--has-description": "awsui_radio--has-description_1mabk_16b73_54"
5
+ "radio-group": "awsui_radio-group_1mabk_1sbpk_10",
6
+ "horizontal-group": "awsui_horizontal-group_1mabk_1sbpk_41",
7
+ "radio": "awsui_radio_1mabk_1sbpk_10",
8
+ "horizontal": "awsui_horizontal_1mabk_1sbpk_41",
9
+ "radio--has-description": "awsui_radio--has-description_1mabk_1sbpk_55"
10
10
  };
11
11
 
@@ -1,7 +1,9 @@
1
1
  import { GroupedControlContextProps } from '../internal/context/control-group-context';
2
2
  import { SegmentedControlProps } from './interfaces';
3
+ import { StyleClassNames } from './internal';
3
4
  interface InternalSegmentedControlComponentProps extends SegmentedControlProps {
4
5
  groupedControlProps?: GroupedControlContextProps;
6
+ styleClassNames?: StyleClassNames;
5
7
  }
6
8
  export default function InternalSegmentedControl({
7
9
  selectedId,
@@ -10,6 +12,7 @@ export default function InternalSegmentedControl({
10
12
  ariaLabelledby,
11
13
  onChange,
12
14
  style,
13
- groupedControlProps
15
+ groupedControlProps,
16
+ styleClassNames
14
17
  }: InternalSegmentedControlComponentProps): JSX.Element;
15
18
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"internal-segmented-control.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/internal-segmented-control.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAMvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAMrD,UAAU,sCAAuC,SAAQ,qBAAqB;IAC5E,mBAAmB,CAAC,EAAE,0BAA0B,CAAC;CAClD;AAED,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,EACR,KAAK,EACL,mBAAmB,GACpB,EAAE,sCAAsC,eAwFxC"}
1
+ {"version":3,"file":"internal-segmented-control.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/internal-segmented-control.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAMvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAM7C,UAAU,sCAAuC,SAAQ,qBAAqB;IAC5E,mBAAmB,CAAC,EAAE,0BAA0B,CAAC;IACjD,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,EACR,KAAK,EACL,mBAAmB,EACnB,eAAe,GAChB,EAAE,sCAAsC,eA+FxC"}
@@ -10,7 +10,7 @@ import handleKey from '../internal/utils/handle-key';
10
10
  import { Segment } from './segment';
11
11
  import { getSegmentedControlRootStyles } from './style';
12
12
  import styles from './styles.css.js';
13
- export default function InternalSegmentedControl({ selectedId, options, label, ariaLabelledby, onChange, style, groupedControlProps, }) {
13
+ export default function InternalSegmentedControl({ selectedId, options, label, ariaLabelledby, onChange, style, groupedControlProps, styleClassNames, }) {
14
14
  const segmentByIdRef = useRef({});
15
15
  const selectedOptions = (options || []).filter(option => {
16
16
  return option.id === selectedId;
@@ -34,7 +34,7 @@ export default function InternalSegmentedControl({ selectedId, options, label, a
34
34
  const isGrouped = !!(groupedControlProps === null || groupedControlProps === void 0 ? void 0 : groupedControlProps.position);
35
35
  const isGroupedVertical = isGrouped && (groupedControlProps === null || groupedControlProps === void 0 ? void 0 : groupedControlProps.direction) === 'vertical';
36
36
  const groupedControlClassNames = isGrouped ? getGroupedControlClassNames(styles, groupedControlProps) : '';
37
- return (React.createElement("div", { className: clsx(styles['segment-part'], styles[`segment-count-${options === null || options === void 0 ? void 0 : options.length}`], groupedControlClassNames, {
37
+ return (React.createElement("div", { className: clsx(styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.root, styles['segment-part'], styles[`segment-count-${options === null || options === void 0 ? void 0 : options.length}`], groupedControlClassNames, {
38
38
  [styles.refresh]: isVisualRefresh,
39
39
  [styles['grouped-vertical']]: isGroupedVertical,
40
40
  }), "aria-label": label, "aria-labelledby": ariaLabelledby, role: "toolbar", style: getSegmentedControlRootStyles(style) }, options &&
@@ -59,7 +59,7 @@ export default function InternalSegmentedControl({ selectedId, options, label, a
59
59
  if (selectedId !== option.id) {
60
60
  fireNonCancelableEvent(onChange, { selectedId: option.id });
61
61
  }
62
- }, onKeyDown: event => moveHighlight(event, focusableSegmentIndex), style: style, fullWidth: isGroupedVertical }));
62
+ }, onKeyDown: event => moveHighlight(event, focusableSegmentIndex), style: style, fullWidth: isGroupedVertical, styleClassNames: styleClassNames }));
63
63
  })));
64
64
  }
65
65
  //# sourceMappingURL=internal-segmented-control.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal-segmented-control.js","sourceRoot":"","sources":["../../../src/segmented-control/internal-segmented-control.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,SAAS,MAAM,8BAA8B,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAMrC,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,EACR,KAAK,EACL,mBAAmB,GACoB;IACvC,MAAM,cAAc,GAAG,MAAM,CAAsC,EAAE,CAAC,CAAC;IACvE,MAAM,eAAe,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACtD,OAAO,MAAM,CAAC,EAAE,KAAK,UAAU,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,MAAM,qBAAqB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjF,MAAM,iBAAiB,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CA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MAAM,CAAC,IAAI,EACjB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,IAAI,CAAC,EAAE;oBACV,IAAI,IAAI,EAAE,CAAC;wBACT,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;oBAC3C,CAAC;yBAAM,CAAC;wBACN,OAAO,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBAC3C,CAAC;gBACH,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;oBACZ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;wBACpB,OAAO;oBACT,CAAC;oBAED,IAAI,UAAU,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC;wBAC7B,sBAAsB,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC9D,CAAC;gBACH,CAAC,EACD,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,qBAAqB,CAAC,EAC/D,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,iBAAiB,GAC5B,CACH,CAAC;QACJ,CAAC,CAAC,CACA,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { GroupedControlContextProps } from '../internal/context/control-group-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { getGroupedControlClassNames } from '../internal/grouped-control/grouped-control-styles';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport handleKey from '../internal/utils/handle-key';\nimport { SegmentedControlProps } from './interfaces';\nimport { Segment } from './segment';\nimport { getSegmentedControlRootStyles } from './style';\n\nimport styles from './styles.css.js';\n\ninterface InternalSegmentedControlComponentProps extends SegmentedControlProps {\n groupedControlProps?: GroupedControlContextProps;\n}\n\nexport default function InternalSegmentedControl({\n selectedId,\n options,\n label,\n ariaLabelledby,\n onChange,\n style,\n groupedControlProps,\n}: InternalSegmentedControlComponentProps) {\n const segmentByIdRef = useRef<{ [id: string]: HTMLButtonElement }>({});\n const selectedOptions = (options || []).filter(option => {\n return option.id === selectedId;\n });\n const currentSelectedOption = selectedOptions.length ? selectedOptions[0] : null;\n const focusableSegments = (options || []).filter(\n option => !option.disabled || (option.disabled && !!option.disabledReason)\n );\n\n const moveHighlight = (event: React.KeyboardEvent<HTMLButtonElement>, activeIndex: number) => {\n if (event.keyCode !== KeyCode.right && event.keyCode !== KeyCode.left) {\n return;\n }\n\n let nextIndex = activeIndex;\n\n handleKey(event, {\n onInlineStart: () => (nextIndex = activeIndex === 0 ? focusableSegments.length - 1 : activeIndex - 1),\n onInlineEnd: () => (nextIndex = activeIndex + 1 === focusableSegments.length ? 0 : activeIndex + 1),\n });\n\n const nextSegmentId = focusableSegments[nextIndex].id;\n segmentByIdRef.current[nextSegmentId]?.focus();\n };\n const isVisualRefresh = useVisualRefresh();\n\n const isGrouped = !!groupedControlProps?.position;\n const isGroupedVertical = isGrouped && groupedControlProps?.direction === 'vertical';\n\n const groupedControlClassNames = isGrouped ? getGroupedControlClassNames(styles, groupedControlProps) : '';\n\n return (\n <div\n className={clsx(styles['segment-part'], styles[`segment-count-${options?.length}`], groupedControlClassNames, {\n [styles.refresh]: isVisualRefresh,\n [styles['grouped-vertical']]: isGroupedVertical,\n })}\n aria-label={label}\n aria-labelledby={ariaLabelledby}\n role=\"toolbar\"\n style={getSegmentedControlRootStyles(style)}\n >\n {options &&\n options.map((option: SegmentedControlProps.Option, index) => {\n const isActive = selectedId === option.id;\n const focusableSegmentIndex = focusableSegments.indexOf(option);\n let tabIndex = isActive ? 0 : -1;\n if (currentSelectedOption === null && focusableSegmentIndex === 0) {\n tabIndex = 0;\n }\n return (\n <Segment\n key={index}\n id={option.id}\n disabled={!!option.disabled}\n disabledReason={option.disabledReason}\n iconName={option.iconName}\n iconAlt={option.iconAlt}\n iconUrl={option.iconUrl}\n iconSvg={option.iconSvg}\n text={option.text}\n isActive={isActive}\n tabIndex={tabIndex}\n ref={node => {\n if (node) {\n segmentByIdRef.current[option.id] = node;\n } else {\n delete segmentByIdRef.current[option.id];\n }\n }}\n onClick={() => {\n if (option.disabled) {\n return;\n }\n\n if (selectedId !== option.id) {\n fireNonCancelableEvent(onChange, { selectedId: option.id });\n }\n }}\n onKeyDown={event => moveHighlight(event, focusableSegmentIndex)}\n style={style}\n fullWidth={isGroupedVertical}\n />\n );\n })}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal-segmented-control.js","sourceRoot":"","sources":["../../../src/segmented-control/internal-segmented-control.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,SAAS,MAAM,8BAA8B,CAAC;AAGrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAOrC,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,EACR,KAAK,EACL,mBAAmB,EACnB,eAAe,GACwB;IACvC,MAAM,cAAc,GAAG,MAAM,CAAsC,EAAE,CAAC,CAAC;IACvE,MAAM,e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served.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { GroupedControlContextProps } from '../internal/context/control-group-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { getGroupedControlClassNames } from '../internal/grouped-control/grouped-control-styles';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport handleKey from '../internal/utils/handle-key';\nimport { SegmentedControlProps } from './interfaces';\nimport { StyleClassNames } from './internal';\nimport { Segment } from './segment';\nimport { getSegmentedControlRootStyles } from './style';\n\nimport styles from './styles.css.js';\n\ninterface InternalSegmentedControlComponentProps extends SegmentedControlProps {\n groupedControlProps?: GroupedControlContextProps;\n styleClassNames?: StyleClassNames;\n}\n\nexport default function InternalSegmentedControl({\n selectedId,\n options,\n label,\n ariaLabelledby,\n onChange,\n style,\n groupedControlProps,\n styleClassNames,\n}: InternalSegmentedControlComponentProps) {\n const segmentByIdRef = useRef<{ [id: string]: HTMLButtonElement }>({});\n const selectedOptions = (options || []).filter(option => {\n return option.id === selectedId;\n });\n const currentSelectedOption = selectedOptions.length ? selectedOptions[0] : null;\n const focusableSegments = (options || []).filter(\n option => !option.disabled || (option.disabled && !!option.disabledReason)\n );\n\n const moveHighlight = (event: React.KeyboardEvent<HTMLButtonElement>, activeIndex: number) => {\n if (event.keyCode !== KeyCode.right && event.keyCode !== KeyCode.left) {\n return;\n }\n\n let nextIndex = activeIndex;\n\n handleKey(event, {\n onInlineStart: () => (nextIndex = activeIndex === 0 ? focusableSegments.length - 1 : activeIndex - 1),\n onInlineEnd: () => (nextIndex = activeIndex + 1 === focusableSegments.length ? 0 : activeIndex + 1),\n });\n\n const nextSegmentId = focusableSegments[nextIndex].id;\n segmentByIdRef.current[nextSegmentId]?.focus();\n };\n const isVisualRefresh = useVisualRefresh();\n\n const isGrouped = !!groupedControlProps?.position;\n const isGroupedVertical = isGrouped && groupedControlProps?.direction === 'vertical';\n\n const groupedControlClassNames = isGrouped ? getGroupedControlClassNames(styles, groupedControlProps) : '';\n\n return (\n <div\n className={clsx(\n styleClassNames?.root,\n styles['segment-part'],\n styles[`segment-count-${options?.length}`],\n groupedControlClassNames,\n {\n [styles.refresh]: isVisualRefresh,\n [styles['grouped-vertical']]: isGroupedVertical,\n }\n )}\n aria-label={label}\n aria-labelledby={ariaLabelledby}\n role=\"toolbar\"\n style={getSegmentedControlRootStyles(style)}\n >\n {options &&\n options.map((option: SegmentedControlProps.Option, index) => {\n const isActive = selectedId === option.id;\n const focusableSegmentIndex = focusableSegments.indexOf(option);\n let tabIndex = isActive ? 0 : -1;\n if (currentSelectedOption === null && focusableSegmentIndex === 0) {\n tabIndex = 0;\n }\n return (\n <Segment\n key={index}\n id={option.id}\n disabled={!!option.disabled}\n disabledReason={option.disabledReason}\n iconName={option.iconName}\n iconAlt={option.iconAlt}\n iconUrl={option.iconUrl}\n iconSvg={option.iconSvg}\n text={option.text}\n isActive={isActive}\n tabIndex={tabIndex}\n ref={node => {\n if (node) {\n segmentByIdRef.current[option.id] = node;\n } else {\n delete segmentByIdRef.current[option.id];\n }\n }}\n onClick={() => {\n if (option.disabled) {\n return;\n }\n\n if (selectedId !== option.id) {\n fireNonCancelableEvent(onChange, { selectedId: option.id });\n }\n }}\n onKeyDown={event => moveHighlight(event, focusableSegmentIndex)}\n style={style}\n fullWidth={isGroupedVertical}\n styleClassNames={styleClassNames}\n />\n );\n })}\n </div>\n );\n}\n"]}
@@ -1,6 +1,15 @@
1
1
  import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
2
+ import { StyleClassNames as SelectStyleClassNames } from '../select/internal';
2
3
  import { SegmentedControlProps } from './interfaces';
3
- type InternalSegmentedControlProps = SegmentedControlProps & InternalBaseComponentProps;
4
+ type InternalSegmentedControlProps = SegmentedControlProps & InternalBaseComponentProps & {
5
+ styleClassNames?: StyleClassNames;
6
+ };
7
+ export interface StyleClassNames {
8
+ root?: string;
9
+ segment?: string;
10
+ divider?: string;
11
+ select?: SelectStyleClassNames;
12
+ }
4
13
  export default function InternalSegmentedControl({
5
14
  selectedId,
6
15
  options,
@@ -9,6 +18,7 @@ export default function InternalSegmentedControl({
9
18
  onChange,
10
19
  __internalRootRef,
11
20
  style,
21
+ styleClassNames,
12
22
  ...props
13
23
  }: InternalSegmentedControlProps): JSX.Element;
14
24
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/internal.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAKrD,KAAK,6BAA6B,GAAG,qBAAqB,GAAG,0BAA0B,CAAC;AAExF,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,EACR,iBAAiB,EACjB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,6BAA6B,eA2C/B"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/internal.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAuB,EAAuB,eAAe,IAAI,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACnH,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAKrD,KAAK,6BAA6B,GAAG,qBAAqB,GACxD,0BAA0B,GAAG;IAC3B,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAGJ,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAED,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,EACR,iBAAiB,EACjB,KAAK,EACL,eAAe,EACf,GAAG,KAAK,EACT,EAAE,6BAA6B,eA6C/B"}