@cloudscape-design/components-themeable 3.0.1243 → 3.0.1245
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/icon/interfaces.d.ts +2 -1
- package/lib/internal/template/icon/interfaces.d.ts.map +1 -1
- package/lib/internal/template/icon/interfaces.js.map +1 -1
- package/lib/internal/template/icon/internal.d.ts.map +1 -1
- package/lib/internal/template/icon/internal.js +5 -1
- package/lib/internal/template/icon/internal.js.map +1 -1
- package/lib/internal/template/icon-provider/define-icons.d.ts +14 -0
- package/lib/internal/template/icon-provider/define-icons.d.ts.map +1 -0
- package/lib/internal/template/icon-provider/define-icons.js +17 -0
- package/lib/internal/template/icon-provider/define-icons.js.map +1 -0
- package/lib/internal/template/icon-provider/index.d.ts +2 -0
- package/lib/internal/template/icon-provider/index.d.ts.map +1 -1
- package/lib/internal/template/icon-provider/index.js +1 -0
- package/lib/internal/template/icon-provider/index.js.map +1 -1
- package/lib/internal/template/icon-provider/interfaces.d.ts +23 -137
- package/lib/internal/template/icon-provider/interfaces.d.ts.map +1 -1
- package/lib/internal/template/icon-provider/interfaces.js.map +1 -1
- package/lib/internal/template/icon-provider/internal.js +4 -3
- package/lib/internal/template/icon-provider/internal.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/select/parts/trigger.js +2 -2
- package/lib/internal/template/select/parts/trigger.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { BuiltInIconName, IconRegistryIconName } from '../icon-provider/interfaces';
|
|
2
3
|
import { BaseComponentProps } from '../internal/base-component';
|
|
3
4
|
/**
|
|
4
5
|
* @awsuiSystem core
|
|
@@ -76,7 +77,7 @@ export interface IconProps extends BaseComponentProps {
|
|
|
76
77
|
nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;
|
|
77
78
|
}
|
|
78
79
|
export declare namespace IconProps {
|
|
79
|
-
type Name =
|
|
80
|
+
type Name = BuiltInIconName | IconRegistryIconName;
|
|
80
81
|
type Variant = 'normal' | 'disabled' | 'error' | 'inverted' | 'link' | 'subtle' | 'success' | 'warning';
|
|
81
82
|
type Size = 'small' | 'normal' | 'medium' | 'big' | 'large' | 'inherit';
|
|
82
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/icon/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IACnD;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAEtB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC;IAE5B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEtB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;CACxE;AAED,yBAAiB,SAAS,CAAC;
|
|
1
|
+
{"version":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js","sourceRoot":"","sources":["../../../src/icon/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../internal/base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface IconProps extends BaseComponentProps {\n /**\n * Specifies the icon to be displayed.\n */\n name?: IconProps.Name;\n\n /**\n * Specifies the size of the icon.\n *\n * If you set size to `inherit`, an icon size will be assigned based on the icon's inherited line height.\n * For icons used alongside text, ensure the icon is placed inside the acompanying text tag.\n * The icon will be vertically centered based on the height.\n *\n * @visualrefresh `medium` size\n */\n size?: IconProps.Size;\n\n /**\n * Specifies the color variant of the icon. The `normal` variant picks up the current color of its context.\n */\n variant?: IconProps.Variant;\n\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available, and your custom icon cannot be an SVG.\n * For SVG icons, use the `svg` slot instead.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n */\n url?: string;\n\n /**\n * Specifies alternate text for a custom icon (using the `url` attribute).\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `svg` slot.\n *\n * @deprecated Use `ariaLabel` instead.\n */\n alt?: string;\n\n /**\n * Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n */\n ariaLabel?: string;\n\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if the icon you want isn't available, and you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span` and ensure icon `size` is not set to `inherit`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n svg?: React.ReactNode;\n\n /**\n * Attributes to add to the native element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;\n}\n\nexport namespace IconProps {\n
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/icon/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BuiltInIconName, IconRegistryIconName } from '../icon-provider/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface IconProps extends BaseComponentProps {\n /**\n * Specifies the icon to be displayed.\n */\n name?: IconProps.Name;\n\n /**\n * Specifies the size of the icon.\n *\n * If you set size to `inherit`, an icon size will be assigned based on the icon's inherited line height.\n * For icons used alongside text, ensure the icon is placed inside the acompanying text tag.\n * The icon will be vertically centered based on the height.\n *\n * @visualrefresh `medium` size\n */\n size?: IconProps.Size;\n\n /**\n * Specifies the color variant of the icon. The `normal` variant picks up the current color of its context.\n */\n variant?: IconProps.Variant;\n\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available, and your custom icon cannot be an SVG.\n * For SVG icons, use the `svg` slot instead.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n */\n url?: string;\n\n /**\n * Specifies alternate text for a custom icon (using the `url` attribute).\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `svg` slot.\n *\n * @deprecated Use `ariaLabel` instead.\n */\n alt?: string;\n\n /**\n * Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n */\n ariaLabel?: string;\n\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if the icon you want isn't available, and you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span` and ensure icon `size` is not set to `inherit`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n svg?: React.ReactNode;\n\n /**\n * Attributes to add to the native element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;\n}\n\nexport namespace IconProps {\n export type Name = BuiltInIconName | IconRegistryIconName;\n\n export type Variant = 'normal' | 'disabled' | 'error' | 'inverted' | 'link' | 'subtle' | 'success' | 'warning';\n\n export type Size = 'small' | 'normal' | 'medium' | 'big' | 'large' | 'inherit';\n}\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;AAuBJ,QAAA,MAAM,YAAY,GAAI,yGAYnB,iBAAiB,
|
|
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;AAuBJ,QAAA,MAAM,YAAY,GAAI,yGAYnB,iBAAiB,gBA6HnB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,eAAe,YAAY,CAAC"}
|
|
@@ -77,7 +77,11 @@ const InternalIcon = ({ name, size = 'normal', variant = 'normal', url, alt, ari
|
|
|
77
77
|
React.createElement("path", { 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", className: "filled" })));
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
80
|
-
|
|
80
|
+
const icon = icons[name];
|
|
81
|
+
if (!icon) {
|
|
82
|
+
warnOnce('Icon', `You have specified \`name="${name}"\` but no icon with that name was found in the current IconProvider context. If this is a custom icon, ensure your app is wrapped in an \`IconProvider\` with the icon defined via \`defineIcons\`.`);
|
|
83
|
+
}
|
|
84
|
+
return icon;
|
|
81
85
|
}
|
|
82
86
|
}
|
|
83
87
|
return (React.createElement(WithNativeAttributes, { ...baseProps, ...labelAttributes, tag: "span", componentName: "Icon", nativeAttributes: nativeAttributes, ref: mergedRef, style: inlineStyles }, validIcon ? iconMap(name) : undefined));
|
|
@@ -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,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,EAAE,QAAwB;IAClE,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,2EAA2E;QAC3E,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,oFAAoF;IACpF,gEAAgE;IAChE,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;QACjB,OAAO,OAAO,CAAC;IACjB,CAAC;SAAM,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,IAAI,MAAM,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,IAAI,EAAE,EAAE,CAAC;QACxD,OAAO,QAAQ,CAAC;IAClB,CAAC;SAAM,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC;IACjB,CAAC;SAAM,CAAC;QACN,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,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ACL,oBAAC,oBAAoB,OACf,SAAS,EACb,GAAG,EAAC,MAAM,EACV,aAAa,EAAC,MAAM,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,YAAY;YAEnB,6BAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,GAAG,GAAI,CACnB,CACxB,CAAC;IACJ,CAAC;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,CAAC;YAC9C,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;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO,CACL,oBAAC,oBAAoB,OACf,SAAS,KACT,eAAe,EACnB,GAAG,EAAC,MAAM,EACV,aAAa,EAAC,MAAM,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,YAAY,IAElB,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, fontSize?: 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 // Only display medium size icon when both line-height >= 24px AND font-size >= 20px\n // This prevents icons from becoming medium size inappropriately\n if (height >= 50) {\n return 'large';\n } else if (height >= 36) {\n return 'big';\n } else if (height >= 24 && !!fontSize && fontSize >= 20) {\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 [parentFontSize, setParentFontSize] = useState<number | null>(null);\n const contextualSize = size === 'inherit';\n const iconSize = contextualSize ? iconSizeMap(parentHeight, parentFontSize) : 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 computedStyle = getComputedStyle(iconRef.current);\n const { lineHeight, fontSize } = computedStyle;\n const newParentHeight = parseInt(lineHeight, 10);\n const newParentFontSize = parseInt(fontSize, 10);\n setParentHeight(newParentHeight);\n setParentFontSize(newParentFontSize);\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"]}
|
|
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,EAAE,QAAwB;IAClE,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,2EAA2E;QAC3E,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,oFAAoF;IACpF,gEAAgE;IAChE,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;QACjB,OAAO,OAAO,CAAC;IACjB,CAAC;SAAM,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,IAAI,MAAM,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,IAAI,EAAE,EAAE,C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a,EAAC,MAAM,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,YAAY,IAElB,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, fontSize?: 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 // Only display medium size icon when both line-height >= 24px AND font-size >= 20px\n // This prevents icons from becoming medium size inappropriately\n if (height >= 50) {\n return 'large';\n } else if (height >= 36) {\n return 'big';\n } else if (height >= 24 && !!fontSize && fontSize >= 20) {\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 [parentFontSize, setParentFontSize] = useState<number | null>(null);\n const contextualSize = size === 'inherit';\n const iconSize = contextualSize ? iconSizeMap(parentHeight, parentFontSize) : 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 computedStyle = getComputedStyle(iconRef.current);\n const { lineHeight, fontSize } = computedStyle;\n const newParentHeight = parseInt(lineHeight, 10);\n const newParentFontSize = parseInt(fontSize, 10);\n setParentHeight(newParentHeight);\n setParentFontSize(newParentFontSize);\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 const icon = icons[name];\n if (!icon) {\n warnOnce(\n 'Icon',\n `You have specified \\`name=\"${name}\"\\` but no icon with that name was found in the current IconProvider context. If this is a custom icon, ensure your app is wrapped in an \\`IconProvider\\` with the icon defined via \\`defineIcons\\`.`\n );\n }\n return icon;\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"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DefineIconsInput } from './interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a set of custom icons for use with {@link IconProvider}.
|
|
4
|
+
* Use with {@link IconMap} and `declare module` to register the icon names.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const myIcons = defineIcons({ "my-icon": <MySvg /> });
|
|
8
|
+
*
|
|
9
|
+
* declare module "@cloudscape-design/components/icon-provider" {
|
|
10
|
+
* interface IconRegistry extends IconMap<typeof myIcons> {}
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export declare function defineIcons<T extends DefineIconsInput>(icons: T): T;
|
|
14
|
+
//# sourceMappingURL=define-icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-icons.d.ts","sourceRoot":"","sources":["../../../src/icon-provider/define-icons.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,gBAAgB,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAEnE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Defines a set of custom icons for use with {@link IconProvider}.
|
|
5
|
+
* Use with {@link IconMap} and `declare module` to register the icon names.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const myIcons = defineIcons({ "my-icon": <MySvg /> });
|
|
9
|
+
*
|
|
10
|
+
* declare module "@cloudscape-design/components/icon-provider" {
|
|
11
|
+
* interface IconRegistry extends IconMap<typeof myIcons> {}
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
export function defineIcons(icons) {
|
|
15
|
+
return icons;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=define-icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-icons.js","sourceRoot":"","sources":["../../../src/icon-provider/define-icons.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAA6B,KAAQ;IAC9D,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { DefineIconsInput } from './interfaces';\n\n/**\n * Defines a set of custom icons for use with {@link IconProvider}.\n * Use with {@link IconMap} and `declare module` to register the icon names.\n *\n * @example\n * const myIcons = defineIcons({ \"my-icon\": <MySvg /> });\n *\n * declare module \"@cloudscape-design/components/icon-provider\" {\n * interface IconRegistry extends IconMap<typeof myIcons> {}\n * }\n */\nexport function defineIcons<T extends DefineIconsInput>(icons: T): T {\n return icons;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icon-provider/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icon-provider/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAG5D"}
|
|
@@ -5,6 +5,7 @@ import React from 'react';
|
|
|
5
5
|
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
6
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
7
|
import InternalIconProvider from './internal';
|
|
8
|
+
export { defineIcons } from './define-icons';
|
|
8
9
|
/**
|
|
9
10
|
* @awsuiSystem core
|
|
10
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/icon-provider/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,oBAAoB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/icon-provider/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,oBAAoB,MAAM,YAAY,CAAC;AAG9C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAwB;IAC3D,gBAAgB,CAAC,cAAc,CAAC,CAAC;IACjC,OAAO,oBAAC,oBAAoB,OAAK,KAAK,GAAI,CAAC;AAC7C,CAAC;AAED,gBAAgB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { IconProviderProps } from './interfaces';\nimport InternalIconProvider from './internal';\n\nexport { IconProviderProps } from './interfaces';\nexport { defineIcons } from './define-icons';\nexport type { IconRegistry, IconMap } from './interfaces';\n\n/**\n * @awsuiSystem core\n */\nexport default function IconProvider(props: IconProviderProps) {\n useBaseComponent('IconProvider');\n return <InternalIconProvider {...props} />;\n}\n\napplyDisplayName(IconProvider, 'IconProvider');\n"]}
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { IconProps } from '../icon/interfaces';
|
|
2
3
|
import { BaseComponentProps } from '../internal/base-component';
|
|
4
|
+
export type BuiltInIconName = 'add-plus' | 'anchor-link' | 'angle-left-double' | 'angle-left' | 'angle-right-double' | 'angle-right' | 'angle-up' | 'angle-down' | 'arrow-left' | 'arrow-right' | 'arrow-up' | 'arrow-down' | 'at-symbol' | 'audio-full' | 'audio-half' | 'audio-off' | 'backward-10-seconds' | 'bug' | 'call' | 'calendar' | 'caret-down-filled' | 'caret-down' | 'caret-left-filled' | 'caret-right-filled' | 'caret-up-filled' | 'caret-up' | 'check' | 'contact' | 'close' | 'closed-caption' | 'closed-caption-unavailable' | 'copy' | 'command-prompt' | 'delete-marker' | 'download' | 'drag-indicator' | 'edit' | 'edit-gen-ai' | 'ellipsis' | 'envelope' | 'exit-full-screen' | 'expand' | 'external' | 'face-happy' | 'face-happy-filled' | 'face-neutral' | 'face-neutral-filled' | 'face-sad' | 'face-sad-filled' | 'file-open' | 'file' | 'filter' | 'flag' | 'folder-open' | 'folder' | 'forward-10-seconds' | 'full-screen' | 'gen-ai' | 'globe' | 'grid-view' | 'group-active' | 'group' | 'heart' | 'heart-filled' | 'history' | 'insert-row' | 'key' | 'keyboard' | 'list-view' | 'location-pin' | 'lock-private' | 'map' | 'menu' | 'microphone' | 'microphone-off' | 'mini-player' | 'multiscreen' | 'notification' | 'pause' | 'play' | 'redo' | 'refresh' | 'remove' | 'resize-area' | 'script' | 'search' | 'search-gen-ai' | 'security' | 'settings' | 'send' | 'share' | 'shrink' | 'slash' | 'star-filled' | 'star-half' | 'star' | 'status-in-progress' | 'status-info' | 'status-negative' | 'status-not-started' | 'status-pending' | 'status-positive' | 'status-stopped' | 'status-warning' | 'stop-circle' | 'subtract-minus' | 'suggestions' | 'suggestions-gen-ai' | 'support' | 'thumbs-down-filled' | 'thumbs-down' | 'thumbs-up-filled' | 'thumbs-up' | 'ticket' | 'transcript' | 'treeview-collapse' | 'treeview-expand' | 'undo' | 'unlocked' | 'upload-download' | 'upload' | 'user-profile-active' | 'user-profile' | 'video-off' | 'video-on' | 'video-unavailable' | 'video-camera-off' | 'video-camera-on' | 'video-camera-unavailable' | 'view-full' | 'view-horizontal' | 'view-vertical' | 'zoom-in' | 'zoom-out' | 'zoom-to-fit';
|
|
5
|
+
/**
|
|
6
|
+
* Augment this interface using `declare module` to register custom icon names.
|
|
7
|
+
* Registered names become valid across all icon-accepting components.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* declare module "@cloudscape-design/components/icon-provider" {
|
|
11
|
+
* interface IconRegistry extends IconMap<typeof myIcons> {}
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
export interface IconRegistry {
|
|
15
|
+
}
|
|
16
|
+
/** Union of all icon names in the {@link IconRegistry}. */
|
|
17
|
+
export type IconRegistryIconName = keyof IconRegistry & string;
|
|
18
|
+
export type DefineIconsInput = Partial<Record<BuiltInIconName | (string & {}), ReactNode>>;
|
|
19
|
+
/** Extracts the keys of a `defineIcons` result into the shape that {@link IconRegistry} expects. */
|
|
20
|
+
export type IconMap<T> = {
|
|
21
|
+
[K in keyof T & string]: T[K];
|
|
22
|
+
};
|
|
3
23
|
export interface IconProviderProps extends BaseComponentProps {
|
|
4
24
|
children: ReactNode;
|
|
5
25
|
/**
|
|
@@ -18,142 +38,8 @@ export interface IconProviderProps extends BaseComponentProps {
|
|
|
18
38
|
icons: IconProviderProps.Icons | null;
|
|
19
39
|
}
|
|
20
40
|
export declare namespace IconProviderProps {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
'angle-left-double'?: ReactNode | null;
|
|
25
|
-
'angle-left'?: ReactNode | null;
|
|
26
|
-
'angle-right-double'?: ReactNode | null;
|
|
27
|
-
'angle-right'?: ReactNode | null;
|
|
28
|
-
'angle-up'?: ReactNode | null;
|
|
29
|
-
'angle-down'?: ReactNode | null;
|
|
30
|
-
'arrow-left'?: ReactNode | null;
|
|
31
|
-
'arrow-right'?: ReactNode | null;
|
|
32
|
-
'arrow-up'?: ReactNode | null;
|
|
33
|
-
'arrow-down'?: ReactNode | null;
|
|
34
|
-
'at-symbol'?: ReactNode | null;
|
|
35
|
-
'audio-full'?: ReactNode | null;
|
|
36
|
-
'audio-half'?: ReactNode | null;
|
|
37
|
-
'audio-off'?: ReactNode | null;
|
|
38
|
-
'backward-10-seconds'?: ReactNode | null;
|
|
39
|
-
bug?: ReactNode | null;
|
|
40
|
-
call?: ReactNode | null;
|
|
41
|
-
calendar?: ReactNode | null;
|
|
42
|
-
'caret-down-filled'?: ReactNode | null;
|
|
43
|
-
'caret-down'?: ReactNode | null;
|
|
44
|
-
'caret-left-filled'?: ReactNode | null;
|
|
45
|
-
'caret-right-filled'?: ReactNode | null;
|
|
46
|
-
'caret-up-filled'?: ReactNode | null;
|
|
47
|
-
'caret-up'?: ReactNode | null;
|
|
48
|
-
check?: ReactNode | null;
|
|
49
|
-
contact?: ReactNode | null;
|
|
50
|
-
close?: ReactNode | null;
|
|
51
|
-
'closed-caption'?: ReactNode | null;
|
|
52
|
-
'closed-caption-unavailable'?: ReactNode | null;
|
|
53
|
-
copy?: ReactNode | null;
|
|
54
|
-
'command-prompt'?: ReactNode | null;
|
|
55
|
-
'delete-marker'?: ReactNode | null;
|
|
56
|
-
download?: ReactNode | null;
|
|
57
|
-
'drag-indicator'?: ReactNode | null;
|
|
58
|
-
edit?: ReactNode | null;
|
|
59
|
-
'edit-gen-ai'?: ReactNode | null;
|
|
60
|
-
ellipsis?: ReactNode | null;
|
|
61
|
-
envelope?: ReactNode | null;
|
|
62
|
-
'exit-full-screen'?: ReactNode | null;
|
|
63
|
-
expand?: ReactNode | null;
|
|
64
|
-
external?: ReactNode | null;
|
|
65
|
-
'face-happy'?: ReactNode | null;
|
|
66
|
-
'face-happy-filled'?: ReactNode | null;
|
|
67
|
-
'face-neutral'?: ReactNode | null;
|
|
68
|
-
'face-neutral-filled'?: ReactNode | null;
|
|
69
|
-
'face-sad'?: ReactNode | null;
|
|
70
|
-
'face-sad-filled'?: ReactNode | null;
|
|
71
|
-
'file-open'?: ReactNode | null;
|
|
72
|
-
file?: ReactNode | null;
|
|
73
|
-
filter?: ReactNode | null;
|
|
74
|
-
flag?: ReactNode | null;
|
|
75
|
-
'folder-open'?: ReactNode | null;
|
|
76
|
-
folder?: ReactNode | null;
|
|
77
|
-
'forward-10-seconds'?: ReactNode | null;
|
|
78
|
-
'full-screen'?: ReactNode | null;
|
|
79
|
-
'gen-ai'?: ReactNode | null;
|
|
80
|
-
globe?: ReactNode | null;
|
|
81
|
-
'grid-view'?: ReactNode | null;
|
|
82
|
-
'group-active'?: ReactNode | null;
|
|
83
|
-
group?: ReactNode | null;
|
|
84
|
-
heart?: ReactNode | null;
|
|
85
|
-
'heart-filled'?: ReactNode | null;
|
|
86
|
-
history?: ReactNode | null;
|
|
87
|
-
'insert-row'?: ReactNode | null;
|
|
88
|
-
key?: ReactNode | null;
|
|
89
|
-
keyboard?: ReactNode | null;
|
|
90
|
-
'list-view'?: ReactNode | null;
|
|
91
|
-
'location-pin'?: ReactNode | null;
|
|
92
|
-
'lock-private'?: ReactNode | null;
|
|
93
|
-
map?: ReactNode | null;
|
|
94
|
-
menu?: ReactNode | null;
|
|
95
|
-
microphone?: ReactNode | null;
|
|
96
|
-
'microphone-off'?: ReactNode | null;
|
|
97
|
-
'mini-player'?: ReactNode | null;
|
|
98
|
-
multiscreen?: ReactNode | null;
|
|
99
|
-
notification?: ReactNode | null;
|
|
100
|
-
pause?: ReactNode | null;
|
|
101
|
-
play?: ReactNode | null;
|
|
102
|
-
redo?: ReactNode | null;
|
|
103
|
-
refresh?: ReactNode | null;
|
|
104
|
-
remove?: ReactNode | null;
|
|
105
|
-
'resize-area'?: ReactNode | null;
|
|
106
|
-
script?: ReactNode | null;
|
|
107
|
-
search?: ReactNode | null;
|
|
108
|
-
'search-gen-ai'?: ReactNode | null;
|
|
109
|
-
security?: ReactNode | null;
|
|
110
|
-
settings?: ReactNode | null;
|
|
111
|
-
send?: ReactNode | null;
|
|
112
|
-
share?: ReactNode | null;
|
|
113
|
-
shrink?: ReactNode | null;
|
|
114
|
-
slash?: ReactNode | null;
|
|
115
|
-
'star-filled'?: ReactNode | null;
|
|
116
|
-
'star-half'?: ReactNode | null;
|
|
117
|
-
star?: ReactNode | null;
|
|
118
|
-
'status-in-progress'?: ReactNode | null;
|
|
119
|
-
'status-info'?: ReactNode | null;
|
|
120
|
-
'status-negative'?: ReactNode | null;
|
|
121
|
-
'status-not-started'?: ReactNode | null;
|
|
122
|
-
'status-pending'?: ReactNode | null;
|
|
123
|
-
'status-positive'?: ReactNode | null;
|
|
124
|
-
'status-stopped'?: ReactNode | null;
|
|
125
|
-
'status-warning'?: ReactNode | null;
|
|
126
|
-
'stop-circle'?: ReactNode | null;
|
|
127
|
-
'subtract-minus'?: ReactNode | null;
|
|
128
|
-
suggestions?: ReactNode | null;
|
|
129
|
-
'suggestions-gen-ai'?: ReactNode | null;
|
|
130
|
-
support?: ReactNode | null;
|
|
131
|
-
'thumbs-down-filled'?: ReactNode | null;
|
|
132
|
-
'thumbs-down'?: ReactNode | null;
|
|
133
|
-
'thumbs-up-filled'?: ReactNode | null;
|
|
134
|
-
'thumbs-up'?: ReactNode | null;
|
|
135
|
-
ticket?: ReactNode | null;
|
|
136
|
-
transcript?: ReactNode | null;
|
|
137
|
-
'treeview-collapse'?: ReactNode | null;
|
|
138
|
-
'treeview-expand'?: ReactNode | null;
|
|
139
|
-
undo?: ReactNode | null;
|
|
140
|
-
unlocked?: ReactNode | null;
|
|
141
|
-
'upload-download'?: ReactNode | null;
|
|
142
|
-
upload?: ReactNode | null;
|
|
143
|
-
'user-profile-active'?: ReactNode | null;
|
|
144
|
-
'user-profile'?: ReactNode | null;
|
|
145
|
-
'video-off'?: ReactNode | null;
|
|
146
|
-
'video-on'?: ReactNode | null;
|
|
147
|
-
'video-unavailable'?: ReactNode | null;
|
|
148
|
-
'video-camera-off'?: ReactNode | null;
|
|
149
|
-
'video-camera-on'?: ReactNode | null;
|
|
150
|
-
'video-camera-unavailable'?: ReactNode | null;
|
|
151
|
-
'view-full'?: ReactNode | null;
|
|
152
|
-
'view-horizontal'?: ReactNode | null;
|
|
153
|
-
'view-vertical'?: ReactNode | null;
|
|
154
|
-
'zoom-in'?: ReactNode | null;
|
|
155
|
-
'zoom-out'?: ReactNode | null;
|
|
156
|
-
'zoom-to-fit'?: ReactNode | null;
|
|
157
|
-
}
|
|
41
|
+
type Icons = {
|
|
42
|
+
[name in IconProps.Name]?: ReactNode | null;
|
|
43
|
+
};
|
|
158
44
|
}
|
|
159
45
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/icon-provider/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/icon-provider/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIhE,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,aAAa,GACb,mBAAmB,GACnB,YAAY,GACZ,oBAAoB,GACpB,aAAa,GACb,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,UAAU,GACV,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,qBAAqB,GACrB,KAAK,GACL,MAAM,GACN,UAAU,GACV,mBAAmB,GACnB,YAAY,GACZ,mBAAmB,GACnB,oBAAoB,GACpB,iBAAiB,GACjB,UAAU,GACV,OAAO,GACP,SAAS,GACT,OAAO,GACP,gBAAgB,GAChB,4BAA4B,GAC5B,MAAM,GACN,gBAAgB,GAChB,eAAe,GACf,UAAU,GACV,gBAAgB,GAChB,MAAM,GACN,aAAa,GACb,UAAU,GACV,UAAU,GACV,kBAAkB,GAClB,QAAQ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Y,GAAG,MAAM,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AAE3F,oGAAoG;AACpG,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE3D,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;;;;;;;;;OAYG;IACH,KAAK,EAAE,iBAAiB,CAAC,KAAK,GAAG,IAAI,CAAC;CACvC;AAED,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,KAAK,GAAG;SACjB,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI;KAC5C,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/icon-provider/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ReactNode } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/icon-provider/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ReactNode } from 'react';\n\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\n\n// Why not enums? Explained there\n// https://stackoverflow.com/questions/52393730/typescript-string-literal-union-type-from-enum\nexport type BuiltInIconName =\n | 'add-plus'\n | 'anchor-link'\n | 'angle-left-double'\n | 'angle-left'\n | 'angle-right-double'\n | 'angle-right'\n | 'angle-up'\n | 'angle-down'\n | 'arrow-left'\n | 'arrow-right'\n | 'arrow-up'\n | 'arrow-down'\n | 'at-symbol'\n | 'audio-full'\n | 'audio-half'\n | 'audio-off'\n | 'backward-10-seconds'\n | 'bug'\n | 'call'\n | 'calendar'\n | 'caret-down-filled'\n | 'caret-down'\n | 'caret-left-filled'\n | 'caret-right-filled'\n | 'caret-up-filled'\n | 'caret-up'\n | 'check'\n | 'contact'\n | 'close'\n | 'closed-caption'\n | 'closed-caption-unavailable'\n | 'copy'\n | 'command-prompt'\n | 'delete-marker'\n | 'download'\n | 'drag-indicator'\n | 'edit'\n | 'edit-gen-ai'\n | 'ellipsis'\n | 'envelope'\n | 'exit-full-screen'\n | 'expand'\n | 'external'\n | 'face-happy'\n | 'face-happy-filled'\n | 'face-neutral'\n | 'face-neutral-filled'\n | 'face-sad'\n | 'face-sad-filled'\n | 'file-open'\n | 'file'\n | 'filter'\n | 'flag'\n | 'folder-open'\n | 'folder'\n | 'forward-10-seconds'\n | 'full-screen'\n | 'gen-ai'\n | 'globe'\n | 'grid-view'\n | 'group-active'\n | 'group'\n | 'heart'\n | 'heart-filled'\n | 'history'\n | 'insert-row'\n | 'key'\n | 'keyboard'\n | 'list-view'\n | 'location-pin'\n | 'lock-private'\n | 'map'\n | 'menu'\n | 'microphone'\n | 'microphone-off'\n | 'mini-player'\n | 'multiscreen'\n | 'notification'\n | 'pause'\n | 'play'\n | 'redo'\n | 'refresh'\n | 'remove'\n | 'resize-area'\n | 'script'\n | 'search'\n | 'search-gen-ai'\n | 'security'\n | 'settings'\n | 'send'\n | 'share'\n | 'shrink'\n | 'slash'\n | 'star-filled'\n | 'star-half'\n | 'star'\n | 'status-in-progress'\n | 'status-info'\n | 'status-negative'\n | 'status-not-started'\n | 'status-pending'\n | 'status-positive'\n | 'status-stopped'\n | 'status-warning'\n | 'stop-circle'\n | 'subtract-minus'\n | 'suggestions'\n | 'suggestions-gen-ai'\n | 'support'\n | 'thumbs-down-filled'\n | 'thumbs-down'\n | 'thumbs-up-filled'\n | 'thumbs-up'\n | 'ticket'\n | 'transcript'\n | 'treeview-collapse'\n | 'treeview-expand'\n | 'undo'\n | 'unlocked'\n | 'upload-download'\n | 'upload'\n | 'user-profile-active'\n | 'user-profile'\n | 'video-off'\n | 'video-on'\n | 'video-unavailable'\n | 'video-camera-off'\n | 'video-camera-on'\n | 'video-camera-unavailable'\n | 'view-full'\n | 'view-horizontal'\n | 'view-vertical'\n | 'zoom-in'\n | 'zoom-out'\n | 'zoom-to-fit';\n\n/**\n * Augment this interface using `declare module` to register custom icon names.\n * Registered names become valid across all icon-accepting components.\n *\n * @example\n * declare module \"@cloudscape-design/components/icon-provider\" {\n * interface IconRegistry extends IconMap<typeof myIcons> {}\n * }\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface IconRegistry {}\n\n/** Union of all icon names in the {@link IconRegistry}. */\nexport type IconRegistryIconName = keyof IconRegistry & string;\n\nexport type DefineIconsInput = Partial<Record<BuiltInIconName | (string & {}), ReactNode>>;\n\n/** Extracts the keys of a `defineIcons` result into the shape that {@link IconRegistry} expects. */\nexport type IconMap<T> = { [K in keyof T & string]: T[K] };\n\nexport interface IconProviderProps extends BaseComponentProps {\n children: ReactNode;\n\n /**\n * Specifies icon overrides using existing icon names, for example, `{'add-plus': <svg>...</svg>}`.\n *\n * These icon overrides will automatically be applied to any component that is a descendant of this provider, including nested providers.\n *\n * Set to `null` to reset the icons to the default set or set specific icon names to `null` to change them back to the default set.\n *\n * For example, override `AppLayout` icons but not icons in the content slot by wrapping content with an `IconProvider` with this property set to `null`.\n *\n * `<Icon ... />` component can be used as an override (for example, `{'close': <Icon name='arrow-left' />}`).\n * However, if the icon name is the same as the key, for example, `{'close': <Icon name='close' />}` an infinite loop will be created.\n * The same applies to switching icons in the same configuration (for example, `{'close': <Icon name='arrow-left' />, 'arrow-left': <Icon name='close' />}`).\n */\n icons: IconProviderProps.Icons | null;\n}\n\nexport namespace IconProviderProps {\n export type Icons = {\n [name in IconProps.Name]?: ReactNode | null;\n };\n}\n"]}
|
|
@@ -9,11 +9,12 @@ function InternalIconProvider({ children, icons }) {
|
|
|
9
9
|
// Merge the context icons with the custom icons, this allows child instances of IconProvider to persist parent configurations
|
|
10
10
|
if (icons !== null) {
|
|
11
11
|
const clonedIcons = { ...icons };
|
|
12
|
-
// Reset null icon values to their
|
|
12
|
+
// Reset null icon values to their generated default, or the inherited context value for custom icons
|
|
13
13
|
Object.keys(clonedIcons).forEach(name => {
|
|
14
|
+
var _a;
|
|
14
15
|
const iconName = name;
|
|
15
|
-
if (
|
|
16
|
-
clonedIcons[iconName] = generatedIcons[iconName];
|
|
16
|
+
if (clonedIcons[iconName] === null) {
|
|
17
|
+
clonedIcons[iconName] = (_a = generatedIcons[iconName]) !== null && _a !== void 0 ? _a : contextIcons[iconName];
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
20
|
iconsToProvide = { ...contextIcons, ...clonedIcons };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/icon-provider/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGhD,SAAS,oBAAoB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAqB;IAClE,MAAM,YAAY,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAErD,IAAI,cAAc,GAA4B,cAAc,CAAC;IAE7D,8HAA8H;IAC9H,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,WAAW,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;QAEjC,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/icon-provider/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGhD,SAAS,oBAAoB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAqB;IAClE,MAAM,YAAY,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAErD,IAAI,cAAc,GAA4B,cAAc,CAAC;IAE7D,8HAA8H;IAC9H,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,WAAW,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;QAEjC,qGAAqG;QACrG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;;YACtC,MAAM,QAAQ,GAAG,IAAmC,CAAC;YACrD,IAAI,WAAW,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;gBACnC,WAAW,CAAC,QAAQ,CAAC,GAAG,MAAA,cAAc,CAAC,QAAQ,CAAC,mCAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,cAAc,GAAG,EAAE,GAAG,YAAY,EAAE,GAAG,WAAW,EAAE,CAAC;IACvD,CAAC;IAED,OAAO,oBAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,IAAG,QAAQ,CAAgC,CAAC;AACxG,CAAC;AAED,eAAe,oBAAoB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useContext } from 'react';\n\nimport generatedIcons from '../icon/generated/icons';\nimport { InternalIconContext } from './context';\nimport { IconProviderProps } from './interfaces';\n\nfunction InternalIconProvider({ children, icons }: IconProviderProps) {\n const contextIcons = useContext(InternalIconContext);\n\n let iconsToProvide: IconProviderProps.Icons = generatedIcons;\n\n // Merge the context icons with the custom icons, this allows child instances of IconProvider to persist parent configurations\n if (icons !== null) {\n const clonedIcons = { ...icons };\n\n // Reset null icon values to their generated default, or the inherited context value for custom icons\n Object.keys(clonedIcons).forEach(name => {\n const iconName = name as keyof typeof generatedIcons;\n if (clonedIcons[iconName] === null) {\n clonedIcons[iconName] = generatedIcons[iconName] ?? contextIcons[iconName];\n }\n });\n\n iconsToProvide = { ...contextIcons, ...clonedIcons };\n }\n\n return <InternalIconContext.Provider value={iconsToProvide}>{children}</InternalIconContext.Provider>;\n}\n\nexport default InternalIconProvider;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
3
|
-
export var GIT_SHA = "
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (3ea95720)";
|
|
3
|
+
export var GIT_SHA = "3ea95720";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "core";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
@@ -30,11 +30,11 @@ const Trigger = React.forwardRef(({ ariaLabelledby, ariaDescribedby, controlId,
|
|
|
30
30
|
ariaLabelledbyIds = ariaLabelledby;
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
triggerContent = (React.createElement("span", {
|
|
33
|
+
triggerContent = (React.createElement("span", { className: clsx(styles.placeholder, styles.trigger), id: triggerContentId }, placeholder));
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
else if (!selectedOption) {
|
|
37
|
-
triggerContent = (React.createElement("span", {
|
|
37
|
+
triggerContent = (React.createElement("span", { className: clsx(styles.placeholder, styles.trigger), id: triggerContentId }, placeholder));
|
|
38
38
|
}
|
|
39
39
|
else if (triggerVariant === 'option') {
|
|
40
40
|
const triggerCustomContent = renderOption === null || renderOption === void 0 ? void 0 : renderOption({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.js","sourceRoot":"","sources":["../../../../src/select/parts/trigger.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE1F,OAAO,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,MAAM,MAAM,kCAAkC,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAIjD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAgBrC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAC9B,CACE,EACE,cAAc,EACd,eAAe,EACf,SAAS,EACT,OAAO,EACP,eAAe,EACf,OAAO,EACP,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,MAAM,EACN,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,YAAY,GACC,EACf,GAAiC,EACjC,EAAE;IACF,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,MAAM,WAAW,GAAG,WAAW,EAAE,CAAC;IAClC,MAAM,EAAE,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,WAAW,CAAC;IACpC,MAAM,gBAAgB,GAAG,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAEzD,IAAI,iBAAiB,GAAG,WAAW,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;IAEtE,IAAI,cAAc,GAAG,IAAI,CAAC;IAC1B,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,IAAI,cAAc,K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C,IAAG,aAAa,CAAO,CACzE,CACP,CAAC,CAAC,CAAC,CACF,0CAAG,aAAa,CAAI,CACrB,CACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,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 { useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport ButtonTrigger from '../../internal/components/button-trigger';\nimport Option from '../../internal/components/option';\nimport { OptionDefinition } from '../../internal/components/option/interfaces';\nimport { FormFieldValidationControlProps } from '../../internal/context/form-field-context';\nimport { useVisualRefresh } from '../../internal/hooks/use-visual-mode';\nimport { joinStrings } from '../../internal/utils/strings';\nimport { MultiselectProps } from '../../multiselect/interfaces';\nimport InternalToken from '../../token/internal';\nimport { SelectProps } from '../interfaces';\nimport { SelectTriggerProps } from '../utils/use-select';\n\nimport styles from './styles.css.js';\n\nexport interface TriggerProps extends FormFieldValidationControlProps {\n placeholder: string | undefined;\n disabled: boolean | undefined;\n readOnly?: boolean;\n triggerProps: SelectTriggerProps;\n selectedOption: OptionDefinition | null;\n inlineLabelText?: string;\n isOpen?: boolean;\n triggerVariant?: SelectProps.TriggerVariant | MultiselectProps.TriggerVariant;\n inFilteringToken?: 'root' | 'nested';\n selectedOptions?: ReadonlyArray<OptionDefinition>;\n renderOption?: SelectProps.SelectOptionItemRenderer;\n}\n\nconst Trigger = React.forwardRef(\n (\n {\n ariaLabelledby,\n ariaDescribedby,\n controlId,\n invalid,\n inlineLabelText,\n warning,\n triggerProps,\n selectedOption,\n selectedOptions,\n triggerVariant,\n inFilteringToken,\n isOpen,\n placeholder,\n disabled,\n readOnly,\n renderOption,\n }: TriggerProps,\n ref: React.Ref<HTMLButtonElement>\n ) => {\n const isVisualRefresh = useVisualRefresh();\n const generatedId = useUniqueId();\n const id = controlId ?? generatedId;\n const triggerContentId = useUniqueId('trigger-content-');\n\n let ariaLabelledbyIds = joinStrings(ariaLabelledby, triggerContentId);\n\n let triggerContent = null;\n let hasCustomContent = false;\n if (triggerVariant === 'tokens') {\n if (selectedOptions?.length) {\n triggerContent = (\n <span\n className={clsx(\n styles['inline-token-trigger'],\n disabled && styles['inline-token-trigger--disabled'],\n isVisualRefresh && styles['visual-refresh']\n )}\n >\n <span className={styles['inline-token-list']}>\n {selectedOptions.map(({ label }, i) => (\n <InternalToken key={i} label={label} variant=\"inline\" disabled={disabled} />\n ))}\n </span>\n <span className={styles['inline-token-counter']} id={triggerContentId}>\n <span className={styles['inline-token-hidden-placeholder']}>{placeholder}</span>\n <span>({selectedOptions.length})</span>\n </span>\n </span>\n );\n ariaLabelledbyIds = ariaLabelledby;\n } else {\n triggerContent = (\n <span className={clsx(styles.placeholder, styles.trigger)} id={triggerContentId}>\n {placeholder}\n </span>\n );\n }\n } else if (!selectedOption) {\n triggerContent = (\n <span className={clsx(styles.placeholder, styles.trigger)} id={triggerContentId}>\n {placeholder}\n </span>\n );\n } else if (triggerVariant === 'option') {\n const triggerCustomContent = renderOption?.({\n filterText: undefined,\n item: {\n type: 'trigger',\n option: selectedOption,\n },\n });\n if (triggerCustomContent) {\n hasCustomContent = true;\n triggerContent = (\n <Option\n customContent={triggerCustomContent}\n id={triggerContentId}\n option={{ ...selectedOption, disabled }}\n triggerVariant={true}\n />\n );\n } else {\n triggerContent = (\n <Option id={triggerContentId} option={{ ...selectedOption, disabled }} triggerVariant={true} />\n );\n }\n } else {\n triggerContent = (\n <span id={triggerContentId} className={styles.trigger}>\n {selectedOption.label || selectedOption.value}\n </span>\n );\n }\n\n const mergedRef = useMergeRefs(triggerProps.ref, ref);\n const triggerButton = (\n <ButtonTrigger\n {...triggerProps}\n id={id}\n ref={mergedRef}\n pressed={!!isOpen}\n disabled={disabled}\n readOnly={readOnly}\n invalid={invalid}\n warning={warning && !invalid}\n inFilteringToken={inFilteringToken}\n inlineTokens={triggerVariant === 'tokens'}\n hasCustomContent={hasCustomContent}\n ariaDescribedby={ariaDescribedby}\n ariaLabelledby={ariaLabelledbyIds}\n >\n {triggerContent}\n </ButtonTrigger>\n );\n return (\n <>\n {inlineLabelText ? (\n <div className={styles['inline-label-wrapper']}>\n <label\n htmlFor={controlId}\n className={clsx(\n styles['inline-label'],\n disabled && styles['inline-label-disabled'],\n triggerVariant === 'tokens' && styles['inline-label-inline-tokens']\n )}\n >\n {inlineLabelText}\n </label>\n <div className={styles['inline-label-trigger-wrapper']}>{triggerButton}</div>\n </div>\n ) : (\n <>{triggerButton}</>\n )}\n </>\n );\n }\n);\n\nexport default Trigger;\n"]}
|