@cloudscape-design/components 3.0.631 → 3.0.632
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/autosuggest/internal.d.ts.map +1 -1
- package/autosuggest/internal.js +10 -0
- package/autosuggest/internal.js.map +1 -1
- package/form-field/styles.css.js +23 -23
- package/form-field/styles.scoped.css +38 -37
- package/form-field/styles.selectors.js +23 -23
- package/internal/components/options-list/utils/use-keyboard.d.ts +2 -1
- package/internal/components/options-list/utils/use-keyboard.d.ts.map +1 -1
- package/internal/components/options-list/utils/use-keyboard.js +4 -4
- package/internal/components/options-list/utils/use-keyboard.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/link/styles.css.js +20 -20
- package/link/styles.scoped.css +71 -75
- package/link/styles.selectors.js +20 -20
- package/package.json +1 -1
- package/select/utils/use-select.d.ts.map +1 -1
- package/select/utils/use-select.js +15 -1
- package/select/utils/use-select.js.map +1 -1
- package/table/selection/use-selection.d.ts.map +1 -1
- package/table/selection/use-selection.js +59 -64
- package/table/selection/use-selection.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAIhE,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAejE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAWlF,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAEjG,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAIhE,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAejE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAWlF,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB,EAAE,0BAA0B;CAAG;AAEjG,QAAA,MAAM,mBAAmB,uGAsOvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
|
package/autosuggest/internal.js
CHANGED
|
@@ -80,9 +80,19 @@ const InternalAutosuggest = React.forwardRef((props, ref) => {
|
|
|
80
80
|
fireCancelableEvent(onKeyDown, event.detail, event);
|
|
81
81
|
};
|
|
82
82
|
const handlePressArrowDown = () => {
|
|
83
|
+
if (autosuggestItemsState.items.length - 1 === autosuggestItemsState.highlightedIndex) {
|
|
84
|
+
autosuggestItemsHandlers.goHomeWithKeyboard();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
83
87
|
autosuggestItemsHandlers.moveHighlightWithKeyboard(1);
|
|
84
88
|
};
|
|
85
89
|
const handlePressArrowUp = () => {
|
|
90
|
+
var _a;
|
|
91
|
+
if ((((_a = autosuggestItemsState.highlightedOption) === null || _a === void 0 ? void 0 : _a.type) === 'child' && autosuggestItemsState.highlightedIndex === 1) ||
|
|
92
|
+
autosuggestItemsState.highlightedIndex === 0) {
|
|
93
|
+
autosuggestItemsHandlers.goEndWithKeyboard();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
86
96
|
autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);
|
|
87
97
|
};
|
|
88
98
|
const handlePressEnter = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAO,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,iBAAiB,E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AClC,YAAY,EAAE,gBAAgB,IAC9B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useAutosuggestItems } from './options-controller';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\n\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport DropdownFooter from '../internal/components/dropdown-footer';\n\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport {\n BaseKeyDetail,\n fireCancelableEvent,\n fireNonCancelableEvent,\n NonCancelableCustomEvent,\n} from '../internal/events';\nimport { BaseChangeDetail } from '../input/interfaces';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport AutosuggestOptionsList from './options-list';\nimport { useAutosuggestLoadMore } from './load-more-controller';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { useInternalI18n } from '../i18n/context';\n\nimport styles from './styles.css.js';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nexport interface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {}\n\nconst InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, ref: Ref<AutosuggestProps.Ref>) => {\n const {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n placeholder,\n clearAriaLabel,\n name,\n disabled,\n disableBrowserAutocorrect = false,\n autoFocus,\n readOnly,\n ariaLabel,\n ariaRequired,\n enteredTextLabel,\n filteringResultsText,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n onSelect,\n renderHighlightedAriaLive,\n __internalRootRef,\n ...restProps\n } = props;\n\n checkControlled('Autosuggest', 'value', value, 'onChange', onChange);\n checkOptionValueField('Autosuggest', 'options', options);\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n useImperativeHandle(\n ref,\n () => ({\n focus: () => autosuggestInputRef.current?.focus(),\n select: () => autosuggestInputRef.current?.select(),\n }),\n []\n );\n\n const i18n = useInternalI18n('autosuggest');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Autosuggest', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: value,\n filteringType,\n enteredTextLabel,\n hideEnteredTextLabel: false,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n fireNonCancelableEvent(onSelect, {\n value,\n selectedOption: option.type !== 'use-entered' ? option.option : undefined,\n });\n autosuggestInputRef.current?.close();\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.setShowAll(false);\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, null);\n };\n\n const handleFocus = () => {\n autosuggestItemsHandlers.setShowAll(true);\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireNonCancelableEvent(onFocus, null);\n };\n\n const handleKeyUp = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyUp, event.detail, event);\n };\n\n const handleKeyDown = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, event.detail, event);\n };\n\n const handlePressArrowDown = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('input');\n const footerControlId = useUniqueId('footer');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionIdSource = useUniqueId();\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? highlightedOptionIdSource : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const isFiltered = !!value && value.length !== 0;\n const filteredText = isFiltered\n ? filteringResultsText?.(autosuggestItemsState.items.length, options?.length ?? 0)\n : undefined;\n const dropdownStatus = useDropdownStatus({\n ...props,\n isEmpty,\n isFiltered,\n recoveryText,\n errorIconAriaLabel,\n onRecoveryClick: handleRecoveryClick,\n filteringResultsText: filteredText,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const shouldRenderDropdownContent = !isEmpty || dropdownStatus.content;\n\n return (\n <AutosuggestInput\n {...restProps}\n className={clsx(styles.root, restProps.className)}\n ref={autosuggestInputRef}\n __internalRootRef={__internalRootRef}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n name={name}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n clearAriaLabel={clearAriaLabel}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={autosuggestItemsState.items.length > 1 || dropdownStatus.content !== null}\n dropdownContent={\n shouldRenderDropdownContent && (\n <AutosuggestOptionsList\n statusType={statusType}\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={value}\n listId={listId}\n controlId={controlId}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n selectedAriaLabel={selectedAriaLabel}\n renderHighlightedAriaLive={renderHighlightedAriaLive}\n listBottom={\n !dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} id={footerControlId} /> : null\n }\n ariaDescribedby={dropdownStatus.content ? footerControlId : undefined}\n />\n )\n }\n dropdownFooter={\n dropdownStatus.isSticky && dropdownStatus.content ? (\n <DropdownFooter\n id={footerControlId}\n content={dropdownStatus.content}\n hasItems={autosuggestItemsState.items.length >= 1}\n />\n ) : null\n }\n loopFocus={statusType === 'error' && !!recoveryText && !!onLoadItems}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n />\n );\n});\n\nexport default InternalAutosuggest;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/autosuggest/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACr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E,eAAe,GAAI,CAAC,CAAC,CAAC,IAAI,EAE5G,eAAe,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,GACrE,CACH,EAEH,cAAc,EACZ,cAAc,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAClD,oBAAC,cAAc,IACb,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,cAAc,CAAC,OAAO,EAC/B,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GACjD,CACH,CAAC,CAAC,CAAC,IAAI,EAEV,SAAS,EAAE,UAAU,KAAK,OAAO,IAAI,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,WAAW,EACpE,eAAe,EAAE,mBAAmB,EACpC,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,IAC9B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useAutosuggestItems } from './options-controller';\nimport { AutosuggestItem, AutosuggestProps } from './interfaces';\n\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport DropdownFooter from '../internal/components/dropdown-footer';\n\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport {\n BaseKeyDetail,\n fireCancelableEvent,\n fireNonCancelableEvent,\n NonCancelableCustomEvent,\n} from '../internal/events';\nimport { BaseChangeDetail } from '../input/interfaces';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport AutosuggestOptionsList from './options-list';\nimport { useAutosuggestLoadMore } from './load-more-controller';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { useInternalI18n } from '../i18n/context';\n\nimport styles from './styles.css.js';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nexport interface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {}\n\nconst InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, ref: Ref<AutosuggestProps.Ref>) => {\n const {\n value,\n onChange,\n onBlur,\n onFocus,\n onKeyUp,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n placeholder,\n clearAriaLabel,\n name,\n disabled,\n disableBrowserAutocorrect = false,\n autoFocus,\n readOnly,\n ariaLabel,\n ariaRequired,\n enteredTextLabel,\n filteringResultsText,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n onSelect,\n renderHighlightedAriaLive,\n __internalRootRef,\n ...restProps\n } = props;\n\n checkControlled('Autosuggest', 'value', value, 'onChange', onChange);\n checkOptionValueField('Autosuggest', 'options', options);\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n useImperativeHandle(\n ref,\n () => ({\n focus: () => autosuggestInputRef.current?.focus(),\n select: () => autosuggestInputRef.current?.select(),\n }),\n []\n );\n\n const i18n = useInternalI18n('autosuggest');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Autosuggest', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: value,\n filteringType,\n enteredTextLabel,\n hideEnteredTextLabel: false,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n fireNonCancelableEvent(onSelect, {\n value,\n selectedOption: option.type !== 'use-entered' ? option.option : undefined,\n });\n autosuggestInputRef.current?.close();\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.setShowAll(false);\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, null);\n };\n\n const handleFocus = () => {\n autosuggestItemsHandlers.setShowAll(true);\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireNonCancelableEvent(onFocus, null);\n };\n\n const handleKeyUp = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyUp, event.detail, event);\n };\n\n const handleKeyDown = (event: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, event.detail, event);\n };\n\n const handlePressArrowDown = () => {\n if (autosuggestItemsState.items.length - 1 === autosuggestItemsState.highlightedIndex) {\n autosuggestItemsHandlers.goHomeWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n if (\n (autosuggestItemsState.highlightedOption?.type === 'child' && autosuggestItemsState.highlightedIndex === 1) ||\n autosuggestItemsState.highlightedIndex === 0\n ) {\n autosuggestItemsHandlers.goEndWithKeyboard();\n return;\n }\n\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const formFieldContext = useFormFieldContext(restProps);\n const selfControlId = useUniqueId('input');\n const footerControlId = useUniqueId('footer');\n const controlId = formFieldContext.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionIdSource = useUniqueId();\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? highlightedOptionIdSource : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const isFiltered = !!value && value.length !== 0;\n const filteredText = isFiltered\n ? filteringResultsText?.(autosuggestItemsState.items.length, options?.length ?? 0)\n : undefined;\n const dropdownStatus = useDropdownStatus({\n ...props,\n isEmpty,\n isFiltered,\n recoveryText,\n errorIconAriaLabel,\n onRecoveryClick: handleRecoveryClick,\n filteringResultsText: filteredText,\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const shouldRenderDropdownContent = !isEmpty || dropdownStatus.content;\n\n return (\n <AutosuggestInput\n {...restProps}\n className={clsx(styles.root, restProps.className)}\n ref={autosuggestInputRef}\n __internalRootRef={__internalRootRef}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n name={name}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n clearAriaLabel={clearAriaLabel}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={autosuggestItemsState.items.length > 1 || dropdownStatus.content !== null}\n dropdownContent={\n shouldRenderDropdownContent && (\n <AutosuggestOptionsList\n statusType={statusType}\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={value}\n listId={listId}\n controlId={controlId}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n selectedAriaLabel={selectedAriaLabel}\n renderHighlightedAriaLive={renderHighlightedAriaLive}\n listBottom={\n !dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} id={footerControlId} /> : null\n }\n ariaDescribedby={dropdownStatus.content ? footerControlId : undefined}\n />\n )\n }\n dropdownFooter={\n dropdownStatus.isSticky && dropdownStatus.content ? (\n <DropdownFooter\n id={footerControlId}\n content={dropdownStatus.content}\n hasItems={autosuggestItemsState.items.length >= 1}\n />\n ) : null\n }\n loopFocus={statusType === 'error' && !!recoveryText && !!onLoadItems}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n />\n );\n});\n\nexport default InternalAutosuggest;\n"]}
|
package/form-field/styles.css.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"error-icon-shake-wrapper": "awsui_error-icon-shake-
|
|
5
|
-
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-
|
|
6
|
-
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-
|
|
7
|
-
"error-icon-scale-wrapper": "awsui_error-icon-scale-
|
|
8
|
-
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-
|
|
9
|
-
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-
|
|
10
|
-
"warning": "
|
|
11
|
-
"error": "
|
|
12
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
13
|
-
"root": "
|
|
14
|
-
"label": "
|
|
15
|
-
"info": "
|
|
16
|
-
"description": "
|
|
17
|
-
"constraint": "
|
|
18
|
-
"hints": "
|
|
19
|
-
"constraint-has-validation-text": "awsui_constraint-has-validation-
|
|
20
|
-
"secondary-control": "awsui_secondary-
|
|
21
|
-
"controls": "
|
|
22
|
-
"label-hidden": "awsui_label-
|
|
23
|
-
"control": "
|
|
24
|
-
"error__message": "
|
|
25
|
-
"warning__message": "
|
|
26
|
-
"visually-hidden": "awsui_visually-
|
|
4
|
+
"error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_3golc_103",
|
|
5
|
+
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_3golc_104",
|
|
6
|
+
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_3golc_1",
|
|
7
|
+
"error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_3golc_134",
|
|
8
|
+
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_3golc_135",
|
|
9
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_3golc_1",
|
|
10
|
+
"warning": "awsui_warning_14mhv_3golc_104",
|
|
11
|
+
"error": "awsui_error_14mhv_3golc_103",
|
|
12
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_3golc_1",
|
|
13
|
+
"root": "awsui_root_14mhv_3golc_186",
|
|
14
|
+
"label": "awsui_label_14mhv_3golc_222",
|
|
15
|
+
"info": "awsui_info_14mhv_3golc_236",
|
|
16
|
+
"description": "awsui_description_14mhv_3golc_242",
|
|
17
|
+
"constraint": "awsui_constraint_14mhv_3golc_243",
|
|
18
|
+
"hints": "awsui_hints_14mhv_3golc_250",
|
|
19
|
+
"constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_3golc_251",
|
|
20
|
+
"secondary-control": "awsui_secondary-control_14mhv_3golc_255",
|
|
21
|
+
"controls": "awsui_controls_14mhv_3golc_259",
|
|
22
|
+
"label-hidden": "awsui_label-hidden_14mhv_3golc_259",
|
|
23
|
+
"control": "awsui_control_14mhv_3golc_259",
|
|
24
|
+
"error__message": "awsui_error__message_14mhv_3golc_286",
|
|
25
|
+
"warning__message": "awsui_warning__message_14mhv_3golc_287",
|
|
26
|
+
"visually-hidden": "awsui_visually-hidden_14mhv_3golc_291"
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -100,11 +100,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
100
100
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
101
101
|
SPDX-License-Identifier: Apache-2.0
|
|
102
102
|
*/
|
|
103
|
-
.awsui_error-icon-shake-
|
|
104
|
-
.awsui_warning-icon-shake-
|
|
105
|
-
animation: awsui_awsui-motion-shake-
|
|
103
|
+
.awsui_error-icon-shake-wrapper_14mhv_3golc_103:not(#\9),
|
|
104
|
+
.awsui_warning-icon-shake-wrapper_14mhv_3golc_104:not(#\9) {
|
|
105
|
+
animation: awsui_awsui-motion-shake-horizontally_14mhv_3golc_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms);
|
|
106
106
|
}
|
|
107
|
-
@keyframes awsui_awsui-motion-shake-
|
|
107
|
+
@keyframes awsui_awsui-motion-shake-horizontally_14mhv_3golc_1 {
|
|
108
108
|
0% {
|
|
109
109
|
transform: translateX(-5px);
|
|
110
110
|
animation-timing-function: linear;
|
|
@@ -118,22 +118,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
@media (prefers-reduced-motion: reduce) {
|
|
121
|
-
.awsui_error-icon-shake-
|
|
122
|
-
.awsui_warning-icon-shake-
|
|
121
|
+
.awsui_error-icon-shake-wrapper_14mhv_3golc_103:not(#\9),
|
|
122
|
+
.awsui_warning-icon-shake-wrapper_14mhv_3golc_104:not(#\9) {
|
|
123
123
|
animation: none;
|
|
124
124
|
transition: none;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
.awsui-motion-disabled .awsui_error-icon-shake-
|
|
127
|
+
.awsui-motion-disabled .awsui_error-icon-shake-wrapper_14mhv_3golc_103:not(#\9), .awsui-mode-entering .awsui_error-icon-shake-wrapper_14mhv_3golc_103:not(#\9), .awsui-motion-disabled .awsui_warning-icon-shake-wrapper_14mhv_3golc_104:not(#\9), .awsui-mode-entering .awsui_warning-icon-shake-wrapper_14mhv_3golc_104:not(#\9) {
|
|
128
128
|
animation: none;
|
|
129
129
|
transition: none;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
.awsui_error-icon-scale-
|
|
133
|
-
.awsui_warning-icon-scale-
|
|
134
|
-
animation: awsui_awsui-motion-scale-
|
|
132
|
+
.awsui_error-icon-scale-wrapper_14mhv_3golc_134:not(#\9),
|
|
133
|
+
.awsui_warning-icon-scale-wrapper_14mhv_3golc_135:not(#\9) {
|
|
134
|
+
animation: awsui_awsui-motion-scale-popup_14mhv_3golc_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms) var(--motion-easing-refresh-only-a-8flf9q, cubic-bezier(0, 0, 0, 1));
|
|
135
135
|
}
|
|
136
|
-
@keyframes awsui_awsui-motion-scale-
|
|
136
|
+
@keyframes awsui_awsui-motion-scale-popup_14mhv_3golc_1 {
|
|
137
137
|
0% {
|
|
138
138
|
transform: scale(0.95);
|
|
139
139
|
}
|
|
@@ -142,22 +142,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
@media (prefers-reduced-motion: reduce) {
|
|
145
|
-
.awsui_error-icon-scale-
|
|
146
|
-
.awsui_warning-icon-scale-
|
|
145
|
+
.awsui_error-icon-scale-wrapper_14mhv_3golc_134:not(#\9),
|
|
146
|
+
.awsui_warning-icon-scale-wrapper_14mhv_3golc_135:not(#\9) {
|
|
147
147
|
animation: none;
|
|
148
148
|
transition: none;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
.awsui-motion-disabled .awsui_error-icon-scale-
|
|
151
|
+
.awsui-motion-disabled .awsui_error-icon-scale-wrapper_14mhv_3golc_134:not(#\9), .awsui-mode-entering .awsui_error-icon-scale-wrapper_14mhv_3golc_134:not(#\9), .awsui-motion-disabled .awsui_warning-icon-scale-wrapper_14mhv_3golc_135:not(#\9), .awsui-mode-entering .awsui_warning-icon-scale-wrapper_14mhv_3golc_135:not(#\9) {
|
|
152
152
|
animation: none;
|
|
153
153
|
transition: none;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
.
|
|
157
|
-
.
|
|
158
|
-
animation: awsui_awsui-motion-fade-in-
|
|
156
|
+
.awsui_warning_14mhv_3golc_104:not(#\9),
|
|
157
|
+
.awsui_error_14mhv_3golc_103:not(#\9) {
|
|
158
|
+
animation: awsui_awsui-motion-fade-in-0_14mhv_3golc_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms) var(--motion-easing-refresh-only-a-8flf9q, cubic-bezier(0, 0, 0, 1));
|
|
159
159
|
}
|
|
160
|
-
@keyframes awsui_awsui-motion-fade-in-
|
|
160
|
+
@keyframes awsui_awsui-motion-fade-in-0_14mhv_3golc_1 {
|
|
161
161
|
from {
|
|
162
162
|
opacity: 0;
|
|
163
163
|
}
|
|
@@ -166,18 +166,18 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
@media (prefers-reduced-motion: reduce) {
|
|
169
|
-
.
|
|
170
|
-
.
|
|
169
|
+
.awsui_warning_14mhv_3golc_104:not(#\9),
|
|
170
|
+
.awsui_error_14mhv_3golc_103:not(#\9) {
|
|
171
171
|
animation: none;
|
|
172
172
|
transition: none;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
.awsui-motion-disabled .
|
|
175
|
+
.awsui-motion-disabled .awsui_warning_14mhv_3golc_104:not(#\9), .awsui-mode-entering .awsui_warning_14mhv_3golc_104:not(#\9), .awsui-motion-disabled .awsui_error_14mhv_3golc_103:not(#\9), .awsui-mode-entering .awsui_error_14mhv_3golc_103:not(#\9) {
|
|
176
176
|
animation: none;
|
|
177
177
|
transition: none;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
.
|
|
180
|
+
.awsui_root_14mhv_3golc_186:not(#\9) {
|
|
181
181
|
border-collapse: separate;
|
|
182
182
|
border-spacing: 0;
|
|
183
183
|
box-sizing: border-box;
|
|
@@ -214,7 +214,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
214
214
|
box-sizing: border-box;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
.
|
|
217
|
+
.awsui_label_14mhv_3golc_222:not(#\9) {
|
|
218
218
|
box-sizing: border-box;
|
|
219
219
|
color: var(--color-text-form-label-ktbzsd, #000716);
|
|
220
220
|
display: inline;
|
|
@@ -223,43 +223,44 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
223
223
|
font-weight: var(--font-display-label-weight-815ja9, 700);
|
|
224
224
|
margin-inline-end: var(--space-xs-zb16t3, 8px);
|
|
225
225
|
}
|
|
226
|
-
.
|
|
226
|
+
.awsui_label_14mhv_3golc_222:not(#\9):only-child {
|
|
227
227
|
margin-block: 0;
|
|
228
228
|
margin-inline: 0;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
.
|
|
231
|
+
.awsui_info_14mhv_3golc_236:not(#\9) {
|
|
232
|
+
display: inline-flex;
|
|
232
233
|
padding-inline-start: var(--space-xs-zb16t3, 8px);
|
|
233
234
|
border-inline-start: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-divider-default-j74lyz, #b6bec9);
|
|
234
235
|
}
|
|
235
236
|
|
|
236
|
-
.
|
|
237
|
-
.
|
|
237
|
+
.awsui_description_14mhv_3golc_242:not(#\9),
|
|
238
|
+
.awsui_constraint_14mhv_3golc_243:not(#\9) {
|
|
238
239
|
color: var(--color-text-form-secondary-dxc248, #5f6b7a);
|
|
239
240
|
font-size: var(--font-size-body-s-asqx2i, 12px);
|
|
240
241
|
line-height: var(--line-height-body-s-7zv1j5, 16px);
|
|
241
242
|
letter-spacing: var(--letter-spacing-body-s-z9jkwp, 0.005em);
|
|
242
243
|
}
|
|
243
244
|
|
|
244
|
-
.
|
|
245
|
-
.awsui_constraint-has-validation-
|
|
245
|
+
.awsui_hints_14mhv_3golc_250:not(#\9),
|
|
246
|
+
.awsui_constraint-has-validation-text_14mhv_3golc_251:not(#\9) {
|
|
246
247
|
padding-block-start: var(--space-xxs-p8yyaw, 4px);
|
|
247
248
|
}
|
|
248
249
|
|
|
249
|
-
.awsui_secondary-
|
|
250
|
+
.awsui_secondary-control_14mhv_3golc_255:not(#\9) {
|
|
250
251
|
/* used in test-utils */
|
|
251
252
|
}
|
|
252
253
|
|
|
253
|
-
.
|
|
254
|
+
.awsui_controls_14mhv_3golc_259:not(#\9):not(.awsui_label-hidden_14mhv_3golc_259) {
|
|
254
255
|
padding-block-start: var(--space-xxs-p8yyaw, 4px);
|
|
255
256
|
}
|
|
256
257
|
|
|
257
|
-
.
|
|
258
|
+
.awsui_control_14mhv_3golc_259:not(#\9) {
|
|
258
259
|
min-inline-size: 0;
|
|
259
260
|
word-break: break-word;
|
|
260
261
|
}
|
|
261
262
|
|
|
262
|
-
.
|
|
263
|
+
.awsui_error_14mhv_3golc_103:not(#\9) {
|
|
263
264
|
color: var(--color-text-status-error-wdvepn, #d91515);
|
|
264
265
|
font-size: var(--font-size-body-s-asqx2i, 12px);
|
|
265
266
|
line-height: var(--line-height-body-s-7zv1j5, 16px);
|
|
@@ -268,7 +269,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
268
269
|
align-items: flex-start;
|
|
269
270
|
}
|
|
270
271
|
|
|
271
|
-
.
|
|
272
|
+
.awsui_warning_14mhv_3golc_104:not(#\9) {
|
|
272
273
|
color: var(--color-text-status-warning-yik8vi, #8d6605);
|
|
273
274
|
font-size: var(--font-size-body-s-asqx2i, 12px);
|
|
274
275
|
line-height: var(--line-height-body-s-7zv1j5, 16px);
|
|
@@ -277,12 +278,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
277
278
|
align-items: flex-start;
|
|
278
279
|
}
|
|
279
280
|
|
|
280
|
-
.
|
|
281
|
-
.
|
|
281
|
+
.awsui_error__message_14mhv_3golc_286:not(#\9),
|
|
282
|
+
.awsui_warning__message_14mhv_3golc_287:not(#\9) {
|
|
282
283
|
margin-inline-start: var(--space-xxs-p8yyaw, 4px);
|
|
283
284
|
}
|
|
284
285
|
|
|
285
|
-
.awsui_visually-
|
|
286
|
+
.awsui_visually-hidden_14mhv_3golc_291:not(#\9) {
|
|
286
287
|
position: absolute !important;
|
|
287
288
|
inset-block-start: -9999px !important;
|
|
288
289
|
inset-inline-start: -9999px !important;
|
|
@@ -2,28 +2,28 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"error-icon-shake-wrapper": "awsui_error-icon-shake-
|
|
6
|
-
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-
|
|
7
|
-
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-
|
|
8
|
-
"error-icon-scale-wrapper": "awsui_error-icon-scale-
|
|
9
|
-
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-
|
|
10
|
-
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-
|
|
11
|
-
"warning": "
|
|
12
|
-
"error": "
|
|
13
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
14
|
-
"root": "
|
|
15
|
-
"label": "
|
|
16
|
-
"info": "
|
|
17
|
-
"description": "
|
|
18
|
-
"constraint": "
|
|
19
|
-
"hints": "
|
|
20
|
-
"constraint-has-validation-text": "awsui_constraint-has-validation-
|
|
21
|
-
"secondary-control": "awsui_secondary-
|
|
22
|
-
"controls": "
|
|
23
|
-
"label-hidden": "awsui_label-
|
|
24
|
-
"control": "
|
|
25
|
-
"error__message": "
|
|
26
|
-
"warning__message": "
|
|
27
|
-
"visually-hidden": "awsui_visually-
|
|
5
|
+
"error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_3golc_103",
|
|
6
|
+
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_3golc_104",
|
|
7
|
+
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_3golc_1",
|
|
8
|
+
"error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_3golc_134",
|
|
9
|
+
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_3golc_135",
|
|
10
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_3golc_1",
|
|
11
|
+
"warning": "awsui_warning_14mhv_3golc_104",
|
|
12
|
+
"error": "awsui_error_14mhv_3golc_103",
|
|
13
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_3golc_1",
|
|
14
|
+
"root": "awsui_root_14mhv_3golc_186",
|
|
15
|
+
"label": "awsui_label_14mhv_3golc_222",
|
|
16
|
+
"info": "awsui_info_14mhv_3golc_236",
|
|
17
|
+
"description": "awsui_description_14mhv_3golc_242",
|
|
18
|
+
"constraint": "awsui_constraint_14mhv_3golc_243",
|
|
19
|
+
"hints": "awsui_hints_14mhv_3golc_250",
|
|
20
|
+
"constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_3golc_251",
|
|
21
|
+
"secondary-control": "awsui_secondary-control_14mhv_3golc_255",
|
|
22
|
+
"controls": "awsui_controls_14mhv_3golc_259",
|
|
23
|
+
"label-hidden": "awsui_label-hidden_14mhv_3golc_259",
|
|
24
|
+
"control": "awsui_control_14mhv_3golc_259",
|
|
25
|
+
"error__message": "awsui_error__message_14mhv_3golc_286",
|
|
26
|
+
"warning__message": "awsui_warning__message_14mhv_3golc_287",
|
|
27
|
+
"visually-hidden": "awsui_visually-hidden_14mhv_3golc_291"
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BaseKeyDetail, CancelableEventHandler } from '../../../events';
|
|
2
2
|
interface UseMenuKeyboard {
|
|
3
3
|
(inputProps: {
|
|
4
|
-
|
|
4
|
+
goUp: () => void;
|
|
5
|
+
goDown: () => void;
|
|
5
6
|
selectOption: () => void;
|
|
6
7
|
goHome: () => void;
|
|
7
8
|
goEnd: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-keyboard.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/options-list/utils/use-keyboard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAKxE,UAAU,eAAe;IACvB,CAAC,UAAU,EAAE;QACX,
|
|
1
|
+
{"version":3,"file":"use-keyboard.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/options-list/utils/use-keyboard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAKxE,UAAU,eAAe;IACvB,CAAC,UAAU,EAAE;QACX,IAAI,EAAE,MAAM,IAAI,CAAC;QACjB,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,YAAY,EAAE,MAAM,IAAI,CAAC;QACzB,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,KAAK,EAAE,MAAM,IAAI,CAAC;QAClB,aAAa,EAAE,MAAM,IAAI,CAAC;QAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;CAC3C;AAED,eAAO,MAAM,eAAe,EAAE,eA2C7B,CAAC;AAEF,UAAU,kBAAkB;IAC1B,CAAC,UAAU,EAAE;QAAE,YAAY,EAAE,MAAM,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;CACvG;AAED,eAAO,MAAM,kBAAkB,EAAE,kBAmBhC,CAAC"}
|
|
@@ -4,16 +4,16 @@ import { useCallback } from 'react';
|
|
|
4
4
|
import { KeyCode } from '../../../keycode';
|
|
5
5
|
const HOME = 36;
|
|
6
6
|
const END = 35;
|
|
7
|
-
export const useMenuKeyboard = ({
|
|
7
|
+
export const useMenuKeyboard = ({ goUp, goDown, selectOption, goHome, goEnd, closeDropdown, preventNativeSpace = false, }) => {
|
|
8
8
|
return useCallback((e) => {
|
|
9
9
|
switch (e.detail.keyCode) {
|
|
10
10
|
case KeyCode.up:
|
|
11
11
|
e.preventDefault();
|
|
12
|
-
|
|
12
|
+
goUp();
|
|
13
13
|
break;
|
|
14
14
|
case KeyCode.down:
|
|
15
15
|
e.preventDefault();
|
|
16
|
-
|
|
16
|
+
goDown();
|
|
17
17
|
break;
|
|
18
18
|
case HOME:
|
|
19
19
|
goHome();
|
|
@@ -35,7 +35,7 @@ export const useMenuKeyboard = ({ moveHighlight, selectOption, goHome, goEnd, cl
|
|
|
35
35
|
selectOption();
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
}, [
|
|
38
|
+
}, [selectOption, goHome, goEnd, closeDropdown, preventNativeSpace, goUp, goDown]);
|
|
39
39
|
};
|
|
40
40
|
export const useTriggerKeyboard = ({ openDropdown, goHome }) => {
|
|
41
41
|
return useCallback((e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-keyboard.js","sourceRoot":"","sources":["../../../../../../src/internal/components/options-list/utils/use-keyboard.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,MAAM,IAAI,GAAG,EAAE,CAAC;AAChB,MAAM,GAAG,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"use-keyboard.js","sourceRoot":"","sources":["../../../../../../src/internal/components/options-list/utils/use-keyboard.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,MAAM,IAAI,GAAG,EAAE,CAAC;AAChB,MAAM,GAAG,GAAG,EAAE,CAAC;AAcf,MAAM,CAAC,MAAM,eAAe,GAAoB,CAAC,EAC/C,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,MAAM,EACN,KAAK,EACL,aAAa,EACb,kBAAkB,GAAG,KAAK,GAC3B,EAAE,EAAE;IACH,OAAO,WAAW,CAChB,CAAC,CAA6B,EAAE,EAAE;QAChC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE;YACxB,KAAK,OAAO,CAAC,EAAE;gBACb,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,IAAI,EAAE,CAAC;gBACP,MAAM;YACR,KAAK,OAAO,CAAC,IAAI;gBACf,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,MAAM,EAAE,CAAC;gBACT,MAAM;YACR,KAAK,IAAI;gBACP,MAAM,EAAE,CAAC;gBACT,MAAM;YACR,KAAK,GAAG;gBACN,KAAK,EAAE,CAAC;gBACR,MAAM;YACR,KAAK,OAAO,CAAC,MAAM;gBACjB,CAAC,CAAC,eAAe,EAAE,CAAC;gBACpB,aAAa,EAAE,CAAC;gBAChB,MAAM;YACR,KAAK,OAAO,CAAC,KAAK;gBAChB,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,YAAY,EAAE,CAAC;gBACf,MAAM;YACR,KAAK,OAAO,CAAC,KAAK;gBAChB,IAAI,kBAAkB,EAAE;oBACtB,CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,YAAY,EAAE,CAAC;iBAChB;SACJ;IACH,CAAC,EACD,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,CAAC,CAC/E,CAAC;AACJ,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,kBAAkB,GAAuB,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE;IACjF,OAAO,WAAW,CAChB,CAAC,CAA6B,EAAE,EAAE;QAChC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE;YACxB,KAAK,OAAO,CAAC,EAAE,CAAC;YAChB,KAAK,OAAO,CAAC,IAAI;gBACf,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,MAAM,EAAE,CAAC;gBACT,YAAY,EAAE,CAAC;gBACf,MAAM;YACR,KAAK,OAAO,CAAC,KAAK,CAAC;YACnB,KAAK,OAAO,CAAC,KAAK;gBAChB,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,YAAY,EAAE,CAAC;gBACf,MAAM;SACT;IACH,CAAC,EACD,CAAC,YAAY,EAAE,MAAM,CAAC,CACvB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useCallback } from 'react';\nimport { KeyCode } from '../../../keycode';\nimport { BaseKeyDetail, CancelableEventHandler } from '../../../events';\n\nconst HOME = 36;\nconst END = 35;\n\ninterface UseMenuKeyboard {\n (inputProps: {\n goUp: () => void;\n goDown: () => void;\n selectOption: () => void;\n goHome: () => void;\n goEnd: () => void;\n closeDropdown: () => void;\n preventNativeSpace?: boolean;\n }): CancelableEventHandler<BaseKeyDetail>;\n}\n\nexport const useMenuKeyboard: UseMenuKeyboard = ({\n goUp,\n goDown,\n selectOption,\n goHome,\n goEnd,\n closeDropdown,\n preventNativeSpace = false,\n}) => {\n return useCallback(\n (e: CustomEvent<BaseKeyDetail>) => {\n switch (e.detail.keyCode) {\n case KeyCode.up:\n e.preventDefault();\n goUp();\n break;\n case KeyCode.down:\n e.preventDefault();\n goDown();\n break;\n case HOME:\n goHome();\n break;\n case END:\n goEnd();\n break;\n case KeyCode.escape:\n e.stopPropagation();\n closeDropdown();\n break;\n case KeyCode.enter:\n e.preventDefault();\n selectOption();\n break;\n case KeyCode.space:\n if (preventNativeSpace) {\n e.preventDefault();\n selectOption();\n }\n }\n },\n [selectOption, goHome, goEnd, closeDropdown, preventNativeSpace, goUp, goDown]\n );\n};\n\ninterface UseTriggerKeyboard {\n (inputProps: { openDropdown: () => void; goHome: () => void }): CancelableEventHandler<BaseKeyDetail>;\n}\n\nexport const useTriggerKeyboard: UseTriggerKeyboard = ({ openDropdown, goHome }) => {\n return useCallback(\n (e: CustomEvent<BaseKeyDetail>) => {\n switch (e.detail.keyCode) {\n case KeyCode.up:\n case KeyCode.down:\n e.preventDefault();\n goHome();\n openDropdown();\n break;\n case KeyCode.space:\n case KeyCode.enter:\n e.preventDefault();\n openDropdown();\n break;\n }\n },\n [openDropdown, goHome]\n );\n};\n"]}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/link/styles.css.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"link": "
|
|
5
|
-
"variant-secondary": "awsui_variant-
|
|
6
|
-
"variant-primary": "awsui_variant-
|
|
7
|
-
"variant-info": "awsui_variant-
|
|
8
|
-
"variant-value-large": "awsui_variant-value-
|
|
9
|
-
"variant-top-navigation": "awsui_variant-top-
|
|
10
|
-
"variant-recovery": "awsui_variant-
|
|
11
|
-
"button": "
|
|
12
|
-
"color-inverted": "awsui_color-
|
|
13
|
-
"font-size-body-s": "awsui_font-size-body-
|
|
14
|
-
"font-size-body-m": "awsui_font-size-body-
|
|
15
|
-
"font-size-heading-xs": "awsui_font-size-heading-
|
|
16
|
-
"font-size-heading-s": "awsui_font-size-heading-
|
|
17
|
-
"font-size-heading-m": "awsui_font-size-heading-
|
|
18
|
-
"font-size-heading-l": "awsui_font-size-heading-
|
|
19
|
-
"font-size-heading-xl": "awsui_font-size-heading-
|
|
20
|
-
"font-size-display-l": "awsui_font-size-display-
|
|
21
|
-
"font-size-inherit": "awsui_font-size-
|
|
22
|
-
"icon-wrapper": "awsui_icon-
|
|
23
|
-
"icon": "
|
|
4
|
+
"link": "awsui_link_4c84z_e7dbz_99",
|
|
5
|
+
"variant-secondary": "awsui_variant-secondary_4c84z_e7dbz_168",
|
|
6
|
+
"variant-primary": "awsui_variant-primary_4c84z_e7dbz_203",
|
|
7
|
+
"variant-info": "awsui_variant-info_4c84z_e7dbz_236",
|
|
8
|
+
"variant-value-large": "awsui_variant-value-large_4c84z_e7dbz_271",
|
|
9
|
+
"variant-top-navigation": "awsui_variant-top-navigation_4c84z_e7dbz_303",
|
|
10
|
+
"variant-recovery": "awsui_variant-recovery_4c84z_e7dbz_336",
|
|
11
|
+
"button": "awsui_button_4c84z_e7dbz_369",
|
|
12
|
+
"color-inverted": "awsui_color-inverted_4c84z_e7dbz_404",
|
|
13
|
+
"font-size-body-s": "awsui_font-size-body-s_4c84z_e7dbz_425",
|
|
14
|
+
"font-size-body-m": "awsui_font-size-body-m_4c84z_e7dbz_432",
|
|
15
|
+
"font-size-heading-xs": "awsui_font-size-heading-xs_4c84z_e7dbz_438",
|
|
16
|
+
"font-size-heading-s": "awsui_font-size-heading-s_4c84z_e7dbz_444",
|
|
17
|
+
"font-size-heading-m": "awsui_font-size-heading-m_4c84z_e7dbz_451",
|
|
18
|
+
"font-size-heading-l": "awsui_font-size-heading-l_4c84z_e7dbz_458",
|
|
19
|
+
"font-size-heading-xl": "awsui_font-size-heading-xl_4c84z_e7dbz_465",
|
|
20
|
+
"font-size-display-l": "awsui_font-size-display-l_4c84z_e7dbz_472",
|
|
21
|
+
"font-size-inherit": "awsui_font-size-inherit_4c84z_e7dbz_479",
|
|
22
|
+
"icon-wrapper": "awsui_icon-wrapper_4c84z_e7dbz_487",
|
|
23
|
+
"icon": "awsui_icon_4c84z_e7dbz_487"
|
|
24
24
|
};
|
|
25
25
|
|