@cloudscape-design/components-themeable 3.0.1226 → 3.0.1227
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/scss/modal/styles.scss +1 -6
- package/lib/internal/template/autosuggest/autosuggest-option.js +3 -3
- package/lib/internal/template/autosuggest/autosuggest-option.js.map +1 -1
- package/lib/internal/template/autosuggest/options-controller.js +2 -1
- package/lib/internal/template/autosuggest/options-controller.js.map +1 -1
- package/lib/internal/template/autosuggest/utils/utils.js +1 -1
- package/lib/internal/template/autosuggest/utils/utils.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/option/utils/filter-options.d.ts.map +1 -1
- package/lib/internal/template/internal/components/option/utils/filter-options.js +4 -1
- package/lib/internal/template/internal/components/option/utils/filter-options.js.map +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/modal/internal.js +1 -1
- package/lib/internal/template/modal/internal.js.map +1 -1
- package/lib/internal/template/modal/styles.css.js +31 -31
- package/lib/internal/template/modal/styles.scoped.css +46 -50
- package/lib/internal/template/modal/styles.selectors.js +31 -31
- package/lib/internal/template/modal/use-modal-dimensions.d.ts.map +1 -1
- package/lib/internal/template/modal/use-modal-dimensions.js +8 -2
- package/lib/internal/template/modal/use-modal-dimensions.js.map +1 -1
- package/lib/internal/template/select/utils/check-option-value-field.d.ts.map +1 -1
- package/lib/internal/template/select/utils/check-option-value-field.js +2 -0
- package/lib/internal/template/select/utils/check-option-value-field.js.map +1 -1
- package/lib/internal/template/table/tools-header.d.ts.map +1 -1
- package/lib/internal/template/table/tools-header.js +3 -2
- package/lib/internal/template/table/tools-header.js.map +1 -1
- package/package.json +1 -1
|
@@ -162,12 +162,7 @@ $modal-z-index: 5000;
|
|
|
162
162
|
inset-block-end: 0;
|
|
163
163
|
z-index: 800;
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
border-end-start-radius: awsui.$border-radius-container;
|
|
167
|
-
border-end-end-radius: awsui.$border-radius-container;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
&--stuck {
|
|
165
|
+
&--rounded {
|
|
171
166
|
border-start-start-radius: 0;
|
|
172
167
|
border-start-end-radius: 0;
|
|
173
168
|
border-end-start-radius: awsui.$border-radius-container;
|
|
@@ -43,9 +43,9 @@ const toAutosuggestUseEnteredItem = (props) => {
|
|
|
43
43
|
};
|
|
44
44
|
const AutosuggestOption = ({ index, virtualIndex, nativeAttributes = {}, highlightText, option, highlighted, highlightType, current, virtualPosition, padBottom, screenReaderContent, ariaSetsize, ariaPosinset, renderOption, parentProps, ...rest }, ref) => {
|
|
45
45
|
const baseProps = getBaseProps(rest);
|
|
46
|
-
const useEntered =
|
|
47
|
-
const isParent =
|
|
48
|
-
const isChild =
|
|
46
|
+
const useEntered = option.type === 'use-entered';
|
|
47
|
+
const isParent = option.type === 'parent';
|
|
48
|
+
const isChild = option.type === 'child';
|
|
49
49
|
const { throughIndex, inGroupIndex, groupIndex } = getTestOptionIndexes(option) || {};
|
|
50
50
|
let optionContent;
|
|
51
51
|
if (useEntered) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autosuggest-option.js","sourceRoot":"","sources":["../../../src/autosuggest/autosuggest-option.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAsB,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAE9F,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAGpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AA2BrC,MAAM,4BAA4B,GAA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O,EAAE,OAAO,EAChB,eAAe,EAAE,eAAe,qBACf,YAAY,yBACR,YAAY,sBACf,UAAU,EAC5B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,CAAC,IAAI,EACjC,KAAK,EAAE,MAAM,CAAC,KAAK,IAElB,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAC9B,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps, getBaseProps } from '../internal/base-component';\nimport OptionComponent from '../internal/components/option';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { getTestOptionIndexes } from '../internal/components/options-list/utils/test-indexes';\nimport { HighlightType } from '../internal/components/options-list/utils/use-highlight-option';\nimport SelectableItem from '../internal/components/selectable-item';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface AutosuggestOptionProps extends BaseComponentProps {\n index: number;\n virtualIndex?: number;\n nativeAttributes?: React.HTMLAttributes<HTMLDivElement>;\n highlightText: string;\n option: AutosuggestItem;\n highlighted: boolean;\n highlightType: HighlightType;\n current: boolean;\n virtualPosition?: number;\n padBottom?: boolean;\n screenReaderContent?: string;\n ariaSetsize?: number;\n ariaPosinset?: number;\n renderOption?: AutosuggestProps.ItemRenderer;\n parentProps?: AutosuggestRenderItemParentProps;\n}\n\nexport interface AutosuggestRenderItemParentProps {\n index: number;\n virtualIndex?: number;\n option: AutosuggestItem;\n disabled: boolean;\n}\n\nconst toAutosuggestOptionGroupItem = (\n props: AutosuggestRenderItemParentProps\n): AutosuggestProps.OptionGroupRenderItem => {\n return {\n type: 'group',\n index: props.virtualIndex ?? props.index,\n option: props.option.option as OptionGroup,\n disabled: props.disabled,\n };\n};\n\nconst toAutosuggestOptionItem = (props: {\n index: number;\n virtualIndex?: number;\n option: AutosuggestItem;\n disabled: boolean;\n selected: boolean;\n highlighted: boolean;\n parentProps?: AutosuggestRenderItemParentProps;\n}): AutosuggestProps.OptionRenderItem => {\n return {\n type: 'item',\n index: props.virtualIndex ?? props.index,\n option: props.option.option as OptionDefinition,\n selected: props.selected,\n highlighted: props.highlighted,\n disabled: props.disabled,\n parent: props.parentProps\n ? toAutosuggestOptionGroupItem({\n index: props.parentProps.index,\n virtualIndex: props.parentProps.virtualIndex,\n option: props.parentProps.option,\n disabled: props.disabled,\n })\n : null,\n };\n};\n\nconst toAutosuggestUseEnteredItem = (props: {\n option: AutosuggestItem;\n highlighted: boolean;\n}): AutosuggestProps.EnteredTextRenderItem => {\n return {\n type: 'entered-text',\n option: props.option.option as OptionDefinition,\n highlighted: props.highlighted,\n };\n};\n\nconst AutosuggestOption = (\n {\n index,\n virtualIndex,\n nativeAttributes = {},\n highlightText,\n option,\n highlighted,\n highlightType,\n current,\n virtualPosition,\n padBottom,\n screenReaderContent,\n ariaSetsize,\n ariaPosinset,\n renderOption,\n parentProps,\n ...rest\n }: AutosuggestOptionProps,\n ref: React.Ref<HTMLDivElement>\n) => {\n const baseProps = getBaseProps(rest);\n const useEntered = 'type' in option && option.type === 'use-entered';\n const isParent = 'type' in option && option.type === 'parent';\n const isChild = 'type' in option && option.type === 'child';\n const { throughIndex, inGroupIndex, groupIndex } = getTestOptionIndexes(option) || {};\n\n let optionContent;\n if (useEntered) {\n optionContent = option.label;\n // we don't want fancy generated content for screenreader for the \"Use...\" option,\n // just the visible text is fine\n screenReaderContent = undefined;\n } else if (isParent) {\n optionContent = option.label;\n } else {\n const a11yProperties: AutosuggestOptionProps['nativeAttributes'] = {};\n if (nativeAttributes['aria-label']) {\n a11yProperties['aria-label'] = nativeAttributes['aria-label'];\n }\n\n optionContent = (\n <div {...a11yProperties}>\n <OptionComponent option={option} highlightedOption={highlighted} highlightText={highlightText} />\n </div>\n );\n }\n\n const getAutosuggestItemProps = (option: AutosuggestItem) => {\n if (option.type === 'parent') {\n return toAutosuggestOptionGroupItem({\n option: option,\n index: index,\n virtualIndex: virtualIndex,\n disabled: !!option.disabled,\n });\n } else if (option.type === 'use-entered') {\n return toAutosuggestUseEnteredItem({\n option: option,\n highlighted: highlighted,\n });\n } else {\n return toAutosuggestOptionItem({\n option: option,\n index: index,\n virtualIndex: virtualIndex,\n disabled: !!option.disabled,\n highlighted: highlighted,\n selected: current,\n parentProps: parentProps,\n });\n }\n };\n\n const renderOptionWrapper = (option: AutosuggestItem) => {\n if (!renderOption) {\n return null;\n }\n\n return renderOption({ item: getAutosuggestItemProps(option), filterText: highlightText });\n };\n const renderResult = renderOptionWrapper(option);\n\n return (\n <SelectableItem\n {...baseProps}\n disableContentStyling={!!renderResult}\n className={styles.option}\n ariaSelected={current}\n highlighted={highlighted}\n disabled={option.disabled}\n hasBackground={useEntered}\n isParent={isParent}\n isChild={isChild}\n virtualPosition={virtualPosition}\n data-test-index={throughIndex}\n data-in-group-index={inGroupIndex}\n data-group-index={groupIndex}\n ref={ref}\n padBottom={padBottom}\n screenReaderContent={screenReaderContent}\n ariaSetsize={ariaSetsize}\n ariaPosinset={ariaPosinset}\n highlightType={highlightType.type}\n value={option.value}\n >\n {!renderResult ? optionContent : renderResult}\n </SelectableItem>\n );\n};\n\nexport default React.memo(React.forwardRef(AutosuggestOption));\n"]}
|
|
1
|
+
{"version":3,"file":"autosuggest-option.js","sourceRoot":"","sources":["../../../src/autosuggest/autosuggest-option.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAsB,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC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EACrB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,aAAa,EAAE,UAAU,EACzB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,eAAe,qBACf,YAAY,yBACR,YAAY,sBACf,UAAU,EAC5B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,CAAC,IAAI,EACjC,KAAK,EAAE,MAAM,CAAC,KAAK,IAElB,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAC9B,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps, getBaseProps } from '../internal/base-component';\nimport OptionComponent from '../internal/components/option';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport { getTestOptionIndexes } from '../internal/components/options-list/utils/test-indexes';\nimport { HighlightType } from '../internal/components/options-list/utils/use-highlight-option';\nimport SelectableItem from '../internal/components/selectable-item';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ninterface AutosuggestOptionProps extends BaseComponentProps {\n index: number;\n virtualIndex?: number;\n nativeAttributes?: React.HTMLAttributes<HTMLDivElement>;\n highlightText: string;\n option: AutosuggestItem;\n highlighted: boolean;\n highlightType: HighlightType;\n current: boolean;\n virtualPosition?: number;\n padBottom?: boolean;\n screenReaderContent?: string;\n ariaSetsize?: number;\n ariaPosinset?: number;\n renderOption?: AutosuggestProps.ItemRenderer;\n parentProps?: AutosuggestRenderItemParentProps;\n}\n\nexport interface AutosuggestRenderItemParentProps {\n index: number;\n virtualIndex?: number;\n option: AutosuggestItem;\n disabled: boolean;\n}\n\nconst toAutosuggestOptionGroupItem = (\n props: AutosuggestRenderItemParentProps\n): AutosuggestProps.OptionGroupRenderItem => {\n return {\n type: 'group',\n index: props.virtualIndex ?? props.index,\n option: props.option.option as OptionGroup,\n disabled: props.disabled,\n };\n};\n\nconst toAutosuggestOptionItem = (props: {\n index: number;\n virtualIndex?: number;\n option: AutosuggestItem;\n disabled: boolean;\n selected: boolean;\n highlighted: boolean;\n parentProps?: AutosuggestRenderItemParentProps;\n}): AutosuggestProps.OptionRenderItem => {\n return {\n type: 'item',\n index: props.virtualIndex ?? props.index,\n option: props.option.option as OptionDefinition,\n selected: props.selected,\n highlighted: props.highlighted,\n disabled: props.disabled,\n parent: props.parentProps\n ? toAutosuggestOptionGroupItem({\n index: props.parentProps.index,\n virtualIndex: props.parentProps.virtualIndex,\n option: props.parentProps.option,\n disabled: props.disabled,\n })\n : null,\n };\n};\n\nconst toAutosuggestUseEnteredItem = (props: {\n option: AutosuggestItem;\n highlighted: boolean;\n}): AutosuggestProps.EnteredTextRenderItem => {\n return {\n type: 'entered-text',\n option: props.option.option as OptionDefinition,\n highlighted: props.highlighted,\n };\n};\n\nconst AutosuggestOption = (\n {\n index,\n virtualIndex,\n nativeAttributes = {},\n highlightText,\n option,\n highlighted,\n highlightType,\n current,\n virtualPosition,\n padBottom,\n screenReaderContent,\n ariaSetsize,\n ariaPosinset,\n renderOption,\n parentProps,\n ...rest\n }: AutosuggestOptionProps,\n ref: React.Ref<HTMLDivElement>\n) => {\n const baseProps = getBaseProps(rest);\n const useEntered = option.type === 'use-entered';\n const isParent = option.type === 'parent';\n const isChild = option.type === 'child';\n const { throughIndex, inGroupIndex, groupIndex } = getTestOptionIndexes(option) || {};\n\n let optionContent;\n if (useEntered) {\n optionContent = option.label;\n // we don't want fancy generated content for screenreader for the \"Use...\" option,\n // just the visible text is fine\n screenReaderContent = undefined;\n } else if (isParent) {\n optionContent = option.label;\n } else {\n const a11yProperties: AutosuggestOptionProps['nativeAttributes'] = {};\n if (nativeAttributes['aria-label']) {\n a11yProperties['aria-label'] = nativeAttributes['aria-label'];\n }\n\n optionContent = (\n <div {...a11yProperties}>\n <OptionComponent option={option} highlightedOption={highlighted} highlightText={highlightText} />\n </div>\n );\n }\n\n const getAutosuggestItemProps = (option: AutosuggestItem) => {\n if (option.type === 'parent') {\n return toAutosuggestOptionGroupItem({\n option: option,\n index: index,\n virtualIndex: virtualIndex,\n disabled: !!option.disabled,\n });\n } else if (option.type === 'use-entered') {\n return toAutosuggestUseEnteredItem({\n option: option,\n highlighted: highlighted,\n });\n } else {\n return toAutosuggestOptionItem({\n option: option,\n index: index,\n virtualIndex: virtualIndex,\n disabled: !!option.disabled,\n highlighted: highlighted,\n selected: current,\n parentProps: parentProps,\n });\n }\n };\n\n const renderOptionWrapper = (option: AutosuggestItem) => {\n if (!renderOption) {\n return null;\n }\n\n return renderOption({ item: getAutosuggestItemProps(option), filterText: highlightText });\n };\n const renderResult = renderOptionWrapper(option);\n\n return (\n <SelectableItem\n {...baseProps}\n disableContentStyling={!!renderResult}\n className={styles.option}\n ariaSelected={current}\n highlighted={highlighted}\n disabled={option.disabled}\n hasBackground={useEntered}\n isParent={isParent}\n isChild={isChild}\n virtualPosition={virtualPosition}\n data-test-index={throughIndex}\n data-in-group-index={inGroupIndex}\n data-group-index={groupIndex}\n ref={ref}\n padBottom={padBottom}\n screenReaderContent={screenReaderContent}\n ariaSetsize={ariaSetsize}\n ariaPosinset={ariaPosinset}\n highlightType={highlightType.type}\n value={option.value}\n >\n {!renderResult ? optionContent : renderResult}\n </SelectableItem>\n );\n};\n\nexport default React.memo(React.forwardRef(AutosuggestOption));\n"]}
|
|
@@ -110,6 +110,7 @@ function createItems(options) {
|
|
|
110
110
|
return { items, getItemGroup, getItemParent };
|
|
111
111
|
}
|
|
112
112
|
function isGroup(optionOrGroup) {
|
|
113
|
-
|
|
113
|
+
const key = 'options';
|
|
114
|
+
return key in optionOrGroup;
|
|
114
115
|
}
|
|
115
116
|
//# sourceMappingURL=options-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options-controller.js","sourceRoot":"","sources":["../../../src/autosuggest/options-controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAGL,oBAAoB,GACrB,MAAM,gEAAgE,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AA2B9C,MAAM,eAAe,GAAG,CAAC,MAAwB,EAAE,EAAE;IACnD,OAAO,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,MAAwB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAE7G,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,OAAO,EACP,WAAW,EACX,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,GACa,EAAqD,EAAE;IAChF,MAAM,IAAI,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IAC5C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAA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C,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,uBAAuB,CAAC;QAEjE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;AAChD,CAAC;AAED,SAAS,OAAO,CAAC,aAAsC;IACrD,OAAO,SAAS,IAAI,aAAa,CAAC;AACpC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useMemo, useState } from 'react';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { generateTestIndexes } from '../internal/components/options-list/utils/test-indexes';\nimport {\n HighlightedOptionHandlers,\n HighlightedOptionState,\n useHighlightedOption,\n} from '../internal/components/options-list/utils/use-highlight-option';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\nimport { filterOptions } from './utils/utils';\n\ntype Options = AutosuggestProps.Options;\n\nexport interface UseAutosuggestItemsProps {\n options: Options;\n filterValue: string;\n filterText: string;\n filteringType: AutosuggestProps.FilteringType;\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n hideEnteredTextLabel?: boolean;\n onSelectItem: (option: AutosuggestItem) => void;\n}\n\nexport interface AutosuggestItemsState extends HighlightedOptionState<AutosuggestItem> {\n items: readonly AutosuggestItem[];\n showAll: boolean;\n getItemGroup: (item: AutosuggestItem) => undefined | AutosuggestProps.OptionGroup;\n}\n\nexport interface AutosuggestItemsHandlers extends HighlightedOptionHandlers<AutosuggestItem> {\n setShowAll(value: boolean): void;\n selectHighlightedOptionWithKeyboard(): boolean;\n highlightVisibleOptionWithMouse(index: number): void;\n selectVisibleOptionWithMouse(index: number): void;\n}\n\nconst isHighlightable = (option?: AutosuggestItem) => {\n return !!option && option.type !== 'parent';\n};\n\nconst isInteractive = (option?: AutosuggestItem) => !!option && !option.disabled && option.type !== 'parent';\n\nexport const useAutosuggestItems = ({\n options,\n filterValue,\n filterText,\n filteringType,\n enteredTextLabel,\n hideEnteredTextLabel,\n onSelectItem,\n}: UseAutosuggestItemsProps): [AutosuggestItemsState, AutosuggestItemsHandlers] => {\n const i18n = useInternalI18n('autosuggest');\n const [showAll, setShowAll] = useState(false);\n\n const { items, getItemGroup, getItemParent } = useMemo(() => createItems(options), [options]);\n\n const enteredItemLabel = i18n('enteredTextLabel', enteredTextLabel?.(filterValue), format =>\n format({ value: filterValue })\n );\n\n if (!enteredItemLabel) {\n warnOnce('Autosuggest', 'A value for enteredTextLabel must be provided.');\n }\n\n const filteredItems = useMemo(() => {\n const filteredItems = filteringType === 'auto' && !showAll ? filterOptions(items, filterText) : [...items];\n if (filterValue && !hideEnteredTextLabel) {\n filteredItems.unshift({\n value: filterValue,\n type: 'use-entered',\n label: enteredItemLabel,\n option: { value: filterValue },\n });\n }\n generateTestIndexes(filteredItems, getItemParent);\n return filteredItems;\n }, [filteringType, showAll, items, filterText, filterValue, hideEnteredTextLabel, getItemParent, enteredItemLabel]);\n\n const [highlightedOptionState, highlightedOptionHandlers] = useHighlightedOption({\n options: filteredItems,\n isHighlightable,\n });\n\n const selectHighlightedOptionWithKeyboard = () => {\n if (highlightedOptionState.highlightedOption && !isInteractive(highlightedOptionState.highlightedOption)) {\n // skip selection when a non-interactive item is active\n return false;\n }\n onSelectItem(\n highlightedOptionState.highlightedOption ?? {\n // put use-entered item as a fallback\n value: filterValue,\n type: 'use-entered',\n option: { value: filterValue },\n }\n );\n return true;\n };\n\n const highlightVisibleOptionWithMouse = (index: number) => {\n if (filteredItems[index] && isHighlightable(filteredItems[index])) {\n highlightedOptionHandlers.setHighlightedIndexWithMouse(index);\n }\n };\n\n const selectVisibleOptionWithMouse = (index: number) => {\n if (filteredItems[index] && isInteractive(filteredItems[index])) {\n onSelectItem(filteredItems[index]);\n }\n };\n\n return [\n { ...highlightedOptionState, items: filteredItems, showAll, getItemGroup },\n {\n ...highlightedOptionHandlers,\n setShowAll,\n selectHighlightedOptionWithKeyboard,\n highlightVisibleOptionWithMouse,\n selectVisibleOptionWithMouse,\n },\n ];\n};\n\nfunction createItems(options: Options) {\n const items: AutosuggestItem[] = [];\n const itemToGroup = new WeakMap<AutosuggestItem, AutosuggestItem>();\n const getItemParent = (item: AutosuggestItem) => itemToGroup.get(item);\n const getItemGroup = (item: AutosuggestItem) => getItemParent(item)?.option as AutosuggestProps.OptionGroup;\n\n for (const option of options) {\n if (isGroup(option)) {\n for (const item of flattenGroup(option)) {\n items.push(item);\n }\n } else {\n items.push({ ...option, option });\n }\n }\n\n function flattenGroup(group: AutosuggestProps.OptionGroup) {\n const { options, ...rest } = group;\n\n let hasOnlyDisabledChildren = true;\n\n const groupItem: AutosuggestItem = { ...rest, type: 'parent', option: group };\n\n const items: AutosuggestItem[] = [groupItem];\n\n for (const option of options) {\n if (!option.disabled) {\n hasOnlyDisabledChildren = false;\n }\n\n const childOption: AutosuggestItem = {\n ...option,\n type: 'child',\n disabled: option.disabled || rest.disabled,\n option,\n parent: group,\n };\n\n items.push(childOption);\n\n itemToGroup.set(childOption, groupItem);\n }\n\n items[0].disabled = items[0].disabled || hasOnlyDisabledChildren;\n\n return items;\n }\n\n return { items, getItemGroup, getItemParent };\n}\n\nfunction isGroup(optionOrGroup: AutosuggestProps.Option): optionOrGroup is AutosuggestProps.OptionGroup {\n return 'options' in optionOrGroup;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"options-controller.js","sourceRoot":"","sources":["../../../src/autosuggest/options-controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAGL,oB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C;QACvD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QAEnC,IAAI,uBAAuB,GAAG,IAAI,CAAC;QAEnC,MAAM,SAAS,GAAoB,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAE9E,MAAM,KAAK,GAAsB,CAAC,SAAS,CAAC,CAAC;QAE7C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACrB,uBAAuB,GAAG,KAAK,CAAC;YAClC,CAAC;YAED,MAAM,WAAW,GAAoB;gBACnC,GAAG,MAAM;gBACT,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;gBAC1C,MAAM;gBACN,MAAM,EAAE,KAAK;aACd,CAAC;YAEF,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAExB,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAC1C,CAAC;QAED,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,uBAAuB,CAAC;QAEjE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;AAChD,CAAC;AAED,SAAS,OAAO,CAAC,aAAsC;IACrD,MAAM,GAAG,GAAuC,SAAS,CAAC;IAC1D,OAAO,GAAG,IAAI,aAAa,CAAC;AAC9B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useMemo, useState } from 'react';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { generateTestIndexes } from '../internal/components/options-list/utils/test-indexes';\nimport {\n HighlightedOptionHandlers,\n HighlightedOptionState,\n useHighlightedOption,\n} from '../internal/components/options-list/utils/use-highlight-option';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\nimport { filterOptions } from './utils/utils';\n\ntype Options = AutosuggestProps.Options;\n\nexport interface UseAutosuggestItemsProps {\n options: Options;\n filterValue: string;\n filterText: string;\n filteringType: AutosuggestProps.FilteringType;\n enteredTextLabel?: AutosuggestProps.EnteredTextLabel;\n hideEnteredTextLabel?: boolean;\n onSelectItem: (option: AutosuggestItem) => void;\n}\n\nexport interface AutosuggestItemsState extends HighlightedOptionState<AutosuggestItem> {\n items: readonly AutosuggestItem[];\n showAll: boolean;\n getItemGroup: (item: AutosuggestItem) => undefined | AutosuggestProps.OptionGroup;\n}\n\nexport interface AutosuggestItemsHandlers extends HighlightedOptionHandlers<AutosuggestItem> {\n setShowAll(value: boolean): void;\n selectHighlightedOptionWithKeyboard(): boolean;\n highlightVisibleOptionWithMouse(index: number): void;\n selectVisibleOptionWithMouse(index: number): void;\n}\n\nconst isHighlightable = (option?: AutosuggestItem) => {\n return !!option && option.type !== 'parent';\n};\n\nconst isInteractive = (option?: AutosuggestItem) => !!option && !option.disabled && option.type !== 'parent';\n\nexport const useAutosuggestItems = ({\n options,\n filterValue,\n filterText,\n filteringType,\n enteredTextLabel,\n hideEnteredTextLabel,\n onSelectItem,\n}: UseAutosuggestItemsProps): [AutosuggestItemsState, AutosuggestItemsHandlers] => {\n const i18n = useInternalI18n('autosuggest');\n const [showAll, setShowAll] = useState(false);\n\n const { items, getItemGroup, getItemParent } = useMemo(() => createItems(options), [options]);\n\n const enteredItemLabel = i18n('enteredTextLabel', enteredTextLabel?.(filterValue), format =>\n format({ value: filterValue })\n );\n\n if (!enteredItemLabel) {\n warnOnce('Autosuggest', 'A value for enteredTextLabel must be provided.');\n }\n\n const filteredItems = useMemo(() => {\n const filteredItems = filteringType === 'auto' && !showAll ? filterOptions(items, filterText) : [...items];\n if (filterValue && !hideEnteredTextLabel) {\n filteredItems.unshift({\n value: filterValue,\n type: 'use-entered',\n label: enteredItemLabel,\n option: { value: filterValue },\n });\n }\n generateTestIndexes(filteredItems, getItemParent);\n return filteredItems;\n }, [filteringType, showAll, items, filterText, filterValue, hideEnteredTextLabel, getItemParent, enteredItemLabel]);\n\n const [highlightedOptionState, highlightedOptionHandlers] = useHighlightedOption({\n options: filteredItems,\n isHighlightable,\n });\n\n const selectHighlightedOptionWithKeyboard = () => {\n if (highlightedOptionState.highlightedOption && !isInteractive(highlightedOptionState.highlightedOption)) {\n // skip selection when a non-interactive item is active\n return false;\n }\n onSelectItem(\n highlightedOptionState.highlightedOption ?? {\n // put use-entered item as a fallback\n value: filterValue,\n type: 'use-entered',\n option: { value: filterValue },\n }\n );\n return true;\n };\n\n const highlightVisibleOptionWithMouse = (index: number) => {\n if (filteredItems[index] && isHighlightable(filteredItems[index])) {\n highlightedOptionHandlers.setHighlightedIndexWithMouse(index);\n }\n };\n\n const selectVisibleOptionWithMouse = (index: number) => {\n if (filteredItems[index] && isInteractive(filteredItems[index])) {\n onSelectItem(filteredItems[index]);\n }\n };\n\n return [\n { ...highlightedOptionState, items: filteredItems, showAll, getItemGroup },\n {\n ...highlightedOptionHandlers,\n setShowAll,\n selectHighlightedOptionWithKeyboard,\n highlightVisibleOptionWithMouse,\n selectVisibleOptionWithMouse,\n },\n ];\n};\n\nfunction createItems(options: Options) {\n const items: AutosuggestItem[] = [];\n const itemToGroup = new WeakMap<AutosuggestItem, AutosuggestItem>();\n const getItemParent = (item: AutosuggestItem) => itemToGroup.get(item);\n const getItemGroup = (item: AutosuggestItem) => getItemParent(item)?.option as AutosuggestProps.OptionGroup;\n\n for (const option of options) {\n if (isGroup(option)) {\n for (const item of flattenGroup(option)) {\n items.push(item);\n }\n } else {\n items.push({ ...option, option });\n }\n }\n\n function flattenGroup(group: AutosuggestProps.OptionGroup) {\n const { options, ...rest } = group;\n\n let hasOnlyDisabledChildren = true;\n\n const groupItem: AutosuggestItem = { ...rest, type: 'parent', option: group };\n\n const items: AutosuggestItem[] = [groupItem];\n\n for (const option of options) {\n if (!option.disabled) {\n hasOnlyDisabledChildren = false;\n }\n\n const childOption: AutosuggestItem = {\n ...option,\n type: 'child',\n disabled: option.disabled || rest.disabled,\n option,\n parent: group,\n };\n\n items.push(childOption);\n\n itemToGroup.set(childOption, groupItem);\n }\n\n items[0].disabled = items[0].disabled || hasOnlyDisabledChildren;\n\n return items;\n }\n\n return { items, getItemGroup, getItemParent };\n}\n\nfunction isGroup(optionOrGroup: AutosuggestProps.Option): optionOrGroup is AutosuggestProps.OptionGroup {\n const key: keyof AutosuggestProps.OptionGroup = 'options';\n return key in optionOrGroup;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/autosuggest/utils/utils.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,GAAG,CAAC,MAAuB,EAAE,EAAE,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/autosuggest/utils/utils.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,GAAG,CAAC,MAAuB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAEtE,MAAM,YAAY,GAAG,CAAC,OAA0B,EAAE,EAAE;IAClD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/C,IAAI,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAA0B,EAAE,IAAY,EAAqB,EAAE;IAC3F,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAoB,CAAC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AAK,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AutosuggestItem } from '../interfaces';\n\ntype SearchableFields = 'value' | 'label' | 'description' | 'labelTag';\ntype SearchableTagFields = 'tags' | 'filteringTags';\n\nconst isGroup = (option: AutosuggestItem) => option.type === 'parent';\n\nconst popLastGroup = (options: AutosuggestItem[]) => {\n if (options.length) {\n const lastOption = options[options.length - 1];\n if (isGroup(lastOption)) {\n options.pop();\n }\n }\n};\n\nexport const filterOptions = (options: AutosuggestItem[], text: string): AutosuggestItem[] => {\n const filteredOptions = options.reduce<AutosuggestItem[]>((filteredIn, option) => {\n if (isGroup(option)) {\n popLastGroup(filteredIn);\n filteredIn.push(option);\n } else if (matchSingleOption(option, text)) {\n filteredIn.push(option);\n }\n return filteredIn;\n }, []);\n popLastGroup(filteredOptions);\n return filteredOptions;\n};\n\nconst matchSingleOption = (option: AutosuggestItem, text: string): boolean => {\n const searchableFields: SearchableFields[] = ['value', 'label', 'description', 'labelTag'];\n const searchableTagFields: SearchableTagFields[] = ['tags', 'filteringTags'];\n\n const searchText = text.toLowerCase();\n\n const searchStrFieldsFn = (attr: SearchableFields) => matchString(option[attr], searchText);\n const searchTagsFieldsFn = (attr: SearchableTagFields) => option[attr]?.some(value => matchString(value, searchText));\n\n return searchableFields.some(searchStrFieldsFn) || searchableTagFields.some(searchTagsFieldsFn);\n};\n\nconst matchString = (value: string | undefined, searchText: string) => {\n return value && value.toLowerCase().indexOf(searchText) !== -1;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-options.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/option/utils/filter-options.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO9E,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,GAAG,SAAS,EAAE,YAAY,MAAM,EAAE,gBAAgB,OAAO,KAAG,OAMtG,CAAC;AAkBF,eAAO,MAAM,aAAa,GACxB,SAAS,aAAa,CAAC,cAAc,CAAC,EACtC,YAAY,MAAM,EAClB,wBAAsB,KACrB,aAAa,CAAC,cAAc,CAgC9B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,cAAc,YAA6D,CAAC;AAEnH,eAAO,MAAM,kBAAkB,GAAI,SAAS,cAAc,YAAiC,CAAC;AAE5F,eAAO,MAAM,OAAO,GAAI,SAAS,gBAAgB,GAAG,WAAW,KAAG,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"filter-options.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/option/utils/filter-options.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO9E,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,GAAG,SAAS,EAAE,YAAY,MAAM,EAAE,gBAAgB,OAAO,KAAG,OAMtG,CAAC;AAkBF,eAAO,MAAM,aAAa,GACxB,SAAS,aAAa,CAAC,cAAc,CAAC,EACtC,YAAY,MAAM,EAClB,wBAAsB,KACrB,aAAa,CAAC,cAAc,CAgC9B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,cAAc,YAA6D,CAAC;AAEnH,eAAO,MAAM,kBAAkB,GAAI,SAAS,cAAc,YAAiC,CAAC;AAE5F,eAAO,MAAM,OAAO,GAAI,SAAS,gBAAgB,GAAG,WAAW,KAAG,MAAM,IAAI,WAG3E,CAAC"}
|
|
@@ -52,5 +52,8 @@ export const filterOptions = (options, searchText, strictMatching = false) => {
|
|
|
52
52
|
};
|
|
53
53
|
export const isInteractive = (option) => !!option && !option.disabled && option.type !== 'parent';
|
|
54
54
|
export const isGroupInteractive = (option) => !!option && !option.disabled;
|
|
55
|
-
export const isGroup = (option) =>
|
|
55
|
+
export const isGroup = (option) => {
|
|
56
|
+
const key = 'options';
|
|
57
|
+
return !!option && key in option && !!option.options;
|
|
58
|
+
};
|
|
56
59
|
//# sourceMappingURL=filter-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-options.js","sourceRoot":"","sources":["../../../../../../src/internal/components/option/utils/filter-options.ts"],"names":[],"mappings":"AAOA,MAAM,gBAAgB,GAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;AAE1F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAE,UAAkB,EAAE,cAAuB,EAAW,EAAE;IAC/G,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACtD,OAAO,cAAc,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,cAA8B,EAAE,IAAY,EAAE,cAAuB,EAAW,EAAE;IAC7G,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAEtC,MAAM,MAAM,GAAqB,cAAc,CAAC,MAAM,CAAC;IACvD,MAAM,eAAe,GAAG,CAAC,IAAqB,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;IAC3G,MAAM,gBAAgB,GAAG,CAAC,IAAwB,EAAE,EAAE,WACpD,OAAA,MAAA,MAAM,CAAC,IAAI,CAAC,0CAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,UAAU,EA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AAC,EAAE,CAAC;YACnE,IAAI,YAAY,EAAE,CAAC;gBACjB,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACvB,YAAY,GAAG,IAAI,CAAC;YACtB,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAuB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAEnH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAuB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;AAE5F,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAuC,EAAyB,EAAE,
|
|
1
|
+
{"version":3,"file":"filter-options.js","sourceRoot":"","sources":["../../../../../../src/internal/components/option/utils/filter-options.ts"],"names":[],"mappings":"AAOA,MAAM,gBAAgB,GAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;AAE1F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAE,UAAkB,EAAE,cAAuB,EAAW,EAAE;IAC/G,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACtD,OAAO,cAAc,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,cAA8B,EAAE,IAAY,EAAE,cAAu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Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DropdownOption, OptionDefinition, OptionGroup } from '../interfaces';\n\ntype SearchableField = 'value' | 'label' | 'description' | 'labelTag';\ntype SearchableTagField = 'tags' | 'filteringTags';\n\nconst searchableFields: SearchableField[] = ['value', 'label', 'description', 'labelTag'];\n\nexport const matchesString = (value: string | undefined, searchText: string, strictMatching: boolean): boolean => {\n if (!value) {\n return false;\n }\n const index = value.toLowerCase().indexOf(searchText);\n return strictMatching ? index === 0 : index > -1;\n};\n\nconst matchesSingleOption = (dropdownOption: DropdownOption, text: string, strictMatching: boolean): boolean => {\n const searchText = text.toLowerCase();\n\n const option: OptionDefinition = dropdownOption.option;\n const searchStrFields = (attr: SearchableField) => matchesString(option[attr], searchText, strictMatching);\n const searchTagsFields = (attr: SearchableTagField) =>\n option[attr]?.some(value => matchesString(value, searchText, strictMatching));\n\n const searchableTagFields: SearchableTagField[] = ['tags'];\n if (!strictMatching) {\n searchableTagFields.push('filteringTags');\n }\n\n return searchableFields.some(searchStrFields) || searchableTagFields.some(searchTagsFields);\n};\n\nexport const filterOptions = (\n options: ReadonlyArray<DropdownOption>,\n searchText: string,\n strictMatching = false\n): ReadonlyArray<DropdownOption> => {\n if (searchText === '') {\n return options;\n }\n\n let currentGroup: DropdownOption | null = null;\n let parentMatched = false;\n return options.reduce<DropdownOption[]>((acc, option) => {\n if (option.type === 'parent') {\n parentMatched = false;\n currentGroup = option;\n if (matchesSingleOption(option, searchText, strictMatching)) {\n parentMatched = true;\n acc.push(currentGroup);\n }\n return acc;\n }\n if (option.type !== 'child') {\n currentGroup = null;\n parentMatched = false;\n }\n if (parentMatched) {\n acc.push(option);\n } else if (matchesSingleOption(option, searchText, strictMatching)) {\n if (currentGroup) {\n acc.push(currentGroup);\n currentGroup = null;\n }\n acc.push(option);\n }\n return acc;\n }, []);\n};\n\nexport const isInteractive = (option?: DropdownOption) => !!option && !option.disabled && option.type !== 'parent';\n\nexport const isGroupInteractive = (option?: DropdownOption) => !!option && !option.disabled;\n\nexport const isGroup = (option?: OptionDefinition | OptionGroup): option is OptionGroup => {\n const key: keyof OptionGroup = 'options';\n return !!option && key in option && !!option.options;\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
3
|
-
export var GIT_SHA = "
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (52a4127e)";
|
|
3
|
+
export var GIT_SHA = "52a4127e";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "core";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
@@ -172,6 +172,6 @@ function PortaledModal({ size, visible, header, children, footer, disableContent
|
|
|
172
172
|
children,
|
|
173
173
|
React.createElement("div", { ref: stickySentinelRef })),
|
|
174
174
|
footer && (React.createElement(ButtonContext.Provider, { value: { onClick: onButtonClick } },
|
|
175
|
-
React.createElement("div", { ref: footerRef, className: clsx(styles.footer, footerStuck
|
|
175
|
+
React.createElement("div", { ref: footerRef, className: clsx(styles.footer, (footerStuck || hasCustomHeight) && styles['footer--rounded']) }, footer))))))))))));
|
|
176
176
|
}
|
|
177
177
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/modal/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,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,cAAc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,EAAE,iBAAiB,GAAI,CAC3B;oCACL,MAAM,IAAI,CACT,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;wCACvD,6BACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,MAAM,EACb,WAAW,IAAI,MAAM,CAAC,eAAe,CAAC,EACtC,eAAe,IAAI,MAAM,CAAC,eAAe,CAAC,CAC3C,IAEA,MAAM,CACH,CACiB,CAC1B,CACoB,CACnB,CACF,CACI,CACR,CACgB,CACF,CACW,CACtC,CAAC;AACJ,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 { Portal, useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { InternalButton } from '../button/internal';\nimport { BuiltInErrorBoundary } from '../error-boundary/internal';\nimport InternalHeader from '../header/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { PerformanceMetrics } from '../internal/analytics';\nimport {\n FunnelNameSelectorContext,\n FunnelStepContextValue,\n FunnelSubStepContextValue,\n} from '../internal/analytics/context/analytics-context';\nimport { FunnelProps, useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport FocusLock from '../internal/components/focus-lock';\nimport { ButtonContext, ButtonContextProps } from '../internal/context/button-context';\nimport { ModalContext } from '../internal/context/modal-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useIntersectionObserver } from '../internal/hooks/use-intersection-observer';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { SomeRequired } from '../internal/types';\nimport {\n GeneratedAnalyticsMetadataModalComponent,\n GeneratedAnalyticsMetadataModalDismiss,\n} from './analytics-metadata/interfaces';\nimport { disableBodyScrolling, enableBodyScrolling } from './body-scroll';\nimport { ModalProps } from './interfaces';\nimport { useModalDimensions } from './use-modal-dimensions';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport function InternalModalAsFunnel(props: InternalModalProps) {\n const { funnelProps, funnelSubmit, funnelNextOrSubmitAttempt } = useFunnel();\n const { funnelStepProps } = useFunnelStep();\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n const onButtonClick: ButtonContextProps['onClick'] = ({ variant }) => {\n if (variant === 'primary') {\n funnelNextOrSubmitAttempt();\n funnelSubmit();\n }\n };\n\n return (\n <InternalModal\n __funnelProps={funnelProps}\n __funnelStepProps={funnelStepProps}\n __subStepRef={subStepRef}\n __subStepFunnelProps={funnelSubStepProps}\n onButtonClick={onButtonClick}\n {...props}\n />\n );\n}\n\ntype InternalModalProps = SomeRequired<ModalProps, 'size'> &\n InternalBaseComponentProps & {\n __funnelProps?: FunnelProps;\n __funnelStepProps?: FunnelStepContextValue['funnelStepProps'];\n __subStepRef?: FunnelSubStepContextValue['subStepRef'];\n __subStepFunnelProps?: FunnelSubStepContextValue['funnelSubStepProps'];\n __injectAnalyticsComponentMetadata?: boolean;\n onButtonClick?: ButtonContextProps['onClick'];\n referrerId?: string;\n width?: number;\n height?: number;\n };\n\nexport default function InternalModal({ modalRoot, getModalRoot, removeModalRoot, ...rest }: InternalModalProps) {\n return (\n <Portal container={modalRoot} getContainer={getModalRoot} removeContainer={removeModalRoot}>\n <PortaledModal {...rest} />\n </Portal>\n );\n}\n\ntype PortaledModalProps = Omit<InternalModalProps, 'modalRoot' | 'getModalRoot' | 'removeModalRoot'>;\n\n// Separate component to prevent the Portal from getting in the way of refs, as it needs extra cycles to render the inner components.\n// useContainerQuery needs its targeted element to exist on the first render in order to work properly.\nfunction PortaledModal({\n size,\n visible,\n header,\n children,\n footer,\n disableContentPaddings,\n position = 'center',\n onButtonClick = () => {},\n onDismiss,\n width,\n height,\n __internalRootRef,\n __injectAnalyticsComponentMetadata,\n __funnelProps,\n __funnelStepProps,\n __subStepRef,\n __subStepFunnelProps,\n referrerId,\n ...rest\n}: PortaledModalProps) {\n const instanceUniqueId = useUniqueId();\n const headerId = `${rest.id || instanceUniqueId}-header`;\n const lastMouseDownElementRef = useRef<HTMLElement | null>(null);\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n\n const i18n = useInternalI18n('modal');\n const closeAriaLabel = i18n('closeAriaLabel', rest.closeAriaLabel);\n\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(breakpointsRef, refObject, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n\n const baseProps = getBaseProps(rest);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataModalComponent = {\n name: 'awsui.Modal',\n label: `.${analyticsSelectors.header} h2`,\n };\n const metadataAttribute = __injectAnalyticsComponentMetadata\n ? getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })\n : {};\n const loadStartTime = useRef<number>(0);\n const loadCompleteTime = useRef<number>(0);\n const componentLoadingCount = useRef<number>(0);\n const performanceMetricLogged = useRef<boolean>(false);\n\n // enable body scroll and restore focus if unmounting while visible\n useEffect(() => {\n return () => {\n enableBodyScrolling();\n };\n }, []);\n\n const resetModalPerformanceData = () => {\n loadStartTime.current = performance.now();\n loadCompleteTime.current = 0;\n performanceMetricLogged.current = false;\n };\n\n const emitTimeToContentReadyInModal = (loadCompleteTime: number) => {\n if (\n componentLoadingCount.current === 0 &&\n loadStartTime.current &&\n loadStartTime.current !== 0 &&\n !performanceMetricLogged.current\n ) {\n const timeToContentReadyInModal = loadCompleteTime - loadStartTime.current;\n PerformanceMetrics.modalPerformanceData({\n timeToContentReadyInModal,\n instanceIdentifier: instanceUniqueId,\n componentIdentifier: headerTextRef.current?.textContent || '',\n });\n performanceMetricLogged.current = true;\n }\n };\n\n const MODAL_READY_TIMEOUT = 100;\n /**\n * This useEffect is triggered when the visible attribute of modal changes.\n * When modal becomes visible, modal performance metrics are reset marking the beginning loading process.\n * To ensure that the modal component ready metric is always emitted, a setTimeout is implemented.\n * This setTimeout automatically emits the component ready metric after a specified duration.\n */\n useEffect(() => {\n if (visible) {\n disableBodyScrolling();\n resetModalPerformanceData();\n setTimeout(() => {\n emitTimeToContentReadyInModal(loadStartTime.current);\n }, MODAL_READY_TIMEOUT);\n } else {\n enableBodyScrolling();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible]);\n\n // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top\n useEffect(() => {\n if (visible && refObject.current) {\n refObject.current.scrollTop = 0;\n }\n }, [visible]);\n\n const dismiss = (reason: string) => fireNonCancelableEvent(onDismiss, { reason });\n\n const onOverlayMouseDown = (event: React.MouseEvent) => {\n lastMouseDownElementRef.current = event.target as HTMLElement;\n };\n const onOverlayClick = (event: React.MouseEvent) => {\n const overlay = refObject.current;\n const lastClicked = lastMouseDownElementRef.current;\n\n if (event.target === overlay && lastClicked === overlay) {\n dismiss('overlay');\n }\n };\n const onCloseButtonClick = () => dismiss('closeButton');\n const escKeyHandler = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n dismiss('keyboard');\n }\n };\n\n // We use an empty div element at the end of the content slot as a sentinel\n // to detect when the user has scrolled to the bottom.\n const { ref: stickySentinelRef, isIntersecting: footerStuck } = useIntersectionObserver();\n\n const headerTextRef = useRef<HTMLSpanElement>(null);\n const { subStepRef } = useFunnelSubStep();\n\n const { footerRef, headerRef, hasCustomHeight, hasCustomWidth, dialogCustomStyles, footerHeight } =\n useModalDimensions({\n height,\n width,\n hasFooter: !!footer,\n });\n\n return (\n <FunnelNameSelectorContext.Provider value={`.${styles['header--text']}`}>\n <ResetContextsForModal>\n <ModalContext.Provider\n value={{\n isInModal: true,\n componentLoadingCount,\n emitTimeToContentReadyInModal,\n }}\n >\n <div\n {...baseProps}\n {...__funnelProps}\n {...__funnelStepProps}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible },\n baseProps.className,\n isRefresh && styles.refresh\n )}\n role=\"dialog\"\n aria-labelledby={headerId}\n onMouseDown={onOverlayMouseDown}\n onClick={onOverlayClick}\n ref={mergedRef}\n style={footerHeight ? { scrollPaddingBottom: footerHeight } : undefined}\n data-awsui-referrer-id={subStepRef.current?.id || referrerId}\n >\n <FocusLock\n disabled={!visible}\n autoFocus={true}\n restoreFocus={true}\n className={clsx(styles['focus-lock'], styles[`position-${position}`])}\n >\n <div\n className={clsx(\n styles.dialog,\n !hasCustomWidth && styles[size],\n styles[`breakpoint-${breakpoint}`],\n isRefresh && styles.refresh,\n hasCustomWidth && styles['custom-width'],\n hasCustomHeight && styles['custom-height']\n )}\n style={dialogCustomStyles}\n onKeyDown={escKeyHandler}\n {...metadataAttribute}\n >\n <div className={clsx(styles.container, hasCustomHeight && styles['custom-height-container'])}>\n <div ref={headerRef} className={clsx(styles.header, analyticsSelectors.header)}>\n <InternalHeader\n variant=\"h2\"\n __disableActionsWrapping={true}\n actions={\n <div\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataModalDismiss>)}\n >\n <InternalButton\n ariaLabel={closeAriaLabel}\n className={styles['dismiss-control']}\n variant=\"modal-dismiss\"\n iconName=\"close\"\n formAction=\"none\"\n onClick={onCloseButtonClick}\n />\n </div>\n }\n >\n <span ref={headerTextRef} id={headerId} className={styles['header--text']}>\n {header}\n </span>\n </InternalHeader>\n </div>\n <BuiltInErrorBoundary\n wrapper={content => <InternalBox padding={{ bottom: 'm', horizontal: 'l' }}>{content}</InternalBox>}\n >\n <div\n ref={__subStepRef}\n {...__subStepFunnelProps}\n className={clsx(\n styles.content,\n { [styles['no-paddings']]: disableContentPaddings },\n hasCustomHeight && styles['custom-height-content']\n )}\n {...(hasCustomHeight && {\n tabIndex: 0,\n role: 'region',\n 'aria-labelledby': headerId,\n })}\n >\n {children}\n <div ref={stickySentinelRef} />\n </div>\n {footer && (\n <ButtonContext.Provider value={{ onClick: onButtonClick }}>\n <div\n ref={footerRef}\n className={clsx(\n styles.footer,\n footerStuck && styles['footer--stuck'],\n hasCustomHeight && styles['custom-height']\n )}\n >\n {footer}\n </div>\n </ButtonContext.Provider>\n )}\n </BuiltInErrorBoundary>\n </div>\n </div>\n </FocusLock>\n </div>\n </ModalContext.Provider>\n </ResetContextsForModal>\n </FunnelNameSelectorContext.Provider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/modal/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,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,yBAAyB,GAG1B,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAe,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACjH,OAAO,EAAE,YA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C","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 { Portal, useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { InternalButton } from '../button/internal';\nimport { BuiltInErrorBoundary } from '../error-boundary/internal';\nimport InternalHeader from '../header/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { PerformanceMetrics } from '../internal/analytics';\nimport {\n FunnelNameSelectorContext,\n FunnelStepContextValue,\n FunnelSubStepContextValue,\n} from '../internal/analytics/context/analytics-context';\nimport { FunnelProps, useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport FocusLock from '../internal/components/focus-lock';\nimport { ButtonContext, ButtonContextProps } from '../internal/context/button-context';\nimport { ModalContext } from '../internal/context/modal-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useIntersectionObserver } from '../internal/hooks/use-intersection-observer';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { SomeRequired } from '../internal/types';\nimport {\n GeneratedAnalyticsMetadataModalComponent,\n GeneratedAnalyticsMetadataModalDismiss,\n} from './analytics-metadata/interfaces';\nimport { disableBodyScrolling, enableBodyScrolling } from './body-scroll';\nimport { ModalProps } from './interfaces';\nimport { useModalDimensions } from './use-modal-dimensions';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport function InternalModalAsFunnel(props: InternalModalProps) {\n const { funnelProps, funnelSubmit, funnelNextOrSubmitAttempt } = useFunnel();\n const { funnelStepProps } = useFunnelStep();\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n const onButtonClick: ButtonContextProps['onClick'] = ({ variant }) => {\n if (variant === 'primary') {\n funnelNextOrSubmitAttempt();\n funnelSubmit();\n }\n };\n\n return (\n <InternalModal\n __funnelProps={funnelProps}\n __funnelStepProps={funnelStepProps}\n __subStepRef={subStepRef}\n __subStepFunnelProps={funnelSubStepProps}\n onButtonClick={onButtonClick}\n {...props}\n />\n );\n}\n\ntype InternalModalProps = SomeRequired<ModalProps, 'size'> &\n InternalBaseComponentProps & {\n __funnelProps?: FunnelProps;\n __funnelStepProps?: FunnelStepContextValue['funnelStepProps'];\n __subStepRef?: FunnelSubStepContextValue['subStepRef'];\n __subStepFunnelProps?: FunnelSubStepContextValue['funnelSubStepProps'];\n __injectAnalyticsComponentMetadata?: boolean;\n onButtonClick?: ButtonContextProps['onClick'];\n referrerId?: string;\n width?: number;\n height?: number;\n };\n\nexport default function InternalModal({ modalRoot, getModalRoot, removeModalRoot, ...rest }: InternalModalProps) {\n return (\n <Portal container={modalRoot} getContainer={getModalRoot} removeContainer={removeModalRoot}>\n <PortaledModal {...rest} />\n </Portal>\n );\n}\n\ntype PortaledModalProps = Omit<InternalModalProps, 'modalRoot' | 'getModalRoot' | 'removeModalRoot'>;\n\n// Separate component to prevent the Portal from getting in the way of refs, as it needs extra cycles to render the inner components.\n// useContainerQuery needs its targeted element to exist on the first render in order to work properly.\nfunction PortaledModal({\n size,\n visible,\n header,\n children,\n footer,\n disableContentPaddings,\n position = 'center',\n onButtonClick = () => {},\n onDismiss,\n width,\n height,\n __internalRootRef,\n __injectAnalyticsComponentMetadata,\n __funnelProps,\n __funnelStepProps,\n __subStepRef,\n __subStepFunnelProps,\n referrerId,\n ...rest\n}: PortaledModalProps) {\n const instanceUniqueId = useUniqueId();\n const headerId = `${rest.id || instanceUniqueId}-header`;\n const lastMouseDownElementRef = useRef<HTMLElement | null>(null);\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n\n const i18n = useInternalI18n('modal');\n const closeAriaLabel = i18n('closeAriaLabel', rest.closeAriaLabel);\n\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(breakpointsRef, refObject, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n\n const baseProps = getBaseProps(rest);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataModalComponent = {\n name: 'awsui.Modal',\n label: `.${analyticsSelectors.header} h2`,\n };\n const metadataAttribute = __injectAnalyticsComponentMetadata\n ? getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })\n : {};\n const loadStartTime = useRef<number>(0);\n const loadCompleteTime = useRef<number>(0);\n const componentLoadingCount = useRef<number>(0);\n const performanceMetricLogged = useRef<boolean>(false);\n\n // enable body scroll and restore focus if unmounting while visible\n useEffect(() => {\n return () => {\n enableBodyScrolling();\n };\n }, []);\n\n const resetModalPerformanceData = () => {\n loadStartTime.current = performance.now();\n loadCompleteTime.current = 0;\n performanceMetricLogged.current = false;\n };\n\n const emitTimeToContentReadyInModal = (loadCompleteTime: number) => {\n if (\n componentLoadingCount.current === 0 &&\n loadStartTime.current &&\n loadStartTime.current !== 0 &&\n !performanceMetricLogged.current\n ) {\n const timeToContentReadyInModal = loadCompleteTime - loadStartTime.current;\n PerformanceMetrics.modalPerformanceData({\n timeToContentReadyInModal,\n instanceIdentifier: instanceUniqueId,\n componentIdentifier: headerTextRef.current?.textContent || '',\n });\n performanceMetricLogged.current = true;\n }\n };\n\n const MODAL_READY_TIMEOUT = 100;\n /**\n * This useEffect is triggered when the visible attribute of modal changes.\n * When modal becomes visible, modal performance metrics are reset marking the beginning loading process.\n * To ensure that the modal component ready metric is always emitted, a setTimeout is implemented.\n * This setTimeout automatically emits the component ready metric after a specified duration.\n */\n useEffect(() => {\n if (visible) {\n disableBodyScrolling();\n resetModalPerformanceData();\n setTimeout(() => {\n emitTimeToContentReadyInModal(loadStartTime.current);\n }, MODAL_READY_TIMEOUT);\n } else {\n enableBodyScrolling();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible]);\n\n // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top\n useEffect(() => {\n if (visible && refObject.current) {\n refObject.current.scrollTop = 0;\n }\n }, [visible]);\n\n const dismiss = (reason: string) => fireNonCancelableEvent(onDismiss, { reason });\n\n const onOverlayMouseDown = (event: React.MouseEvent) => {\n lastMouseDownElementRef.current = event.target as HTMLElement;\n };\n const onOverlayClick = (event: React.MouseEvent) => {\n const overlay = refObject.current;\n const lastClicked = lastMouseDownElementRef.current;\n\n if (event.target === overlay && lastClicked === overlay) {\n dismiss('overlay');\n }\n };\n const onCloseButtonClick = () => dismiss('closeButton');\n const escKeyHandler = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n dismiss('keyboard');\n }\n };\n\n // We use an empty div element at the end of the content slot as a sentinel\n // to detect when the user has scrolled to the bottom.\n const { ref: stickySentinelRef, isIntersecting: footerStuck } = useIntersectionObserver();\n\n const headerTextRef = useRef<HTMLSpanElement>(null);\n const { subStepRef } = useFunnelSubStep();\n\n const { footerRef, headerRef, hasCustomHeight, hasCustomWidth, dialogCustomStyles, footerHeight } =\n useModalDimensions({\n height,\n width,\n hasFooter: !!footer,\n });\n\n return (\n <FunnelNameSelectorContext.Provider value={`.${styles['header--text']}`}>\n <ResetContextsForModal>\n <ModalContext.Provider\n value={{\n isInModal: true,\n componentLoadingCount,\n emitTimeToContentReadyInModal,\n }}\n >\n <div\n {...baseProps}\n {...__funnelProps}\n {...__funnelStepProps}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible },\n baseProps.className,\n isRefresh && styles.refresh\n )}\n role=\"dialog\"\n aria-labelledby={headerId}\n onMouseDown={onOverlayMouseDown}\n onClick={onOverlayClick}\n ref={mergedRef}\n style={footerHeight ? { scrollPaddingBottom: footerHeight } : undefined}\n data-awsui-referrer-id={subStepRef.current?.id || referrerId}\n >\n <FocusLock\n disabled={!visible}\n autoFocus={true}\n restoreFocus={true}\n className={clsx(styles['focus-lock'], styles[`position-${position}`])}\n >\n <div\n className={clsx(\n styles.dialog,\n !hasCustomWidth && styles[size],\n styles[`breakpoint-${breakpoint}`],\n isRefresh && styles.refresh,\n hasCustomWidth && styles['custom-width'],\n hasCustomHeight && styles['custom-height']\n )}\n style={dialogCustomStyles}\n onKeyDown={escKeyHandler}\n {...metadataAttribute}\n >\n <div className={clsx(styles.container, hasCustomHeight && styles['custom-height-container'])}>\n <div ref={headerRef} className={clsx(styles.header, analyticsSelectors.header)}>\n <InternalHeader\n variant=\"h2\"\n __disableActionsWrapping={true}\n actions={\n <div\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataModalDismiss>)}\n >\n <InternalButton\n ariaLabel={closeAriaLabel}\n className={styles['dismiss-control']}\n variant=\"modal-dismiss\"\n iconName=\"close\"\n formAction=\"none\"\n onClick={onCloseButtonClick}\n />\n </div>\n }\n >\n <span ref={headerTextRef} id={headerId} className={styles['header--text']}>\n {header}\n </span>\n </InternalHeader>\n </div>\n <BuiltInErrorBoundary\n wrapper={content => <InternalBox padding={{ bottom: 'm', horizontal: 'l' }}>{content}</InternalBox>}\n >\n <div\n ref={__subStepRef}\n {...__subStepFunnelProps}\n className={clsx(\n styles.content,\n { [styles['no-paddings']]: disableContentPaddings },\n hasCustomHeight && styles['custom-height-content']\n )}\n {...(hasCustomHeight && {\n tabIndex: 0,\n role: 'region',\n 'aria-labelledby': headerId,\n })}\n >\n {children}\n <div ref={stickySentinelRef} />\n </div>\n {footer && (\n <ButtonContext.Provider value={{ onClick: onButtonClick }}>\n <div\n ref={footerRef}\n className={clsx(styles.footer, (footerStuck || hasCustomHeight) && styles['footer--rounded'])}\n >\n {footer}\n </div>\n </ButtonContext.Provider>\n )}\n </BuiltInErrorBoundary>\n </div>\n </div>\n </FocusLock>\n </div>\n </ModalContext.Provider>\n </ResetContextsForModal>\n </FunnelNameSelectorContext.Provider>\n );\n}\n"]}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"dialog": "
|
|
5
|
-
"modal-slide-up": "awsui_modal-slide-
|
|
6
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
7
|
-
"refresh": "
|
|
8
|
-
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-
|
|
9
|
-
"root": "
|
|
10
|
-
"awsui-motion-fade-in": "awsui_awsui-motion-fade-
|
|
11
|
-
"hidden": "
|
|
12
|
-
"focus-lock": "awsui_focus-
|
|
13
|
-
"position-top": "awsui_position-
|
|
14
|
-
"position-center": "awsui_position-
|
|
15
|
-
"small": "
|
|
16
|
-
"medium": "
|
|
17
|
-
"large": "
|
|
18
|
-
"x-large": "awsui_x-
|
|
19
|
-
"xx-large": "awsui_xx-
|
|
20
|
-
"custom-width": "awsui_custom-
|
|
21
|
-
"max": "
|
|
22
|
-
"breakpoint-xs": "awsui_breakpoint-
|
|
23
|
-
"custom-height": "awsui_custom-
|
|
24
|
-
"container": "
|
|
25
|
-
"custom-height-container": "awsui_custom-height-
|
|
26
|
-
"content": "
|
|
27
|
-
"no-paddings": "awsui_no-
|
|
28
|
-
"custom-height-content": "awsui_custom-height-
|
|
29
|
-
"header": "
|
|
30
|
-
"header--text": "awsui_header--
|
|
31
|
-
"footer": "
|
|
32
|
-
"footer--
|
|
33
|
-
"dismiss-control": "awsui_dismiss-
|
|
34
|
-
"modal-open": "awsui_modal-
|
|
4
|
+
"dialog": "awsui_dialog_1d2i7_1qty0_169",
|
|
5
|
+
"modal-slide-up": "awsui_modal-slide-up_1d2i7_1qty0_1",
|
|
6
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_1d2i7_1qty0_1",
|
|
7
|
+
"refresh": "awsui_refresh_1d2i7_1qty0_192",
|
|
8
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_1d2i7_1qty0_1",
|
|
9
|
+
"root": "awsui_root_1d2i7_1qty0_225",
|
|
10
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_1d2i7_1qty0_1",
|
|
11
|
+
"hidden": "awsui_hidden_1d2i7_1qty0_302",
|
|
12
|
+
"focus-lock": "awsui_focus-lock_1d2i7_1qty0_306",
|
|
13
|
+
"position-top": "awsui_position-top_1d2i7_1qty0_314",
|
|
14
|
+
"position-center": "awsui_position-center_1d2i7_1qty0_317",
|
|
15
|
+
"small": "awsui_small_1d2i7_1qty0_331",
|
|
16
|
+
"medium": "awsui_medium_1d2i7_1qty0_334",
|
|
17
|
+
"large": "awsui_large_1d2i7_1qty0_337",
|
|
18
|
+
"x-large": "awsui_x-large_1d2i7_1qty0_340",
|
|
19
|
+
"xx-large": "awsui_xx-large_1d2i7_1qty0_343",
|
|
20
|
+
"custom-width": "awsui_custom-width_1d2i7_1qty0_346",
|
|
21
|
+
"max": "awsui_max_1d2i7_1qty0_349",
|
|
22
|
+
"breakpoint-xs": "awsui_breakpoint-xs_1d2i7_1qty0_349",
|
|
23
|
+
"custom-height": "awsui_custom-height_1d2i7_1qty0_354",
|
|
24
|
+
"container": "awsui_container_1d2i7_1qty0_359",
|
|
25
|
+
"custom-height-container": "awsui_custom-height-container_1d2i7_1qty0_399",
|
|
26
|
+
"content": "awsui_content_1d2i7_1qty0_405",
|
|
27
|
+
"no-paddings": "awsui_no-paddings_1d2i7_1qty0_410",
|
|
28
|
+
"custom-height-content": "awsui_custom-height-content_1d2i7_1qty0_414",
|
|
29
|
+
"header": "awsui_header_1d2i7_1qty0_419",
|
|
30
|
+
"header--text": "awsui_header--text_1d2i7_1qty0_431",
|
|
31
|
+
"footer": "awsui_footer_1d2i7_1qty0_435",
|
|
32
|
+
"footer--rounded": "awsui_footer--rounded_1d2i7_1qty0_444",
|
|
33
|
+
"dismiss-control": "awsui_dismiss-control_1d2i7_1qty0_456",
|
|
34
|
+
"modal-open": "awsui_modal-open_1d2i7_1qty0_460"
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -158,7 +158,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
158
158
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
159
159
|
SPDX-License-Identifier: Apache-2.0
|
|
160
160
|
*/
|
|
161
|
-
@keyframes awsui_modal-slide-
|
|
161
|
+
@keyframes awsui_modal-slide-up_1d2i7_1qty0_1 {
|
|
162
162
|
0% {
|
|
163
163
|
transform: translate(0, 10px);
|
|
164
164
|
}
|
|
@@ -166,12 +166,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
166
166
|
transform: translate(0, 0);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
.
|
|
170
|
-
animation: awsui_modal-slide-
|
|
169
|
+
.awsui_dialog_1d2i7_1qty0_169:not(#\9) {
|
|
170
|
+
animation: awsui_modal-slide-up_1d2i7_1qty0_1 var(--motion-duration-slow-cxexcj, 180ms) ease-out, awsui_awsui-motion-fade-in-0_1d2i7_1qty0_1 var(--motion-duration-slow-cxexcj, 180ms) ease-out;
|
|
171
171
|
animation-delay: var(--motion-duration-fast-okdxjh, 90ms);
|
|
172
172
|
animation-fill-mode: both;
|
|
173
173
|
}
|
|
174
|
-
@keyframes awsui_awsui-motion-fade-in-
|
|
174
|
+
@keyframes awsui_awsui-motion-fade-in-0_1d2i7_1qty0_1 {
|
|
175
175
|
from {
|
|
176
176
|
opacity: 0;
|
|
177
177
|
}
|
|
@@ -180,22 +180,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
@media (prefers-reduced-motion: reduce) {
|
|
183
|
-
.
|
|
183
|
+
.awsui_dialog_1d2i7_1qty0_169:not(#\9) {
|
|
184
184
|
animation: none;
|
|
185
185
|
transition: none;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
.awsui-motion-disabled .
|
|
188
|
+
.awsui-motion-disabled .awsui_dialog_1d2i7_1qty0_169:not(#\9), .awsui-mode-entering .awsui_dialog_1d2i7_1qty0_169:not(#\9) {
|
|
189
189
|
animation: none;
|
|
190
190
|
transition: none;
|
|
191
191
|
}
|
|
192
|
-
.
|
|
193
|
-
animation: awsui_awsui-motion-scale-
|
|
192
|
+
.awsui_dialog_1d2i7_1qty0_169.awsui_refresh_1d2i7_1qty0_192:not(#\9) {
|
|
193
|
+
animation: awsui_awsui-motion-scale-popup_1d2i7_1qty0_1, awsui_awsui-motion-fade-in-0_1d2i7_1qty0_1;
|
|
194
194
|
animation-duration: var(--motion-duration-refresh-only-fast-v9rk6z, 0ms);
|
|
195
195
|
animation-timing-function: var(--motion-easing-refresh-only-a-8gio5w, cubic-bezier(0, 0, 0, 1));
|
|
196
196
|
animation-fill-mode: both;
|
|
197
197
|
}
|
|
198
|
-
@keyframes awsui_awsui-motion-fade-in-
|
|
198
|
+
@keyframes awsui_awsui-motion-fade-in-0_1d2i7_1qty0_1 {
|
|
199
199
|
from {
|
|
200
200
|
opacity: 0;
|
|
201
201
|
}
|
|
@@ -203,7 +203,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
203
203
|
opacity: 1;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
@keyframes awsui_awsui-motion-scale-
|
|
206
|
+
@keyframes awsui_awsui-motion-scale-popup_1d2i7_1qty0_1 {
|
|
207
207
|
0% {
|
|
208
208
|
transform: scale(0.95);
|
|
209
209
|
}
|
|
@@ -212,21 +212,21 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
@media (prefers-reduced-motion: reduce) {
|
|
215
|
-
.
|
|
215
|
+
.awsui_dialog_1d2i7_1qty0_169.awsui_refresh_1d2i7_1qty0_192:not(#\9) {
|
|
216
216
|
animation: none;
|
|
217
217
|
transition: none;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
.awsui-motion-disabled .
|
|
220
|
+
.awsui-motion-disabled .awsui_dialog_1d2i7_1qty0_169.awsui_refresh_1d2i7_1qty0_192:not(#\9), .awsui-mode-entering .awsui_dialog_1d2i7_1qty0_169.awsui_refresh_1d2i7_1qty0_192:not(#\9) {
|
|
221
221
|
animation: none;
|
|
222
222
|
transition: none;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
.
|
|
226
|
-
animation: awsui_awsui-motion-fade-
|
|
225
|
+
.awsui_root_1d2i7_1qty0_225:not(#\9) {
|
|
226
|
+
animation: awsui_awsui-motion-fade-in_1d2i7_1qty0_1 var(--motion-duration-extra-slow-j8l6m4, 270ms) ease-out;
|
|
227
227
|
animation-fill-mode: both;
|
|
228
228
|
}
|
|
229
|
-
@keyframes awsui_awsui-motion-fade-
|
|
229
|
+
@keyframes awsui_awsui-motion-fade-in_1d2i7_1qty0_1 {
|
|
230
230
|
from {
|
|
231
231
|
opacity: 0.2;
|
|
232
232
|
}
|
|
@@ -235,30 +235,30 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
@media (prefers-reduced-motion: reduce) {
|
|
238
|
-
.
|
|
238
|
+
.awsui_root_1d2i7_1qty0_225:not(#\9) {
|
|
239
239
|
animation: none;
|
|
240
240
|
transition: none;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
.awsui-motion-disabled .
|
|
243
|
+
.awsui-motion-disabled .awsui_root_1d2i7_1qty0_225:not(#\9), .awsui-mode-entering .awsui_root_1d2i7_1qty0_225:not(#\9) {
|
|
244
244
|
animation: none;
|
|
245
245
|
transition: none;
|
|
246
246
|
}
|
|
247
|
-
.
|
|
247
|
+
.awsui_root_1d2i7_1qty0_225.awsui_refresh_1d2i7_1qty0_192:not(#\9) {
|
|
248
248
|
animation-duration: var(--motion-duration-refresh-only-fast-v9rk6z, 0ms);
|
|
249
249
|
}
|
|
250
250
|
@media (prefers-reduced-motion: reduce) {
|
|
251
|
-
.
|
|
251
|
+
.awsui_root_1d2i7_1qty0_225.awsui_refresh_1d2i7_1qty0_192:not(#\9) {
|
|
252
252
|
animation: none;
|
|
253
253
|
transition: none;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
.awsui-motion-disabled .
|
|
256
|
+
.awsui-motion-disabled .awsui_root_1d2i7_1qty0_225.awsui_refresh_1d2i7_1qty0_192:not(#\9), .awsui-mode-entering .awsui_root_1d2i7_1qty0_225.awsui_refresh_1d2i7_1qty0_192:not(#\9) {
|
|
257
257
|
animation: none;
|
|
258
258
|
transition: none;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
.
|
|
261
|
+
.awsui_root_1d2i7_1qty0_225:not(#\9) {
|
|
262
262
|
border-collapse: separate;
|
|
263
263
|
border-spacing: 0;
|
|
264
264
|
box-sizing: border-box;
|
|
@@ -299,11 +299,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
299
299
|
overflow: auto;
|
|
300
300
|
cursor: pointer;
|
|
301
301
|
}
|
|
302
|
-
.
|
|
302
|
+
.awsui_root_1d2i7_1qty0_225.awsui_hidden_1d2i7_1qty0_302:not(#\9) {
|
|
303
303
|
display: none;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
.awsui_focus-
|
|
306
|
+
.awsui_focus-lock_1d2i7_1qty0_306:not(#\9) {
|
|
307
307
|
align-self: flex-start;
|
|
308
308
|
margin-inline: auto;
|
|
309
309
|
padding-block: var(--space-s-4a5hs8, 12px);
|
|
@@ -311,14 +311,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
311
311
|
z-index: 5000;
|
|
312
312
|
pointer-events: none;
|
|
313
313
|
}
|
|
314
|
-
.awsui_focus-
|
|
314
|
+
.awsui_focus-lock_1d2i7_1qty0_306.awsui_position-top_1d2i7_1qty0_314:not(#\9) {
|
|
315
315
|
margin-block-start: 0;
|
|
316
316
|
}
|
|
317
|
-
.awsui_focus-
|
|
317
|
+
.awsui_focus-lock_1d2i7_1qty0_306.awsui_position-center_1d2i7_1qty0_317:not(#\9) {
|
|
318
318
|
margin-block: auto;
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
.
|
|
321
|
+
.awsui_dialog_1d2i7_1qty0_169:not(#\9) {
|
|
322
322
|
position: static;
|
|
323
323
|
inset-block-start: 0;
|
|
324
324
|
transform: translate(0, 0);
|
|
@@ -328,35 +328,35 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
328
328
|
z-index: 5000;
|
|
329
329
|
pointer-events: all;
|
|
330
330
|
}
|
|
331
|
-
.
|
|
331
|
+
.awsui_dialog_1d2i7_1qty0_169.awsui_small_1d2i7_1qty0_331:not(#\9) {
|
|
332
332
|
max-inline-size: 320px;
|
|
333
333
|
}
|
|
334
|
-
.
|
|
334
|
+
.awsui_dialog_1d2i7_1qty0_169.awsui_medium_1d2i7_1qty0_334:not(#\9) {
|
|
335
335
|
max-inline-size: 600px;
|
|
336
336
|
}
|
|
337
|
-
.
|
|
337
|
+
.awsui_dialog_1d2i7_1qty0_169.awsui_large_1d2i7_1qty0_337:not(#\9) {
|
|
338
338
|
max-inline-size: 820px;
|
|
339
339
|
}
|
|
340
|
-
.
|
|
340
|
+
.awsui_dialog_1d2i7_1qty0_169.awsui_x-large_1d2i7_1qty0_340:not(#\9) {
|
|
341
341
|
max-inline-size: 1024px;
|
|
342
342
|
}
|
|
343
|
-
.
|
|
343
|
+
.awsui_dialog_1d2i7_1qty0_169.awsui_xx-large_1d2i7_1qty0_343:not(#\9) {
|
|
344
344
|
max-inline-size: 1280px;
|
|
345
345
|
}
|
|
346
|
-
.
|
|
346
|
+
.awsui_dialog_1d2i7_1qty0_169.awsui_custom-width_1d2i7_1qty0_346:not(#\9) {
|
|
347
347
|
max-inline-size: var(--awsui-modal-custom-width-n6lfw8);
|
|
348
348
|
}
|
|
349
|
-
.
|
|
349
|
+
.awsui_dialog_1d2i7_1qty0_169.awsui_max_1d2i7_1qty0_349.awsui_breakpoint-xs_1d2i7_1qty0_349:not(#\9) {
|
|
350
350
|
max-inline-size: calc(100vw - (8 * 10px + var(--space-xxxl-qhelse, 40px)));
|
|
351
351
|
margin-block: auto;
|
|
352
352
|
margin-inline: auto;
|
|
353
353
|
}
|
|
354
|
-
.
|
|
354
|
+
.awsui_dialog_1d2i7_1qty0_169.awsui_custom-height_1d2i7_1qty0_354:not(#\9) {
|
|
355
355
|
block-size: var(--awsui-modal-custom-height-n6lfw8);
|
|
356
356
|
max-block-size: calc(100vh - 2 * var(--space-s-4a5hs8, 12px));
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
.
|
|
359
|
+
.awsui_container_1d2i7_1qty0_359:not(#\9) {
|
|
360
360
|
border-collapse: separate;
|
|
361
361
|
border-spacing: 0;
|
|
362
362
|
box-sizing: border-box;
|
|
@@ -396,27 +396,27 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
396
396
|
border-end-end-radius: var(--border-radius-container-l30zxy, 0px);
|
|
397
397
|
box-shadow: var(--shadow-modal-pjndl9, 0 1px 1px 0 rgba(0, 28, 36, 0.3), 1px 1px 1px 0 rgba(0, 28, 36, 0.15), -1px 1px 1px 0 rgba(0, 28, 36, 0.15));
|
|
398
398
|
}
|
|
399
|
-
.
|
|
399
|
+
.awsui_container_1d2i7_1qty0_359.awsui_custom-height-container_1d2i7_1qty0_399:not(#\9) {
|
|
400
400
|
display: flex;
|
|
401
401
|
flex-direction: column;
|
|
402
402
|
block-size: 100%;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
-
.
|
|
405
|
+
.awsui_content_1d2i7_1qty0_405:not(#\9) {
|
|
406
406
|
padding-block-start: var(--space-container-content-top-8fvzh2, 16px);
|
|
407
407
|
padding-block-end: var(--space-modal-content-bottom-pxcvcj, 20px);
|
|
408
408
|
padding-inline: var(--space-modal-horizontal-tieytu, 20px);
|
|
409
409
|
}
|
|
410
|
-
.
|
|
410
|
+
.awsui_content_1d2i7_1qty0_405.awsui_no-paddings_1d2i7_1qty0_410:not(#\9) {
|
|
411
411
|
padding-block: 0;
|
|
412
412
|
padding-inline: 0;
|
|
413
413
|
}
|
|
414
|
-
.
|
|
414
|
+
.awsui_content_1d2i7_1qty0_405.awsui_custom-height-content_1d2i7_1qty0_414:not(#\9) {
|
|
415
415
|
flex-grow: 1;
|
|
416
416
|
overflow-y: auto;
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
-
.
|
|
419
|
+
.awsui_header_1d2i7_1qty0_419:not(#\9) {
|
|
420
420
|
padding-block-start: var(--space-container-header-top-3cfni8, 12px);
|
|
421
421
|
padding-block-end: var(--space-container-header-bottom-rbnprk, 12px);
|
|
422
422
|
padding-inline: var(--space-modal-horizontal-tieytu, 20px);
|
|
@@ -428,11 +428,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
428
428
|
border-end-end-radius: 0;
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
-
.awsui_header--
|
|
431
|
+
.awsui_header--text_1d2i7_1qty0_431:not(#\9) {
|
|
432
432
|
/* used in test-utils */
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
.
|
|
435
|
+
.awsui_footer_1d2i7_1qty0_435:not(#\9) {
|
|
436
436
|
border-block-start: var(--border-divider-section-width-sznrdy, 1px) solid var(--color-border-divider-default-ipvpev, #eaeded);
|
|
437
437
|
padding-block: var(--space-scaled-s-gjhvjd, 12px);
|
|
438
438
|
padding-inline: var(--space-container-horizontal-ipmk0e, 20px);
|
|
@@ -441,27 +441,23 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
441
441
|
inset-block-end: 0;
|
|
442
442
|
z-index: 800;
|
|
443
443
|
}
|
|
444
|
-
.
|
|
445
|
-
border-end-start-radius: var(--border-radius-container-l30zxy, 0px);
|
|
446
|
-
border-end-end-radius: var(--border-radius-container-l30zxy, 0px);
|
|
447
|
-
}
|
|
448
|
-
.awsui_footer--stuck_1d2i7_jna9e_448:not(#\9) {
|
|
444
|
+
.awsui_footer--rounded_1d2i7_1qty0_444:not(#\9) {
|
|
449
445
|
border-start-start-radius: 0;
|
|
450
446
|
border-start-end-radius: 0;
|
|
451
447
|
border-end-start-radius: var(--border-radius-container-l30zxy, 0px);
|
|
452
448
|
border-end-end-radius: var(--border-radius-container-l30zxy, 0px);
|
|
453
449
|
}
|
|
454
|
-
.
|
|
450
|
+
.awsui_footer_1d2i7_1qty0_435:not(#\9):after {
|
|
455
451
|
content: "";
|
|
456
452
|
display: table;
|
|
457
453
|
clear: both;
|
|
458
454
|
}
|
|
459
455
|
|
|
460
|
-
.awsui_dismiss-
|
|
456
|
+
.awsui_dismiss-control_1d2i7_1qty0_456:not(#\9) {
|
|
461
457
|
/* used in test-utils */
|
|
462
458
|
}
|
|
463
459
|
|
|
464
|
-
.awsui_modal-
|
|
460
|
+
.awsui_modal-open_1d2i7_1qty0_460:not(#\9) {
|
|
465
461
|
overflow: hidden;
|
|
466
462
|
/*
|
|
467
463
|
* When padding-right is added to account for scrollbar being turned
|
|
@@ -2,36 +2,36 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"dialog": "
|
|
6
|
-
"modal-slide-up": "awsui_modal-slide-
|
|
7
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
8
|
-
"refresh": "
|
|
9
|
-
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-
|
|
10
|
-
"root": "
|
|
11
|
-
"awsui-motion-fade-in": "awsui_awsui-motion-fade-
|
|
12
|
-
"hidden": "
|
|
13
|
-
"focus-lock": "awsui_focus-
|
|
14
|
-
"position-top": "awsui_position-
|
|
15
|
-
"position-center": "awsui_position-
|
|
16
|
-
"small": "
|
|
17
|
-
"medium": "
|
|
18
|
-
"large": "
|
|
19
|
-
"x-large": "awsui_x-
|
|
20
|
-
"xx-large": "awsui_xx-
|
|
21
|
-
"custom-width": "awsui_custom-
|
|
22
|
-
"max": "
|
|
23
|
-
"breakpoint-xs": "awsui_breakpoint-
|
|
24
|
-
"custom-height": "awsui_custom-
|
|
25
|
-
"container": "
|
|
26
|
-
"custom-height-container": "awsui_custom-height-
|
|
27
|
-
"content": "
|
|
28
|
-
"no-paddings": "awsui_no-
|
|
29
|
-
"custom-height-content": "awsui_custom-height-
|
|
30
|
-
"header": "
|
|
31
|
-
"header--text": "awsui_header--
|
|
32
|
-
"footer": "
|
|
33
|
-
"footer--
|
|
34
|
-
"dismiss-control": "awsui_dismiss-
|
|
35
|
-
"modal-open": "awsui_modal-
|
|
5
|
+
"dialog": "awsui_dialog_1d2i7_1qty0_169",
|
|
6
|
+
"modal-slide-up": "awsui_modal-slide-up_1d2i7_1qty0_1",
|
|
7
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_1d2i7_1qty0_1",
|
|
8
|
+
"refresh": "awsui_refresh_1d2i7_1qty0_192",
|
|
9
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_1d2i7_1qty0_1",
|
|
10
|
+
"root": "awsui_root_1d2i7_1qty0_225",
|
|
11
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_1d2i7_1qty0_1",
|
|
12
|
+
"hidden": "awsui_hidden_1d2i7_1qty0_302",
|
|
13
|
+
"focus-lock": "awsui_focus-lock_1d2i7_1qty0_306",
|
|
14
|
+
"position-top": "awsui_position-top_1d2i7_1qty0_314",
|
|
15
|
+
"position-center": "awsui_position-center_1d2i7_1qty0_317",
|
|
16
|
+
"small": "awsui_small_1d2i7_1qty0_331",
|
|
17
|
+
"medium": "awsui_medium_1d2i7_1qty0_334",
|
|
18
|
+
"large": "awsui_large_1d2i7_1qty0_337",
|
|
19
|
+
"x-large": "awsui_x-large_1d2i7_1qty0_340",
|
|
20
|
+
"xx-large": "awsui_xx-large_1d2i7_1qty0_343",
|
|
21
|
+
"custom-width": "awsui_custom-width_1d2i7_1qty0_346",
|
|
22
|
+
"max": "awsui_max_1d2i7_1qty0_349",
|
|
23
|
+
"breakpoint-xs": "awsui_breakpoint-xs_1d2i7_1qty0_349",
|
|
24
|
+
"custom-height": "awsui_custom-height_1d2i7_1qty0_354",
|
|
25
|
+
"container": "awsui_container_1d2i7_1qty0_359",
|
|
26
|
+
"custom-height-container": "awsui_custom-height-container_1d2i7_1qty0_399",
|
|
27
|
+
"content": "awsui_content_1d2i7_1qty0_405",
|
|
28
|
+
"no-paddings": "awsui_no-paddings_1d2i7_1qty0_410",
|
|
29
|
+
"custom-height-content": "awsui_custom-height-content_1d2i7_1qty0_414",
|
|
30
|
+
"header": "awsui_header_1d2i7_1qty0_419",
|
|
31
|
+
"header--text": "awsui_header--text_1d2i7_1qty0_431",
|
|
32
|
+
"footer": "awsui_footer_1d2i7_1qty0_435",
|
|
33
|
+
"footer--rounded": "awsui_footer--rounded_1d2i7_1qty0_444",
|
|
34
|
+
"dismiss-control": "awsui_dismiss-control_1d2i7_1qty0_456",
|
|
35
|
+
"modal-open": "awsui_modal-open_1d2i7_1qty0_460"
|
|
36
36
|
};
|
|
37
37
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-modal-dimensions.d.ts","sourceRoot":"","sources":["../../../src/modal/use-modal-dimensions.ts"],"names":[],"mappings":"AAWA,UAAU,uBAAuB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,uBAAuB;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"use-modal-dimensions.d.ts","sourceRoot":"","sources":["../../../src/modal/use-modal-dimensions.ts"],"names":[],"mappings":"AAWA,UAAU,uBAAuB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,uBAAuB;;;;;;;;;EA0CvF"}
|
|
@@ -15,10 +15,16 @@ export function useModalDimensions({ height, width, hasFooter }) {
|
|
|
15
15
|
const hasCustomHeight = height !== undefined && !Number.isNaN(height);
|
|
16
16
|
const hasCustomWidth = width !== undefined && !Number.isNaN(width);
|
|
17
17
|
if (isDevelopment) {
|
|
18
|
-
if (
|
|
18
|
+
if (Number.isNaN(height)) {
|
|
19
|
+
warnOnce('Modal', 'Height is NaN and will not be set. This is likely a bug in your code.');
|
|
20
|
+
}
|
|
21
|
+
else if (hasCustomHeight && constrainedHeight !== height) {
|
|
19
22
|
warnOnce('Modal', `Height (${height}px) is too small. Modal requires at least ${MIN_CONTENT_HEIGHT}px for content plus header/footer space (total: ${minModalHeight}px). Height will be adjusted to ${constrainedHeight}px.`);
|
|
20
23
|
}
|
|
21
|
-
if (
|
|
24
|
+
if (Number.isNaN(width)) {
|
|
25
|
+
warnOnce('Modal', 'Width is NaN and will not be set. This is likely a bug in your code.');
|
|
26
|
+
}
|
|
27
|
+
else if (hasCustomWidth && constrainedWidth !== width) {
|
|
22
28
|
warnOnce('Modal', `Width (${width}px) is below minimum (${MIN_MODAL_WIDTH}px) and will be adjusted to ${constrainedWidth}px.`);
|
|
23
29
|
}
|
|
24
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-modal-dimensions.js","sourceRoot":"","sources":["../../../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,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport customCssProps from '../internal/generated/custom-css-properties';\nimport { isDevelopment } from '../internal/is-development';\n\nconst MIN_CONTENT_HEIGHT = 60;\nconst MIN_MODAL_WIDTH = 320;\n\ninterface UseModalDimensionsProps {\n height?: number;\n width?: number;\n hasFooter: boolean;\n}\n\nexport function useModalDimensions({ height, width, hasFooter }: UseModalDimensionsProps) {\n const [footerHeight, footerRef] = useContainerQuery(rect => rect.borderBoxHeight);\n const [headerHeight, headerRef] = useContainerQuery(rect => rect.borderBoxHeight);\n\n const minModalHeight = (headerHeight ?? 0) + (hasFooter ? (footerHeight ?? 0) : 0) + MIN_CONTENT_HEIGHT;\n const constrainedHeight = Math.max(height ?? 0, minModalHeight);\n const constrainedWidth = Math.max(width ?? 0, MIN_MODAL_WIDTH);\n\n const hasCustomHeight = height !== undefined && !Number.isNaN(height);\n const hasCustomWidth = width !== undefined && !Number.isNaN(width);\n\n if (isDevelopment) {\n if (Number.isNaN(height)) {\n warnOnce('Modal', 'Height is NaN and will not be set. This is likely a bug in your code.');\n } else if (hasCustomHeight && constrainedHeight !== height) {\n warnOnce(\n 'Modal',\n `Height (${height}px) is too small. Modal requires at least ${MIN_CONTENT_HEIGHT}px for content plus header/footer space (total: ${minModalHeight}px). Height will be adjusted to ${constrainedHeight}px.`\n );\n }\n\n if (Number.isNaN(width)) {\n warnOnce('Modal', 'Width is NaN and will not be set. This is likely a bug in your code.');\n } else if (hasCustomWidth && constrainedWidth !== width) {\n warnOnce(\n 'Modal',\n `Width (${width}px) is below minimum (${MIN_MODAL_WIDTH}px) and will be adjusted to ${constrainedWidth}px.`\n );\n }\n }\n\n return {\n footerRef,\n headerRef,\n footerHeight,\n hasCustomHeight,\n hasCustomWidth,\n dialogCustomStyles: {\n ...(hasCustomWidth && { [customCssProps.modalCustomWidth]: `${constrainedWidth}px` }),\n ...(hasCustomHeight && { [customCssProps.modalCustomHeight]: `${constrainedHeight}px` }),\n },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-option-value-field.d.ts","sourceRoot":"","sources":["../../../../src/select/utils/check-option-value-field.ts"],"names":[],"mappings":"AAMA,wBAAgB,qBAAqB,CAAC,SAAS,SAAS,aAAa,CAAC,GAAG,CAAC,EACxE,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,SAAS,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"check-option-value-field.d.ts","sourceRoot":"","sources":["../../../../src/select/utils/check-option-value-field.ts"],"names":[],"mappings":"AAMA,wBAAgB,qBAAqB,CAAC,SAAS,SAAS,aAAa,CAAC,GAAG,CAAC,EACxE,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,SAAS,GAAG,SAAS,QAoBrC"}
|
|
@@ -7,6 +7,8 @@ export function checkOptionValueField(componentName, propertyName, propertyValue
|
|
|
7
7
|
if (!propertyValue) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
+
// The `in` checks below are intentional: `element` is `any` (loosely-typed external input),
|
|
11
|
+
// so compile-time `keyof` validation is not possible. These checks validate runtime shape.
|
|
10
12
|
const valuePropertyMissing = !propertyValue.every(element => {
|
|
11
13
|
return 'options' in element || 'value' in element;
|
|
12
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-option-value-field.js","sourceRoot":"","sources":["../../../../src/select/utils/check-option-value-field.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,UAAU,qBAAqB,CACnC,aAAqB,EACrB,YAAoB,EACpB,aAAoC;IAEpC,IAAI,aAAa,EAAE,CAAC;QAClB,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,MAAM,oBAAoB,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;YAC1D,OAAO,SAAS,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,CAAC;QACpD,CAAC,CAAC,CAAC;QAEH,IAAI,oBAAoB,EAAE,CAAC;YACzB,QAAQ,CACN,aAAa,EACb,qBAAqB,YAAY,8IAA8I,CAChL,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { isDevelopment } from '../../internal/is-development';\n\nexport function checkOptionValueField<ValueType extends ReadonlyArray<any>>(\n componentName: string,\n propertyName: string,\n propertyValue: ValueType | undefined\n) {\n if (isDevelopment) {\n if (!propertyValue) {\n return;\n }\n\n const valuePropertyMissing = !propertyValue.every(element => {\n return 'options' in element || 'value' in element;\n });\n\n if (valuePropertyMissing) {\n warnOnce(\n componentName,\n `You provided an \\`${propertyName}\\` prop where at least one non-group array element is missing the \\`value\\` field. This field is required for all options without sub-items.`\n );\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"check-option-value-field.js","sourceRoot":"","sources":["../../../../src/select/utils/check-option-value-field.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,UAAU,qBAAqB,CACnC,aAAqB,EACrB,YAAoB,EACpB,aAAoC;IAEpC,IAAI,aAAa,EAAE,CAAC;QAClB,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,4FAA4F;QAC5F,2FAA2F;QAC3F,MAAM,oBAAoB,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;YAC1D,OAAO,SAAS,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,CAAC;QACpD,CAAC,CAAC,CAAC;QAEH,IAAI,oBAAoB,EAAE,CAAC;YACzB,QAAQ,CACN,aAAa,EACb,qBAAqB,YAAY,8IAA8I,CAChL,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { isDevelopment } from '../../internal/is-development';\n\nexport function checkOptionValueField<ValueType extends ReadonlyArray<any>>(\n componentName: string,\n propertyName: string,\n propertyValue: ValueType | undefined\n) {\n if (isDevelopment) {\n if (!propertyValue) {\n return;\n }\n\n // The `in` checks below are intentional: `element` is `any` (loosely-typed external input),\n // so compile-time `keyof` validation is not possible. These checks validate runtime shape.\n const valuePropertyMissing = !propertyValue.every(element => {\n return 'options' in element || 'value' in element;\n });\n\n if (valuePropertyMissing) {\n warnOnce(\n componentName,\n `You provided an \\`${propertyName}\\` prop where at least one non-group array element is missing the \\`value\\` field. This field is required for all options without sub-items.`\n );\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools-header.d.ts","sourceRoot":"","sources":["../../../src/table/tools-header.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAU1C,UAAU,gBAAgB;IACxB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"tools-header.d.ts","sourceRoot":"","sources":["../../../src/table/tools-header.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAU1C,UAAU,gBAAgB;IACxB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,EAAE,gBAAgB,eA2CnH"}
|
|
@@ -16,12 +16,13 @@ export default function ToolsHeader({ header, filter, pagination, preferences, s
|
|
|
16
16
|
}
|
|
17
17
|
const isSmall = breakpoint === 'default';
|
|
18
18
|
const hasTools = filter || pagination || preferences;
|
|
19
|
+
const hasRightAlignedTools = !!(pagination || preferences);
|
|
19
20
|
return (React.createElement(React.Fragment, null,
|
|
20
21
|
isHeaderString ? React.createElement("span", { id: headingId }, header) : header,
|
|
21
22
|
hasTools && (React.createElement("div", { ref: ref, className: clsx(styles.tools, isSmall && styles['tools-small']) },
|
|
22
23
|
filter && (React.createElement("div", { className: styles['tools-filtering'], onClickCapture: () => setLastUserAction === null || setLastUserAction === void 0 ? void 0 : setLastUserAction('filter'), onKeyDownCapture: () => setLastUserAction === null || setLastUserAction === void 0 ? void 0 : setLastUserAction('filter') }, filter)),
|
|
23
|
-
React.createElement("div", { className: styles['tools-align-right'] },
|
|
24
|
+
hasRightAlignedTools && (React.createElement("div", { className: styles['tools-align-right'] },
|
|
24
25
|
pagination && (React.createElement("div", { className: styles['tools-pagination'], onClickCapture: () => setLastUserAction === null || setLastUserAction === void 0 ? void 0 : setLastUserAction('pagination') }, pagination)),
|
|
25
|
-
preferences && (React.createElement("div", { className: styles['tools-preferences'], onClickCapture: () => setLastUserAction === null || setLastUserAction === void 0 ? void 0 : setLastUserAction('preferences') }, preferences)))))));
|
|
26
|
+
preferences && (React.createElement("div", { className: styles['tools-preferences'], onClickCapture: () => setLastUserAction === null || setLastUserAction === void 0 ? void 0 : setLastUserAction('preferences') }, preferences))))))));
|
|
26
27
|
}
|
|
27
28
|
//# sourceMappingURL=tools-header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools-header.js","sourceRoot":"","sources":["../../../src/table/tools-header.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAUrC,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAoB;IAClH,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,uBAAuB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,MAAM,cAAc,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC;IAClD,MAAM,cAAc,GAAG,UAAU,CAAC,sBAAsB,C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;YACA,oBAAoB,IAAI,CACvB,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;gBACxC,UAAU,IAAI,CACb,6BAAK,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAG,YAAY,CAAC,IAChG,UAAU,CACP,CACP;gBACA,WAAW,IAAI,CACd,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAG,aAAa,CAAC,IAClG,WAAW,CACR,CACP,CACG,CACP,CACG,CACP,CACA,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\n\nimport styles from './styles.css.js';\n\ninterface ToolsHeaderProps {\n header: React.ReactNode;\n filter?: React.ReactNode;\n pagination?: React.ReactNode;\n preferences?: React.ReactNode;\n setLastUserAction?: (name: string) => void;\n}\n\nexport default function ToolsHeader({ header, filter, pagination, preferences, setLastUserAction }: ToolsHeaderProps) {\n const [breakpoint, ref] = useContainerBreakpoints(['xs']);\n const isHeaderString = typeof header === 'string';\n const assignHeaderId = useContext(CollectionLabelContext).assignId;\n const headingId = useUniqueId('heading');\n if (assignHeaderId !== undefined && isHeaderString) {\n assignHeaderId(headingId);\n }\n const isSmall = breakpoint === 'default';\n const hasTools = filter || pagination || preferences;\n const hasRightAlignedTools = !!(pagination || preferences);\n return (\n <>\n {isHeaderString ? <span id={headingId}>{header}</span> : header}\n {hasTools && (\n <div ref={ref} className={clsx(styles.tools, isSmall && styles['tools-small'])}>\n {filter && (\n <div\n className={styles['tools-filtering']}\n onClickCapture={() => setLastUserAction?.('filter')}\n onKeyDownCapture={() => setLastUserAction?.('filter')}\n >\n {filter}\n </div>\n )}\n {hasRightAlignedTools && (\n <div className={styles['tools-align-right']}>\n {pagination && (\n <div className={styles['tools-pagination']} onClickCapture={() => setLastUserAction?.('pagination')}>\n {pagination}\n </div>\n )}\n {preferences && (\n <div className={styles['tools-preferences']} onClickCapture={() => setLastUserAction?.('preferences')}>\n {preferences}\n </div>\n )}\n </div>\n )}\n </div>\n )}\n </>\n );\n}\n"]}
|