@cloudscape-design/components 3.0.1081 → 3.0.1083

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 (61) hide show
  1. package/badge/index.d.ts.map +1 -1
  2. package/badge/internal-do-not-use-core.js +1 -1
  3. package/badge/internal-do-not-use-core.js.map +1 -1
  4. package/box/index.js +13 -20
  5. package/box/interfaces.d.ts +14 -0
  6. package/box/interfaces.d.ts.map +1 -1
  7. package/box/interfaces.js.map +1 -1
  8. package/box/internal-do-not-use-core.js +25 -0
  9. package/box/internal.d.ts +1 -0
  10. package/box/internal.d.ts.map +1 -1
  11. package/box/internal.js +3 -5
  12. package/box/internal.js.map +1 -1
  13. package/button/internal.d.ts.map +1 -1
  14. package/button/internal.js +3 -3
  15. package/button/internal.js.map +1 -1
  16. package/button-dropdown/utils/create-items-tree.d.ts +1 -1
  17. package/button-dropdown/utils/create-items-tree.d.ts.map +1 -1
  18. package/button-dropdown/utils/create-items-tree.js +11 -2
  19. package/button-dropdown/utils/create-items-tree.js.map +1 -1
  20. package/button-dropdown/utils/use-button-dropdown.d.ts.map +1 -1
  21. package/button-dropdown/utils/use-button-dropdown.js +14 -7
  22. package/button-dropdown/utils/use-button-dropdown.js.map +1 -1
  23. package/button-dropdown/utils/use-highlighted-menu.d.ts +1 -1
  24. package/button-dropdown/utils/use-highlighted-menu.d.ts.map +1 -1
  25. package/button-dropdown/utils/use-highlighted-menu.js +2 -2
  26. package/button-dropdown/utils/use-highlighted-menu.js.map +1 -1
  27. package/checkbox/internal.d.ts.map +1 -1
  28. package/checkbox/internal.js +1 -1
  29. package/checkbox/internal.js.map +1 -1
  30. package/icon/internal.d.ts.map +1 -1
  31. package/icon/internal.js +3 -3
  32. package/icon/internal.js.map +1 -1
  33. package/internal/base-component/styles.scoped.css +1 -2
  34. package/internal/components/option/index.js +1 -1
  35. package/internal/components/option/index.js.map +1 -1
  36. package/internal/components/option/option-parts.js +1 -1
  37. package/internal/components/option/option-parts.js.map +1 -1
  38. package/internal/components/option/styles.css.js +16 -17
  39. package/internal/components/option/styles.scoped.css +28 -32
  40. package/internal/components/option/styles.selectors.js +16 -17
  41. package/internal/environment.js +2 -2
  42. package/internal/environment.json +2 -2
  43. package/internal/manifest.json +1 -1
  44. package/internal/utils/with-native-attributes.d.ts +1 -0
  45. package/internal/utils/with-native-attributes.d.ts.map +1 -1
  46. package/internal/utils/with-native-attributes.js +2 -2
  47. package/internal/utils/with-native-attributes.js.map +1 -1
  48. package/package.json +1 -1
  49. package/space-between/index.js +13 -12
  50. package/space-between/interfaces.d.ts +14 -0
  51. package/space-between/interfaces.d.ts.map +1 -1
  52. package/space-between/interfaces.js.map +1 -1
  53. package/space-between/internal-do-not-use-core.js +17 -0
  54. package/space-between/internal.d.ts.map +1 -1
  55. package/space-between/internal.js +3 -2
  56. package/space-between/internal.js.map +1 -1
  57. package/spinner/internal.d.ts.map +1 -1
  58. package/spinner/internal.js +1 -1
  59. package/spinner/internal.js.map +1 -1
  60. /package/box/{index.js.map → internal-do-not-use-core.js.map} +0 -0
  61. /package/space-between/{index.js.map → internal-do-not-use-core.js.map} +0 -0
@@ -23,9 +23,9 @@ export default function useHighlightedMenu({ items, hasExpandableGroups, isInRes
23
23
  const index = getItemIndex(group);
24
24
  return indexIncludes(index, expandedIndex);
25
25
  }, [expandedIndex, getItemIndex]);
26
- const moveHighlight = useCallback((direction) => {
26
+ const moveHighlight = useCallback((direction, loop) => {
27
27
  const getNext = (index) => {
28
- const nextIndex = getSequentialIndex(index, direction);
28
+ const nextIndex = getSequentialIndex(index, direction, loop);
29
29
  const item = getItem(nextIndex || [-1]);
30
30
  if (!nextIndex || !item) {
31
31
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"use-highlighted-menu.js","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/use-highlighted-menu.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,OAAO,EAA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Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useCallback, useMemo, useState } from 'react';\n\nimport { ButtonDropdownProps, HighlightProps } from '../interfaces';\nimport createItemsTree, { TreeIndex } from './create-items-tree';\nimport moveHighlightOneStep from './move-highlight';\nimport { indexEquals, indexIncludes } from './utils';\n\ninterface UseHighlightedMenuOptions {\n items: ButtonDropdownProps.Items;\n hasExpandableGroups: boolean;\n isInRestrictedView?: boolean;\n}\n\ninterface UseHighlightedMenuApi extends HighlightProps {\n moveHighlight: (direction: -1 | 1) => void;\n expandGroup: (group?: ButtonDropdownProps.ItemGroup) => void;\n collapseGroup: () => void;\n reset: () => void;\n setIsUsingMouse: (isUsingMouse: boolean) => void;\n}\n\nexport default function useHighlightedMenu({\n items,\n hasExpandableGroups,\n isInRestrictedView = false,\n}: UseHighlightedMenuOptions): UseHighlightedMenuApi {\n const [targetIndex, setTargetIndex] = useState<TreeIndex>([]);\n const [expandedIndex, setExpandedIndex] = useState<TreeIndex>([]);\n const [isUsingMouse, setIsUsingMouse] = useState<boolean>(true);\n\n const { getItem, getItemIndex, getSequentialIndex, getParentIndex } = useMemo(() => createItemsTree(items), [items]);\n\n const targetItem = useMemo(() => getItem(targetIndex), [targetIndex, getItem]);\n\n const isHighlighted = useCallback(\n (item: ButtonDropdownProps.ItemOrGroup) => {\n const index = getItemIndex(item);\n return indexIncludes(index, targetIndex);\n },\n [targetIndex, getItemIndex]\n );\n\n // check if keyboard focus is on the element\n const isKeyboardHighlight = useCallback(\n (item: ButtonDropdownProps.ItemOrGroup) => {\n const index = getItemIndex(item);\n return !isUsingMouse && indexEquals(index, targetIndex);\n },\n [targetIndex, getItemIndex, isUsingMouse]\n );\n\n const isExpanded = useCallback(\n (group: ButtonDropdownProps.ItemGroup) => {\n const index = getItemIndex(group);\n\n return indexIncludes(index, expandedIndex);\n },\n [expandedIndex, getItemIndex]\n );\n\n const moveHighlight = useCallback(\n (direction: -1 | 1) => {\n const getNext = (index: TreeIndex) => {\n const nextIndex = getSequentialIndex(index, direction);\n const item = getItem(nextIndex || [-1]);\n\n if (!nextIndex || !item) {\n return null;\n }\n\n const parentIndex = getParentIndex(item);\n const parentItem = parentIndex && getItem(parentIndex);\n\n return { index: nextIndex, item, parent: parentItem || undefined };\n };\n\n const nextIndex = moveHighlightOneStep({\n startIndex: targetIndex,\n expandedIndex,\n getNext,\n hasExpandableGroups,\n isInRestrictedView,\n });\n\n if (nextIndex) {\n setTargetIndex(nextIndex);\n }\n },\n [targetIndex, expandedIndex, getItem, getSequentialIndex, getParentIndex, hasExpandableGroups, isInRestrictedView]\n );\n\n const highlightItem = useCallback(\n (item: ButtonDropdownProps.ItemOrGroup) => {\n setTargetIndex(getItemIndex(item));\n },\n [getItemIndex]\n );\n\n const expandGroup = useCallback(\n (group?: ButtonDropdownProps.ItemGroup) => {\n const groupIndex = group ? getItemIndex(group) : targetIndex;\n const firstChildIndex = [...groupIndex, 0];\n\n // move to the first child item unless in restricted mode\n setTargetIndex(isInRestrictedView ? groupIndex : firstChildIndex);\n setExpandedIndex(groupIndex);\n },\n [targetIndex, getItemIndex, isInRestrictedView]\n );\n\n const collapseGroup = useCallback(() => {\n if (expandedIndex.length > 0) {\n setTargetIndex(expandedIndex);\n setExpandedIndex(expandedIndex.slice(0, -1));\n }\n }, [expandedIndex]);\n\n const reset = useCallback(() => {\n setTargetIndex([]);\n setExpandedIndex([]);\n }, []);\n\n return {\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n moveHighlight,\n highlightItem,\n expandGroup,\n collapseGroup,\n reset,\n setIsUsingMouse,\n };\n}\n"]}
1
+ {"version":3,"file":"use-highlighted-menu.js","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/use-highlighted-menu.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,eAA8B,MAAM,qBAAqB,CAAC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AE,EAAE;QACxC,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACrC,CAAC,EACD,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,KAAqC,EAAE,EAAE;QACxC,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;QAC7D,MAAM,eAAe,GAAG,CAAC,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC;QAE3C,yDAAyD;QACzD,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QAClE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAC/B,CAAC,EACD,CAAC,WAAW,EAAE,YAAY,EAAE,kBAAkB,CAAC,CAChD,CAAC;IAEF,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE;QACrC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,cAAc,CAAC,aAAa,CAAC,CAAC;YAC9B,gBAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9C;IACH,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7B,cAAc,CAAC,EAAE,CAAC,CAAC;QACnB,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,UAAU;QACV,aAAa;QACb,mBAAmB;QACnB,UAAU;QACV,aAAa;QACb,aAAa;QACb,WAAW;QACX,aAAa;QACb,KAAK;QACL,eAAe;KAChB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useCallback, useMemo, useState } from 'react';\n\nimport { ButtonDropdownProps, HighlightProps } from '../interfaces';\nimport createItemsTree, { TreeIndex } from './create-items-tree';\nimport moveHighlightOneStep from './move-highlight';\nimport { indexEquals, indexIncludes } from './utils';\n\ninterface UseHighlightedMenuOptions {\n items: ButtonDropdownProps.Items;\n hasExpandableGroups: boolean;\n isInRestrictedView?: boolean;\n}\n\ninterface UseHighlightedMenuApi extends HighlightProps {\n moveHighlight: (direction: -1 | 1, loop?: boolean) => void;\n expandGroup: (group?: ButtonDropdownProps.ItemGroup) => void;\n collapseGroup: () => void;\n reset: () => void;\n setIsUsingMouse: (isUsingMouse: boolean) => void;\n}\n\nexport default function useHighlightedMenu({\n items,\n hasExpandableGroups,\n isInRestrictedView = false,\n}: UseHighlightedMenuOptions): UseHighlightedMenuApi {\n const [targetIndex, setTargetIndex] = useState<TreeIndex>([]);\n const [expandedIndex, setExpandedIndex] = useState<TreeIndex>([]);\n const [isUsingMouse, setIsUsingMouse] = useState<boolean>(true);\n\n const { getItem, getItemIndex, getSequentialIndex, getParentIndex } = useMemo(() => createItemsTree(items), [items]);\n\n const targetItem = useMemo(() => getItem(targetIndex), [targetIndex, getItem]);\n\n const isHighlighted = useCallback(\n (item: ButtonDropdownProps.ItemOrGroup) => {\n const index = getItemIndex(item);\n return indexIncludes(index, targetIndex);\n },\n [targetIndex, getItemIndex]\n );\n\n // check if keyboard focus is on the element\n const isKeyboardHighlight = useCallback(\n (item: ButtonDropdownProps.ItemOrGroup) => {\n const index = getItemIndex(item);\n return !isUsingMouse && indexEquals(index, targetIndex);\n },\n [targetIndex, getItemIndex, isUsingMouse]\n );\n\n const isExpanded = useCallback(\n (group: ButtonDropdownProps.ItemGroup) => {\n const index = getItemIndex(group);\n\n return indexIncludes(index, expandedIndex);\n },\n [expandedIndex, getItemIndex]\n );\n\n const moveHighlight = useCallback(\n (direction: -1 | 1, loop?: boolean) => {\n const getNext = (index: TreeIndex) => {\n const nextIndex = getSequentialIndex(index, direction, loop);\n const item = getItem(nextIndex || [-1]);\n\n if (!nextIndex || !item) {\n return null;\n }\n\n const parentIndex = getParentIndex(item);\n const parentItem = parentIndex && getItem(parentIndex);\n\n return { index: nextIndex, item, parent: parentItem || undefined };\n };\n\n const nextIndex = moveHighlightOneStep({\n startIndex: targetIndex,\n expandedIndex,\n getNext,\n hasExpandableGroups,\n isInRestrictedView,\n });\n\n if (nextIndex) {\n setTargetIndex(nextIndex);\n }\n },\n [targetIndex, expandedIndex, getItem, getSequentialIndex, getParentIndex, hasExpandableGroups, isInRestrictedView]\n );\n\n const highlightItem = useCallback(\n (item: ButtonDropdownProps.ItemOrGroup) => {\n setTargetIndex(getItemIndex(item));\n },\n [getItemIndex]\n );\n\n const expandGroup = useCallback(\n (group?: ButtonDropdownProps.ItemGroup) => {\n const groupIndex = group ? getItemIndex(group) : targetIndex;\n const firstChildIndex = [...groupIndex, 0];\n\n // move to the first child item unless in restricted mode\n setTargetIndex(isInRestrictedView ? groupIndex : firstChildIndex);\n setExpandedIndex(groupIndex);\n },\n [targetIndex, getItemIndex, isInRestrictedView]\n );\n\n const collapseGroup = useCallback(() => {\n if (expandedIndex.length > 0) {\n setTargetIndex(expandedIndex);\n setExpandedIndex(expandedIndex.slice(0, -1));\n }\n }, [expandedIndex]);\n\n const reset = useCallback(() => {\n setTargetIndex([]);\n setExpandedIndex([]);\n }, []);\n\n return {\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n moveHighlight,\n highlightItem,\n expandGroup,\n collapseGroup,\n reset,\n setIsUsingMouse,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/checkbox/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAejD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAK7C,UAAU,aAAc,SAAQ,aAAa,EAAE,0BAA0B;IACvE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED,QAAA,MAAM,gBAAgB,yFAgHrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/checkbox/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAejD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAK7C,UAAU,aAAc,SAAQ,aAAa,EAAE,0BAA0B;IACvE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED,QAAA,MAAM,gBAAgB,yFAiHrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -40,7 +40,7 @@ const InternalCheckbox = React.forwardRef((_a, ref) => {
40
40
  if (!disabled && !readOnly) {
41
41
  analyticsMetadata.action = !checked ? 'select' : 'deselect';
42
42
  }
43
- return (React.createElement(AbstractSwitch, Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className), controlClassName: styles['checkbox-control'], outlineClassName: styles.outline, controlId: controlId, disabled: disabled, readOnly: readOnly, label: children, description: description, descriptionBottomPadding: true, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, ariaControls: ariaControls, showOutline: showOutline, nativeControl: nativeControlProps => (React.createElement(WithNativeAttributes, Object.assign({}, nativeControlProps, { tag: "input", nativeAttributes: nativeInputAttributes, ref: checkboxRef, type: "checkbox", checked: checked, name: name, "aria-required": ariaRequired ? 'true' : undefined, "aria-disabled": readOnly && !disabled ? 'true' : undefined, tabIndex: tabIndex, onFocus: () => fireNonCancelableEvent(onFocus), onBlur: () => fireNonCancelableEvent(onBlur),
43
+ return (React.createElement(AbstractSwitch, Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className), controlClassName: styles['checkbox-control'], outlineClassName: styles.outline, controlId: controlId, disabled: disabled, readOnly: readOnly, label: children, description: description, descriptionBottomPadding: true, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, ariaControls: ariaControls, showOutline: showOutline, nativeControl: nativeControlProps => (React.createElement(WithNativeAttributes, Object.assign({}, nativeControlProps, { tag: "input", componentName: "Checkbox", nativeAttributes: nativeInputAttributes, ref: checkboxRef, type: "checkbox", checked: checked, name: name, "aria-required": ariaRequired ? 'true' : undefined, "aria-disabled": readOnly && !disabled ? 'true' : undefined, tabIndex: tabIndex, onFocus: () => fireNonCancelableEvent(onFocus), onBlur: () => fireNonCancelableEvent(onBlur),
44
44
  // empty handler to suppress React controllability warning
45
45
  onChange: () => { } }))), onClick: () => {
46
46
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/checkbox/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAEL,6BAA6B,GAC9B,MAAM,kEAAkE,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC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AC,EAC9C,MAAM,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,MAAM,CAAC;YAC5C,0DAA0D;YAC1D,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,IAClB,CACH,EACD,OAAO,EAAE,GAAG,EAAE;;YACZ,MAAA,WAAW,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;YAC7B,sBAAsB,CACpB,QAAQ;YACR,4EAA4E;YAC5E,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CACtG,CAAC;QACJ,CAAC,EACD,aAAa,EACX,oBAAC,YAAY,IACX,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,GAC/E,EAEJ,KAAK,EAAE,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,EACjF,iBAAiB,EAAE,iBAAiB,IAChC,6BAA6B,CAAC,iBAAiB,CAAC,EACpD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useSingleTabStopNavigation } from '@cloudscape-design/component-toolkit/internal';\nimport {\n GeneratedAnalyticsMetadataFragment,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport CheckboxIcon from '../internal/components/checkbox-icon';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { GeneratedAnalyticsMetadataCheckboxComponent } from './analytics-metadata/interfaces';\nimport { CheckboxProps } from './interfaces';\nimport { getAbstractSwitchStyles, getCheckboxIconStyles } from './style';\n\nimport styles from './styles.css.js';\n\ninterface InternalProps extends CheckboxProps, InternalBaseComponentProps {\n tabIndex?: -1;\n showOutline?: boolean;\n __injectAnalyticsComponentMetadata?: boolean;\n}\n\nconst InternalCheckbox = React.forwardRef<CheckboxProps.Ref, InternalProps>(\n (\n {\n controlId,\n name,\n checked,\n disabled,\n readOnly,\n ariaRequired,\n indeterminate,\n children,\n description,\n ariaLabel,\n onFocus,\n onBlur,\n onChange,\n tabIndex: explicitTabIndex,\n showOutline,\n ariaControls,\n style,\n nativeInputAttributes,\n __internalRootRef,\n __injectAnalyticsComponentMetadata = false,\n ...rest\n },\n ref\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n const checkboxRef = useRef<HTMLInputElement>(null);\n useForwardFocus(ref, checkboxRef);\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = Boolean(indeterminate);\n }\n });\n\n const { tabIndex } = useSingleTabStopNavigation(checkboxRef, { tabIndex: explicitTabIndex });\n\n const analyticsMetadata: GeneratedAnalyticsMetadataFragment = {};\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataCheckboxComponent = {\n name: 'awsui.Checkbox',\n label: { root: 'self' },\n properties: {\n checked: `${!!checked}`,\n },\n };\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = analyticsComponentMetadata;\n }\n if (!disabled && !readOnly) {\n analyticsMetadata.action = !checked ? 'select' : 'deselect';\n }\n\n return (\n <AbstractSwitch\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n controlClassName={styles['checkbox-control']}\n outlineClassName={styles.outline}\n controlId={controlId}\n disabled={disabled}\n readOnly={readOnly}\n label={children}\n description={description}\n descriptionBottomPadding={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaControls={ariaControls}\n showOutline={showOutline}\n nativeControl={nativeControlProps => (\n <WithNativeAttributes<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>\n {...nativeControlProps}\n tag=\"input\"\n nativeAttributes={nativeInputAttributes}\n ref={checkboxRef}\n type=\"checkbox\"\n checked={checked}\n name={name}\n aria-required={ariaRequired ? 'true' : undefined}\n aria-disabled={readOnly && !disabled ? 'true' : undefined}\n tabIndex={tabIndex}\n onFocus={() => fireNonCancelableEvent(onFocus)}\n onBlur={() => fireNonCancelableEvent(onBlur)}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n checkboxRef.current?.focus();\n fireNonCancelableEvent(\n onChange,\n // for deterministic transitions \"indeterminate\" -> \"checked\" -> \"unchecked\"\n indeterminate ? { checked: true, indeterminate: false } : { checked: !checked, indeterminate: false }\n );\n }}\n styledControl={\n <CheckboxIcon\n checked={checked}\n indeterminate={indeterminate}\n disabled={disabled}\n readOnly={readOnly}\n style={getCheckboxIconStyles(style, checked, disabled, readOnly, indeterminate)}\n />\n }\n style={getAbstractSwitchStyles(style, checked, disabled, readOnly, indeterminate)}\n __internalRootRef={__internalRootRef}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n />\n );\n }\n);\n\nexport default InternalCheckbox;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/checkbox/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAA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AiB,EAAE,iBAAiB,IAChC,6BAA6B,CAAC,iBAAiB,CAAC,EACpD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useSingleTabStopNavigation } from '@cloudscape-design/component-toolkit/internal';\nimport {\n GeneratedAnalyticsMetadataFragment,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport CheckboxIcon from '../internal/components/checkbox-icon';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { GeneratedAnalyticsMetadataCheckboxComponent } from './analytics-metadata/interfaces';\nimport { CheckboxProps } from './interfaces';\nimport { getAbstractSwitchStyles, getCheckboxIconStyles } from './style';\n\nimport styles from './styles.css.js';\n\ninterface InternalProps extends CheckboxProps, InternalBaseComponentProps {\n tabIndex?: -1;\n showOutline?: boolean;\n __injectAnalyticsComponentMetadata?: boolean;\n}\n\nconst InternalCheckbox = React.forwardRef<CheckboxProps.Ref, InternalProps>(\n (\n {\n controlId,\n name,\n checked,\n disabled,\n readOnly,\n ariaRequired,\n indeterminate,\n children,\n description,\n ariaLabel,\n onFocus,\n onBlur,\n onChange,\n tabIndex: explicitTabIndex,\n showOutline,\n ariaControls,\n style,\n nativeInputAttributes,\n __internalRootRef,\n __injectAnalyticsComponentMetadata = false,\n ...rest\n },\n ref\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n const checkboxRef = useRef<HTMLInputElement>(null);\n useForwardFocus(ref, checkboxRef);\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = Boolean(indeterminate);\n }\n });\n\n const { tabIndex } = useSingleTabStopNavigation(checkboxRef, { tabIndex: explicitTabIndex });\n\n const analyticsMetadata: GeneratedAnalyticsMetadataFragment = {};\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataCheckboxComponent = {\n name: 'awsui.Checkbox',\n label: { root: 'self' },\n properties: {\n checked: `${!!checked}`,\n },\n };\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = analyticsComponentMetadata;\n }\n if (!disabled && !readOnly) {\n analyticsMetadata.action = !checked ? 'select' : 'deselect';\n }\n\n return (\n <AbstractSwitch\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n controlClassName={styles['checkbox-control']}\n outlineClassName={styles.outline}\n controlId={controlId}\n disabled={disabled}\n readOnly={readOnly}\n label={children}\n description={description}\n descriptionBottomPadding={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaControls={ariaControls}\n showOutline={showOutline}\n nativeControl={nativeControlProps => (\n <WithNativeAttributes<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>\n {...nativeControlProps}\n tag=\"input\"\n componentName=\"Checkbox\"\n nativeAttributes={nativeInputAttributes}\n ref={checkboxRef}\n type=\"checkbox\"\n checked={checked}\n name={name}\n aria-required={ariaRequired ? 'true' : undefined}\n aria-disabled={readOnly && !disabled ? 'true' : undefined}\n tabIndex={tabIndex}\n onFocus={() => fireNonCancelableEvent(onFocus)}\n onBlur={() => fireNonCancelableEvent(onBlur)}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n checkboxRef.current?.focus();\n fireNonCancelableEvent(\n onChange,\n // for deterministic transitions \"indeterminate\" -> \"checked\" -> \"unchecked\"\n indeterminate ? { checked: true, indeterminate: false } : { checked: !checked, indeterminate: false }\n );\n }}\n styledControl={\n <CheckboxIcon\n checked={checked}\n indeterminate={indeterminate}\n disabled={disabled}\n readOnly={readOnly}\n style={getCheckboxIconStyles(style, checked, disabled, readOnly, indeterminate)}\n />\n }\n style={getAbstractSwitchStyles(style, checked, disabled, readOnly, indeterminate)}\n __internalRootRef={__internalRootRef}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n />\n );\n }\n);\n\nexport default InternalCheckbox;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/icon/internal.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,KAAK,iBAAiB,GAAG,SAAS,GAChC,0BAA0B,GAAG;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAqBJ,QAAA,MAAM,YAAY,4GAYf,iBAAiB,gBA+GnB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/icon/internal.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,KAAK,iBAAiB,GAAG,SAAS,GAChC,0BAA0B,GAAG;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAqBJ,QAAA,MAAM,YAAY,4GAYf,iBAAiB,gBAkHnB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,eAAe,YAAY,CAAC"}
package/icon/internal.js CHANGED
@@ -60,10 +60,10 @@ const InternalIcon = (_a) => {
60
60
  if (url) {
61
61
  warnOnce('Icon', 'You have specified both `url` and `svg`. `svg` will take precedence and `url` will be ignored.');
62
62
  }
63
- return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, labelAttributes, { tag: "span", nativeAttributes: nativeAttributes, ref: mergedRef, "aria-hidden": !hasAriaLabel, style: inlineStyles }), svg));
63
+ return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, labelAttributes, { tag: "span", componentName: "Icon", nativeAttributes: nativeAttributes, ref: mergedRef, "aria-hidden": !hasAriaLabel, style: inlineStyles }), svg));
64
64
  }
65
65
  if (url) {
66
- return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, { tag: "span", nativeAttributes: nativeAttributes, ref: mergedRef, style: inlineStyles }),
66
+ return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, { tag: "span", componentName: "Icon", nativeAttributes: nativeAttributes, ref: mergedRef, style: inlineStyles }),
67
67
  React.createElement("img", { src: url, alt: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : alt })));
68
68
  }
69
69
  const validIcon = name && Object.prototype.hasOwnProperty.call(icons, name);
@@ -76,7 +76,7 @@ const InternalIcon = (_a) => {
76
76
  return icons[name];
77
77
  }
78
78
  }
79
- return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, labelAttributes, { tag: "span", nativeAttributes: nativeAttributes, ref: mergedRef, style: inlineStyles }), validIcon ? iconMap(name) : undefined));
79
+ return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, labelAttributes, { tag: "span", componentName: "Icon", nativeAttributes: nativeAttributes, ref: mergedRef, style: inlineStyles }), validIcon ? iconMap(name) : undefined));
80
80
  };
81
81
  export default InternalIcon;
82
82
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/icon/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,IAAI,MAA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oBAAoB,oBACf,SAAS,EACT,eAAe,IACnB,GAAG,EAAC,MAAM,EACV,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,YAAY,KAElB,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CACjB,CACxB,CAAC;AACJ,CAAC,CAAC;AAGF,eAAe,YAAY,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalIconContext } from '../icon-provider/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { IconProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype InternalIconProps = IconProps &\n InternalBaseComponentProps & {\n badge?: boolean;\n };\n\nfunction iconSizeMap(height: number | null) {\n if (height === null) {\n // This is the best guess for the contextual height while server rendering.\n return 'normal';\n }\n\n if (height >= 50) {\n return 'large';\n } else if (height >= 36) {\n return 'big';\n } else if (height >= 24) {\n return 'medium';\n } else if (height <= 16) {\n return 'small';\n } else {\n return 'normal';\n }\n}\n\nconst InternalIcon = ({\n name,\n size = 'normal',\n variant = 'normal',\n url,\n alt,\n ariaLabel,\n svg,\n badge,\n nativeAttributes,\n __internalRootRef,\n ...props\n}: InternalIconProps) => {\n const icons = useContext(InternalIconContext);\n const iconRef = useRef<HTMLElement>(null);\n // To ensure a re-render is triggered on visual mode changes\n useVisualRefresh();\n const [parentHeight, setParentHeight] = useState<number | null>(null);\n const contextualSize = size === 'inherit';\n const iconSize = contextualSize ? iconSizeMap(parentHeight) : size;\n const inlineStyles = contextualSize && parentHeight !== null ? { height: `${parentHeight}px` } : {};\n const baseProps = getBaseProps(props);\n\n baseProps.className = clsx(\n baseProps.className,\n styles.icon,\n contextualSize && styles['icon-flex-height'],\n badge && styles.badge,\n !contextualSize && styles[`size-${iconSize}-mapped-height`],\n styles[`size-${iconSize}`],\n styles[`variant-${variant}`],\n styles[`name-${name}`]\n );\n\n // Possible infinite loop is not a concern here because line\n // height should not change without an external state update.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (!contextualSize || !iconRef.current) {\n return;\n }\n const { lineHeight } = getComputedStyle(iconRef.current);\n const newParentHeight = parseInt(lineHeight, 10);\n setParentHeight(newParentHeight);\n });\n\n const mergedRef = useMergeRefs(iconRef, __internalRootRef);\n const hasAriaLabel = typeof ariaLabel === 'string';\n const labelAttributes = hasAriaLabel ? { role: 'img', 'aria-label': ariaLabel } : {};\n\n if (svg) {\n if (url) {\n warnOnce(\n 'Icon',\n 'You have specified both `url` and `svg`. `svg` will take precedence and `url` will be ignored.'\n );\n }\n return (\n <WithNativeAttributes\n {...baseProps}\n {...labelAttributes}\n tag=\"span\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n aria-hidden={!hasAriaLabel}\n style={inlineStyles}\n >\n {svg}\n </WithNativeAttributes>\n );\n }\n\n if (url) {\n return (\n <WithNativeAttributes\n {...baseProps}\n tag=\"span\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n style={inlineStyles}\n >\n <img src={url} alt={ariaLabel ?? alt} />\n </WithNativeAttributes>\n );\n }\n\n const validIcon = name && Object.prototype.hasOwnProperty.call(icons, name);\n\n function iconMap(name: IconProps.Name) {\n if (name === 'gen-ai' && iconSize === 'small') {\n return (\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 16 16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n aria-hidden=\"true\"\n data-testid=\"gen-ai-filled\"\n >\n <path\n d=\"m8 4.4 1.018 2.582L11.6 8 9.018 9.018 8 11.6 6.982 9.018 4.4 8l2.582-1.018L8 4.4ZM2.405 2.41l.002-.003.003-.002-.003-.002-.002-.003-.002.003-.003.002.003.002.002.003Z\"\n className=\"filled\"\n />\n </svg>\n );\n } else {\n return icons[name];\n }\n }\n\n return (\n <WithNativeAttributes\n {...baseProps}\n {...labelAttributes}\n tag=\"span\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n style={inlineStyles}\n >\n {validIcon ? iconMap(name) : undefined}\n </WithNativeAttributes>\n );\n};\n\nexport { InternalIconProps };\nexport default InternalIcon;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/icon/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAG5E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAOrC,SAAS,WAAW,CAAC,MAAqB;IACxC,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,2EAA2E;QAC3E,OAAO,QAAQ,CAAC;KACjB;IAED,IAAI,MAAM,IAAI,EAAE,EAAE;QAChB,OAAO,OAAO,CAAC;KAChB;SAAM,IAAI,MAAM,IAAI,EAAE,EAAE;QACvB,OAAO,KAAK,CAAC;KACd;SAAM,IAAI,MAAM,IAAI,EAAE,EAAE;QACvB,OAAO,QAAQ,CAAC;KACjB;SAAM,IA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GAAG,EAAE,GAAG,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,GAAG,GAAI,CACnB,CACxB,CAAC;KACH;IAED,MAAM,SAAS,GAAG,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAE5E,SAAS,OAAO,CAAC,IAAoB;QACnC,IAAI,IAAI,KAAK,QAAQ,IAAI,QAAQ,KAAK,OAAO,EAAE;YAC7C,OAAO,CACL,6BACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,4BAA4B,EAClC,SAAS,EAAC,OAAO,iBACL,MAAM,iBACN,eAAe;gBAE3B,8BACE,CAAC,EAAC,wKAAwK,EAC1K,SAAS,EAAC,QAAQ,GAClB,CACE,CACP,CAAC;SACH;aAAM;YACL,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;SACpB;IACH,CAAC;IAED,OAAO,CACL,oBAAC,oBAAoB,oBACf,SAAS,EACT,eAAe,IACnB,GAAG,EAAC,MAAM,EACV,aAAa,EAAC,MAAM,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,YAAY,KAElB,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CACjB,CACxB,CAAC;AACJ,CAAC,CAAC;AAGF,eAAe,YAAY,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalIconContext } from '../icon-provider/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { IconProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype InternalIconProps = IconProps &\n InternalBaseComponentProps & {\n badge?: boolean;\n };\n\nfunction iconSizeMap(height: number | null) {\n if (height === null) {\n // This is the best guess for the contextual height while server rendering.\n return 'normal';\n }\n\n if (height >= 50) {\n return 'large';\n } else if (height >= 36) {\n return 'big';\n } else if (height >= 24) {\n return 'medium';\n } else if (height <= 16) {\n return 'small';\n } else {\n return 'normal';\n }\n}\n\nconst InternalIcon = ({\n name,\n size = 'normal',\n variant = 'normal',\n url,\n alt,\n ariaLabel,\n svg,\n badge,\n nativeAttributes,\n __internalRootRef,\n ...props\n}: InternalIconProps) => {\n const icons = useContext(InternalIconContext);\n const iconRef = useRef<HTMLElement>(null);\n // To ensure a re-render is triggered on visual mode changes\n useVisualRefresh();\n const [parentHeight, setParentHeight] = useState<number | null>(null);\n const contextualSize = size === 'inherit';\n const iconSize = contextualSize ? iconSizeMap(parentHeight) : size;\n const inlineStyles = contextualSize && parentHeight !== null ? { height: `${parentHeight}px` } : {};\n const baseProps = getBaseProps(props);\n\n baseProps.className = clsx(\n baseProps.className,\n styles.icon,\n contextualSize && styles['icon-flex-height'],\n badge && styles.badge,\n !contextualSize && styles[`size-${iconSize}-mapped-height`],\n styles[`size-${iconSize}`],\n styles[`variant-${variant}`],\n styles[`name-${name}`]\n );\n\n // Possible infinite loop is not a concern here because line\n // height should not change without an external state update.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (!contextualSize || !iconRef.current) {\n return;\n }\n const { lineHeight } = getComputedStyle(iconRef.current);\n const newParentHeight = parseInt(lineHeight, 10);\n setParentHeight(newParentHeight);\n });\n\n const mergedRef = useMergeRefs(iconRef, __internalRootRef);\n const hasAriaLabel = typeof ariaLabel === 'string';\n const labelAttributes = hasAriaLabel ? { role: 'img', 'aria-label': ariaLabel } : {};\n\n if (svg) {\n if (url) {\n warnOnce(\n 'Icon',\n 'You have specified both `url` and `svg`. `svg` will take precedence and `url` will be ignored.'\n );\n }\n return (\n <WithNativeAttributes\n {...baseProps}\n {...labelAttributes}\n tag=\"span\"\n componentName=\"Icon\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n aria-hidden={!hasAriaLabel}\n style={inlineStyles}\n >\n {svg}\n </WithNativeAttributes>\n );\n }\n\n if (url) {\n return (\n <WithNativeAttributes\n {...baseProps}\n tag=\"span\"\n componentName=\"Icon\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n style={inlineStyles}\n >\n <img src={url} alt={ariaLabel ?? alt} />\n </WithNativeAttributes>\n );\n }\n\n const validIcon = name && Object.prototype.hasOwnProperty.call(icons, name);\n\n function iconMap(name: IconProps.Name) {\n if (name === 'gen-ai' && iconSize === 'small') {\n return (\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 16 16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n aria-hidden=\"true\"\n data-testid=\"gen-ai-filled\"\n >\n <path\n d=\"m8 4.4 1.018 2.582L11.6 8 9.018 9.018 8 11.6 6.982 9.018 4.4 8l2.582-1.018L8 4.4ZM2.405 2.41l.002-.003.003-.002-.003-.002-.002-.003-.002.003-.003.002.003.002.002.003Z\"\n className=\"filled\"\n />\n </svg>\n );\n } else {\n return icons[name];\n }\n }\n\n return (\n <WithNativeAttributes\n {...baseProps}\n {...labelAttributes}\n tag=\"span\"\n componentName=\"Icon\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n style={inlineStyles}\n >\n {validIcon ? iconMap(name) : undefined}\n </WithNativeAttributes>\n );\n};\n\nexport { InternalIconProps };\nexport default InternalIcon;\n"]}
@@ -609,7 +609,6 @@
609
609
  --space-layout-toggle-padding-chwlhz:12px;
610
610
  --space-modal-content-bottom-nl6ceq:16px;
611
611
  --space-modal-horizontal-y5hnwp:20px;
612
- --space-option-icon-big-top-rs5wgf:0px;
613
612
  --space-panel-content-bottom-24c6lu:40px;
614
613
  --space-panel-content-top-qvd1dr:20px;
615
614
  --space-panel-divider-margin-horizontal-yw31p0:8px;
@@ -2039,5 +2038,5 @@
2039
2038
  }
2040
2039
  }
2041
2040
  :root {
2042
- --awsui-version-info-e41e149c: true;
2041
+ --awsui-version-info-52c36f0c: true;
2043
2042
  }
@@ -33,7 +33,7 @@ const Option = (_a) => {
33
33
  });
34
34
  }
35
35
  const className = clsx(styles.option, disabled && styles.disabled, isGroupOption && styles.parent, highlightedOption && styles.highlighted);
36
- const icon = option.__customIcon || (React.createElement(OptionIcon, { name: option.iconName, url: option.iconUrl, svg: option.iconSvg, alt: option.iconAlt, ariaLabel: option.iconAriaLabel, size: option.description || option.tags ? 'big' : 'normal' }));
36
+ const icon = option.__customIcon || (React.createElement(OptionIcon, { name: option.iconName, url: option.iconUrl, svg: option.iconSvg, alt: option.iconAlt, ariaLabel: option.iconAriaLabel, size: "normal" }));
37
37
  // The option is conditionally assigned 'title' and 'aria-disabled' attributes to ensure it is viewed as a (generic) group by assistive technology only when necessary.
38
38
  // Omitting the props might be necessary if they are provided on the parent element to avoid nested groups.
39
39
  // See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/generic_role
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/option/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC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AM,CAAC,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,GAAI,CAChG;YACP,oBAAC,WAAW,IACV,WAAW,EAAE,MAAM,CAAC,WAAW,EAC/B,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B;YACF,oBAAC,IAAI,IACH,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B;YACF,oBAAC,aAAa,IACZ,aAAa,EAAE,MAAM,CAAC,aAAa,EACnC,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B,CACG,CACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,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 { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../../base-component';\nimport { isDevelopment } from '../../is-development';\nimport { OptionProps } from './interfaces';\nimport { Description, FilteringTags, Label, LabelTag, OptionIcon, Tags } from './option-parts';\n\nimport styles from './styles.css.js';\n\nexport { OptionProps };\n\nfunction validateStringValue(value: string | undefined, propertyName: string) {\n if (typeof value !== 'undefined' && typeof value !== 'string') {\n warnOnce(\n 'DropdownOption',\n `This component only supports string values, but \"option.${propertyName}\" has ${typeof value} type. The component may work incorrectly.`\n );\n }\n}\n\nconst Option = ({\n option,\n highlightText,\n triggerVariant = false,\n isGroupOption = false,\n isGenericGroup = true,\n highlightedOption = false,\n selectedOption = false,\n ...restProps\n}: OptionProps) => {\n if (!option) {\n return null;\n }\n const { disabled } = option;\n const baseProps = getBaseProps(restProps);\n\n if (isDevelopment) {\n validateStringValue(option.label, 'label');\n validateStringValue(option.description, 'description');\n validateStringValue(option.labelTag, 'labelTag');\n option.tags?.forEach((tag, index) => {\n validateStringValue(tag, `tags[${index}]`);\n });\n option.filteringTags?.forEach((tag, index) => {\n validateStringValue(tag, `filteringTags[${index}]`);\n });\n }\n\n const className = clsx(\n styles.option,\n disabled && styles.disabled,\n isGroupOption && styles.parent,\n highlightedOption && styles.highlighted\n );\n\n const icon = option.__customIcon || (\n <OptionIcon\n name={option.iconName}\n url={option.iconUrl}\n svg={option.iconSvg}\n alt={option.iconAlt}\n ariaLabel={option.iconAriaLabel}\n size={option.description || option.tags ? 'big' : 'normal'}\n />\n );\n\n // The option is conditionally assigned 'title' and 'aria-disabled' attributes to ensure it is viewed as a (generic) group by assistive technology only when necessary.\n // Omitting the props might be necessary if they are provided on the parent element to avoid nested groups.\n // See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/generic_role\n const genericGroupProps = isGenericGroup\n ? {\n title: option.label ?? option.value,\n 'aria-disabled': disabled,\n }\n : undefined;\n\n return (\n <span data-value={option.value} className={className} lang={option.lang} {...genericGroupProps} {...baseProps}>\n {icon}\n <span className={styles.content}>\n <span className={styles['label-content']}>\n <Label\n label={option.label ?? option.value}\n prefix={option.__labelPrefix}\n highlightText={highlightText}\n triggerVariant={triggerVariant}\n />\n <LabelTag labelTag={option.labelTag} highlightText={highlightText} triggerVariant={triggerVariant} />\n </span>\n <Description\n description={option.description}\n highlightedOption={highlightedOption}\n selectedOption={selectedOption}\n highlightText={highlightText}\n triggerVariant={triggerVariant}\n />\n <Tags\n tags={option.tags}\n highlightedOption={highlightedOption}\n selectedOption={selectedOption}\n highlightText={highlightText}\n triggerVariant={triggerVariant}\n />\n <FilteringTags\n filteringTags={option.filteringTags}\n highlightedOption={highlightedOption}\n selectedOption={selectedOption}\n highlightText={highlightText}\n triggerVariant={triggerVariant}\n />\n </span>\n </span>\n );\n};\n\nexport default Option;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/option/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE/F,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,SAAS,mBAAmB,CAAC,KAAyB,EAAE,YAAoB;IAC1E,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7D,QAAQ,CACN,gBAAgB,EAChB,2DAA2D,YAAY,SAAS,OAAO,KAAK,4CAA4C,CACzI,CAAC;KACH;AACH,CAAC;AAED,MAAM,MAAM,GAAG,CAAC,EASF,EAAE,EAAE;;QATF,EACd,MAAM,EACN,aAAa,EACb,cAAc,GAAG,KAAK,EACtB,aAAa,GAAG,KAAK,EACrB,cAAc,GAAG,IAAI,EACrB,iBAAiB,GAAG,KAAK,EACzB,cAAc,GAAG,KAAK,OAEV,EADT,SAAS,cARE,uHASf,CADa;IAEZ,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAC5B,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAE1C,IAAI,aAAa,EAAE;QACjB,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC3C,mBAAm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E,IAAI,EAAE,MAAM,CAAC,IAAI,IAAM,iBAAiB,EAAM,SAAS;QAC1G,IAAI;QACL,8BAAM,SAAS,EAAE,MAAM,CAAC,OAAO;YAC7B,8BAAM,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC;gBACtC,oBAAC,KAAK,IACJ,KAAK,EAAE,MAAA,MAAM,CAAC,KAAK,mCAAI,MAAM,CAAC,KAAK,EACnC,MAAM,EAAE,MAAM,CAAC,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B;gBACF,oBAAC,QAAQ,IAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,GAAI,CAChG;YACP,oBAAC,WAAW,IACV,WAAW,EAAE,MAAM,CAAC,WAAW,EAC/B,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B;YACF,oBAAC,IAAI,IACH,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B;YACF,oBAAC,aAAa,IACZ,aAAa,EAAE,MAAM,CAAC,aAAa,EACnC,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B,CACG,CACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,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 { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../../base-component';\nimport { isDevelopment } from '../../is-development';\nimport { OptionProps } from './interfaces';\nimport { Description, FilteringTags, Label, LabelTag, OptionIcon, Tags } from './option-parts';\n\nimport styles from './styles.css.js';\n\nexport { OptionProps };\n\nfunction validateStringValue(value: string | undefined, propertyName: string) {\n if (typeof value !== 'undefined' && typeof value !== 'string') {\n warnOnce(\n 'DropdownOption',\n `This component only supports string values, but \"option.${propertyName}\" has ${typeof value} type. The component may work incorrectly.`\n );\n }\n}\n\nconst Option = ({\n option,\n highlightText,\n triggerVariant = false,\n isGroupOption = false,\n isGenericGroup = true,\n highlightedOption = false,\n selectedOption = false,\n ...restProps\n}: OptionProps) => {\n if (!option) {\n return null;\n }\n const { disabled } = option;\n const baseProps = getBaseProps(restProps);\n\n if (isDevelopment) {\n validateStringValue(option.label, 'label');\n validateStringValue(option.description, 'description');\n validateStringValue(option.labelTag, 'labelTag');\n option.tags?.forEach((tag, index) => {\n validateStringValue(tag, `tags[${index}]`);\n });\n option.filteringTags?.forEach((tag, index) => {\n validateStringValue(tag, `filteringTags[${index}]`);\n });\n }\n\n const className = clsx(\n styles.option,\n disabled && styles.disabled,\n isGroupOption && styles.parent,\n highlightedOption && styles.highlighted\n );\n\n const icon = option.__customIcon || (\n <OptionIcon\n name={option.iconName}\n url={option.iconUrl}\n svg={option.iconSvg}\n alt={option.iconAlt}\n ariaLabel={option.iconAriaLabel}\n size=\"normal\"\n />\n );\n\n // The option is conditionally assigned 'title' and 'aria-disabled' attributes to ensure it is viewed as a (generic) group by assistive technology only when necessary.\n // Omitting the props might be necessary if they are provided on the parent element to avoid nested groups.\n // See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/generic_role\n const genericGroupProps = isGenericGroup\n ? {\n title: option.label ?? option.value,\n 'aria-disabled': disabled,\n }\n : undefined;\n\n return (\n <span data-value={option.value} className={className} lang={option.lang} {...genericGroupProps} {...baseProps}>\n {icon}\n <span className={styles.content}>\n <span className={styles['label-content']}>\n <Label\n label={option.label ?? option.value}\n prefix={option.__labelPrefix}\n highlightText={highlightText}\n triggerVariant={triggerVariant}\n />\n <LabelTag labelTag={option.labelTag} highlightText={highlightText} triggerVariant={triggerVariant} />\n </span>\n <Description\n description={option.description}\n highlightedOption={highlightedOption}\n selectedOption={selectedOption}\n highlightText={highlightText}\n triggerVariant={triggerVariant}\n />\n <Tags\n tags={option.tags}\n highlightedOption={highlightedOption}\n selectedOption={selectedOption}\n highlightText={highlightText}\n triggerVariant={triggerVariant}\n />\n <FilteringTags\n filteringTags={option.filteringTags}\n highlightedOption={highlightedOption}\n selectedOption={selectedOption}\n highlightText={highlightText}\n triggerVariant={triggerVariant}\n />\n </span>\n </span>\n );\n};\n\nexport default Option;\n"]}
@@ -45,7 +45,7 @@ export const OptionIcon = (props) => {
45
45
  if (!props.name && !props.url && !props.svg) {
46
46
  return null;
47
47
  }
48
- return (React.createElement("span", { className: clsx(styles.icon, props.size === 'big' && [styles[`icon-size-big`]]) },
48
+ return (React.createElement("span", { className: styles.icon },
49
49
  React.createElement(InternalIcon, Object.assign({}, props))));
50
50
  };
51
51
  //# sourceMappingURL=option-parts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"option-parts.js","sourceRoot":"","sources":["../../../../../src/internal/components/option/option-parts.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAc,EAAE,EAAE,CAAC,CACrF,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,kBAAkB,CAAC,KAAK,EAAE,cAAc,IAAI,MAA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G,EAAE,cAAc,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC,EACxE,GAAG,EAAE,GAAG,mBACO,IAAI;gBAEnB,oBAAC,cAAc,IAAC,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,GAAI,CAC9D,CACR,CAAC;SACH;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAgB,EAAE,EAAE;IAC7C,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;QAC3C,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;QACnF,oBAAC,YAAY,oBAAK,KAAK,EAAI,CACtB,CACR,CAAC;AACJ,CAAC,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 { IconProps } from '../../../icon/interfaces';\nimport InternalIcon from '../../../icon/internal';\nimport HighlightMatch from './highlight-match';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface LabelProps {\n label?: string;\n prefix?: string;\n highlightText?: string;\n triggerVariant: boolean;\n}\nexport const Label = ({ label, prefix, highlightText, triggerVariant }: LabelProps) => (\n <span className={clsx(styles.label, analyticsSelectors.label, triggerVariant && styles['trigger-variant'])}>\n {prefix && (\n <span className={clsx(styles['label-prefix'], triggerVariant && styles['trigger-variant'])}>{prefix} </span>\n )}\n <HighlightMatch str={label} highlightText={highlightText} />\n </span>\n);\n\ninterface LabelTagProps {\n labelTag?: string;\n highlightText?: string;\n triggerVariant: boolean;\n}\nexport const LabelTag = ({ labelTag, highlightText, triggerVariant }: LabelTagProps) =>\n labelTag ? (\n <span className={clsx(styles['label-tag'], triggerVariant && styles['trigger-variant'])}>\n <HighlightMatch str={labelTag} highlightText={highlightText} />\n </span>\n ) : null;\n\ninterface DescriptionProps {\n description?: string;\n highlightedOption: boolean;\n highlightText?: string;\n selectedOption: boolean;\n triggerVariant: boolean;\n}\nexport const Description = ({\n description,\n highlightedOption,\n highlightText,\n selectedOption,\n triggerVariant,\n}: DescriptionProps) =>\n description ? (\n <span\n className={clsx(styles.description, {\n [styles['trigger-variant']]: triggerVariant,\n [styles.highlighted]: highlightedOption,\n [styles.selected]: selectedOption,\n })}\n >\n <HighlightMatch str={description} highlightText={highlightText} />\n </span>\n ) : null;\n\ninterface TagsProps {\n tags?: ReadonlyArray<string>;\n highlightedOption: boolean;\n highlightText?: string;\n selectedOption: boolean;\n triggerVariant: boolean;\n}\nexport const Tags = ({ tags, highlightedOption, highlightText, selectedOption, triggerVariant }: TagsProps) =>\n tags ? (\n <span\n className={clsx(styles.tags, {\n [styles.highlighted]: highlightedOption,\n [styles.selected]: selectedOption,\n })}\n >\n {tags.map((tag, idx) => (\n <span key={idx} className={clsx(styles.tag, triggerVariant && styles['trigger-variant'])}>\n <HighlightMatch str={tag} highlightText={highlightText} />\n </span>\n ))}\n </span>\n ) : null;\n\ninterface FilteringTagProps {\n filteringTags?: ReadonlyArray<string>;\n highlightedOption: boolean;\n highlightText?: string;\n selectedOption: boolean;\n triggerVariant: boolean;\n}\nexport const FilteringTags = ({\n filteringTags,\n highlightedOption,\n highlightText,\n selectedOption,\n triggerVariant,\n}: FilteringTagProps) => {\n if (!highlightText || !filteringTags) {\n return null;\n }\n\n const searchElement = highlightText.toLowerCase();\n\n return (\n <span\n className={clsx(styles.tags, {\n [styles.highlighted]: highlightedOption,\n [styles.selected]: selectedOption,\n })}\n >\n {filteringTags.map((filteringTag, key) => {\n const match = filteringTag.toLowerCase().indexOf(searchElement) !== -1;\n if (match) {\n return (\n <span\n className={clsx(styles.tag, triggerVariant && styles['trigger-variant'])}\n key={key}\n aria-disabled={true}\n >\n <HighlightMatch str={filteringTag} highlightText={highlightText} />\n </span>\n );\n }\n return null;\n })}\n </span>\n );\n};\n\nexport const OptionIcon = (props: IconProps) => {\n if (!props.name && !props.url && !props.svg) {\n return null;\n }\n\n return (\n <span className={clsx(styles.icon, props.size === 'big' && [styles[`icon-size-big`]])}>\n <InternalIcon {...props} />\n </span>\n );\n};\n"]}
1
+ {"version":3,"file":"option-parts.js","sourceRoot":"","sources":["../../../../../src/internal/components/option/option-parts.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAc,EAAE,EAAE,CAAC,CACrF,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,kBAAkB,CAAC,KAAK,EAAE,cAAc,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACvG,MAAM,IAAI,CACT,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,cAAc,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAAG,MAAM;YAAS,CAC7G;IACD,oBAAC,cAAc,IAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,GAAI,CACvD,CACR,CAAC;AAOF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,QAAQ,EAAE,aAA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AC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;QAC3C,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,8BAAM,SAAS,EAAE,MAAM,CAAC,IAAI;QAC1B,oBAAC,YAAY,oBAAK,KAAK,EAAI,CACtB,CACR,CAAC;AACJ,CAAC,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 { IconProps } from '../../../icon/interfaces';\nimport InternalIcon from '../../../icon/internal';\nimport HighlightMatch from './highlight-match';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface LabelProps {\n label?: string;\n prefix?: string;\n highlightText?: string;\n triggerVariant: boolean;\n}\nexport const Label = ({ label, prefix, highlightText, triggerVariant }: LabelProps) => (\n <span className={clsx(styles.label, analyticsSelectors.label, triggerVariant && styles['trigger-variant'])}>\n {prefix && (\n <span className={clsx(styles['label-prefix'], triggerVariant && styles['trigger-variant'])}>{prefix} </span>\n )}\n <HighlightMatch str={label} highlightText={highlightText} />\n </span>\n);\n\ninterface LabelTagProps {\n labelTag?: string;\n highlightText?: string;\n triggerVariant: boolean;\n}\nexport const LabelTag = ({ labelTag, highlightText, triggerVariant }: LabelTagProps) =>\n labelTag ? (\n <span className={clsx(styles['label-tag'], triggerVariant && styles['trigger-variant'])}>\n <HighlightMatch str={labelTag} highlightText={highlightText} />\n </span>\n ) : null;\n\ninterface DescriptionProps {\n description?: string;\n highlightedOption: boolean;\n highlightText?: string;\n selectedOption: boolean;\n triggerVariant: boolean;\n}\nexport const Description = ({\n description,\n highlightedOption,\n highlightText,\n selectedOption,\n triggerVariant,\n}: DescriptionProps) =>\n description ? (\n <span\n className={clsx(styles.description, {\n [styles['trigger-variant']]: triggerVariant,\n [styles.highlighted]: highlightedOption,\n [styles.selected]: selectedOption,\n })}\n >\n <HighlightMatch str={description} highlightText={highlightText} />\n </span>\n ) : null;\n\ninterface TagsProps {\n tags?: ReadonlyArray<string>;\n highlightedOption: boolean;\n highlightText?: string;\n selectedOption: boolean;\n triggerVariant: boolean;\n}\nexport const Tags = ({ tags, highlightedOption, highlightText, selectedOption, triggerVariant }: TagsProps) =>\n tags ? (\n <span\n className={clsx(styles.tags, {\n [styles.highlighted]: highlightedOption,\n [styles.selected]: selectedOption,\n })}\n >\n {tags.map((tag, idx) => (\n <span key={idx} className={clsx(styles.tag, triggerVariant && styles['trigger-variant'])}>\n <HighlightMatch str={tag} highlightText={highlightText} />\n </span>\n ))}\n </span>\n ) : null;\n\ninterface FilteringTagProps {\n filteringTags?: ReadonlyArray<string>;\n highlightedOption: boolean;\n highlightText?: string;\n selectedOption: boolean;\n triggerVariant: boolean;\n}\nexport const FilteringTags = ({\n filteringTags,\n highlightedOption,\n highlightText,\n selectedOption,\n triggerVariant,\n}: FilteringTagProps) => {\n if (!highlightText || !filteringTags) {\n return null;\n }\n\n const searchElement = highlightText.toLowerCase();\n\n return (\n <span\n className={clsx(styles.tags, {\n [styles.highlighted]: highlightedOption,\n [styles.selected]: selectedOption,\n })}\n >\n {filteringTags.map((filteringTag, key) => {\n const match = filteringTag.toLowerCase().indexOf(searchElement) !== -1;\n if (match) {\n return (\n <span\n className={clsx(styles.tag, triggerVariant && styles['trigger-variant'])}\n key={key}\n aria-disabled={true}\n >\n <HighlightMatch str={filteringTag} highlightText={highlightText} />\n </span>\n );\n }\n return null;\n })}\n </span>\n );\n};\n\nexport const OptionIcon = (props: IconProps) => {\n if (!props.name && !props.url && !props.svg) {\n return null;\n }\n\n return (\n <span className={styles.icon}>\n <InternalIcon {...props} />\n </span>\n );\n};\n"]}
@@ -1,22 +1,21 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "option": "awsui_option_1p2cx_1w5f5_153",
5
- "disabled": "awsui_disabled_1p2cx_1w5f5_190",
6
- "parent": "awsui_parent_1p2cx_1w5f5_193",
7
- "highlighted": "awsui_highlighted_1p2cx_1w5f5_196",
8
- "content": "awsui_content_1p2cx_1w5f5_200",
9
- "label-content": "awsui_label-content_1p2cx_1w5f5_207",
10
- "label": "awsui_label_1p2cx_1w5f5_207",
11
- "tag": "awsui_tag_1p2cx_1w5f5_214",
12
- "label-tag": "awsui_label-tag_1p2cx_1w5f5_215",
13
- "label-prefix": "awsui_label-prefix_1p2cx_1w5f5_225",
14
- "tags": "awsui_tags_1p2cx_1w5f5_238",
15
- "description": "awsui_description_1p2cx_1w5f5_239",
16
- "selected": "awsui_selected_1p2cx_1w5f5_250",
17
- "icon": "awsui_icon_1p2cx_1w5f5_264",
18
- "icon-size-big": "awsui_icon-size-big_1p2cx_1w5f5_271",
19
- "filtering-match-highlight": "awsui_filtering-match-highlight_1p2cx_1w5f5_275",
20
- "trigger-variant": "awsui_trigger-variant_1p2cx_1w5f5_290"
4
+ "option": "awsui_option_1p2cx_ph5rs_153",
5
+ "disabled": "awsui_disabled_1p2cx_ph5rs_190",
6
+ "parent": "awsui_parent_1p2cx_ph5rs_193",
7
+ "highlighted": "awsui_highlighted_1p2cx_ph5rs_196",
8
+ "content": "awsui_content_1p2cx_ph5rs_200",
9
+ "label-content": "awsui_label-content_1p2cx_ph5rs_207",
10
+ "label": "awsui_label_1p2cx_ph5rs_207",
11
+ "tag": "awsui_tag_1p2cx_ph5rs_214",
12
+ "label-tag": "awsui_label-tag_1p2cx_ph5rs_215",
13
+ "label-prefix": "awsui_label-prefix_1p2cx_ph5rs_225",
14
+ "tags": "awsui_tags_1p2cx_ph5rs_238",
15
+ "description": "awsui_description_1p2cx_ph5rs_239",
16
+ "selected": "awsui_selected_1p2cx_ph5rs_250",
17
+ "icon": "awsui_icon_1p2cx_ph5rs_264",
18
+ "filtering-match-highlight": "awsui_filtering-match-highlight_1p2cx_ph5rs_271",
19
+ "trigger-variant": "awsui_trigger-variant_1p2cx_ph5rs_286"
21
20
  };
22
21
 
@@ -150,7 +150,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
150
150
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
151
151
  SPDX-License-Identifier: Apache-2.0
152
152
  */
153
- .awsui_option_1p2cx_1w5f5_153:not(#\9) {
153
+ .awsui_option_1p2cx_ph5rs_153:not(#\9) {
154
154
  border-collapse: separate;
155
155
  border-spacing: 0;
156
156
  box-sizing: border-box;
@@ -187,107 +187,103 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
187
187
  box-sizing: border-box;
188
188
  color: inherit;
189
189
  }
190
- .awsui_option_1p2cx_1w5f5_153:not(#\9):not(.awsui_disabled_1p2cx_1w5f5_190) {
190
+ .awsui_option_1p2cx_ph5rs_153:not(#\9):not(.awsui_disabled_1p2cx_ph5rs_190) {
191
191
  cursor: inherit;
192
192
  }
193
- .awsui_option_1p2cx_1w5f5_153.awsui_parent_1p2cx_1w5f5_193:not(#\9) {
193
+ .awsui_option_1p2cx_ph5rs_153.awsui_parent_1p2cx_ph5rs_193:not(#\9) {
194
194
  font-weight: bold;
195
195
  }
196
- .awsui_option_1p2cx_1w5f5_153.awsui_parent_1p2cx_1w5f5_193:not(#\9):not(.awsui_disabled_1p2cx_1w5f5_190):not(.awsui_highlighted_1p2cx_1w5f5_196) {
196
+ .awsui_option_1p2cx_ph5rs_153.awsui_parent_1p2cx_ph5rs_193:not(#\9):not(.awsui_disabled_1p2cx_ph5rs_190):not(.awsui_highlighted_1p2cx_ph5rs_196) {
197
197
  color: var(--color-text-dropdown-group-label-2tmyik, #424650);
198
198
  }
199
199
 
200
- .awsui_content_1p2cx_1w5f5_200:not(#\9) {
200
+ .awsui_content_1p2cx_ph5rs_200:not(#\9) {
201
201
  inline-size: 100%;
202
202
  display: flex;
203
203
  flex-direction: column;
204
204
  min-inline-size: 0;
205
205
  }
206
206
 
207
- .awsui_label-content_1p2cx_1w5f5_207:not(#\9) {
207
+ .awsui_label-content_1p2cx_ph5rs_207:not(#\9) {
208
208
  display: flex;
209
209
  justify-content: space-between;
210
210
  flex-wrap: wrap;
211
211
  }
212
212
 
213
- .awsui_label_1p2cx_1w5f5_207:not(#\9),
214
- .awsui_tag_1p2cx_1w5f5_214:not(#\9),
215
- .awsui_label-tag_1p2cx_1w5f5_215:not(#\9) {
213
+ .awsui_label_1p2cx_ph5rs_207:not(#\9),
214
+ .awsui_tag_1p2cx_ph5rs_214:not(#\9),
215
+ .awsui_label-tag_1p2cx_ph5rs_215:not(#\9) {
216
216
  min-inline-size: 0;
217
217
  word-break: break-word;
218
218
  }
219
219
 
220
- .awsui_label_1p2cx_1w5f5_207:not(#\9),
221
- .awsui_tag_1p2cx_1w5f5_214:not(#\9) {
220
+ .awsui_label_1p2cx_ph5rs_207:not(#\9),
221
+ .awsui_tag_1p2cx_ph5rs_214:not(#\9) {
222
222
  flex-wrap: wrap;
223
223
  }
224
224
 
225
- .awsui_label-prefix_1p2cx_1w5f5_225:not(#\9) {
225
+ .awsui_label-prefix_1p2cx_ph5rs_225:not(#\9) {
226
226
  font-weight: 700;
227
227
  }
228
228
 
229
- .awsui_label-tag_1p2cx_1w5f5_215:not(#\9) {
229
+ .awsui_label-tag_1p2cx_ph5rs_215:not(#\9) {
230
230
  padding-inline-start: var(--space-s-tvghoh, 12px);
231
231
  flex: auto;
232
232
  text-align: end;
233
233
  }
234
- .awsui_label-tag_1p2cx_1w5f5_215:not(#\9):empty {
234
+ .awsui_label-tag_1p2cx_ph5rs_215:not(#\9):empty {
235
235
  display: none;
236
236
  }
237
237
 
238
- .awsui_tags_1p2cx_1w5f5_238:not(#\9),
239
- .awsui_description_1p2cx_1w5f5_239:not(#\9) {
238
+ .awsui_tags_1p2cx_ph5rs_238:not(#\9),
239
+ .awsui_description_1p2cx_ph5rs_239:not(#\9) {
240
240
  font-size: var(--font-size-body-s-smc8cv, 12px);
241
241
  line-height: var(--line-height-body-s-nu5hx1, 16px);
242
242
  letter-spacing: var(--letter-spacing-body-s-gq78ok, 0.005em);
243
243
  color: var(--color-text-dropdown-item-secondary-v12lfh, #656871);
244
244
  flex-wrap: wrap;
245
245
  }
246
- .awsui_tags_1p2cx_1w5f5_238.awsui_highlighted_1p2cx_1w5f5_196:not(#\9),
247
- .awsui_description_1p2cx_1w5f5_239.awsui_highlighted_1p2cx_1w5f5_196:not(#\9) {
246
+ .awsui_tags_1p2cx_ph5rs_238.awsui_highlighted_1p2cx_ph5rs_196:not(#\9),
247
+ .awsui_description_1p2cx_ph5rs_239.awsui_highlighted_1p2cx_ph5rs_196:not(#\9) {
248
248
  color: var(--color-text-dropdown-item-secondary-hover-de15wb, #656871);
249
249
  }
250
- .awsui_tags_1p2cx_1w5f5_238.awsui_selected_1p2cx_1w5f5_250:not(#\9),
251
- .awsui_description_1p2cx_1w5f5_239.awsui_selected_1p2cx_1w5f5_250:not(#\9) {
250
+ .awsui_tags_1p2cx_ph5rs_238.awsui_selected_1p2cx_ph5rs_250:not(#\9),
251
+ .awsui_description_1p2cx_ph5rs_239.awsui_selected_1p2cx_ph5rs_250:not(#\9) {
252
252
  color: var(--color-text-dropdown-item-secondary-v12lfh, #656871);
253
253
  }
254
254
 
255
- .awsui_tags_1p2cx_1w5f5_238:not(#\9) {
255
+ .awsui_tags_1p2cx_ph5rs_238:not(#\9) {
256
256
  display: flex;
257
257
  align-items: stretch;
258
258
  }
259
259
 
260
- .awsui_tag_1p2cx_1w5f5_214:not(#\9):not(:last-child) {
260
+ .awsui_tag_1p2cx_ph5rs_214:not(#\9):not(:last-child) {
261
261
  padding-inline-end: var(--space-m-dsumyt, 16px);
262
262
  }
263
263
 
264
- .awsui_icon_1p2cx_1w5f5_264:not(#\9) {
264
+ .awsui_icon_1p2cx_ph5rs_264:not(#\9) {
265
265
  padding-inline-end: var(--space-xs-ymlm0b, 8px);
266
266
  align-content: center;
267
267
  display: flex;
268
268
  flex-shrink: 0;
269
269
  }
270
270
 
271
- .awsui_icon-size-big_1p2cx_1w5f5_271:not(#\9) {
272
- padding-block-start: var(--space-option-icon-big-top-rs5wgf, 0px);
273
- }
274
-
275
- .awsui_filtering-match-highlight_1p2cx_1w5f5_275:not(#\9) {
271
+ .awsui_filtering-match-highlight_1p2cx_ph5rs_271:not(#\9) {
276
272
  background-color: var(--color-background-dropdown-item-filter-match-49b5vt, #f0fbff);
277
273
  color: var(--color-text-dropdown-item-filter-match-ebhvct, #006ce0);
278
274
  font-weight: bold;
279
275
  }
280
276
 
281
- .awsui_disabled_1p2cx_1w5f5_190:not(#\9) {
277
+ .awsui_disabled_1p2cx_ph5rs_190:not(#\9) {
282
278
  color: var(--color-text-dropdown-item-disabled-8m65hf, #b4b4bb);
283
279
  pointer-events: none;
284
280
  }
285
- .awsui_disabled_1p2cx_1w5f5_190 > .awsui_content_1p2cx_1w5f5_200 > .awsui_tags_1p2cx_1w5f5_238:not(#\9),
286
- .awsui_disabled_1p2cx_1w5f5_190 > .awsui_content_1p2cx_1w5f5_200 > .awsui_description_1p2cx_1w5f5_239:not(#\9) {
281
+ .awsui_disabled_1p2cx_ph5rs_190 > .awsui_content_1p2cx_ph5rs_200 > .awsui_tags_1p2cx_ph5rs_238:not(#\9),
282
+ .awsui_disabled_1p2cx_ph5rs_190 > .awsui_content_1p2cx_ph5rs_200 > .awsui_description_1p2cx_ph5rs_239:not(#\9) {
287
283
  color: currentColor;
288
284
  }
289
285
 
290
- .awsui_trigger-variant_1p2cx_1w5f5_290:not(#\9) {
286
+ .awsui_trigger-variant_1p2cx_ph5rs_286:not(#\9) {
291
287
  white-space: nowrap;
292
288
  overflow: hidden;
293
289
  text-overflow: ellipsis;
@@ -2,22 +2,21 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "option": "awsui_option_1p2cx_1w5f5_153",
6
- "disabled": "awsui_disabled_1p2cx_1w5f5_190",
7
- "parent": "awsui_parent_1p2cx_1w5f5_193",
8
- "highlighted": "awsui_highlighted_1p2cx_1w5f5_196",
9
- "content": "awsui_content_1p2cx_1w5f5_200",
10
- "label-content": "awsui_label-content_1p2cx_1w5f5_207",
11
- "label": "awsui_label_1p2cx_1w5f5_207",
12
- "tag": "awsui_tag_1p2cx_1w5f5_214",
13
- "label-tag": "awsui_label-tag_1p2cx_1w5f5_215",
14
- "label-prefix": "awsui_label-prefix_1p2cx_1w5f5_225",
15
- "tags": "awsui_tags_1p2cx_1w5f5_238",
16
- "description": "awsui_description_1p2cx_1w5f5_239",
17
- "selected": "awsui_selected_1p2cx_1w5f5_250",
18
- "icon": "awsui_icon_1p2cx_1w5f5_264",
19
- "icon-size-big": "awsui_icon-size-big_1p2cx_1w5f5_271",
20
- "filtering-match-highlight": "awsui_filtering-match-highlight_1p2cx_1w5f5_275",
21
- "trigger-variant": "awsui_trigger-variant_1p2cx_1w5f5_290"
5
+ "option": "awsui_option_1p2cx_ph5rs_153",
6
+ "disabled": "awsui_disabled_1p2cx_ph5rs_190",
7
+ "parent": "awsui_parent_1p2cx_ph5rs_193",
8
+ "highlighted": "awsui_highlighted_1p2cx_ph5rs_196",
9
+ "content": "awsui_content_1p2cx_ph5rs_200",
10
+ "label-content": "awsui_label-content_1p2cx_ph5rs_207",
11
+ "label": "awsui_label_1p2cx_ph5rs_207",
12
+ "tag": "awsui_tag_1p2cx_ph5rs_214",
13
+ "label-tag": "awsui_label-tag_1p2cx_ph5rs_215",
14
+ "label-prefix": "awsui_label-prefix_1p2cx_ph5rs_225",
15
+ "tags": "awsui_tags_1p2cx_ph5rs_238",
16
+ "description": "awsui_description_1p2cx_ph5rs_239",
17
+ "selected": "awsui_selected_1p2cx_ph5rs_250",
18
+ "icon": "awsui_icon_1p2cx_ph5rs_264",
19
+ "filtering-match-highlight": "awsui_filtering-match-highlight_1p2cx_ph5rs_271",
20
+ "trigger-variant": "awsui_trigger-variant_1p2cx_ph5rs_286"
22
21
  };
23
22
 
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (e41e149c)";
3
- export var GIT_SHA = "e41e149c";
2
+ export var PACKAGE_VERSION = "3.0.0 (52c36f0c)";
3
+ export var GIT_SHA = "52c36f0c";
4
4
  export var THEME = "open-source-visual-refresh";
5
5
  export var SYSTEM = "console";
6
6
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (e41e149c)",
4
- "GIT_SHA": "e41e149c",
3
+ "PACKAGE_VERSION": "3.0.0 (52c36f0c)",
4
+ "GIT_SHA": "52c36f0c",
5
5
  "THEME": "open-source-visual-refresh",
6
6
  "SYSTEM": "console",
7
7
  "ALWAYS_VISUAL_REFRESH": true
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "e41e149c7322b0a858dae6fc6ea4c46d06e1bf5d"
2
+ "commit": "52c36f0cc3b8c9ff4721f5e9ac5405cc7b12577d"
3
3
  }
@@ -5,6 +5,7 @@ type NativeAttributesProps<AT extends React.HTMLAttributes<HTMLElement>> = {
5
5
  children?: ReactNode;
6
6
  skipWarnings?: boolean;
7
7
  nativeAttributes: NativeAttributes<AT>;
8
+ componentName: string;
8
9
  } & NativeAttributes<AT>;
9
10
  interface ForwardRefType {
10
11
  <ET extends HTMLElement, AT extends React.HTMLAttributes<ET>>(props: NativeAttributesProps<AT> & {
@@ -1 +1 @@
1
- {"version":3,"file":"with-native-attributes.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/with-native-attributes.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKzC,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,IACpE,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,GACxD,SAAS,CAAC;AAEd,KAAK,qBAAqB,CAAC,EAAE,SAAS,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC;CACxC,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;AACzB,UAAU,cAAc;IACtB,CAAC,EAAE,SAAS,WAAW,EAAE,EAAE,SAAS,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,EAC1D,KAAK,EAAE,qBAAqB,CAAC,EAAE,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;KAAE,GACzD,GAAG,CAAC,OAAO,CAAC;CAChB;;AAED,wBAyCoB"}
1
+ {"version":3,"file":"with-native-attributes.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/with-native-attributes.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKzC,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,IACpE,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,GACxD,SAAS,CAAC;AAEd,KAAK,qBAAqB,CAAC,EAAE,SAAS,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;AACzB,UAAU,cAAc;IACtB,CAAC,EAAE,SAAS,WAAW,EAAE,EAAE,SAAS,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,EAC1D,KAAK,EAAE,qBAAqB,CAAC,EAAE,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;KAAE,GACzD,GAAG,CAAC,OAAO,CAAC;CAChB;;AAED,wBAyCoB"}
@@ -5,7 +5,7 @@ import React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
7
7
  export default React.forwardRef((_a, ref) => {
8
- var { tag, nativeAttributes, children, skipWarnings } = _a, rest = __rest(_a, ["tag", "nativeAttributes", "children", "skipWarnings"]);
8
+ var { tag, nativeAttributes, children, skipWarnings, componentName } = _a, rest = __rest(_a, ["tag", "nativeAttributes", "children", "skipWarnings", "componentName"]);
9
9
  const Tag = tag;
10
10
  const processedAttributes = Object.entries(nativeAttributes || {}).reduce((acc, [key, value]) => {
11
11
  // concatenate className
@@ -28,7 +28,7 @@ export default React.forwardRef((_a, ref) => {
28
28
  }
29
29
  else {
30
30
  if (key in rest && !skipWarnings) {
31
- warnOnce('Button', `Overriding native attribute [${key}] which has a Cloudscape-provided value`);
31
+ warnOnce(componentName, `Overriding native attribute [${key}] which has a Cloudscape-provided value`);
32
32
  }
33
33
  acc[key] = value;
34
34
  }