@cloudscape-design/components-themeable 3.0.1091 → 3.0.1092
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/components/option/styles.scss +0 -4
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/badge/index.d.ts.map +1 -1
- package/lib/internal/template/badge/index.js +1 -1
- package/lib/internal/template/badge/index.js.map +1 -1
- package/lib/internal/template/box/interfaces.d.ts +15 -0
- package/lib/internal/template/box/interfaces.d.ts.map +1 -1
- package/lib/internal/template/box/interfaces.js.map +1 -1
- package/lib/internal/template/box/internal.d.ts +1 -1
- package/lib/internal/template/box/internal.d.ts.map +1 -1
- package/lib/internal/template/box/internal.js +3 -5
- package/lib/internal/template/box/internal.js.map +1 -1
- package/lib/internal/template/button/internal.d.ts.map +1 -1
- package/lib/internal/template/button/internal.js +3 -3
- package/lib/internal/template/button/internal.js.map +1 -1
- package/lib/internal/template/checkbox/internal.d.ts.map +1 -1
- package/lib/internal/template/checkbox/internal.js +1 -1
- package/lib/internal/template/checkbox/internal.js.map +1 -1
- package/lib/internal/template/icon/internal.d.ts.map +1 -1
- package/lib/internal/template/icon/internal.js +3 -3
- package/lib/internal/template/icon/internal.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -3
- package/lib/internal/template/internal/components/option/index.js +1 -1
- package/lib/internal/template/internal/components/option/index.js.map +1 -1
- package/lib/internal/template/internal/components/option/option-parts.js +1 -1
- package/lib/internal/template/internal/components/option/option-parts.js.map +1 -1
- package/lib/internal/template/internal/components/option/styles.css.js +16 -17
- package/lib/internal/template/internal/components/option/styles.scoped.css +28 -32
- package/lib/internal/template/internal/components/option/styles.selectors.js +16 -17
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/utils/with-native-attributes.d.ts +1 -0
- package/lib/internal/template/internal/utils/with-native-attributes.d.ts.map +1 -1
- package/lib/internal/template/internal/utils/with-native-attributes.js +2 -2
- package/lib/internal/template/internal/utils/with-native-attributes.js.map +1 -1
- package/lib/internal/template/space-between/interfaces.d.ts +15 -0
- package/lib/internal/template/space-between/interfaces.d.ts.map +1 -1
- package/lib/internal/template/space-between/interfaces.js.map +1 -1
- package/lib/internal/template/space-between/internal.d.ts.map +1 -1
- package/lib/internal/template/space-between/internal.js +3 -2
- package/lib/internal/template/space-between/internal.js.map +1 -1
- package/lib/internal/template/spinner/internal.d.ts.map +1 -1
- package/lib/internal/template/spinner/internal.js +1 -1
- package/lib/internal/template/spinner/internal.js.map +1 -1
- package/package.json +1 -1
|
@@ -99,10 +99,6 @@
|
|
|
99
99
|
flex-shrink: 0;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
.icon-size-big {
|
|
103
|
-
padding-block-start: awsui.$space-option-icon-big-top;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
102
|
.filtering-match-highlight {
|
|
107
103
|
background-color: awsui.$color-background-dropdown-item-filter-match;
|
|
108
104
|
color: awsui.$color-text-dropdown-item-filter-match;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/badge/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,KAAc,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/badge/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,KAAc,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,EAAE,UAAU,eAmBvG"}
|
|
@@ -15,7 +15,7 @@ export default function Badge(_a) {
|
|
|
15
15
|
const { __internalRootRef } = useBaseComponent('Badge', { props: { color } });
|
|
16
16
|
const baseProps = getBaseProps(rest);
|
|
17
17
|
const className = clsx(baseProps.className, styles.badge, styles[`badge-color-${color}`]);
|
|
18
|
-
return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, { tag: "span", nativeAttributes: nativeAttributes, className: className, ref: __internalRootRef, style: getBadgeStyles(style) }), children));
|
|
18
|
+
return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, { tag: "span", componentName: "Badge", nativeAttributes: nativeAttributes, className: className, ref: __internalRootRef, style: getBadgeStyles(style) }), children));
|
|
19
19
|
}
|
|
20
20
|
applyDisplayName(Badge, 'Badge');
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/badge/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAA0E;QAA1E,EAAE,KAAK,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,OAAuB,EAAlB,IAAI,cAA5D,kDAA8D,CAAF;IACxF,MAAM,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9E,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,eAAe,KAAK,EAAE,CAAC,CAAC,CAAC;IAE1F,OAAO,CACL,oBAAC,oBAAoB,oBACf,SAAS,IACb,GAAG,EAAC,MAAM,EACV,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,KAE3B,QAAQ,CACY,CACxB,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,KAAK,EAAE,OAAO,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';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { BadgeProps } from './interfaces';\nimport { getBadgeStyles } from './style';\n\nimport styles from './styles.css.js';\n\nexport { BadgeProps };\n\nexport default function Badge({ color = 'grey', children, style, nativeAttributes, ...rest }: BadgeProps) {\n const { __internalRootRef } = useBaseComponent('Badge', { props: { color } });\n const baseProps = getBaseProps(rest);\n\n const className = clsx(baseProps.className, styles.badge, styles[`badge-color-${color}`]);\n\n return (\n <WithNativeAttributes\n {...baseProps}\n tag=\"span\"\n nativeAttributes={nativeAttributes}\n className={className}\n ref={__internalRootRef}\n style={getBadgeStyles(style)}\n >\n {children}\n </WithNativeAttributes>\n );\n}\n\napplyDisplayName(Badge, 'Badge');\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/badge/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAA0E;QAA1E,EAAE,KAAK,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,OAAuB,EAAlB,IAAI,cAA5D,kDAA8D,CAAF;IACxF,MAAM,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9E,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,eAAe,KAAK,EAAE,CAAC,CAAC,CAAC;IAE1F,OAAO,CACL,oBAAC,oBAAoB,oBACf,SAAS,IACb,GAAG,EAAC,MAAM,EACV,aAAa,EAAC,OAAO,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,KAE3B,QAAQ,CACY,CACxB,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,KAAK,EAAE,OAAO,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';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { BadgeProps } from './interfaces';\nimport { getBadgeStyles } from './style';\n\nimport styles from './styles.css.js';\n\nexport { BadgeProps };\n\nexport default function Badge({ color = 'grey', children, style, nativeAttributes, ...rest }: BadgeProps) {\n const { __internalRootRef } = useBaseComponent('Badge', { props: { color } });\n const baseProps = getBaseProps(rest);\n\n const className = clsx(baseProps.className, styles.badge, styles[`badge-color-${color}`]);\n\n return (\n <WithNativeAttributes\n {...baseProps}\n tag=\"span\"\n componentName=\"Badge\"\n nativeAttributes={nativeAttributes}\n className={className}\n ref={__internalRootRef}\n style={getBadgeStyles(style)}\n >\n {children}\n </WithNativeAttributes>\n );\n}\n\napplyDisplayName(Badge, 'Badge');\n"]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseComponentProps } from '../internal/base-component';
|
|
3
|
+
/**
|
|
4
|
+
* @awsuiSystem core
|
|
5
|
+
*/
|
|
6
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
3
7
|
export interface BoxProps extends BaseComponentProps {
|
|
4
8
|
/**
|
|
5
9
|
* Defines the style of element to display.
|
|
@@ -114,6 +118,17 @@ export interface BoxProps extends BaseComponentProps {
|
|
|
114
118
|
* @displayname content
|
|
115
119
|
*/
|
|
116
120
|
children?: React.ReactNode;
|
|
121
|
+
/**
|
|
122
|
+
* Attributes to add to the native element.
|
|
123
|
+
* Some attributes will be automatically combined with internal attribute values:
|
|
124
|
+
* - `className` will be appended.
|
|
125
|
+
* - Event handlers will be chained, unless the default is prevented.
|
|
126
|
+
*
|
|
127
|
+
* We do not support using this attribute to apply custom styling.
|
|
128
|
+
*
|
|
129
|
+
* @awsuiSystem core
|
|
130
|
+
*/
|
|
131
|
+
nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;
|
|
117
132
|
}
|
|
118
133
|
export declare namespace BoxProps {
|
|
119
134
|
type Variant = 'div' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'p' | 'strong' | 'small' | 'code' | 'pre' | 'samp' | 'awsui-key-label' | 'awsui-gen-ai-label' | 'awsui-value-large';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/box/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/box/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,MAAM,WAAW,QAAS,SAAQ,kBAAkB;IAClD;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC3B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC;IACjD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC;IAClD;;OAEG;IACH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AAC;IAC1B,KAAY,WAAW,GAAG,GAAG,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;IAChG,UAAiB,OAAO;QACtB,GAAG,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;QAC3B,KAAK,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;QAC7B,MAAM,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;QAC9B,IAAI,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;QAC5B,UAAU,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;QAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;KACjC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/box/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface BoxProps extends BaseComponentProps {\n /**\n * Defines the style of element to display.\n *\n * - If you set it to `'div'`, `'span'`, `'h1'`, `'h2'`, `'h3'`, `'h4'`, `'h5'`, `'p'`, `'strong'`, `'small'`, `'code'`, `'pre'`, or `'samp'`, the variant is also used as the HTML tag name.\n * - If you set it to `awsui-key-label`, the component will render a `div`,\n * styled for use as a key label in key-value pairs.\n * - If you set it to `awsui-gen-ai-label`, the component will render a `div`,\n * styled for use as a label indicating that content is produced by generative AI.\n * - If you set it to `awsui-value-large`, the component will render a `span`,\n * styled using \"Display large light\" typography.\n *\n * Override the HTML tag by using property `tagOverride`.\n */\n variant?: BoxProps.Variant;\n /**\n * Overrides the default HTML tag provided by the variant.\n */\n tagOverride?: string;\n /**\n * Overrides the display of the element. You can set it to the following values:\n *\n * - `block` - Specifies block display.\n * - `inline` - Specifies inline display.\n * - `inline-block` - Specifies inline-block display.\n * - `none` - Hides the box.\n *\n * Note: If you don't set it, the display depends on the variant.\n */\n display?: BoxProps.Display;\n /**\n * Adds margins to the element. It can be the following:\n *\n * - A single string with a size. This applies the same margin to all sides (that is, top, right, bottom, left).\n * - An object specifying the size of the margin per side. The object has the following format:\n * ```\n * {\n * top: \"size of top margin\",\n * right: \"size of right margin\",\n * bottom: \"size of bottom margin\",\n * left: \"size of left margin\",\n * horizontal: \"size of left and right margin\",\n * vertical: \"size of top and bottom margin\",\n * }\n * ```\n *\n * The size can be `n`, `xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`, where `n` stands for none.\n * Sizes are automatically scaled down in compact mode.\n *\n * For example, `margin=\"s\"` adds a small margin to all sides.\n * `margin={{ right: \"l\", bottom: \"s\" }}` adds a small margin to the bottom and a large margin to the right.\n */\n margin?: BoxProps.SpacingSize | BoxProps.Spacing;\n /**\n * Adds padding to the element. It can be the following:\n *\n * - A single string with a size. This applies the same padding to all sides (that is, top, right, bottom, left).\n * - An object specifying the size of padding per side. The object has the following format:\n * ```\n * {\n * top: \"size of top padding\",\n * right: \"size of right padding\",\n * bottom: \"size of bottom padding\",\n * left: \"size of left padding\",\n * horizontal: \"size of left and right padding\",\n * vertical: \"size of top and bottom padding\",\n * }\n * ```\n *\n * The size can be `n`, `xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`, where `n` stands for none.\n * Sizes are automatically scaled down in compact mode.\n *\n * For example, `padding=\"s\"` adds small padding to all sides.\n * `padding={{ right: \"l\", bottom: \"s\" }}` adds small padding to the bottom and large padding to the right.\n */\n padding?: BoxProps.SpacingSize | BoxProps.Spacing;\n /**\n * Defines the text alignment within the element. You can set it to `left`, `center`, or `right`.\n */\n textAlign?: BoxProps.TextAlign;\n /**\n * Defines the floating behavior. You can set it to `left` or `right`.\n */\n float?: BoxProps.Float;\n /**\n * Overrides the font size and line height. If not set, the font size and line height depend on the variant.\n */\n fontSize?: BoxProps.FontSize;\n /**\n * Overrides the font weight. If not set, the value depends on the variant.\n * @visualrefresh 'heavy'\n */\n fontWeight?: BoxProps.FontWeight;\n /**\n * Overrides the text color. You can set it to the following values:\n *\n * - `inherit` - Inherits the color from the parent element. For example, use this to style content\n * in Flashbars and to style the `empty` and `noMatch` slots of the Table and Cards components.\n * - `text-label` - Specifies the text color for non-form labels. For example, use it for the key in key/value pairs.\n * - `text-body-secondary` - Specifies the color for secondary text.\n * - `text-status-error` - Specifies the color for error text and icons.\n * - `text-status-success` - Specifies the color for success text and icons.\n * - `text-status-info` - Specifies the color for info text and icon.\n * - `text-status-inactive` - Specifies the color for inactive and loading text and icons.\n * - `text-status-warning` - Specifies the color for warning text and icons.\n *\n * Note: If you don't set it, the text color depends on the variant.\n */\n color?: BoxProps.Color;\n /**\n * Content of the box.\n * @displayname content\n */\n children?: React.ReactNode;\n}\n\nexport namespace BoxProps {\n export type Variant =\n | 'div'\n | 'span'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'p'\n | 'strong'\n | 'small'\n | 'code'\n | 'pre'\n | 'samp'\n | 'awsui-key-label'\n | 'awsui-gen-ai-label'\n | 'awsui-value-large';\n\n export type Display = 'block' | 'inline' | 'inline-block' | 'none';\n export type TextAlign = 'left' | 'center' | 'right';\n export type Float = 'left' | 'right';\n export type FontSize =\n | 'body-s'\n | 'body-m'\n | 'heading-xs'\n | 'heading-s'\n | 'heading-m'\n | 'heading-l'\n | 'heading-xl'\n | 'display-l';\n export type FontWeight = 'light' | 'normal' | 'bold' | 'heavy';\n export type Color =\n | 'inherit'\n | 'text-label'\n | 'text-body-secondary'\n | 'text-status-error'\n | 'text-status-success'\n | 'text-status-info'\n | 'text-status-inactive'\n | 'text-status-warning';\n export type SpacingSize = 'n' | 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';\n export interface Spacing {\n top?: BoxProps.SpacingSize;\n right?: BoxProps.SpacingSize;\n bottom?: BoxProps.SpacingSize;\n left?: BoxProps.SpacingSize;\n horizontal?: BoxProps.SpacingSize;\n vertical?: BoxProps.SpacingSize;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/box/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface BoxProps extends BaseComponentProps {\n /**\n * Defines the style of element to display.\n *\n * - If you set it to `'div'`, `'span'`, `'h1'`, `'h2'`, `'h3'`, `'h4'`, `'h5'`, `'p'`, `'strong'`, `'small'`, `'code'`, `'pre'`, or `'samp'`, the variant is also used as the HTML tag name.\n * - If you set it to `awsui-key-label`, the component will render a `div`,\n * styled for use as a key label in key-value pairs.\n * - If you set it to `awsui-gen-ai-label`, the component will render a `div`,\n * styled for use as a label indicating that content is produced by generative AI.\n * - If you set it to `awsui-value-large`, the component will render a `span`,\n * styled using \"Display large light\" typography.\n *\n * Override the HTML tag by using property `tagOverride`.\n */\n variant?: BoxProps.Variant;\n /**\n * Overrides the default HTML tag provided by the variant.\n */\n tagOverride?: string;\n /**\n * Overrides the display of the element. You can set it to the following values:\n *\n * - `block` - Specifies block display.\n * - `inline` - Specifies inline display.\n * - `inline-block` - Specifies inline-block display.\n * - `none` - Hides the box.\n *\n * Note: If you don't set it, the display depends on the variant.\n */\n display?: BoxProps.Display;\n /**\n * Adds margins to the element. It can be the following:\n *\n * - A single string with a size. This applies the same margin to all sides (that is, top, right, bottom, left).\n * - An object specifying the size of the margin per side. The object has the following format:\n * ```\n * {\n * top: \"size of top margin\",\n * right: \"size of right margin\",\n * bottom: \"size of bottom margin\",\n * left: \"size of left margin\",\n * horizontal: \"size of left and right margin\",\n * vertical: \"size of top and bottom margin\",\n * }\n * ```\n *\n * The size can be `n`, `xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`, where `n` stands for none.\n * Sizes are automatically scaled down in compact mode.\n *\n * For example, `margin=\"s\"` adds a small margin to all sides.\n * `margin={{ right: \"l\", bottom: \"s\" }}` adds a small margin to the bottom and a large margin to the right.\n */\n margin?: BoxProps.SpacingSize | BoxProps.Spacing;\n /**\n * Adds padding to the element. It can be the following:\n *\n * - A single string with a size. This applies the same padding to all sides (that is, top, right, bottom, left).\n * - An object specifying the size of padding per side. The object has the following format:\n * ```\n * {\n * top: \"size of top padding\",\n * right: \"size of right padding\",\n * bottom: \"size of bottom padding\",\n * left: \"size of left padding\",\n * horizontal: \"size of left and right padding\",\n * vertical: \"size of top and bottom padding\",\n * }\n * ```\n *\n * The size can be `n`, `xxxs`, `xxs`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`, where `n` stands for none.\n * Sizes are automatically scaled down in compact mode.\n *\n * For example, `padding=\"s\"` adds small padding to all sides.\n * `padding={{ right: \"l\", bottom: \"s\" }}` adds small padding to the bottom and large padding to the right.\n */\n padding?: BoxProps.SpacingSize | BoxProps.Spacing;\n /**\n * Defines the text alignment within the element. You can set it to `left`, `center`, or `right`.\n */\n textAlign?: BoxProps.TextAlign;\n /**\n * Defines the floating behavior. You can set it to `left` or `right`.\n */\n float?: BoxProps.Float;\n /**\n * Overrides the font size and line height. If not set, the font size and line height depend on the variant.\n */\n fontSize?: BoxProps.FontSize;\n /**\n * Overrides the font weight. If not set, the value depends on the variant.\n * @visualrefresh 'heavy'\n */\n fontWeight?: BoxProps.FontWeight;\n /**\n * Overrides the text color. You can set it to the following values:\n *\n * - `inherit` - Inherits the color from the parent element. For example, use this to style content\n * in Flashbars and to style the `empty` and `noMatch` slots of the Table and Cards components.\n * - `text-label` - Specifies the text color for non-form labels. For example, use it for the key in key/value pairs.\n * - `text-body-secondary` - Specifies the color for secondary text.\n * - `text-status-error` - Specifies the color for error text and icons.\n * - `text-status-success` - Specifies the color for success text and icons.\n * - `text-status-info` - Specifies the color for info text and icon.\n * - `text-status-inactive` - Specifies the color for inactive and loading text and icons.\n * - `text-status-warning` - Specifies the color for warning text and icons.\n *\n * Note: If you don't set it, the text color depends on the variant.\n */\n color?: BoxProps.Color;\n /**\n * Content of the box.\n * @displayname content\n */\n children?: 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 BoxProps {\n export type Variant =\n | 'div'\n | 'span'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'p'\n | 'strong'\n | 'small'\n | 'code'\n | 'pre'\n | 'samp'\n | 'awsui-key-label'\n | 'awsui-gen-ai-label'\n | 'awsui-value-large';\n\n export type Display = 'block' | 'inline' | 'inline-block' | 'none';\n export type TextAlign = 'left' | 'center' | 'right';\n export type Float = 'left' | 'right';\n export type FontSize =\n | 'body-s'\n | 'body-m'\n | 'heading-xs'\n | 'heading-s'\n | 'heading-m'\n | 'heading-l'\n | 'heading-xl'\n | 'display-l';\n export type FontWeight = 'light' | 'normal' | 'bold' | 'heavy';\n export type Color =\n | 'inherit'\n | 'text-label'\n | 'text-body-secondary'\n | 'text-status-error'\n | 'text-status-success'\n | 'text-status-info'\n | 'text-status-inactive'\n | 'text-status-warning';\n export type SpacingSize = 'n' | 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';\n export interface Spacing {\n top?: BoxProps.SpacingSize;\n right?: BoxProps.SpacingSize;\n bottom?: BoxProps.SpacingSize;\n left?: BoxProps.SpacingSize;\n horizontal?: BoxProps.SpacingSize;\n vertical?: BoxProps.SpacingSize;\n }\n}\n"]}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
3
3
|
import { BoxProps } from './interfaces';
|
|
4
4
|
type InternalBoxProps = BoxProps & InternalBaseComponentProps;
|
|
5
|
-
export default function InternalBox({ variant, tagOverride, margin, padding, display, textAlign, float, fontSize, fontWeight, color, children, __internalRootRef, ...props }: InternalBoxProps): JSX.Element;
|
|
5
|
+
export default function InternalBox({ variant, tagOverride, margin, padding, display, textAlign, float, fontSize, fontWeight, color, children, nativeAttributes, __internalRootRef, ...props }: InternalBoxProps): JSX.Element;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/box/internal.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/box/internal.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIxC,KAAK,gBAAgB,GAAG,QAAQ,GAAG,0BAA0B,CAAC;AAE9D,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAe,EACf,WAAW,EACX,MAAW,EACX,OAAY,EACZ,OAAO,EACP,SAAS,EACT,KAAK,EACL,QAAQ,EACR,UAAU,EACV,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,gBAAgB,eAgClB"}
|
|
@@ -4,17 +4,15 @@ import { __rest } from "tslib";
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { getBaseProps } from '../internal/base-component';
|
|
7
|
+
import WithNativeAttributes from '../internal/utils/with-native-attributes';
|
|
7
8
|
import styles from './styles.css.js';
|
|
8
9
|
export default function InternalBox(_a) {
|
|
9
|
-
var { variant = 'div', tagOverride, margin = {}, padding = {}, display, textAlign, float, fontSize, fontWeight, color, children, __internalRootRef } = _a, props = __rest(_a, ["variant", "tagOverride", "margin", "padding", "display", "textAlign", "float", "fontSize", "fontWeight", "color", "children", "__internalRootRef"]);
|
|
10
|
+
var { variant = 'div', tagOverride, margin = {}, padding = {}, display, textAlign, float, fontSize, fontWeight, color, children, nativeAttributes, __internalRootRef } = _a, props = __rest(_a, ["variant", "tagOverride", "margin", "padding", "display", "textAlign", "float", "fontSize", "fontWeight", "color", "children", "nativeAttributes", "__internalRootRef"]);
|
|
10
11
|
const baseProps = getBaseProps(props);
|
|
11
12
|
const marginsClassNamesSuffices = getClassNamesSuffixes(margin);
|
|
12
13
|
const paddingsClassNamesSuffices = getClassNamesSuffixes(padding);
|
|
13
|
-
// This can be any arbitrary string if passed into tagOverride.
|
|
14
|
-
// We appease the compiler with an incorrect type.
|
|
15
|
-
const Tag = getTag(variant, tagOverride);
|
|
16
14
|
const className = clsx(baseProps.className, styles.root, styles.box, styles[`${variant.replace(/^awsui-/, '')}-variant`], marginsClassNamesSuffices.map(suffix => styles[`m-${suffix}`]), paddingsClassNamesSuffices.map(suffix => styles[`p-${suffix}`]), styles[`d-${display}`], styles[`f-${float}`], styles[`color-${color || 'default'}`], styles[`font-size-${fontSize || 'default'}`], styles[`font-weight-${fontWeight || 'default'}`], styles[`t-${textAlign}`]);
|
|
17
|
-
return (React.createElement(
|
|
15
|
+
return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, { tag: getTag(variant, tagOverride), componentName: "Box", nativeAttributes: nativeAttributes, className: className, ref: __internalRootRef }), children));
|
|
18
16
|
}
|
|
19
17
|
const getClassNamesSuffixes = (value) => {
|
|
20
18
|
if (typeof value === 'string') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/box/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/box/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAG5E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAejB;QAfiB,EAClC,OAAO,GAAG,KAAK,EACf,WAAW,EACX,MAAM,GAAG,EAAE,EACX,OAAO,GAAG,EAAE,EACZ,OAAO,EACP,SAAS,EACT,KAAK,EACL,QAAQ,EACR,UAAU,EACV,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,OAEA,EADd,KAAK,cAd0B,wKAenC,CADS;IAER,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,yBAAyB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAChE,MAAM,0BAA0B,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAElE,MAAM,SAAS,GAAG,IAAI,CACpB,SAAS,CAAC,SAAS,EACnB,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,GAAG,EACV,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,EACnD,yBAAyB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,EAC9D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AAI,OAAO,KAAK,mBAAmB,EAAE;QACnC,OAAO,MAAM,CAAC;KACf;IAED,IAAI,OAAO,KAAK,iBAAiB,IAAI,OAAO,KAAK,oBAAoB,EAAE;QACrE,OAAO,KAAK,CAAC;KACd;IAED,OAAO,OAAO,CAAC;AACjB,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 { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { BoxProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype InternalBoxProps = BoxProps & InternalBaseComponentProps;\n\nexport default function InternalBox({\n variant = 'div',\n tagOverride,\n margin = {},\n padding = {},\n display,\n textAlign,\n float,\n fontSize,\n fontWeight,\n color,\n children,\n nativeAttributes,\n __internalRootRef,\n ...props\n}: InternalBoxProps) {\n const baseProps = getBaseProps(props);\n const marginsClassNamesSuffices = getClassNamesSuffixes(margin);\n const paddingsClassNamesSuffices = getClassNamesSuffixes(padding);\n\n const className = clsx(\n baseProps.className,\n styles.root,\n styles.box,\n styles[`${variant.replace(/^awsui-/, '')}-variant`],\n marginsClassNamesSuffices.map(suffix => styles[`m-${suffix}`]),\n paddingsClassNamesSuffices.map(suffix => styles[`p-${suffix}`]),\n styles[`d-${display}`],\n styles[`f-${float}`],\n styles[`color-${color || 'default'}`],\n styles[`font-size-${fontSize || 'default'}`],\n styles[`font-weight-${fontWeight || 'default'}`],\n styles[`t-${textAlign}`]\n );\n\n return (\n <WithNativeAttributes\n {...baseProps}\n tag={getTag(variant, tagOverride)}\n componentName=\"Box\"\n nativeAttributes={nativeAttributes}\n className={className}\n ref={__internalRootRef}\n >\n {children}\n </WithNativeAttributes>\n );\n}\n\nconst getClassNamesSuffixes = (value: BoxProps.SpacingSize | BoxProps.Spacing) => {\n if (typeof value === 'string') {\n return [value];\n }\n const sides = ['top', 'right', 'bottom', 'left', 'horizontal', 'vertical'] as const;\n return sides.filter(side => !!value[side]).map(side => `${side}-${value[side]}`);\n};\n\nconst getTag = (variant: BoxProps.Variant, tagOverride: BoxProps['tagOverride']) => {\n if (tagOverride) {\n return tagOverride;\n }\n\n if (variant === 'awsui-value-large') {\n return 'span';\n }\n\n if (variant === 'awsui-key-label' || variant === 'awsui-gen-ai-label') {\n return 'div';\n }\n\n return variant;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAwB3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAO3C,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG;IAC/D,OAAO,CAAC,EACJ,WAAW,CAAC,SAAS,CAAC,GACtB,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,eAAe,GACf,4BAA4B,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,0BAA0B,CAAC;AAE/B,eAAO,MAAM,cAAc;cAjBrB,WAAW,CAAC,SAAS,CAAC,GACtB,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,eAAe,GACf,4BAA4B;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAwB3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAO3C,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG;IAC/D,OAAO,CAAC,EACJ,WAAW,CAAC,SAAS,CAAC,GACtB,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,eAAe,GACf,4BAA4B,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,0BAA0B,CAAC;AAE/B,eAAO,MAAM,cAAc;cAjBrB,WAAW,CAAC,SAAS,CAAC,GACtB,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,eAAe,GACf,4BAA4B;;;;;;;;;;sEA2TjC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -161,15 +161,15 @@ export const InternalButton = React.forwardRef((_a, ref) => {
|
|
|
161
161
|
return buttonProps.tabIndex;
|
|
162
162
|
};
|
|
163
163
|
return (React.createElement(React.Fragment, null,
|
|
164
|
-
React.createElement(WithNativeAttributes, Object.assign({ tag: "a", nativeAttributes: nativeAnchorAttributes, skipWarnings: __skipNativeAttributesWarnings
|
|
164
|
+
React.createElement(WithNativeAttributes, Object.assign({}, buttonProps, disabledReasonProps, { tag: "a", componentName: "Button", nativeAttributes: nativeAnchorAttributes, skipWarnings: __skipNativeAttributesWarnings, href: isNotInteractive ? undefined : href, role: isNotInteractive ? 'link' : undefined, tabIndex: getAnchorTabIndex(), target: target,
|
|
165
165
|
// security recommendation: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target
|
|
166
|
-
rel: rel !== null && rel !== void 0 ? rel : (target === '_blank' ? 'noopener noreferrer' : undefined), "aria-disabled": isNotInteractive ? true : undefined, download: download
|
|
166
|
+
rel: rel !== null && rel !== void 0 ? rel : (target === '_blank' ? 'noopener noreferrer' : undefined), "aria-disabled": isNotInteractive ? true : undefined, download: download, style: stylePropertiesAndVariables }),
|
|
167
167
|
buttonContent,
|
|
168
168
|
isDisabledWithReason && disabledReasonContent),
|
|
169
169
|
loading && loadingText && (React.createElement(InternalLiveRegion, { tagName: "span", hidden: true }, loadingText))));
|
|
170
170
|
}
|
|
171
171
|
return (React.createElement(React.Fragment, null,
|
|
172
|
-
React.createElement(WithNativeAttributes, Object.assign({ tag: "button", nativeAttributes: nativeButtonAttributes, skipWarnings: __skipNativeAttributesWarnings
|
|
172
|
+
React.createElement(WithNativeAttributes, Object.assign({}, buttonProps, disabledReasonProps, { tag: "button", componentName: "Button", nativeAttributes: nativeButtonAttributes, skipWarnings: __skipNativeAttributesWarnings, type: formAction === 'none' ? 'button' : 'submit', disabled: disabled && !__focusable && !isDisabledWithReason, "aria-disabled": hasAriaDisabled ? true : undefined, style: stylePropertiesAndVariables }),
|
|
173
173
|
buttonContent,
|
|
174
174
|
isDisabledWithReason && disabledReasonContent),
|
|
175
175
|
loading && loadingText && (React.createElement(InternalLiveRegion, { tagName: "span", hidden: true }, loadingText))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAA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IAC5C,WAAW,CACO,CACtB,CACA,CACJ,CAAC;KACH;IAED,OAAO,CACL;QACE,oBAAC,oBAAoB,kBACnB,GAAG,EAAC,QAAQ,EACZ,gBAAgB,EAAE,sBAAsB,EACxC,YAAY,EAAE,8BAA8B,IACxC,WAAW,IACf,IAAI,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EACjD,QAAQ,EAAE,QAAQ,IAAI,CAAC,WAAW,IAAI,CAAC,oBAAoB,mBAC5C,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,IAC7C,mBAAmB,IACvB,KAAK,EAAE,2BAA2B;YAEjC,aAAa;YACb,oBAAoB,IAAI,qBAAqB,CACzB;QACtB,OAAO,IAAI,WAAW,IAAI,CACzB,oBAAC,kBAAkB,IAAC,OAAO,EAAC,MAAM,EAAC,MAAM,EAAE,IAAI,IAC5C,WAAW,CACO,CACtB,CACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { useSingleTabStopNavigation } from '@cloudscape-design/component-toolkit/internal';\nimport {\n getAnalyticsLabelAttribute,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { useInternalI18n } from '../i18n/context';\nimport Icon from '../icon/internal';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FUNNEL_VALUE,\n getFunnelValueSelector,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport Tooltip from '../internal/components/tooltip/index.js';\nimport { useButtonContext } from '../internal/context/button-context';\nimport { fireCancelableEvent, isPlainLeftClick } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport useHiddenDescription from '../internal/hooks/use-hidden-description';\nimport { useModalContextLoadingButtonComponent } from '../internal/hooks/use-modal-component-analytics';\nimport { usePerformanceMarks } from '../internal/hooks/use-performance-marks';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport InternalLiveRegion from '../live-region/internal';\nimport { GeneratedAnalyticsMetadataButtonFragment } from './analytics-metadata/interfaces';\nimport { ButtonIconProps, LeftIcon, RightIcon } from './icon-helper';\nimport { ButtonProps } from './interfaces';\nimport { getButtonStyles } from './style';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport type InternalButtonProps = Omit<ButtonProps, 'variant'> & {\n variant?:\n | ButtonProps['variant']\n | 'flashbar-icon'\n | 'breadcrumb-group'\n | 'menu-trigger'\n | 'modal-dismiss'\n | 'inline-icon-pointer-target';\n badge?: boolean;\n analyticsAction?: string;\n __iconClass?: string;\n __focusable?: boolean;\n __injectAnalyticsComponentMetadata?: boolean;\n __title?: string;\n __emitPerformanceMarks?: boolean;\n __skipNativeAttributesWarnings?: boolean;\n __hideFromTestUtils?: boolean;\n} & InternalBaseComponentProps;\n\nexport const InternalButton = React.forwardRef(\n (\n {\n children,\n iconName,\n __iconClass,\n onClick,\n onFollow,\n iconAlign = 'left',\n iconUrl,\n iconSvg,\n iconAlt,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n wrapText = true,\n href,\n external,\n target: targetOverride,\n rel,\n download,\n formAction = 'submit',\n ariaLabel,\n ariaDescribedby,\n ariaExpanded,\n ariaControls,\n fullWidth,\n badge,\n i18nStrings,\n style,\n nativeButtonAttributes,\n nativeAnchorAttributes,\n __internalRootRef,\n __focusable = false,\n __injectAnalyticsComponentMetadata = false,\n __title,\n __emitPerformanceMarks = true,\n __skipNativeAttributesWarnings,\n __hideFromTestUtils = false,\n analyticsAction = 'click',\n ...props\n }: InternalButtonProps,\n ref: React.Ref<ButtonProps.Ref>\n ) => {\n const [showTooltip, setShowTooltip] = useState(false);\n\n checkSafeUrl('Button', href);\n const isAnchor = Boolean(href);\n const target = targetOverride ?? (external ? '_blank' : undefined);\n const isNotInteractive = loading || disabled;\n const isDisabledWithReason =\n (variant === 'normal' || variant === 'primary' || variant === 'icon') && !!disabledReason && disabled;\n\n const hasAriaDisabled = (loading && !disabled) || (disabled && __focusable) || isDisabledWithReason;\n const shouldHaveContent =\n children &&\n ['icon', 'inline-icon', 'flashbar-icon', 'modal-dismiss', 'inline-icon-pointer-target'].indexOf(variant) === -1;\n\n if ((iconName || iconUrl || iconSvg) && iconAlign === 'right' && external) {\n warnOnce('Button', 'A right-aligned icon should not be combined with an external icon.');\n }\n\n const buttonRef = useRef<HTMLElement>(null);\n useForwardFocus(ref, buttonRef);\n\n const buttonContext = useButtonContext();\n const i18n = useInternalI18n('button');\n\n const uniqueId = useUniqueId('button');\n const { funnelInteractionId } = useFunnel();\n const { stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const performanceMarkAttributes = usePerformanceMarks(\n 'primaryButton',\n () => variant === 'primary' && __emitPerformanceMarks && !loading && !disabled,\n buttonRef,\n () => ({\n loading,\n disabled,\n text: buttonRef.current?.innerText,\n }),\n [loading, disabled]\n );\n useModalContextLoadingButtonComponent(variant === 'primary', loading);\n\n const { targetProps, descriptionEl } = useHiddenDescription(disabledReason);\n\n const handleClick = (event: React.MouseEvent) => {\n if (isNotInteractive) {\n return event.preventDefault();\n }\n\n if (isAnchor && isPlainLeftClick(event)) {\n fireCancelableEvent(onFollow, { href, target }, event);\n\n if ((iconName === 'external' || target === '_blank') && funnelInteractionId) {\n const stepName = getTextFromSelector(stepNameSelector);\n const subStepName = getTextFromSelector(subStepNameSelector);\n\n FunnelMetrics.externalLinkInteracted({\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n elementSelector: getFunnelValueSelector(uniqueId),\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n }\n\n const { altKey, button, ctrlKey, metaKey, shiftKey } = event;\n fireCancelableEvent(onClick, { altKey, button, ctrlKey, metaKey, shiftKey }, event);\n buttonContext.onClick({ variant });\n };\n\n const buttonClass = clsx(props.className, styles.button, styles[`variant-${variant}`], {\n [testUtilStyles.button]: !__hideFromTestUtils,\n [styles.disabled]: isNotInteractive,\n [styles['disabled-with-reason']]: isDisabledWithReason,\n [styles['button-no-wrap']]: !wrapText,\n [styles['button-no-text']]: !shouldHaveContent,\n [styles['full-width']]: shouldHaveContent && fullWidth,\n [styles.link]: isAnchor,\n });\n\n const explicitTabIndex = nativeButtonAttributes?.tabIndex ?? nativeAnchorAttributes?.tabIndex;\n const { tabIndex } = useSingleTabStopNavigation(buttonRef, {\n tabIndex: isAnchor && isNotInteractive && !isDisabledWithReason ? -1 : explicitTabIndex,\n });\n\n const analyticsMetadata: GeneratedAnalyticsMetadataButtonFragment = disabled\n ? {}\n : {\n action: analyticsAction,\n detail: { label: { root: 'self' } },\n };\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = {\n name: 'awsui.Button',\n label: { root: 'self' },\n properties: { variant, disabled: `${disabled}` },\n };\n }\n\n const buttonProps = {\n ...props,\n ...performanceMarkAttributes,\n tabIndex,\n // https://github.com/microsoft/TypeScript/issues/36659\n ref: useMergeRefs(buttonRef, __internalRootRef),\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedby,\n 'aria-expanded': ariaExpanded,\n 'aria-controls': ariaControls,\n // add ariaLabel as `title` as visible hint text\n title: __title ?? ariaLabel,\n className: buttonClass,\n onClick: handleClick,\n [DATA_ATTR_FUNNEL_VALUE]: uniqueId,\n ...getAnalyticsMetadataAttribute(analyticsMetadata),\n ...getAnalyticsLabelAttribute(shouldHaveContent ? `.${analyticsSelectors.label}` : ''),\n } as const;\n\n const iconProps: ButtonIconProps = {\n loading,\n iconName,\n iconAlign,\n iconUrl,\n iconSvg,\n iconAlt,\n variant,\n badge,\n iconClass: __iconClass,\n iconSize: variant === 'modal-dismiss' ? 'medium' : 'normal',\n };\n const buttonContent = (\n <>\n <LeftIcon {...iconProps} />\n {shouldHaveContent && (\n <>\n <span className={clsx(testUtilStyles.content, analyticsSelectors.label)}>{children}</span>\n {external && (\n <>\n \n <Icon\n name=\"external\"\n className={testUtilStyles['external-icon']}\n ariaLabel={i18n('i18nStrings.externalIconAriaLabel', i18nStrings?.externalIconAriaLabel)}\n />\n </>\n )}\n </>\n )}\n <RightIcon {...iconProps} />\n </>\n );\n\n const { loadingButtonCount } = useFunnel();\n useEffect(() => {\n if (loading) {\n loadingButtonCount.current++;\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n loadingButtonCount.current--;\n };\n }\n }, [loading, loadingButtonCount]);\n\n const disabledReasonProps = {\n onFocus: isDisabledWithReason ? () => setShowTooltip(true) : undefined,\n onBlur: isDisabledWithReason ? () => setShowTooltip(false) : undefined,\n onMouseEnter: isDisabledWithReason ? () => setShowTooltip(true) : undefined,\n onMouseLeave: isDisabledWithReason ? () => setShowTooltip(false) : undefined,\n ...(isDisabledWithReason ? targetProps : {}),\n };\n const disabledReasonContent = (\n <>\n {descriptionEl}\n {showTooltip && (\n <Tooltip\n className={testUtilStyles['disabled-reason-tooltip']}\n trackRef={buttonRef}\n value={disabledReason!}\n onDismiss={() => setShowTooltip(false)}\n />\n )}\n </>\n );\n\n const stylePropertiesAndVariables = getButtonStyles(style);\n\n if (isAnchor) {\n const getAnchorTabIndex = () => {\n if (isNotInteractive) {\n // If disabled with a reason, make it focusable so users can access the tooltip\n // Otherwise, resolve to the default button props tabIndex.\n return disabledReason ? 0 : buttonProps.tabIndex;\n }\n return buttonProps.tabIndex;\n };\n\n return (\n <>\n <WithNativeAttributes<HTMLAnchorElement, React.AnchorHTMLAttributes<HTMLAnchorElement>>\n tag=\"a\"\n nativeAttributes={nativeAnchorAttributes}\n skipWarnings={__skipNativeAttributesWarnings}\n {...buttonProps}\n href={isNotInteractive ? undefined : href}\n role={isNotInteractive ? 'link' : undefined}\n tabIndex={getAnchorTabIndex()}\n target={target}\n // security recommendation: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target\n rel={rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined)}\n aria-disabled={isNotInteractive ? true : undefined}\n download={download}\n {...disabledReasonProps}\n style={stylePropertiesAndVariables}\n >\n {buttonContent}\n {isDisabledWithReason && disabledReasonContent}\n </WithNativeAttributes>\n {loading && loadingText && (\n <InternalLiveRegion tagName=\"span\" hidden={true}>\n {loadingText}\n </InternalLiveRegion>\n )}\n </>\n );\n }\n\n return (\n <>\n <WithNativeAttributes<HTMLButtonElement, React.ButtonHTMLAttributes<HTMLButtonElement>>\n tag=\"button\"\n nativeAttributes={nativeButtonAttributes}\n skipWarnings={__skipNativeAttributesWarnings}\n {...buttonProps}\n type={formAction === 'none' ? 'button' : 'submit'}\n disabled={disabled && !__focusable && !isDisabledWithReason}\n aria-disabled={hasAriaDisabled ? true : undefined}\n {...disabledReasonProps}\n style={stylePropertiesAndVariables}\n >\n {buttonContent}\n {isDisabledWithReason && disabledReasonContent}\n </WithNativeAttributes>\n {loading && loadingText && (\n <InternalLiveRegion tagName=\"span\" hidden={true}>\n {loadingText}\n </InternalLiveRegion>\n )}\n </>\n );\n }\n);\n\nexport default InternalButton;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/button/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM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,CACO,CACtB,CACA,CACJ,CAAC;KACH;IAED,OAAO,CACL;QACE,oBAAC,oBAAoB,oBACf,WAAW,EACX,mBAAmB,IACvB,GAAG,EAAC,QAAQ,EACZ,aAAa,EAAC,QAAQ,EACtB,gBAAgB,EAAE,sBAAsB,EACxC,YAAY,EAAE,8BAA8B,EAC5C,IAAI,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EACjD,QAAQ,EAAE,QAAQ,IAAI,CAAC,WAAW,IAAI,CAAC,oBAAoB,mBAC5C,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EACjD,KAAK,EAAE,2BAA2B;YAEjC,aAAa;YACb,oBAAoB,IAAI,qBAAqB,CACzB;QACtB,OAAO,IAAI,WAAW,IAAI,CACzB,oBAAC,kBAAkB,IAAC,OAAO,EAAC,MAAM,EAAC,MAAM,EAAE,IAAI,IAC5C,WAAW,CACO,CACtB,CACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { useSingleTabStopNavigation } from '@cloudscape-design/component-toolkit/internal';\nimport {\n getAnalyticsLabelAttribute,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { useInternalI18n } from '../i18n/context';\nimport Icon from '../icon/internal';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FUNNEL_VALUE,\n getFunnelValueSelector,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport Tooltip from '../internal/components/tooltip/index.js';\nimport { useButtonContext } from '../internal/context/button-context';\nimport { fireCancelableEvent, isPlainLeftClick } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport useHiddenDescription from '../internal/hooks/use-hidden-description';\nimport { useModalContextLoadingButtonComponent } from '../internal/hooks/use-modal-component-analytics';\nimport { usePerformanceMarks } from '../internal/hooks/use-performance-marks';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport InternalLiveRegion from '../live-region/internal';\nimport { GeneratedAnalyticsMetadataButtonFragment } from './analytics-metadata/interfaces';\nimport { ButtonIconProps, LeftIcon, RightIcon } from './icon-helper';\nimport { ButtonProps } from './interfaces';\nimport { getButtonStyles } from './style';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport type InternalButtonProps = Omit<ButtonProps, 'variant'> & {\n variant?:\n | ButtonProps['variant']\n | 'flashbar-icon'\n | 'breadcrumb-group'\n | 'menu-trigger'\n | 'modal-dismiss'\n | 'inline-icon-pointer-target';\n badge?: boolean;\n analyticsAction?: string;\n __iconClass?: string;\n __focusable?: boolean;\n __injectAnalyticsComponentMetadata?: boolean;\n __title?: string;\n __emitPerformanceMarks?: boolean;\n __skipNativeAttributesWarnings?: boolean;\n __hideFromTestUtils?: boolean;\n} & InternalBaseComponentProps;\n\nexport const InternalButton = React.forwardRef(\n (\n {\n children,\n iconName,\n __iconClass,\n onClick,\n onFollow,\n iconAlign = 'left',\n iconUrl,\n iconSvg,\n iconAlt,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n wrapText = true,\n href,\n external,\n target: targetOverride,\n rel,\n download,\n formAction = 'submit',\n ariaLabel,\n ariaDescribedby,\n ariaExpanded,\n ariaControls,\n fullWidth,\n badge,\n i18nStrings,\n style,\n nativeButtonAttributes,\n nativeAnchorAttributes,\n __internalRootRef,\n __focusable = false,\n __injectAnalyticsComponentMetadata = false,\n __title,\n __emitPerformanceMarks = true,\n __skipNativeAttributesWarnings,\n __hideFromTestUtils = false,\n analyticsAction = 'click',\n ...props\n }: InternalButtonProps,\n ref: React.Ref<ButtonProps.Ref>\n ) => {\n const [showTooltip, setShowTooltip] = useState(false);\n\n checkSafeUrl('Button', href);\n const isAnchor = Boolean(href);\n const target = targetOverride ?? (external ? '_blank' : undefined);\n const isNotInteractive = loading || disabled;\n const isDisabledWithReason =\n (variant === 'normal' || variant === 'primary' || variant === 'icon') && !!disabledReason && disabled;\n\n const hasAriaDisabled = (loading && !disabled) || (disabled && __focusable) || isDisabledWithReason;\n const shouldHaveContent =\n children &&\n ['icon', 'inline-icon', 'flashbar-icon', 'modal-dismiss', 'inline-icon-pointer-target'].indexOf(variant) === -1;\n\n if ((iconName || iconUrl || iconSvg) && iconAlign === 'right' && external) {\n warnOnce('Button', 'A right-aligned icon should not be combined with an external icon.');\n }\n\n const buttonRef = useRef<HTMLElement>(null);\n useForwardFocus(ref, buttonRef);\n\n const buttonContext = useButtonContext();\n const i18n = useInternalI18n('button');\n\n const uniqueId = useUniqueId('button');\n const { funnelInteractionId } = useFunnel();\n const { stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const performanceMarkAttributes = usePerformanceMarks(\n 'primaryButton',\n () => variant === 'primary' && __emitPerformanceMarks && !loading && !disabled,\n buttonRef,\n () => ({\n loading,\n disabled,\n text: buttonRef.current?.innerText,\n }),\n [loading, disabled]\n );\n useModalContextLoadingButtonComponent(variant === 'primary', loading);\n\n const { targetProps, descriptionEl } = useHiddenDescription(disabledReason);\n\n const handleClick = (event: React.MouseEvent) => {\n if (isNotInteractive) {\n return event.preventDefault();\n }\n\n if (isAnchor && isPlainLeftClick(event)) {\n fireCancelableEvent(onFollow, { href, target }, event);\n\n if ((iconName === 'external' || target === '_blank') && funnelInteractionId) {\n const stepName = getTextFromSelector(stepNameSelector);\n const subStepName = getTextFromSelector(subStepNameSelector);\n\n FunnelMetrics.externalLinkInteracted({\n funnelInteractionId,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n elementSelector: getFunnelValueSelector(uniqueId),\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n }\n\n const { altKey, button, ctrlKey, metaKey, shiftKey } = event;\n fireCancelableEvent(onClick, { altKey, button, ctrlKey, metaKey, shiftKey }, event);\n buttonContext.onClick({ variant });\n };\n\n const buttonClass = clsx(props.className, styles.button, styles[`variant-${variant}`], {\n [testUtilStyles.button]: !__hideFromTestUtils,\n [styles.disabled]: isNotInteractive,\n [styles['disabled-with-reason']]: isDisabledWithReason,\n [styles['button-no-wrap']]: !wrapText,\n [styles['button-no-text']]: !shouldHaveContent,\n [styles['full-width']]: shouldHaveContent && fullWidth,\n [styles.link]: isAnchor,\n });\n\n const explicitTabIndex = nativeButtonAttributes?.tabIndex ?? nativeAnchorAttributes?.tabIndex;\n const { tabIndex } = useSingleTabStopNavigation(buttonRef, {\n tabIndex: isAnchor && isNotInteractive && !isDisabledWithReason ? -1 : explicitTabIndex,\n });\n\n const analyticsMetadata: GeneratedAnalyticsMetadataButtonFragment = disabled\n ? {}\n : {\n action: analyticsAction,\n detail: { label: { root: 'self' } },\n };\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = {\n name: 'awsui.Button',\n label: { root: 'self' },\n properties: { variant, disabled: `${disabled}` },\n };\n }\n\n const buttonProps = {\n ...props,\n ...performanceMarkAttributes,\n tabIndex,\n // https://github.com/microsoft/TypeScript/issues/36659\n ref: useMergeRefs(buttonRef, __internalRootRef),\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedby,\n 'aria-expanded': ariaExpanded,\n 'aria-controls': ariaControls,\n // add ariaLabel as `title` as visible hint text\n title: __title ?? ariaLabel,\n className: buttonClass,\n onClick: handleClick,\n [DATA_ATTR_FUNNEL_VALUE]: uniqueId,\n ...getAnalyticsMetadataAttribute(analyticsMetadata),\n ...getAnalyticsLabelAttribute(shouldHaveContent ? `.${analyticsSelectors.label}` : ''),\n } as const;\n\n const iconProps: ButtonIconProps = {\n loading,\n iconName,\n iconAlign,\n iconUrl,\n iconSvg,\n iconAlt,\n variant,\n badge,\n iconClass: __iconClass,\n iconSize: variant === 'modal-dismiss' ? 'medium' : 'normal',\n };\n const buttonContent = (\n <>\n <LeftIcon {...iconProps} />\n {shouldHaveContent && (\n <>\n <span className={clsx(testUtilStyles.content, analyticsSelectors.label)}>{children}</span>\n {external && (\n <>\n \n <Icon\n name=\"external\"\n className={testUtilStyles['external-icon']}\n ariaLabel={i18n('i18nStrings.externalIconAriaLabel', i18nStrings?.externalIconAriaLabel)}\n />\n </>\n )}\n </>\n )}\n <RightIcon {...iconProps} />\n </>\n );\n\n const { loadingButtonCount } = useFunnel();\n useEffect(() => {\n if (loading) {\n loadingButtonCount.current++;\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n loadingButtonCount.current--;\n };\n }\n }, [loading, loadingButtonCount]);\n\n const disabledReasonProps = {\n onFocus: isDisabledWithReason ? () => setShowTooltip(true) : undefined,\n onBlur: isDisabledWithReason ? () => setShowTooltip(false) : undefined,\n onMouseEnter: isDisabledWithReason ? () => setShowTooltip(true) : undefined,\n onMouseLeave: isDisabledWithReason ? () => setShowTooltip(false) : undefined,\n ...(isDisabledWithReason ? targetProps : {}),\n };\n const disabledReasonContent = (\n <>\n {descriptionEl}\n {showTooltip && (\n <Tooltip\n className={testUtilStyles['disabled-reason-tooltip']}\n trackRef={buttonRef}\n value={disabledReason!}\n onDismiss={() => setShowTooltip(false)}\n />\n )}\n </>\n );\n\n const stylePropertiesAndVariables = getButtonStyles(style);\n\n if (isAnchor) {\n const getAnchorTabIndex = () => {\n if (isNotInteractive) {\n // If disabled with a reason, make it focusable so users can access the tooltip\n // Otherwise, resolve to the default button props tabIndex.\n return disabledReason ? 0 : buttonProps.tabIndex;\n }\n return buttonProps.tabIndex;\n };\n\n return (\n <>\n <WithNativeAttributes<HTMLAnchorElement, React.AnchorHTMLAttributes<HTMLAnchorElement>>\n {...buttonProps}\n {...disabledReasonProps}\n tag=\"a\"\n componentName=\"Button\"\n nativeAttributes={nativeAnchorAttributes}\n skipWarnings={__skipNativeAttributesWarnings}\n href={isNotInteractive ? undefined : href}\n role={isNotInteractive ? 'link' : undefined}\n tabIndex={getAnchorTabIndex()}\n target={target}\n // security recommendation: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target\n rel={rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined)}\n aria-disabled={isNotInteractive ? true : undefined}\n download={download}\n style={stylePropertiesAndVariables}\n >\n {buttonContent}\n {isDisabledWithReason && disabledReasonContent}\n </WithNativeAttributes>\n {loading && loadingText && (\n <InternalLiveRegion tagName=\"span\" hidden={true}>\n {loadingText}\n </InternalLiveRegion>\n )}\n </>\n );\n }\n\n return (\n <>\n <WithNativeAttributes<HTMLButtonElement, React.ButtonHTMLAttributes<HTMLButtonElement>>\n {...buttonProps}\n {...disabledReasonProps}\n tag=\"button\"\n componentName=\"Button\"\n nativeAttributes={nativeButtonAttributes}\n skipWarnings={__skipNativeAttributesWarnings}\n type={formAction === 'none' ? 'button' : 'submit'}\n disabled={disabled && !__focusable && !isDisabledWithReason}\n aria-disabled={hasAriaDisabled ? true : undefined}\n style={stylePropertiesAndVariables}\n >\n {buttonContent}\n {isDisabledWithReason && disabledReasonContent}\n </WithNativeAttributes>\n {loading && loadingText && (\n <InternalLiveRegion tagName=\"span\" hidden={true}>\n {loadingText}\n </InternalLiveRegion>\n )}\n </>\n );\n }\n);\n\nexport default InternalButton;\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,
|
|
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,CAA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,CAAC,SAAS,mBACjC,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EACzD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,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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AAqB,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 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,
|
|
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"}
|
|
@@ -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,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,IAAI,MAAM,IAAI,EAAE,EAAE;QACvB,OAAO,OAAO,CAAC;KAChB;SAAM;QACL,OAAO,QAAQ,CAAC;KACjB;AACH,CAAC;AAED,MAAM,YAAY,GAAG,CAAC,EAYF,EAAE,EAAE;QAZF,EACpB,IAAI,EACJ,IAAI,GAAG,QAAQ,EACf,OAAO,GAAG,QAAQ,EAClB,GAAG,EACH,GAAG,EACH,SAAS,EACT,GAAG,EACH,KAAK,EACL,gBAAgB,EAChB,iBAAiB,OAEC,EADf,KAAK,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,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,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,IA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on.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-quc8b2:12px;
|
|
610
610
|
--space-modal-content-bottom-pxcvcj:20px;
|
|
611
611
|
--space-modal-horizontal-tieytu:20px;
|
|
612
|
-
--space-option-icon-big-top-ybqefd:2px;
|
|
613
612
|
--space-panel-content-bottom-igtxf0:40px;
|
|
614
613
|
--space-panel-content-top-s8rcdz:20px;
|
|
615
614
|
--space-panel-divider-margin-horizontal-6msb21:12px;
|
|
@@ -1861,7 +1860,6 @@
|
|
|
1861
1860
|
--space-layout-content-bottom-iu1izz:40px;
|
|
1862
1861
|
--space-layout-content-horizontal-q3zhej:24px;
|
|
1863
1862
|
--space-modal-content-bottom-pxcvcj:16px;
|
|
1864
|
-
--space-option-icon-big-top-ybqefd:0px;
|
|
1865
1863
|
--space-panel-divider-margin-horizontal-6msb21:8px;
|
|
1866
1864
|
--space-panel-nav-left-kmy0f5:28px;
|
|
1867
1865
|
--space-panel-side-left-07kpj4:28px;
|
|
@@ -3892,5 +3890,5 @@
|
|
|
3892
3890
|
}
|
|
3893
3891
|
}
|
|
3894
3892
|
:root {
|
|
3895
|
-
--awsui-version-info-
|
|
3893
|
+
--awsui-version-info-52c36f0c: true;
|
|
3896
3894
|
}
|
|
@@ -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:
|
|
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;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,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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:
|
|
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,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACvG,MAAM,IAAI,CACT,8BAAM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,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,
|
|
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,EA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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,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": "
|
|
5
|
-
"disabled": "
|
|
6
|
-
"parent": "
|
|
7
|
-
"highlighted": "
|
|
8
|
-
"content": "
|
|
9
|
-
"label-content": "awsui_label-
|
|
10
|
-
"label": "
|
|
11
|
-
"tag": "
|
|
12
|
-
"label-tag": "awsui_label-
|
|
13
|
-
"label-prefix": "awsui_label-
|
|
14
|
-
"tags": "
|
|
15
|
-
"description": "
|
|
16
|
-
"selected": "
|
|
17
|
-
"icon": "
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"trigger-variant": "awsui_trigger-variant_1p2cx_17ag7_290"
|
|
4
|
+
"option": "awsui_option_1p2cx_k1pkp_153",
|
|
5
|
+
"disabled": "awsui_disabled_1p2cx_k1pkp_190",
|
|
6
|
+
"parent": "awsui_parent_1p2cx_k1pkp_193",
|
|
7
|
+
"highlighted": "awsui_highlighted_1p2cx_k1pkp_196",
|
|
8
|
+
"content": "awsui_content_1p2cx_k1pkp_200",
|
|
9
|
+
"label-content": "awsui_label-content_1p2cx_k1pkp_207",
|
|
10
|
+
"label": "awsui_label_1p2cx_k1pkp_207",
|
|
11
|
+
"tag": "awsui_tag_1p2cx_k1pkp_214",
|
|
12
|
+
"label-tag": "awsui_label-tag_1p2cx_k1pkp_215",
|
|
13
|
+
"label-prefix": "awsui_label-prefix_1p2cx_k1pkp_225",
|
|
14
|
+
"tags": "awsui_tags_1p2cx_k1pkp_238",
|
|
15
|
+
"description": "awsui_description_1p2cx_k1pkp_239",
|
|
16
|
+
"selected": "awsui_selected_1p2cx_k1pkp_250",
|
|
17
|
+
"icon": "awsui_icon_1p2cx_k1pkp_264",
|
|
18
|
+
"filtering-match-highlight": "awsui_filtering-match-highlight_1p2cx_k1pkp_271",
|
|
19
|
+
"trigger-variant": "awsui_trigger-variant_1p2cx_k1pkp_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
|
-
.
|
|
153
|
+
.awsui_option_1p2cx_k1pkp_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
|
-
.
|
|
190
|
+
.awsui_option_1p2cx_k1pkp_153:not(#\9):not(.awsui_disabled_1p2cx_k1pkp_190) {
|
|
191
191
|
cursor: inherit;
|
|
192
192
|
}
|
|
193
|
-
.
|
|
193
|
+
.awsui_option_1p2cx_k1pkp_153.awsui_parent_1p2cx_k1pkp_193:not(#\9) {
|
|
194
194
|
font-weight: bold;
|
|
195
195
|
}
|
|
196
|
-
.
|
|
196
|
+
.awsui_option_1p2cx_k1pkp_153.awsui_parent_1p2cx_k1pkp_193:not(#\9):not(.awsui_disabled_1p2cx_k1pkp_190):not(.awsui_highlighted_1p2cx_k1pkp_196) {
|
|
197
197
|
color: var(--color-text-dropdown-group-label-7pa4nd, #545b64);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
.
|
|
200
|
+
.awsui_content_1p2cx_k1pkp_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-
|
|
207
|
+
.awsui_label-content_1p2cx_k1pkp_207:not(#\9) {
|
|
208
208
|
display: flex;
|
|
209
209
|
justify-content: space-between;
|
|
210
210
|
flex-wrap: wrap;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
.
|
|
214
|
-
.
|
|
215
|
-
.awsui_label-
|
|
213
|
+
.awsui_label_1p2cx_k1pkp_207:not(#\9),
|
|
214
|
+
.awsui_tag_1p2cx_k1pkp_214:not(#\9),
|
|
215
|
+
.awsui_label-tag_1p2cx_k1pkp_215:not(#\9) {
|
|
216
216
|
min-inline-size: 0;
|
|
217
217
|
word-break: break-word;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
.
|
|
221
|
-
.
|
|
220
|
+
.awsui_label_1p2cx_k1pkp_207:not(#\9),
|
|
221
|
+
.awsui_tag_1p2cx_k1pkp_214:not(#\9) {
|
|
222
222
|
flex-wrap: wrap;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
.awsui_label-
|
|
225
|
+
.awsui_label-prefix_1p2cx_k1pkp_225:not(#\9) {
|
|
226
226
|
font-weight: 700;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
.awsui_label-
|
|
229
|
+
.awsui_label-tag_1p2cx_k1pkp_215:not(#\9) {
|
|
230
230
|
padding-inline-start: var(--space-s-4a5hs8, 12px);
|
|
231
231
|
flex: auto;
|
|
232
232
|
text-align: end;
|
|
233
233
|
}
|
|
234
|
-
.awsui_label-
|
|
234
|
+
.awsui_label-tag_1p2cx_k1pkp_215:not(#\9):empty {
|
|
235
235
|
display: none;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
.
|
|
239
|
-
.
|
|
238
|
+
.awsui_tags_1p2cx_k1pkp_238:not(#\9),
|
|
239
|
+
.awsui_description_1p2cx_k1pkp_239:not(#\9) {
|
|
240
240
|
font-size: var(--font-size-body-s-psgqn2, 12px);
|
|
241
241
|
line-height: var(--line-height-body-s-otgtsr, 16px);
|
|
242
242
|
letter-spacing: var(--letter-spacing-body-s-egrcsd, normal);
|
|
243
243
|
color: var(--color-text-dropdown-item-secondary-fi0yxi, #687078);
|
|
244
244
|
flex-wrap: wrap;
|
|
245
245
|
}
|
|
246
|
-
.
|
|
247
|
-
.
|
|
246
|
+
.awsui_tags_1p2cx_k1pkp_238.awsui_highlighted_1p2cx_k1pkp_196:not(#\9),
|
|
247
|
+
.awsui_description_1p2cx_k1pkp_239.awsui_highlighted_1p2cx_k1pkp_196:not(#\9) {
|
|
248
248
|
color: var(--color-text-dropdown-item-secondary-hover-p5zsls, #687078);
|
|
249
249
|
}
|
|
250
|
-
.
|
|
251
|
-
.
|
|
250
|
+
.awsui_tags_1p2cx_k1pkp_238.awsui_selected_1p2cx_k1pkp_250:not(#\9),
|
|
251
|
+
.awsui_description_1p2cx_k1pkp_239.awsui_selected_1p2cx_k1pkp_250:not(#\9) {
|
|
252
252
|
color: var(--color-text-dropdown-item-secondary-fi0yxi, #687078);
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
.
|
|
255
|
+
.awsui_tags_1p2cx_k1pkp_238:not(#\9) {
|
|
256
256
|
display: flex;
|
|
257
257
|
align-items: stretch;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
.
|
|
260
|
+
.awsui_tag_1p2cx_k1pkp_214:not(#\9):not(:last-child) {
|
|
261
261
|
padding-inline-end: var(--space-m-n2lypl, 16px);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
.
|
|
264
|
+
.awsui_icon_1p2cx_k1pkp_264:not(#\9) {
|
|
265
265
|
padding-inline-end: var(--space-xs-kw7k3v, 8px);
|
|
266
266
|
align-content: center;
|
|
267
267
|
display: flex;
|
|
268
268
|
flex-shrink: 0;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
.
|
|
272
|
-
padding-block-start: var(--space-option-icon-big-top-ybqefd, 2px);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.awsui_filtering-match-highlight_1p2cx_17ag7_275:not(#\9) {
|
|
271
|
+
.awsui_filtering-match-highlight_1p2cx_k1pkp_271:not(#\9) {
|
|
276
272
|
background-color: var(--color-background-dropdown-item-filter-match-eq1r00, #f1faff);
|
|
277
273
|
color: var(--color-text-dropdown-item-filter-match-5ifrfz, #0073bb);
|
|
278
274
|
font-weight: bold;
|
|
279
275
|
}
|
|
280
276
|
|
|
281
|
-
.
|
|
277
|
+
.awsui_disabled_1p2cx_k1pkp_190:not(#\9) {
|
|
282
278
|
color: var(--color-text-dropdown-item-disabled-oysy8n, #aab7b8);
|
|
283
279
|
pointer-events: none;
|
|
284
280
|
}
|
|
285
|
-
.
|
|
286
|
-
.
|
|
281
|
+
.awsui_disabled_1p2cx_k1pkp_190 > .awsui_content_1p2cx_k1pkp_200 > .awsui_tags_1p2cx_k1pkp_238:not(#\9),
|
|
282
|
+
.awsui_disabled_1p2cx_k1pkp_190 > .awsui_content_1p2cx_k1pkp_200 > .awsui_description_1p2cx_k1pkp_239:not(#\9) {
|
|
287
283
|
color: currentColor;
|
|
288
284
|
}
|
|
289
285
|
|
|
290
|
-
.awsui_trigger-
|
|
286
|
+
.awsui_trigger-variant_1p2cx_k1pkp_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": "
|
|
6
|
-
"disabled": "
|
|
7
|
-
"parent": "
|
|
8
|
-
"highlighted": "
|
|
9
|
-
"content": "
|
|
10
|
-
"label-content": "awsui_label-
|
|
11
|
-
"label": "
|
|
12
|
-
"tag": "
|
|
13
|
-
"label-tag": "awsui_label-
|
|
14
|
-
"label-prefix": "awsui_label-
|
|
15
|
-
"tags": "
|
|
16
|
-
"description": "
|
|
17
|
-
"selected": "
|
|
18
|
-
"icon": "
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"trigger-variant": "awsui_trigger-variant_1p2cx_17ag7_290"
|
|
5
|
+
"option": "awsui_option_1p2cx_k1pkp_153",
|
|
6
|
+
"disabled": "awsui_disabled_1p2cx_k1pkp_190",
|
|
7
|
+
"parent": "awsui_parent_1p2cx_k1pkp_193",
|
|
8
|
+
"highlighted": "awsui_highlighted_1p2cx_k1pkp_196",
|
|
9
|
+
"content": "awsui_content_1p2cx_k1pkp_200",
|
|
10
|
+
"label-content": "awsui_label-content_1p2cx_k1pkp_207",
|
|
11
|
+
"label": "awsui_label_1p2cx_k1pkp_207",
|
|
12
|
+
"tag": "awsui_tag_1p2cx_k1pkp_214",
|
|
13
|
+
"label-tag": "awsui_label-tag_1p2cx_k1pkp_215",
|
|
14
|
+
"label-prefix": "awsui_label-prefix_1p2cx_k1pkp_225",
|
|
15
|
+
"tags": "awsui_tags_1p2cx_k1pkp_238",
|
|
16
|
+
"description": "awsui_description_1p2cx_k1pkp_239",
|
|
17
|
+
"selected": "awsui_selected_1p2cx_k1pkp_250",
|
|
18
|
+
"icon": "awsui_icon_1p2cx_k1pkp_264",
|
|
19
|
+
"filtering-match-highlight": "awsui_filtering-match-highlight_1p2cx_k1pkp_271",
|
|
20
|
+
"trigger-variant": "awsui_trigger-variant_1p2cx_k1pkp_286"
|
|
22
21
|
};
|
|
23
22
|
|
|
@@ -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 (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;
|
|
@@ -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;
|
|
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(
|
|
31
|
+
warnOnce(componentName, `Overriding native attribute [${key}] which has a Cloudscape-provided value`);
|
|
32
32
|
}
|
|
33
33
|
acc[key] = value;
|
|
34
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-native-attributes.js","sourceRoot":"","sources":["../../../../src/internal/utils/with-native-attributes.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"with-native-attributes.js","sourceRoot":"","sources":["../../../../src/internal/utils/with-native-attributes.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAmBzE,eAAe,KAAK,CAAC,UAAU,CAC7B,CACE,EAAoG,EACpG,GAAkB,EAClB,EAAE;QAFF,EAAE,GAAG,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,OAAsC,EAAjC,IAAI,cAAvE,wEAAyE,CAAF;IAGvE,MAAM,GAAG,GAAG,GAAG,CAAC;IAEhB,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC9F,wBAAwB;QACxB,IAAI,GAAG,KAAK,WAAW,EAAE;YACvB,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YAEvC,cAAc;SACf;aAAM,IAAI,GAAG,KAAK,OAAO,EAAE;YAC1B,GAAG,CAAC,GAAG,CAAC,mCAAQ,IAAI,CAAC,KAAK,GAAK,KAAK,CAAE,CAAC;YAEvC,uBAAuB;SACxB;aAAM,IAAI,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,OAAO,KAAK,KAAK,UAAU,IAAI,GAAG,IAAI,IAAI,EAAE;YAC9E,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,KAAY,EAAE,EAAE;gBAC1B,KAAK,CAAC,KAAK,CAAC,CAAC;gBACb,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE;oBAC1B,IAAY,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;iBAC3B;YACH,CAAC,CAAC;YAEF,0DAA0D;SAC3D;aAAM;YACL,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,YAAY,EAAE;gBAChC,QAAQ,CAAC,aAAa,EAAE,gCAAgC,GAAG,yCAAyC,CAAC,CAAC;aACvG;YACD,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SAClB;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAS,CAAC,CAAC;IAEd,OAAO,CACL,oBAAC,GAAG,oBAAK,IAAI,EAAM,mBAAmB,IAAE,GAAG,EAAE,GAAG,KAC7C,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CACgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ReactNode } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nexport type NativeAttributes<T extends React.HTMLAttributes<HTMLElement>> =\n | (Omit<T, 'children'> & Record<`data-${string}`, string>)\n | undefined;\n\ntype NativeAttributesProps<AT extends React.HTMLAttributes<HTMLElement>> = {\n tag: string;\n children?: ReactNode;\n skipWarnings?: boolean;\n nativeAttributes: NativeAttributes<AT>;\n componentName: string;\n} & NativeAttributes<AT>;\ninterface ForwardRefType {\n <ET extends HTMLElement, AT extends React.HTMLAttributes<ET>>(\n props: NativeAttributesProps<AT> & { ref?: React.Ref<ET> }\n ): JSX.Element;\n}\n\nexport default React.forwardRef(\n <ET extends HTMLElement, AT extends React.HTMLAttributes<ET>>(\n { tag, nativeAttributes, children, skipWarnings, componentName, ...rest }: NativeAttributesProps<AT>,\n ref: React.Ref<ET>\n ) => {\n const Tag = tag;\n\n const processedAttributes = Object.entries(nativeAttributes || {}).reduce((acc, [key, value]) => {\n // concatenate className\n if (key === 'className') {\n acc[key] = clsx(rest.className, value);\n\n // merge style\n } else if (key === 'style') {\n acc[key] = { ...rest.style, ...value };\n\n // chain event handlers\n } else if (key.match(/^on[A-Z]/) && typeof value === 'function' && key in rest) {\n acc[key] = (event: Event) => {\n value(event);\n if (!event.defaultPrevented) {\n (rest as any)[key](event);\n }\n };\n\n // override other attributes, warning if it already exists\n } else {\n if (key in rest && !skipWarnings) {\n warnOnce(componentName, `Overriding native attribute [${key}] which has a Cloudscape-provided value`);\n }\n acc[key] = value;\n }\n return acc;\n }, {} as any);\n\n return (\n <Tag {...rest} {...processedAttributes} ref={ref}>\n {children}\n </Tag>\n );\n }\n) as ForwardRefType;\n"]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseComponentProps } from '../internal/base-component';
|
|
3
|
+
/**
|
|
4
|
+
* @awsuiSystem core
|
|
5
|
+
*/
|
|
6
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
3
7
|
export interface SpaceBetweenProps extends BaseComponentProps {
|
|
4
8
|
/**
|
|
5
9
|
* Defines the direction in which the content is laid out.
|
|
@@ -17,6 +21,17 @@ export interface SpaceBetweenProps extends BaseComponentProps {
|
|
|
17
21
|
* Determines how the child elements will be aligned based on the [align-items](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) property of the CSS Flexbox.
|
|
18
22
|
*/
|
|
19
23
|
alignItems?: SpaceBetweenProps.AlignItems;
|
|
24
|
+
/**
|
|
25
|
+
* Attributes to add to the native element.
|
|
26
|
+
* Some attributes will be automatically combined with internal attribute values:
|
|
27
|
+
* - `className` will be appended.
|
|
28
|
+
* - Event handlers will be chained, unless the default is prevented.
|
|
29
|
+
*
|
|
30
|
+
* We do not support using this attribute to apply custom styling.
|
|
31
|
+
*
|
|
32
|
+
* @awsuiSystem core
|
|
33
|
+
*/
|
|
34
|
+
nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLDivElement>>;
|
|
20
35
|
}
|
|
21
36
|
export declare namespace SpaceBetweenProps {
|
|
22
37
|
type Direction = 'vertical' | 'horizontal';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/space-between/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/space-between/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D;;OAEG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC;IAExC;;OAEG;IACH,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC;IAE1C;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC;CAC3E;AAED,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;IAElD,KAAY,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC;IAE1E,KAAY,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;CACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/space-between/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface SpaceBetweenProps extends BaseComponentProps {\n /**\n * Defines the direction in which the content is laid out.\n */\n direction?: SpaceBetweenProps.Direction;\n\n /**\n * Defines the spacing between the individual items of the content.\n */\n size: SpaceBetweenProps.Size;\n\n /**\n * Content of this component.\n */\n children?: React.ReactNode;\n\n /**\n * Determines how the child elements will be aligned based on the [align-items](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) property of the CSS Flexbox.\n */\n alignItems?: SpaceBetweenProps.AlignItems;\n}\n\nexport namespace SpaceBetweenProps {\n export type Direction = 'vertical' | 'horizontal';\n\n export type Size = 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';\n\n export type AlignItems = 'center' | 'start' | 'end';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/space-between/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface SpaceBetweenProps extends BaseComponentProps {\n /**\n * Defines the direction in which the content is laid out.\n */\n direction?: SpaceBetweenProps.Direction;\n\n /**\n * Defines the spacing between the individual items of the content.\n */\n size: SpaceBetweenProps.Size;\n\n /**\n * Content of this component.\n */\n children?: React.ReactNode;\n\n /**\n * Determines how the child elements will be aligned based on the [align-items](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) property of the CSS Flexbox.\n */\n alignItems?: SpaceBetweenProps.AlignItems;\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<HTMLDivElement>>;\n}\n\nexport namespace SpaceBetweenProps {\n export type Direction = 'vertical' | 'horizontal';\n\n export type Size = 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';\n\n export type AlignItems = 'center' | 'start' | 'end';\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/space-between/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAO1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/space-between/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAO1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMjD,QAAA,MAAM,oBAAoB,uHAgDzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -6,16 +6,17 @@ import flattenChildren from 'react-keyed-flatten-children';
|
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';
|
|
8
8
|
import { getBaseProps } from '../internal/base-component';
|
|
9
|
+
import WithNativeAttributes from '../internal/utils/with-native-attributes';
|
|
9
10
|
import styles from './styles.css.js';
|
|
10
11
|
const InternalSpaceBetween = forwardRef((_a, ref) => {
|
|
11
|
-
var { direction = 'vertical', size, children, alignItems, __internalRootRef } = _a, props = __rest(_a, ["direction", "size", "children", "alignItems", "__internalRootRef"]);
|
|
12
|
+
var { direction = 'vertical', size, children, alignItems, nativeAttributes, __internalRootRef } = _a, props = __rest(_a, ["direction", "size", "children", "alignItems", "nativeAttributes", "__internalRootRef"]);
|
|
12
13
|
const mergedRef = useMergeRefs(ref, __internalRootRef);
|
|
13
14
|
const baseProps = getBaseProps(props);
|
|
14
15
|
/*
|
|
15
16
|
Flattening the children allows us to "see through" React Fragments and nested arrays.
|
|
16
17
|
*/
|
|
17
18
|
const flattenedChildren = flattenChildren(children);
|
|
18
|
-
return (React.createElement(
|
|
19
|
+
return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, { tag: "div", componentName: "SpaceBetween", nativeAttributes: nativeAttributes, className: clsx(baseProps.className, styles.root, styles[direction], styles[`${direction}-${size}`], alignItems && styles[`align-${alignItems}`]), ref: mergedRef }), flattenedChildren.map(child => {
|
|
19
20
|
const key = typeof child === 'object' ? child.key : undefined;
|
|
20
21
|
return (React.createElement("div", { key: key, className: styles.child }, child));
|
|
21
22
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/space-between/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/space-between/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAA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AC,CAAC,CACmB,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef } from 'react';\nimport flattenChildren from 'react-keyed-flatten-children';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { SpaceBetweenProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype InternalSpaceBetweenProps = SpaceBetweenProps & InternalBaseComponentProps;\n\nconst InternalSpaceBetween = forwardRef(\n (\n {\n direction = 'vertical',\n size,\n children,\n alignItems,\n nativeAttributes,\n __internalRootRef,\n ...props\n }: InternalSpaceBetweenProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const mergedRef = useMergeRefs(ref, __internalRootRef);\n const baseProps = getBaseProps(props);\n\n /*\n Flattening the children allows us to \"see through\" React Fragments and nested arrays.\n */\n const flattenedChildren = flattenChildren(children);\n\n return (\n <WithNativeAttributes\n {...baseProps}\n tag=\"div\"\n componentName=\"SpaceBetween\"\n nativeAttributes={nativeAttributes}\n className={clsx(\n baseProps.className,\n styles.root,\n styles[direction],\n styles[`${direction}-${size}`],\n alignItems && styles[`align-${alignItems}`]\n )}\n ref={mergedRef}\n >\n {flattenedChildren.map(child => {\n const key = typeof child === 'object' ? child.key : undefined;\n\n return (\n <div key={key} className={styles.child}>\n {child}\n </div>\n );\n })}\n </WithNativeAttributes>\n );\n }\n);\n\nexport default InternalSpaceBetween;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/spinner/internal.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C,UAAU,oBAAqB,SAAQ,YAAY,EAAE,0BAA0B;CAAG;AAElF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,IAAe,EACf,OAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/spinner/internal.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C,UAAU,oBAAqB,SAAQ,YAAY,EAAE,0BAA0B;CAAG;AAElF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,IAAe,EACf,OAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,oBAAoB,eAgBtB"}
|
|
@@ -11,7 +11,7 @@ export default function InternalSpinner(_a) {
|
|
|
11
11
|
var { size = 'normal', variant = 'normal', nativeAttributes, __internalRootRef } = _a, props = __rest(_a, ["size", "variant", "nativeAttributes", "__internalRootRef"]);
|
|
12
12
|
const baseProps = getBaseProps(props);
|
|
13
13
|
useModalContextLoadingComponent();
|
|
14
|
-
return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, { tag: "span", nativeAttributes: nativeAttributes, className: clsx(baseProps.className, styles.root, styles[`size-${size}`], styles[`variant-${variant}`]), ref: __internalRootRef }),
|
|
14
|
+
return (React.createElement(WithNativeAttributes, Object.assign({}, baseProps, { tag: "span", componentName: "Spinner", nativeAttributes: nativeAttributes, className: clsx(baseProps.className, styles.root, styles[`size-${size}`], styles[`variant-${variant}`]), ref: __internalRootRef }),
|
|
15
15
|
React.createElement("span", { className: clsx(styles.circle, styles['circle-left']) }),
|
|
16
16
|
React.createElement("span", { className: clsx(styles.circle, styles['circle-right']) })));
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/spinner/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,iDAAiD,CAAC;AAClG,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAG5E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAMjB;QANiB,EACtC,IAAI,GAAG,QAAQ,EACf,OAAO,GAAG,QAAQ,EAClB,gBAAgB,EAChB,iBAAiB,OAEI,EADlB,KAAK,cAL8B,4DAMvC,CADS;IAER,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,+BAA+B,EAAE,CAAC;IAClC,OAAO,CACL,oBAAC,oBAAoB,oBACf,SAAS,IACb,GAAG,EAAC,MAAM,EACV,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC,EACvG,GAAG,EAAE,iBAAiB;QAEtB,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,GAAI;QAC/D,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,GAAI,CAC3C,CACxB,CAAC;AACJ,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 { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useModalContextLoadingComponent } from '../internal/hooks/use-modal-component-analytics';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { SpinnerProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface InternalSpinnerProps extends SpinnerProps, InternalBaseComponentProps {}\n\nexport default function InternalSpinner({\n size = 'normal',\n variant = 'normal',\n nativeAttributes,\n __internalRootRef,\n ...props\n}: InternalSpinnerProps) {\n const baseProps = getBaseProps(props);\n useModalContextLoadingComponent();\n return (\n <WithNativeAttributes\n {...baseProps}\n tag=\"span\"\n nativeAttributes={nativeAttributes}\n className={clsx(baseProps.className, styles.root, styles[`size-${size}`], styles[`variant-${variant}`])}\n ref={__internalRootRef}\n >\n <span className={clsx(styles.circle, styles['circle-left'])} />\n <span className={clsx(styles.circle, styles['circle-right'])} />\n </WithNativeAttributes>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/spinner/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,iDAAiD,CAAC;AAClG,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAG5E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAMjB;QANiB,EACtC,IAAI,GAAG,QAAQ,EACf,OAAO,GAAG,QAAQ,EAClB,gBAAgB,EAChB,iBAAiB,OAEI,EADlB,KAAK,cAL8B,4DAMvC,CADS;IAER,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACtC,+BAA+B,EAAE,CAAC;IAClC,OAAO,CACL,oBAAC,oBAAoB,oBACf,SAAS,IACb,GAAG,EAAC,MAAM,EACV,aAAa,EAAC,SAAS,EACvB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC,EACvG,GAAG,EAAE,iBAAiB;QAEtB,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,GAAI;QAC/D,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,GAAI,CAC3C,CACxB,CAAC;AACJ,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 { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useModalContextLoadingComponent } from '../internal/hooks/use-modal-component-analytics';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { SpinnerProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface InternalSpinnerProps extends SpinnerProps, InternalBaseComponentProps {}\n\nexport default function InternalSpinner({\n size = 'normal',\n variant = 'normal',\n nativeAttributes,\n __internalRootRef,\n ...props\n}: InternalSpinnerProps) {\n const baseProps = getBaseProps(props);\n useModalContextLoadingComponent();\n return (\n <WithNativeAttributes\n {...baseProps}\n tag=\"span\"\n componentName=\"Spinner\"\n nativeAttributes={nativeAttributes}\n className={clsx(baseProps.className, styles.root, styles[`size-${size}`], styles[`variant-${variant}`])}\n ref={__internalRootRef}\n >\n <span className={clsx(styles.circle, styles['circle-left'])} />\n <span className={clsx(styles.circle, styles['circle-right'])} />\n </WithNativeAttributes>\n );\n}\n"]}
|