@cloudscape-design/components 3.0.1411 → 3.0.1413
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/action-card/internal.d.ts +10 -2
- package/action-card/internal.d.ts.map +1 -1
- package/action-card/internal.js +5 -5
- package/action-card/internal.js.map +1 -1
- package/action-card/styles.css.js +18 -17
- package/action-card/styles.scoped.css +274 -202
- package/action-card/styles.selectors.js +18 -17
- package/app-layout/visual-refresh-toolbar/skeleton/toolbar-container.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/toolbar-container.js +3 -1
- package/app-layout/visual-refresh-toolbar/skeleton/toolbar-container.js.map +1 -1
- package/button-dropdown/filter.d.ts +1 -1
- package/expandable-section/expandable-section-header.js +1 -1
- package/expandable-section/expandable-section-header.js.map +1 -1
- package/header/interfaces.d.ts +4 -0
- package/header/interfaces.d.ts.map +1 -1
- package/header/interfaces.js.map +1 -1
- package/header/internal.d.ts +1 -6
- package/header/internal.d.ts.map +1 -1
- package/header/internal.js +2 -2
- package/header/internal.js.map +1 -1
- package/header/styles.css.js +36 -36
- package/header/styles.scoped.css +55 -55
- package/header/styles.selectors.js +36 -36
- package/i18n/messages/all.all.js +1 -1
- package/i18n/messages/all.all.json +1 -1
- package/i18n/messages/all.de.js +1 -1
- package/i18n/messages/all.de.json +1 -1
- package/i18n/messages/all.en-GB.js +1 -1
- package/i18n/messages/all.en-GB.json +1 -1
- package/i18n/messages/all.en.js +1 -1
- package/i18n/messages/all.en.json +1 -1
- package/i18n/messages/all.es.js +1 -1
- package/i18n/messages/all.es.json +1 -1
- package/i18n/messages/all.fr.js +1 -1
- package/i18n/messages/all.fr.json +1 -1
- package/i18n/messages/all.id.js +1 -1
- package/i18n/messages/all.id.json +1 -1
- package/i18n/messages/all.it.js +1 -1
- package/i18n/messages/all.it.json +1 -1
- package/i18n/messages/all.ja.js +1 -1
- package/i18n/messages/all.ja.json +1 -1
- package/i18n/messages/all.ko.js +1 -1
- package/i18n/messages/all.ko.json +1 -1
- package/i18n/messages/all.pt-BR.js +1 -1
- package/i18n/messages/all.pt-BR.json +1 -1
- package/i18n/messages/all.tr.js +1 -1
- package/i18n/messages/all.tr.json +1 -1
- package/i18n/messages/all.zh-CN.js +1 -1
- package/i18n/messages/all.zh-CN.json +1 -1
- package/i18n/messages/all.zh-TW.js +1 -1
- package/i18n/messages/all.zh-TW.json +1 -1
- package/i18n/messages-types.d.ts +3 -0
- package/i18n/messages-types.d.ts.map +1 -1
- package/i18n/messages-types.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/components/focus-lock/utils.d.ts +2 -0
- package/internal/components/focus-lock/utils.d.ts.map +1 -1
- package/internal/components/focus-lock/utils.js +5 -1
- package/internal/components/focus-lock/utils.js.map +1 -1
- package/internal/components/listbox/interfaces.d.ts +12 -0
- package/internal/components/listbox/interfaces.d.ts.map +1 -0
- package/internal/components/listbox/interfaces.js +2 -0
- package/internal/components/listbox/interfaces.js.map +1 -0
- package/internal/components/listbox/parts/get-item-props.d.ts +1 -3
- package/internal/components/listbox/parts/get-item-props.d.ts.map +1 -1
- package/internal/components/listbox/parts/get-item-props.js +1 -2
- package/internal/components/listbox/parts/get-item-props.js.map +1 -1
- package/internal/components/listbox/parts/item.d.ts +45 -0
- package/internal/components/listbox/parts/item.d.ts.map +1 -0
- package/internal/components/listbox/parts/item.js +184 -0
- package/internal/components/listbox/parts/item.js.map +1 -0
- package/internal/components/listbox/parts/plain-list.d.ts +29 -0
- package/internal/components/listbox/parts/plain-list.d.ts.map +1 -0
- package/{select → internal/components/listbox}/parts/plain-list.js +12 -12
- package/internal/components/listbox/parts/plain-list.js.map +1 -0
- package/internal/components/listbox/parts/render-options.d.ts +3 -4
- package/internal/components/listbox/parts/render-options.d.ts.map +1 -1
- package/internal/components/listbox/parts/render-options.js +3 -6
- package/internal/components/listbox/parts/render-options.js.map +1 -1
- package/internal/components/listbox/parts/scroll-to-index.d.ts +11 -0
- package/internal/components/listbox/parts/scroll-to-index.d.ts.map +1 -1
- package/internal/components/listbox/parts/scroll-to-index.js +16 -0
- package/internal/components/listbox/parts/scroll-to-index.js.map +1 -1
- package/internal/components/listbox/use-listbox.d.ts +95 -0
- package/internal/components/listbox/use-listbox.d.ts.map +1 -0
- package/internal/components/listbox/use-listbox.js +117 -0
- package/internal/components/listbox/use-listbox.js.map +1 -0
- package/internal/components/listbox/use-type-ahead.d.ts +18 -0
- package/internal/components/listbox/use-type-ahead.d.ts.map +1 -0
- package/{select/utils/use-native-search.js → internal/components/listbox/use-type-ahead.js} +8 -8
- package/internal/components/listbox/use-type-ahead.js.map +1 -0
- package/internal/components/listbox/utils/navigation.d.ts +27 -0
- package/internal/components/listbox/utils/navigation.d.ts.map +1 -0
- package/internal/components/listbox/utils/navigation.js +22 -0
- package/internal/components/listbox/utils/navigation.js.map +1 -0
- package/internal/components/listbox/utils/option-props.d.ts +35 -0
- package/internal/components/listbox/utils/option-props.d.ts.map +1 -0
- package/internal/components/listbox/utils/option-props.js +51 -0
- package/internal/components/listbox/utils/option-props.js.map +1 -0
- package/internal/components/options-list/index.d.ts +4 -1
- package/internal/components/options-list/index.d.ts.map +1 -1
- package/internal/components/options-list/index.js +1 -1
- package/internal/components/options-list/index.js.map +1 -1
- 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 +5 -3
- package/internal/components/options-list/utils/use-keyboard.js.map +1 -1
- package/internal/components/selectable-item/index.d.ts +1 -0
- package/internal/components/selectable-item/index.d.ts.map +1 -1
- package/internal/components/selectable-item/index.js +2 -1
- package/internal/components/selectable-item/index.js.map +1 -1
- package/internal/components/selectable-item/interfaces.d.ts +1 -0
- package/internal/components/selectable-item/interfaces.d.ts.map +1 -1
- package/internal/components/selectable-item/interfaces.js.map +1 -1
- package/internal/components/selectable-item/styles.css.js +23 -22
- package/internal/components/selectable-item/styles.scoped.css +52 -49
- package/internal/components/selectable-item/styles.selectors.js +23 -22
- package/internal/components/sticky-header/use-untabbable-descendants.d.ts +2 -0
- package/internal/components/sticky-header/use-untabbable-descendants.d.ts.map +1 -0
- package/internal/components/sticky-header/use-untabbable-descendants.js +16 -0
- package/internal/components/sticky-header/use-untabbable-descendants.js.map +1 -0
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/manifest.json +1 -1
- package/item-card/internal.d.ts +11 -1
- package/item-card/internal.d.ts.map +1 -1
- package/item-card/internal.js +4 -4
- package/item-card/internal.js.map +1 -1
- package/item-card/style.d.ts.map +1 -1
- package/item-card/style.js +6 -1
- package/item-card/style.js.map +1 -1
- package/item-card/styles.css.js +14 -14
- package/item-card/styles.scoped.css +125 -63
- package/item-card/styles.selectors.js +14 -14
- package/manifest.json +2 -2
- package/multiselect/embedded.d.ts.map +1 -1
- package/multiselect/embedded.js +2 -2
- package/multiselect/embedded.js.map +1 -1
- package/multiselect/internal.d.ts.map +1 -1
- package/multiselect/internal.js +2 -2
- package/multiselect/internal.js.map +1 -1
- package/multiselect/use-multiselect.d.ts +3 -4
- package/multiselect/use-multiselect.d.ts.map +1 -1
- package/multiselect/use-multiselect.js +7 -18
- package/multiselect/use-multiselect.js.map +1 -1
- package/option-list/index.d.ts +5 -0
- package/option-list/index.d.ts.map +1 -0
- package/option-list/index.js +21 -0
- package/option-list/index.js.map +1 -0
- package/option-list/interfaces.d.ts +131 -0
- package/option-list/interfaces.d.ts.map +1 -0
- package/option-list/interfaces.js +2 -0
- package/option-list/interfaces.js.map +1 -0
- package/option-list/internal.d.ts +5 -0
- package/option-list/internal.d.ts.map +1 -0
- package/option-list/internal.js +138 -0
- package/option-list/internal.js.map +1 -0
- package/option-list/styles.css.js +6 -0
- package/option-list/styles.scoped.css +40 -0
- package/option-list/styles.selectors.js +7 -0
- package/option-list/test-classes/styles.css.js +8 -0
- package/option-list/test-classes/styles.scoped.css +9 -0
- package/option-list/test-classes/styles.selectors.js +9 -0
- package/option-list/use-option-list.d.ts +36 -0
- package/option-list/use-option-list.d.ts.map +1 -0
- package/option-list/use-option-list.js +69 -0
- package/option-list/use-option-list.js.map +1 -0
- package/package.json +4 -1
- package/select/internal.d.ts.map +1 -1
- package/select/internal.js +9 -19
- package/select/internal.js.map +1 -1
- package/select/parts/filter.d.ts +1 -1
- package/select/parts/virtual-list.d.ts +3 -2
- package/select/parts/virtual-list.d.ts.map +1 -1
- package/select/parts/virtual-list.js +7 -8
- package/select/parts/virtual-list.js.map +1 -1
- package/select/utils/use-select.d.ts +18 -11
- package/select/utils/use-select.d.ts.map +1 -1
- package/select/utils/use-select.js +41 -117
- package/select/utils/use-select.js.map +1 -1
- package/styling/action-card.scss +56 -0
- package/styling/item-card.scss +81 -0
- package/table-root/index.js +1 -1
- package/table-root/index.js.map +1 -1
- package/table-root/interfaces.d.ts +15 -1
- package/table-root/interfaces.d.ts.map +1 -1
- package/table-root/interfaces.js.map +1 -1
- package/table-root/internal.d.ts +2 -0
- package/table-root/internal.d.ts.map +1 -1
- package/table-root/internal.js +23 -11
- package/table-root/internal.js.map +1 -1
- package/table-root/sticky-header-slot.d.ts +24 -0
- package/table-root/sticky-header-slot.d.ts.map +1 -0
- package/table-root/sticky-header-slot.js +13 -0
- package/table-root/sticky-header-slot.js.map +1 -0
- package/table-root/styles.css.js +10 -5
- package/table-root/styles.scoped.css +52 -7
- package/table-root/styles.selectors.js +10 -5
- package/table-root/use-sticky-header.d.ts +33 -0
- package/table-root/use-sticky-header.d.ts.map +1 -0
- package/table-root/use-sticky-header.js +141 -0
- package/table-root/use-sticky-header.js.map +1 -0
- package/test-utils/dom/header/index.d.ts +1 -0
- package/test-utils/dom/header/index.js +3 -0
- package/test-utils/dom/header/index.js.map +1 -1
- package/test-utils/dom/index.d.ts +28 -0
- package/test-utils/dom/index.js +21 -2
- package/test-utils/dom/index.js.map +1 -1
- package/test-utils/dom/option-list/index.d.ts +69 -0
- package/test-utils/dom/option-list/index.js +132 -0
- package/test-utils/dom/option-list/index.js.map +1 -0
- package/test-utils/selectors/header/index.d.ts +1 -0
- package/test-utils/selectors/header/index.js +3 -0
- package/test-utils/selectors/header/index.js.map +1 -1
- package/test-utils/selectors/index.d.ts +18 -0
- package/test-utils/selectors/index.js +16 -2
- package/test-utils/selectors/index.js.map +1 -1
- package/test-utils/selectors/option-list/index.d.ts +66 -0
- package/test-utils/selectors/option-list/index.js +108 -0
- package/test-utils/selectors/option-list/index.js.map +1 -0
- package/select/parts/item.d.ts +0 -33
- package/select/parts/item.d.ts.map +0 -1
- package/select/parts/item.js +0 -94
- package/select/parts/item.js.map +0 -1
- package/select/parts/multiselect-item.d.ts +0 -14
- package/select/parts/multiselect-item.d.ts.map +0 -1
- package/select/parts/multiselect-item.js +0 -112
- package/select/parts/multiselect-item.js.map +0 -1
- package/select/parts/plain-list.d.ts +0 -26
- package/select/parts/plain-list.d.ts.map +0 -1
- package/select/parts/plain-list.js.map +0 -1
- package/select/utils/use-native-search.d.ts +0 -18
- package/select/utils/use-native-search.d.ts.map +0 -1
- package/select/utils/use-native-search.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-select.js","sourceRoot":"","sources":["../../../../src/select/utils/use-select.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAa,WAAW,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAK5E,OAAO,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAEhG,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAEnH,OAA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AiB,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC;IAClH,MAAM,gBAAgB,GACpB,CAAC,CAAC,iBAAiB,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,wBAAwB,CAAC,CAAC;IAEnG,4FAA4F;IAC5F,sGAAsG;IACtG,gGAAgG;IAChG,gGAAgG;IAChG,uCAAuC;IACvC,MAAM,uBAAuB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC/C,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QACnC,IAAI,OAAO,IAAI,OAAO,KAAK,QAAQ,CAAC,aAAa,EAAE,CAAC;YAClD,aAAa,EAAE,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,EAAE,CAAC;QACnB,CAAC;IACH,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO;QACL,MAAM;QACN,iBAAiB;QACjB,gBAAgB;QAChB,aAAa;QACb,eAAe;QACf,gBAAgB;QAChB,YAAY;QACZ,cAAc;QACd,cAAc;QACd,eAAe,EAAE,2BAA2B;QAC5C,YAAY;QACZ,gBAAgB;QAChB,aAAa,EAAE,uBAAuB;QACtC,QAAQ;QACR,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { RefObject, useCallback } from 'react';\nimport { useEffect, useRef } from 'react';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalDropdownProps } from '../../dropdown/internal';\nimport { ButtonTriggerProps } from '../../internal/components/button-trigger';\nimport { SelectionModel } from '../../internal/components/listbox/selection/interfaces';\nimport { singleSelection } from '../../internal/components/listbox/selection/single-selection';\nimport { connectOptionsByValue } from '../../internal/components/listbox/utils/connect-options';\nimport { DropdownOption } from '../../internal/components/option/interfaces';\nimport { isGroup, isGroupInteractive, isInteractive } from '../../internal/components/option/utils/filter-options';\nimport { OptionsListProps } from '../../internal/components/options-list';\nimport { useHighlightedOption } from '../../internal/components/options-list/utils/use-highlight-option';\nimport { getOptionId } from '../../internal/components/options-list/utils/use-ids';\nimport { useMenuKeyboard, useTriggerKeyboard } from '../../internal/components/options-list/utils/use-keyboard';\nimport { useOpenState } from '../../internal/components/options-list/utils/use-open-state';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport useForwardFocus from '../../internal/hooks/forward-focus';\nimport { usePrevious } from '../../internal/hooks/use-previous';\nimport { DropdownStatusProps } from '../../types/dropdown-status';\nimport { NonCancelableEventHandler } from '../../types/events';\nimport { OptionDefinition } from '../../types/option';\nimport { SelectProps } from '../interfaces';\nimport { FilterProps } from '../parts/filter';\nimport { ItemProps } from '../parts/item';\n\nexport type MenuProps = Omit<OptionsListProps, 'children'> & { ref: React.RefObject<HTMLDivElement> };\nexport type GetOptionProps = (option: DropdownOption, index: number) => ItemProps;\n\ninterface UseSelectProps {\n selectedOptions: ReadonlyArray<OptionDefinition>;\n updateSelectedOption: (option: OptionDefinition) => void;\n options: ReadonlyArray<DropdownOption>;\n filteringType: string;\n keepOpen?: boolean;\n embedded?: boolean;\n onBlur?: NonCancelableEventHandler;\n onFocus?: NonCancelableEventHandler;\n externalRef: React.Ref<any>;\n fireLoadItems: (filteringText: string) => void;\n setFilteringValue?: (filteringText: string) => void;\n useInteractiveGroups?: boolean;\n statusType: DropdownStatusProps.StatusType;\n /** Source of group and select-all state. Defaults to single selection over `selectedOptions`. */\n selection?: SelectionModel;\n toggleAll?: () => void;\n dropdownRole?: SelectProps.DropdownRole;\n}\n\nexport interface SelectTriggerProps extends ButtonTriggerProps {\n ref: RefObject<HTMLButtonElement>;\n}\n\nexport function useSelect({\n selectedOptions,\n updateSelectedOption,\n options,\n filteringType,\n onBlur,\n onFocus,\n externalRef,\n keepOpen,\n embedded,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups = false,\n statusType,\n selection = singleSelection(selectedOptions),\n toggleAll,\n dropdownRole,\n}: UseSelectProps) {\n const interactivityCheck = useInteractiveGroups ? isGroupInteractive : isInteractive;\n\n const isHighlightable = (option?: DropdownOption) => !!option && (useInteractiveGroups || option.type !== 'parent');\n\n const filterRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const hasFilter = filteringType !== 'none' && !embedded;\n // Filtering always renders a dialog; `dropdownRole` can additionally force dialog semantics without a filter.\n const isDialog = hasFilter || dropdownRole === 'dialog';\n const activeRef = hasFilter ? filterRef : menuRef;\n const __selectedOptions = connectOptionsByValue(options, selectedOptions);\n const __selectedOptionsSet = new Set(__selectedOptions);\n const [\n { highlightType, highlightedOption, highlightedIndex },\n {\n moveHighlightWithKeyboard,\n resetHighlightWithKeyboard,\n setHighlightedIndexWithMouse,\n highlightOptionWithKeyboard,\n highlightFirstOptionWithMouse,\n goHomeWithKeyboard,\n goEndWithKeyboard,\n },\n ] = useHighlightedOption({ options: options, isHighlightable });\n\n const { isOpen, openDropdown, closeDropdown, toggleDropdown, openedWithKeyboard } = useOpenState({\n defaultOpen: embedded,\n onOpen: () => fireLoadItems(''),\n onClose: () => {\n resetHighlightWithKeyboard();\n setFilteringValue?.('');\n },\n });\n\n const handleFocus = () => {\n fireNonCancelableEvent(onFocus, {});\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, {});\n closeDropdown();\n };\n\n const hasSelectedOption = __selectedOptions.length > 0;\n const menuId = useUniqueId('option-list');\n const dialogId = useUniqueId('dialog');\n const highlightedOptionId = getOptionId(menuId, highlightedIndex);\n\n const closeDropdownIfNecessary = () => {\n if (!keepOpen) {\n triggerRef.current?.focus();\n closeDropdown();\n }\n };\n\n const selectOption = (option?: DropdownOption) => {\n const optionToSelect = option || highlightedOption;\n if (!optionToSelect || !interactivityCheck(optionToSelect)) {\n return;\n }\n if (optionToSelect.type === 'select-all' && toggleAll) {\n toggleAll();\n } else {\n updateSelectedOption(optionToSelect.option);\n }\n closeDropdownIfNecessary();\n };\n\n const activeKeyDownHandler = useMenuKeyboard({\n goUp: () => {\n if (\n (!useInteractiveGroups && highlightedOption?.type === 'child' && highlightedIndex === 1) ||\n highlightedIndex === 0\n ) {\n goEndWithKeyboard();\n return;\n }\n moveHighlightWithKeyboard(-1);\n },\n goDown: () => {\n if (highlightedIndex === options.length - 1) {\n goHomeWithKeyboard();\n return;\n }\n\n moveHighlightWithKeyboard(1);\n },\n selectOption,\n goHome: goHomeWithKeyboard,\n goEnd: goEndWithKeyboard,\n closeDropdown: () => {\n if (!embedded) {\n triggerRef.current?.focus();\n closeDropdown();\n }\n },\n preventNativeSpace: !hasFilter || (highlightedOption && highlightType.type === 'keyboard'),\n });\n\n const triggerKeyDownHandler = useTriggerKeyboard({\n openDropdown: () => openDropdown(true),\n goHome: goHomeWithKeyboard,\n });\n\n const getDropdownProps: () => Pick<\n InternalDropdownProps,\n 'onFocus' | 'onBlur' | 'dropdownContentId' | 'ariaRole'\n > = () => ({\n onFocus: handleFocus,\n onBlur: handleBlur,\n dropdownContentId: dialogId,\n ariaRole: isDialog ? 'dialog' : undefined,\n });\n\n const getTriggerProps = (disabled = false, autoFocus = false) => {\n const triggerProps: SelectTriggerProps = {\n ref: triggerRef,\n onFocus: () => closeDropdown(),\n autoFocus,\n ariaHasPopup: isDialog ? 'dialog' : 'listbox',\n ariaControls: isOpen ? (isDialog ? dialogId : menuId) : undefined,\n };\n if (!disabled) {\n triggerProps.onMouseDown = (event: CustomEvent) => {\n event.preventDefault(); // prevent current focus from blurring as it immediately closes the dropdown\n if (isOpen) {\n triggerRef.current?.focus();\n }\n toggleDropdown();\n };\n triggerProps.onKeyDown = triggerKeyDownHandler;\n }\n return triggerProps;\n };\n\n const getFilterProps = (): Partial<FilterProps> => {\n if (!hasFilter || !setFilteringValue) {\n return {};\n }\n\n return {\n ref: filterRef,\n onKeyDown: activeKeyDownHandler,\n onChange: event => {\n setFilteringValue(event.detail.value);\n resetHighlightWithKeyboard();\n },\n __onDelayedInput: event => {\n fireLoadItems(event.detail.value);\n },\n nativeInputAttributes: {\n 'aria-activedescendant': highlightedOptionId,\n ['aria-owns']: menuId,\n ['aria-controls']: menuId,\n },\n };\n };\n\n const getMenuProps = () => {\n const menuProps: MenuProps = {\n id: menuId,\n ref: menuRef,\n open: isOpen,\n onMouseUp: itemIndex => {\n if (itemIndex > -1) {\n selectOption(options[itemIndex]);\n }\n },\n onMouseMove: itemIndex => {\n if (itemIndex > -1) {\n setHighlightedIndexWithMouse(itemIndex);\n }\n },\n statusType,\n };\n if (!hasFilter) {\n menuProps.onKeyDown = activeKeyDownHandler;\n menuProps.nativeAttributes = {\n 'aria-activedescendant': highlightedOptionId,\n };\n }\n if (embedded) {\n menuProps.onFocus = () => {\n if (!highlightedOption) {\n goHomeWithKeyboard();\n }\n };\n menuProps.onBlur = () => {\n resetHighlightWithKeyboard();\n };\n }\n return menuProps;\n };\n const getOptionProps = (option: DropdownOption, index: number) => {\n const isSelectAll = option.type === 'select-all';\n const highlighted = option === highlightedOption;\n const groupState = isSelectAll || isGroup(option.option) ? selection.getGroupState(option) : undefined;\n const selected = isSelectAll ? !!groupState?.selected : __selectedOptionsSet.has(option) || !!groupState?.selected;\n // Only group neighbours use group state. Select-all never counts as a selected neighbour, so the row\n // below it doesn't get the previous-item-selected style.\n const nextOption = options[index + 1];\n const isNextSelected =\n !!nextOption && isGroup(nextOption.option)\n ? selection.getGroupState(nextOption).selected\n : __selectedOptionsSet.has(nextOption);\n const previousOption = options[index - 1];\n const isPreviousSelected =\n !!previousOption && isGroup(previousOption.option)\n ? selection.getGroupState(previousOption).selected\n : __selectedOptionsSet.has(previousOption);\n const optionProps: any = {\n key: index,\n option,\n highlighted,\n selected,\n isNextSelected,\n isPreviousSelected,\n indeterminate: !!groupState?.indeterminate,\n ['data-mouse-target']: isHighlightable(option) ? index : -1,\n id: getOptionId(menuId, index),\n };\n\n return optionProps;\n };\n\n const prevOpen = usePrevious<boolean>(isOpen);\n useEffect(() => {\n // highlight the first selected option, when opening the Select component without filter input\n // keep the focus in the filter input when opening, so that screenreader can recognize the combobox\n if (isOpen && !prevOpen && options.length > 0 && !hasFilter) {\n if (openedWithKeyboard) {\n if (__selectedOptions[0]) {\n highlightOptionWithKeyboard(__selectedOptions[0]);\n } else {\n goHomeWithKeyboard();\n }\n } else {\n if (!__selectedOptions[0] || !options.includes(__selectedOptions[0])) {\n highlightFirstOptionWithMouse();\n } else {\n const highlightedIndex = options.indexOf(__selectedOptions[0]);\n setHighlightedIndexWithMouse(highlightedIndex, true);\n }\n }\n }\n }, [\n isOpen,\n __selectedOptions,\n hasSelectedOption,\n setHighlightedIndexWithMouse,\n highlightOptionWithKeyboard,\n highlightFirstOptionWithMouse,\n goHomeWithKeyboard,\n openedWithKeyboard,\n options,\n prevOpen,\n hasFilter,\n ]);\n\n const focusActiveRef = useCallback(() => {\n // dropdown-fit calculations ensure that the dropdown will fit inside the current\n // viewport, so prevent the browser from trying to scroll it into view (e.g. if\n // scroll-padding-top is set on a parent)\n activeRef.current?.focus({ preventScroll: true });\n }, [activeRef]);\n\n useEffect(() => {\n if (isOpen && !embedded) {\n focusActiveRef();\n }\n }, [isOpen, activeRef, embedded, focusActiveRef]);\n\n useForwardFocus(externalRef, triggerRef as React.RefObject<HTMLElement>);\n const highlightedGroupSelected =\n !!highlightedOption && isGroup(highlightedOption.option) && selection.getGroupState(highlightedOption).selected;\n const announceSelected =\n !!highlightedOption && (__selectedOptionsSet.has(highlightedOption) || highlightedGroupSelected);\n\n // Closes the dropdown and returns focus to the trigger, matching the normal close behavior.\n // Exposed to the public dropdown-customization render props via `DropdownContentProps.closeDropdown`.\n // Focusing the trigger fires its onFocus handler, which already closes the dropdown; only close\n // explicitly when the trigger is already focused (re-focusing it does not fire onFocus), so the\n // close side effects run exactly once.\n const closeDropdownAndRefocus = useCallback(() => {\n const trigger = triggerRef.current;\n if (trigger && trigger === document.activeElement) {\n closeDropdown();\n } else {\n trigger?.focus();\n }\n }, [closeDropdown]);\n\n return {\n isOpen,\n highlightedOption,\n highlightedIndex,\n highlightType,\n getTriggerProps,\n getDropdownProps,\n getMenuProps,\n getFilterProps,\n getOptionProps,\n highlightOption: highlightOptionWithKeyboard,\n selectOption,\n announceSelected,\n closeDropdown: closeDropdownAndRefocus,\n dialogId,\n focusActiveRef,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"use-select.js","sourceRoot":"","sources":["../../../../src/select/utils/use-select.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAa,WAAW,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAM5E,OAAO,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAE3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,6DAA6D,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAsChE,MAAM,UAAU,SAAS,CAAC,EACxB,eAAe,EACf,oBAAoB,EACpB,OAAO,EACP,aAAa,EACb,MAAM,EACN,OAAO,EACP,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,oBAAoB,GAAG,KAAK,EAC5B,UAAU,EACV,SAAS,GAAG,eAAe,CAAC,eAAe,CAAC,EAC5C,SAAS,EACT,YAAY,EACZ,SAAS,GAAG,GAAG,EAAE,CAAC,SAA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CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO;QACL,MAAM;QACN,iBAAiB;QACjB,gBAAgB;QAChB,aAAa;QACb,eAAe;QACf,gBAAgB;QAChB,YAAY;QACZ,cAAc;QACd,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,eAAe,EAAE,2BAA2B;QAC5C,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,aAAa,EAAE,uBAAuB;QACtC,QAAQ;QACR,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { RefObject, useCallback } from 'react';\nimport { useEffect, useRef } from 'react';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalDropdownProps } from '../../dropdown/internal';\nimport { ButtonTriggerProps } from '../../internal/components/button-trigger';\nimport { ListElementProps } from '../../internal/components/listbox/interfaces';\nimport { SelectionModel } from '../../internal/components/listbox/selection/interfaces';\nimport { singleSelection } from '../../internal/components/listbox/selection/single-selection';\nimport { useListbox } from '../../internal/components/listbox/use-listbox';\nimport { DropdownOption } from '../../internal/components/option/interfaces';\nimport { useTriggerKeyboard } from '../../internal/components/options-list/utils/use-keyboard';\nimport { useOpenState } from '../../internal/components/options-list/utils/use-open-state';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport useForwardFocus from '../../internal/hooks/forward-focus';\nimport { usePrevious } from '../../internal/hooks/use-previous';\nimport { DropdownStatusProps } from '../../types/dropdown-status';\nimport { NonCancelableEventHandler } from '../../types/events';\nimport { OptionDefinition, OptionGroup } from '../../types/option';\nimport { SelectProps } from '../interfaces';\nimport { FilterProps } from '../parts/filter';\n\ninterface UseSelectProps {\n selectedOptions: ReadonlyArray<OptionDefinition>;\n updateSelectedOption: (option: OptionDefinition) => void;\n options: ReadonlyArray<DropdownOption>;\n filteringType: string;\n keepOpen?: boolean;\n embedded?: boolean;\n onBlur?: NonCancelableEventHandler;\n onFocus?: NonCancelableEventHandler;\n externalRef: React.Ref<any>;\n fireLoadItems: (filteringText: string) => void;\n setFilteringValue?: (filteringText: string) => void;\n useInteractiveGroups?: boolean;\n statusType: DropdownStatusProps.StatusType;\n /**\n * Source of group and select-all state, built from `selectedOptions`.\n * Defaults to single selection over `selectedOptions`.\n */\n selection?: SelectionModel;\n toggleAll?: () => void;\n dropdownRole?: SelectProps.DropdownRole;\n /** Group of the option, announced with the highlighted option. Defaults to no group. */\n getParent?: (option: DropdownOption) => undefined | OptionGroup;\n selectedAriaLabel?: string;\n renderHighlightedAriaLive?: SelectProps.ContainingOptionAndGroupString;\n}\n\nexport interface SelectTriggerProps extends ButtonTriggerProps {\n ref: RefObject<HTMLButtonElement>;\n}\n\nexport function useSelect({\n selectedOptions,\n updateSelectedOption,\n options,\n filteringType,\n onBlur,\n onFocus,\n externalRef,\n keepOpen,\n embedded,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups = false,\n statusType,\n selection = singleSelection(selectedOptions),\n toggleAll,\n dropdownRole,\n getParent = () => undefined,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n}: UseSelectProps) {\n const filterRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const hasFilter = filteringType !== 'none' && !embedded;\n // Filtering always renders a dialog; `dropdownRole` can additionally force dialog semantics without a filter.\n const isDialog = hasFilter || dropdownRole === 'dialog';\n\n // `onSelect` and `onEscape` run only on user events, after `closeDropdownIfNecessary` and `handleEscape` below\n // are declared.\n const listbox = useListbox({\n options,\n selectedOptions,\n selection,\n interactiveGroups: useInteractiveGroups,\n onSelect: option => {\n if (option.type === 'select-all' && toggleAll) {\n toggleAll();\n } else {\n updateSelectedOption(option.option);\n }\n closeDropdownIfNecessary();\n },\n // With a filter input, Space types into it unless an option has a keyboard highlight.\n spaceSelects: hasFilter ? 'keyboard-highlight' : 'always',\n onEscape: () => handleEscape(),\n getParent,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n const activeRef = hasFilter ? filterRef : listbox.listRef;\n const {\n listId: menuId,\n highlightType,\n highlightedOption,\n highlightedIndex,\n selectedOptions: __selectedOptions,\n highlight: {\n resetHighlightWithKeyboard,\n setHighlightedIndexWithMouse,\n highlightOptionWithKeyboard,\n highlightFirstOptionWithMouse,\n goHomeWithKeyboard,\n },\n } = listbox;\n\n const { isOpen, openDropdown, closeDropdown, toggleDropdown, openedWithKeyboard } = useOpenState({\n defaultOpen: embedded,\n onOpen: () => fireLoadItems(''),\n onClose: () => {\n resetHighlightWithKeyboard();\n setFilteringValue?.('');\n },\n });\n\n const handleFocus = () => {\n fireNonCancelableEvent(onFocus, {});\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, {});\n closeDropdown();\n };\n\n const hasSelectedOption = __selectedOptions.length > 0;\n const dialogId = useUniqueId('dialog');\n\n const closeDropdownIfNecessary = () => {\n if (!keepOpen) {\n triggerRef.current?.focus();\n closeDropdown();\n }\n };\n\n const handleEscape = () => {\n if (!embedded) {\n triggerRef.current?.focus();\n closeDropdown();\n }\n };\n\n const triggerKeyDownHandler = useTriggerKeyboard({\n openDropdown: () => openDropdown(true),\n goHome: goHomeWithKeyboard,\n });\n\n const getDropdownProps: () => Pick<\n InternalDropdownProps,\n 'onFocus' | 'onBlur' | 'dropdownContentId' | 'ariaRole'\n > = () => ({\n onFocus: handleFocus,\n onBlur: handleBlur,\n dropdownContentId: dialogId,\n ariaRole: isDialog ? 'dialog' : undefined,\n });\n\n const getTriggerProps = (disabled = false, autoFocus = false) => {\n const triggerProps: SelectTriggerProps = {\n ref: triggerRef,\n onFocus: () => closeDropdown(),\n autoFocus,\n ariaHasPopup: isDialog ? 'dialog' : 'listbox',\n ariaControls: isOpen ? (isDialog ? dialogId : menuId) : undefined,\n };\n if (!disabled) {\n triggerProps.onMouseDown = (event: CustomEvent) => {\n event.preventDefault(); // prevent current focus from blurring as it immediately closes the dropdown\n if (isOpen) {\n triggerRef.current?.focus();\n }\n toggleDropdown();\n };\n triggerProps.onKeyDown = triggerKeyDownHandler;\n }\n return triggerProps;\n };\n\n const getFilterProps = (): Partial<FilterProps> => {\n if (!hasFilter || !setFilteringValue) {\n return {};\n }\n\n return {\n ref: filterRef,\n onKeyDown: listbox.onKeyDown,\n onChange: event => {\n setFilteringValue(event.detail.value);\n resetHighlightWithKeyboard();\n },\n __onDelayedInput: event => {\n fireLoadItems(event.detail.value);\n },\n nativeInputAttributes: {\n 'aria-activedescendant': listbox.activeDescendantId,\n ['aria-owns']: menuId,\n ['aria-controls']: menuId,\n },\n };\n };\n\n const getMenuProps = () => {\n const menuProps: ListElementProps = {\n ...listbox.getListProps({ withKeyboard: !hasFilter, embedded }),\n open: isOpen,\n statusType,\n };\n return menuProps;\n };\n\n const prevOpen = usePrevious<boolean>(isOpen);\n useEffect(() => {\n // highlight the first selected option, when opening the Select component without filter input\n // keep the focus in the filter input when opening, so that screenreader can recognize the combobox\n if (isOpen && !prevOpen && options.length > 0 && !hasFilter) {\n if (openedWithKeyboard) {\n if (__selectedOptions[0]) {\n highlightOptionWithKeyboard(__selectedOptions[0]);\n } else {\n goHomeWithKeyboard();\n }\n } else {\n if (!__selectedOptions[0] || !options.includes(__selectedOptions[0])) {\n highlightFirstOptionWithMouse();\n } else {\n const highlightedIndex = options.indexOf(__selectedOptions[0]);\n setHighlightedIndexWithMouse(highlightedIndex, true);\n }\n }\n }\n }, [\n isOpen,\n __selectedOptions,\n hasSelectedOption,\n setHighlightedIndexWithMouse,\n highlightOptionWithKeyboard,\n highlightFirstOptionWithMouse,\n goHomeWithKeyboard,\n openedWithKeyboard,\n options,\n prevOpen,\n hasFilter,\n ]);\n\n const focusActiveRef = useCallback(() => {\n // dropdown-fit calculations ensure that the dropdown will fit inside the current\n // viewport, so prevent the browser from trying to scroll it into view (e.g. if\n // scroll-padding-top is set on a parent)\n activeRef.current?.focus({ preventScroll: true });\n }, [activeRef]);\n\n useEffect(() => {\n if (isOpen && !embedded) {\n focusActiveRef();\n }\n }, [isOpen, activeRef, embedded, focusActiveRef]);\n\n useForwardFocus(externalRef, triggerRef as React.RefObject<HTMLElement>);\n\n // Closes the dropdown and returns focus to the trigger, matching the normal close behavior.\n // Exposed to the public dropdown-customization render props via `DropdownContentProps.closeDropdown`.\n // Focusing the trigger fires its onFocus handler, which already closes the dropdown; only close\n // explicitly when the trigger is already focused (re-focusing it does not fire onFocus), so the\n // close side effects run exactly once.\n const closeDropdownAndRefocus = useCallback(() => {\n const trigger = triggerRef.current;\n if (trigger && trigger === document.activeElement) {\n closeDropdown();\n } else {\n trigger?.focus();\n }\n }, [closeDropdown]);\n\n return {\n isOpen,\n highlightedOption,\n highlightedIndex,\n highlightType,\n getTriggerProps,\n getDropdownProps,\n getMenuProps,\n getFilterProps,\n getOptionProps: listbox.getOptionProps,\n highlightOption: highlightOptionWithKeyboard,\n selectOption: listbox.selectOption,\n announceSelected: listbox.announceSelected,\n announcement: listbox.announcement,\n scrollToIndex: listbox.scrollToIndex,\n closeDropdown: closeDropdownAndRefocus,\n dialogId,\n focusActiveRef,\n };\n}\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// GENERATED from the action-card Style API docs — do not edit.
|
|
2
|
+
@use '@cloudscape-design/component-toolkit/internal/style-api/slot-mixins' as slot-mixins;
|
|
3
|
+
|
|
4
|
+
@mixin root(
|
|
5
|
+
$border-color: null,
|
|
6
|
+
$border-width: null,
|
|
7
|
+
$border-radius: null,
|
|
8
|
+
$focus-ring-color: null,
|
|
9
|
+
$focus-ring-width: null,
|
|
10
|
+
$focus-ring-radius: null,
|
|
11
|
+
$background: null
|
|
12
|
+
) {
|
|
13
|
+
@include slot-mixins.apply(
|
|
14
|
+
'action-card.root',
|
|
15
|
+
$tokens: (
|
|
16
|
+
'border-color': $border-color,
|
|
17
|
+
'border-width': $border-width,
|
|
18
|
+
'border-radius': $border-radius,
|
|
19
|
+
'focus-ring-color': $focus-ring-color,
|
|
20
|
+
'focus-ring-width': $focus-ring-width,
|
|
21
|
+
'focus-ring-radius': $focus-ring-radius,
|
|
22
|
+
),
|
|
23
|
+
$properties: (
|
|
24
|
+
'background': $background,
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@mixin header(
|
|
30
|
+
$background: null,
|
|
31
|
+
$border-color: null,
|
|
32
|
+
$border-width: null,
|
|
33
|
+
$border-style: null,
|
|
34
|
+
$border-block-color: null,
|
|
35
|
+
$border-block-width: null,
|
|
36
|
+
$border-block-style: null,
|
|
37
|
+
$border-inline-color: null,
|
|
38
|
+
$border-inline-width: null,
|
|
39
|
+
$border-inline-style: null
|
|
40
|
+
) {
|
|
41
|
+
@include slot-mixins.apply(
|
|
42
|
+
'action-card.header',
|
|
43
|
+
$properties: (
|
|
44
|
+
'background': $background,
|
|
45
|
+
'border-color': $border-color,
|
|
46
|
+
'border-width': $border-width,
|
|
47
|
+
'border-style': $border-style,
|
|
48
|
+
'border-block-color': $border-block-color,
|
|
49
|
+
'border-block-width': $border-block-width,
|
|
50
|
+
'border-block-style': $border-block-style,
|
|
51
|
+
'border-inline-color': $border-inline-color,
|
|
52
|
+
'border-inline-width': $border-inline-width,
|
|
53
|
+
'border-inline-style': $border-inline-style,
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// GENERATED from the item-card Style API docs — do not edit.
|
|
2
|
+
@use '@cloudscape-design/component-toolkit/internal/style-api/slot-mixins' as slot-mixins;
|
|
3
|
+
|
|
4
|
+
@mixin root(
|
|
5
|
+
$border-color: null,
|
|
6
|
+
$border-width: null,
|
|
7
|
+
$border-radius: null,
|
|
8
|
+
$background: null,
|
|
9
|
+
$box-shadow: null
|
|
10
|
+
) {
|
|
11
|
+
@include slot-mixins.apply(
|
|
12
|
+
'item-card.root',
|
|
13
|
+
$tokens: (
|
|
14
|
+
'border-color': $border-color,
|
|
15
|
+
'border-width': $border-width,
|
|
16
|
+
'border-radius': $border-radius,
|
|
17
|
+
),
|
|
18
|
+
$properties: (
|
|
19
|
+
'background': $background,
|
|
20
|
+
'box-shadow': $box-shadow,
|
|
21
|
+
),
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@mixin header(
|
|
26
|
+
$background: null,
|
|
27
|
+
$border-color: null,
|
|
28
|
+
$border-width: null,
|
|
29
|
+
$border-style: null,
|
|
30
|
+
$border-block-color: null,
|
|
31
|
+
$border-block-width: null,
|
|
32
|
+
$border-block-style: null,
|
|
33
|
+
$border-inline-color: null,
|
|
34
|
+
$border-inline-width: null,
|
|
35
|
+
$border-inline-style: null
|
|
36
|
+
) {
|
|
37
|
+
@include slot-mixins.apply(
|
|
38
|
+
'item-card.header',
|
|
39
|
+
$properties: (
|
|
40
|
+
'background': $background,
|
|
41
|
+
'border-color': $border-color,
|
|
42
|
+
'border-width': $border-width,
|
|
43
|
+
'border-style': $border-style,
|
|
44
|
+
'border-block-color': $border-block-color,
|
|
45
|
+
'border-block-width': $border-block-width,
|
|
46
|
+
'border-block-style': $border-block-style,
|
|
47
|
+
'border-inline-color': $border-inline-color,
|
|
48
|
+
'border-inline-width': $border-inline-width,
|
|
49
|
+
'border-inline-style': $border-inline-style,
|
|
50
|
+
),
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@mixin footer(
|
|
55
|
+
$background: null,
|
|
56
|
+
$border-color: null,
|
|
57
|
+
$border-width: null,
|
|
58
|
+
$border-style: null,
|
|
59
|
+
$border-block-color: null,
|
|
60
|
+
$border-block-width: null,
|
|
61
|
+
$border-block-style: null,
|
|
62
|
+
$border-inline-color: null,
|
|
63
|
+
$border-inline-width: null,
|
|
64
|
+
$border-inline-style: null
|
|
65
|
+
) {
|
|
66
|
+
@include slot-mixins.apply(
|
|
67
|
+
'item-card.footer',
|
|
68
|
+
$properties: (
|
|
69
|
+
'background': $background,
|
|
70
|
+
'border-color': $border-color,
|
|
71
|
+
'border-width': $border-width,
|
|
72
|
+
'border-style': $border-style,
|
|
73
|
+
'border-block-color': $border-block-color,
|
|
74
|
+
'border-block-width': $border-block-width,
|
|
75
|
+
'border-block-style': $border-block-style,
|
|
76
|
+
'border-inline-color': $border-inline-color,
|
|
77
|
+
'border-inline-width': $border-inline-width,
|
|
78
|
+
'border-inline-style': $border-inline-style,
|
|
79
|
+
),
|
|
80
|
+
);
|
|
81
|
+
}
|
package/table-root/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import InternalTableRoot from './internal';
|
|
|
8
8
|
function TableRoot({ columnLayout = { type: 'auto' }, ...props }) {
|
|
9
9
|
const baseComponentProps = useBaseComponent('TableRoot', {
|
|
10
10
|
props: {},
|
|
11
|
-
metadata: { columnLayoutType: columnLayout.type },
|
|
11
|
+
metadata: { columnLayoutType: columnLayout.type, hasStickyHeader: !!props.stickyHeader },
|
|
12
12
|
});
|
|
13
13
|
return React.createElement(InternalTableRoot, { columnLayout: columnLayout, ...props, ...baseComponentProps });
|
|
14
14
|
}
|
package/table-root/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table-root/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAK3C,SAAS,SAAS,CAAC,EAAE,YAAY,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,KAAK,EAAkB;IAC9E,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,EAAE;QACvD,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,EAAE,gBAAgB,EAAE,YAAY,CAAC,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table-root/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAK3C,SAAS,SAAS,CAAC,EAAE,YAAY,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,KAAK,EAAkB;IAC9E,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,EAAE;QACvD,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,EAAE,gBAAgB,EAAE,YAAY,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE;KACzF,CAAC,CAAC;IACH,OAAO,oBAAC,iBAAiB,IAAC,YAAY,EAAE,YAAY,KAAM,KAAK,KAAM,kBAAkB,GAAI,CAAC;AAC9F,CAAC;AAED,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEzC,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { TableRootProps } from './interfaces';\nimport InternalTableRoot from './internal';\n\n// Each part is its own top-level component (one default export + props type) so the documenter documents it separately.\nexport { TableRootProps };\n\nfunction TableRoot({ columnLayout = { type: 'auto' }, ...props }: TableRootProps) {\n const baseComponentProps = useBaseComponent('TableRoot', {\n props: {},\n metadata: { columnLayoutType: columnLayout.type, hasStickyHeader: !!props.stickyHeader },\n });\n return <InternalTableRoot columnLayout={columnLayout} {...props} {...baseComponentProps} />;\n}\n\napplyDisplayName(TableRoot, 'TableRoot');\n\nexport default TableRoot;\n"]}
|
|
@@ -6,7 +6,8 @@ import { BaseComponentProps } from '../types/base-component';
|
|
|
6
6
|
*/
|
|
7
7
|
export interface TableRootProps extends BaseComponentProps {
|
|
8
8
|
/**
|
|
9
|
-
* The table's content. Provide a `TableHead` followed by a `TableBody` that contains the rows.
|
|
9
|
+
* The table's content. Provide a `TableHead` followed by a `TableBody` that contains the rows. When you
|
|
10
|
+
* use `stickyHeader`, provide only the `TableBody` here.
|
|
10
11
|
*/
|
|
11
12
|
children: React.ReactNode;
|
|
12
13
|
/**
|
|
@@ -37,6 +38,19 @@ export interface TableRootProps extends BaseComponentProps {
|
|
|
37
38
|
* subset of rows, such as with virtualization; otherwise it is derived from the DOM.
|
|
38
39
|
*/
|
|
39
40
|
ariaRowcount?: number;
|
|
41
|
+
/**
|
|
42
|
+
* A `TableHead` that stays pinned to the top of its scroll container as the body scrolls. When you
|
|
43
|
+
* provide it, render only the `TableBody` as `children`.
|
|
44
|
+
*
|
|
45
|
+
* The header is rendered twice, as the real header and a pinned copy, so use controlled state for any
|
|
46
|
+
* controls in it.
|
|
47
|
+
*/
|
|
48
|
+
stickyHeader?: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Specifies a vertical offset (in pixels) for the sticky header. For example, use this if you
|
|
51
|
+
* need to position the sticky header below other fixed position elements on the page.
|
|
52
|
+
*/
|
|
53
|
+
stickyHeaderVerticalOffset?: number;
|
|
40
54
|
}
|
|
41
55
|
export declare namespace TableRootProps {
|
|
42
56
|
type ColumnLayout = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/table-root/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EA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CAAC,EAAE,KAAK,CAAA;KAAE,GAC/D;QAAE,IAAI,CAAC,EAAE,KAAK,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/table-root/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../types/base-component';\n\n/**\n * A composable table. You render the head and rows as children, and TableRoot provides the column\n * layout and accessibility semantics.\n */\nexport interface TableRootProps extends BaseComponentProps {\n /**\n * The table's content. Provide a `TableHead` followed by a `TableBody` that contains the rows.\n */\n children: React.ReactNode;\n\n /**\n * Determines how column widths are calculated.\n * * `{ type: 'auto' }` - Renders a standard HTML table whose columns size to their content. No\n * column configuration is required.\n * * `{ type: 'grid'; columns: ColumnDefinition[] }` - Renders a CSS grid. The columns are then provided as\n * an array of objects with the following properties:\n * * `size` (number | { flex: number }) - A number sets a fixed pixel width; `{ flex }` gives the\n * column a weight that shares the remaining space in proportion. Omit it for a flexible column\n * with the default weight of 1.\n * * `minWidth` (number) - The minimum width in pixels for a flexible column. We recommend setting one;\n * without it the column can shrink until its content clips or overlaps at narrow widths.\n * * `maxWidth` (number) - Caps a flexible column's width in pixels (it grows up to the cap). A capped\n * column can't also carry a proportional `flex` weight, so weighting applies to the uncapped columns.\n *\n * Defaults to `{ type: 'auto' }`.\n */\n columnLayout?: TableRootProps.ColumnLayout;\n\n /** Provides an accessible name for the table. Use this or `ariaLabelledby` to label the table. */\n ariaLabel?: string;\n /** Sets the `aria-labelledby` attribute. Use the ID of a visible element that labels the table. */\n ariaLabelledby?: string;\n /** Sets the `aria-describedby` attribute. Use the ID of a visible element that describes the table. */\n ariaDescribedby?: string;\n\n /**\n * Sets the table's `aria-rowcount`, counting the header row. Provide it only when you render a\n * subset of rows, such as with virtualization; otherwise it is derived from the DOM.\n */\n ariaRowcount?: number;\n}\n\nexport namespace TableRootProps {\n export type ColumnLayout = { type: 'auto' } | { type: 'grid'; columns: ReadonlyArray<ColumnDefinition> };\n\n export type ColumnDefinition =\n | { size: number; minWidth?: never; maxWidth?: never }\n | { size: { flex: number }; minWidth?: number; maxWidth?: never }\n | { size?: never; minWidth?: number; maxWidth?: number };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/table-root/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../types/base-component';\n\n/**\n * A composable table. You render the head and rows as children, and TableRoot provides the column\n * layout and accessibility semantics.\n */\nexport interface TableRootProps extends BaseComponentProps {\n /**\n * The table's content. Provide a `TableHead` followed by a `TableBody` that contains the rows. When you\n * use `stickyHeader`, provide only the `TableBody` here.\n */\n children: React.ReactNode;\n\n /**\n * Determines how column widths are calculated.\n * * `{ type: 'auto' }` - Renders a standard HTML table whose columns size to their content. No\n * column configuration is required.\n * * `{ type: 'grid'; columns: ColumnDefinition[] }` - Renders a CSS grid. The columns are then provided as\n * an array of objects with the following properties:\n * * `size` (number | { flex: number }) - A number sets a fixed pixel width; `{ flex }` gives the\n * column a weight that shares the remaining space in proportion. Omit it for a flexible column\n * with the default weight of 1.\n * * `minWidth` (number) - The minimum width in pixels for a flexible column. We recommend setting one;\n * without it the column can shrink until its content clips or overlaps at narrow widths.\n * * `maxWidth` (number) - Caps a flexible column's width in pixels (it grows up to the cap). A capped\n * column can't also carry a proportional `flex` weight, so weighting applies to the uncapped columns.\n *\n * Defaults to `{ type: 'auto' }`.\n */\n columnLayout?: TableRootProps.ColumnLayout;\n\n /** Provides an accessible name for the table. Use this or `ariaLabelledby` to label the table. */\n ariaLabel?: string;\n /** Sets the `aria-labelledby` attribute. Use the ID of a visible element that labels the table. */\n ariaLabelledby?: string;\n /** Sets the `aria-describedby` attribute. Use the ID of a visible element that describes the table. */\n ariaDescribedby?: string;\n\n /**\n * Sets the table's `aria-rowcount`, counting the header row. Provide it only when you render a\n * subset of rows, such as with virtualization; otherwise it is derived from the DOM.\n */\n ariaRowcount?: number;\n\n /**\n * A `TableHead` that stays pinned to the top of its scroll container as the body scrolls. When you\n * provide it, render only the `TableBody` as `children`.\n *\n * The header is rendered twice, as the real header and a pinned copy, so use controlled state for any\n * controls in it.\n */\n stickyHeader?: React.ReactNode;\n\n /**\n * Specifies a vertical offset (in pixels) for the sticky header. For example, use this if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n}\n\nexport namespace TableRootProps {\n export type ColumnLayout = { type: 'auto' } | { type: 'grid'; columns: ReadonlyArray<ColumnDefinition> };\n\n export type ColumnDefinition =\n | { size: number; minWidth?: never; maxWidth?: never }\n | { size: { flex: number }; minWidth?: number; maxWidth?: never }\n | { size?: never; minWidth?: number; maxWidth?: number };\n}\n"]}
|
package/table-root/internal.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/table-root/internal.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/table-root/internal.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM9C,MAAM,WAAW,sBAAuB,SAAQ,cAAc,EAAE,0BAA0B;CAAG;AAW7F,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,YAA+B,EAC/B,YAAY,EACZ,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,0BAA0B,EAC1B,QAAQ,EACR,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,sBAAsB,eA2GxB"}
|
package/table-root/internal.js
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';
|
|
5
|
+
import { useMergeRefs, useResizeObserver } from '@cloudscape-design/component-toolkit/internal';
|
|
6
6
|
import { getBaseProps } from '../internal/base-component';
|
|
7
7
|
import { StickyScrollbar } from '../internal/components/sticky-scrollbar';
|
|
8
8
|
import { useScrollSync } from '../internal/hooks/use-scroll-sync';
|
|
9
9
|
import { TableContextProvider } from './context';
|
|
10
10
|
import { computeGridTemplateColumns } from './grid-template-columns';
|
|
11
|
+
import StickyHeaderSlot from './sticky-header-slot';
|
|
12
|
+
import { useTableRootStickyHeader } from './use-sticky-header';
|
|
11
13
|
import styles from './styles.css.js';
|
|
12
14
|
// In grid layout the rows overflow the table element, so the scroller, not the table, measures the
|
|
13
15
|
// scrollable width. scrollWidth is rounded to a whole pixel, so content that fits a fractional-width
|
|
@@ -17,7 +19,7 @@ function getScrollerContentInlineSize(_table, scroller) {
|
|
|
17
19
|
? scroller.scrollWidth
|
|
18
20
|
: scroller.getBoundingClientRect().width;
|
|
19
21
|
}
|
|
20
|
-
export default function InternalTableRoot({ columnLayout = { type: 'auto' }, ariaRowcount, ariaLabel, ariaLabelledby, ariaDescribedby, children, __internalRootRef, ...rest }) {
|
|
22
|
+
export default function InternalTableRoot({ columnLayout = { type: 'auto' }, ariaRowcount, ariaLabel, ariaLabelledby, ariaDescribedby, stickyHeader, stickyHeaderVerticalOffset, children, __internalRootRef, ...rest }) {
|
|
21
23
|
const isGrid = columnLayout.type === 'grid';
|
|
22
24
|
const gridTemplateColumns = computeGridTemplateColumns(columnLayout);
|
|
23
25
|
// Memoized because it is the TableContext value; a fresh object re-renders every cell. Both fields are
|
|
@@ -47,9 +49,17 @@ export default function InternalTableRoot({ columnLayout = { type: 'auto' }, ari
|
|
|
47
49
|
measureScrollable();
|
|
48
50
|
}
|
|
49
51
|
}, [isGrid, gridTemplateColumns, measureScrollable]);
|
|
50
|
-
const
|
|
52
|
+
const rootRef = useRef(null);
|
|
53
|
+
const mergedRootRef = useMergeRefs(rootRef, __internalRootRef);
|
|
54
|
+
const sticky = useTableRootStickyHeader({
|
|
55
|
+
enabled: !!stickyHeader,
|
|
56
|
+
verticalOffset: stickyHeaderVerticalOffset,
|
|
57
|
+
isGrid,
|
|
58
|
+
rootRef,
|
|
59
|
+
scrollerRef,
|
|
60
|
+
});
|
|
51
61
|
const scrollbarRef = useRef(null);
|
|
52
|
-
const handleScroll = useScrollSync([scrollerRef, scrollbarRef]);
|
|
62
|
+
const handleScroll = useScrollSync([scrollerRef, scrollbarRef, sticky.copyScrollerRef]);
|
|
53
63
|
// Set role="region" whenever scrollable (label passes through even if undefined), matching the
|
|
54
64
|
// existing Table's getTableWrapperRoleProps rather than gating the role on a label.
|
|
55
65
|
const scrollRegionProps = isScrollable
|
|
@@ -60,13 +70,15 @@ export default function InternalTableRoot({ columnLayout = { type: 'auto' }, ari
|
|
|
60
70
|
'aria-labelledby': ariaLabelledby,
|
|
61
71
|
}
|
|
62
72
|
: {};
|
|
63
|
-
return (React.createElement("div", { ...baseProps, className: clsx(baseProps.className, styles.root), ref:
|
|
73
|
+
return (React.createElement("div", { ...baseProps, className: clsx(baseProps.className, styles.root), ref: mergedRootRef },
|
|
64
74
|
React.createElement(TableContextProvider, { value: tableContext },
|
|
65
|
-
React.createElement(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
role:
|
|
70
|
-
|
|
75
|
+
sticky.isSticky && (React.createElement(StickyHeaderSlot, { slotRef: sticky.slotRef, copyScrollerRef: sticky.copyScrollerRef, copyTableRef: sticky.copyTableRef, onScroll: handleScroll, onFocus: sticky.onCopyFocus, isStuck: sticky.isStuck, isGrid: isGrid, style: sticky.stickyStyles.style }, stickyHeader)),
|
|
76
|
+
React.createElement("div", { className: styles['body-scroller'], ref: scrollerRef, onScroll: handleScroll, onFocus: sticky.onScrollerFocus, onBlur: sticky.onScrollerBlur, ...scrollRegionProps },
|
|
77
|
+
React.createElement("table", { ref: sticky.realTableRef,
|
|
78
|
+
// Without an explicit role, browsers guess whether a table holds data or is only for layout.
|
|
79
|
+
role: "table", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-rowcount": ariaRowcount, className: clsx(styles.table, isGrid ? styles['table-grid'] : styles['table-auto']) },
|
|
80
|
+
stickyHeader,
|
|
81
|
+
children)),
|
|
82
|
+
React.createElement(StickyScrollbar, { ref: scrollbarRef, wrapperRef: scrollerRef, tableRef: sticky.realTableRef, onScroll: handleScroll, getContentInlineSize: getScrollerContentInlineSize, contentKey: gridTemplateColumns }))));
|
|
71
83
|
}
|
|
72
84
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/table-root/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AA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Ae,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,KAAM,iBAAiB;gBACtG,+BACE,GAAG,EAAE,QAAQ;oBACb,oFAAoF;oBACpF,4FAA4F;oBAC5F,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,gBACtB,SAAS,qBACJ,cAAc,sBACb,eAAe,mBAClB,YAAY,EAC3B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,IAElF,QAAQ,CACH,CACJ;YACN,oBAAC,eAAe,IACd,GAAG,EAAE,YAAY,EACjB,UAAU,EAAE,WAAW,EACvB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,YAAY,EACtB,oBAAoB,EAAE,4BAA4B,EAClD,UAAU,EAAE,mBAAmB,GAC/B,CACmB,CACnB,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyScrollbar } from '../internal/components/sticky-scrollbar';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useScrollSync } from '../internal/hooks/use-scroll-sync';\nimport { TableContextProvider } from './context';\nimport { computeGridTemplateColumns } from './grid-template-columns';\nimport { TableRootProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport interface InternalTableRootProps extends TableRootProps, InternalBaseComponentProps {}\n\n// In grid layout the rows overflow the table element, so the scroller, not the table, measures the\n// scrollable width. scrollWidth is rounded to a whole pixel, so content that fits a fractional-width\n// scroller reports the scroller's own width instead, using the same tolerance as measureScrollable.\nfunction getScrollerContentInlineSize(_table: HTMLElement, scroller: HTMLElement) {\n return scroller.scrollWidth - scroller.clientWidth > 1\n ? scroller.scrollWidth\n : scroller.getBoundingClientRect().width;\n}\n\nexport default function InternalTableRoot({\n columnLayout = { type: 'auto' },\n ariaRowcount,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n children,\n __internalRootRef,\n ...rest\n}: InternalTableRootProps) {\n const isGrid = columnLayout.type === 'grid';\n const gridTemplateColumns = computeGridTemplateColumns(columnLayout);\n // Memoized because it is the TableContext value; a fresh object re-renders every cell. Both fields are\n // primitives compared by value, so it stays stable even when the caller passes a fresh columnLayout.\n const tableContext = useMemo(() => ({ isGrid, gridTemplateColumns }), [isGrid, gridTemplateColumns]);\n const baseProps = getBaseProps(rest);\n\n // A wide table's horizontal scroller isn't keyboard-reachable on its own, so a read-only table with no\n // focusable cell content can't be scrolled by keyboard. When the content overflows, expose the scroller\n // as a focusable region so keyboard users can scroll it horizontally, matching the existing Table's\n // getTableWrapperRoleProps.\n const scrollerRef = useRef<HTMLDivElement>(null);\n const [isScrollable, setIsScrollable] = useState(false);\n const measureScrollable = useCallback(() => {\n const node = scrollerRef.current;\n if (node) {\n setIsScrollable(node.scrollWidth - node.clientWidth > 1);\n }\n }, []);\n // Observe the scroller and the table it wraps: a viewport resize changes the scroller box, and\n // auto-layout content growth changes the table box — either can start or stop the horizontal overflow.\n useResizeObserver(scrollerRef, measureScrollable);\n useResizeObserver(() => scrollerRef.current?.firstElementChild ?? null, measureScrollable);\n // Grid column templates change the tracks' overflow without resizing either observed box, so no observer\n // fires — re-measure when the template changes.\n useEffect(() => {\n if (isGrid) {\n measureScrollable();\n }\n }, [isGrid, gridTemplateColumns, measureScrollable]);\n\n const tableRef = useRef<HTMLTableElement>(null);\n const scrollbarRef = useRef<HTMLDivElement>(null);\n const handleScroll = useScrollSync([scrollerRef, scrollbarRef]);\n\n // Set role=\"region\" whenever scrollable (label passes through even if undefined), matching the\n // existing Table's getTableWrapperRoleProps rather than gating the role on a label.\n const scrollRegionProps = isScrollable\n ? {\n role: 'region' as const,\n tabIndex: 0,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n }\n : {};\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n {/* TableContext supplies this table's column layout to every part. */}\n <TableContextProvider value={tableContext}>\n {/* The page owns vertical scroll; this wrapper reintroduces an inline scroll viewport so a wide table scrolls horizontally instead of spilling out. */}\n <div className={styles['body-scroller']} ref={scrollerRef} onScroll={handleScroll} {...scrollRegionProps}>\n <table\n ref={tableRef}\n // Grid mode only: display:grid drops the table's implicit role. Auto mode keeps the\n // native role (an explicit role=\"table\" there is redundant and flagged by a11y validators).\n role={isGrid ? 'table' : undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-rowcount={ariaRowcount}\n className={clsx(styles.table, isGrid ? styles['table-grid'] : styles['table-auto'])}\n >\n {children}\n </table>\n </div>\n <StickyScrollbar\n ref={scrollbarRef}\n wrapperRef={scrollerRef}\n tableRef={tableRef}\n onScroll={handleScroll}\n getContentInlineSize={getScrollerContentInlineSize}\n contentKey={gridTemplateColumns}\n />\n </TableContextProvider>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/table-root/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAEhG,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;A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H,CACJ;YACN,oBAAC,eAAe,IACd,GAAG,EAAE,YAAY,EACjB,UAAU,EAAE,WAAW,EACvB,QAAQ,EAAE,MAAM,CAAC,YAAY,EAC7B,QAAQ,EAAE,YAAY,EACtB,oBAAoB,EAAE,4BAA4B,EAClD,UAAU,EAAE,mBAAmB,GAC/B,CACmB,CACnB,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyScrollbar } from '../internal/components/sticky-scrollbar';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useScrollSync } from '../internal/hooks/use-scroll-sync';\nimport { TableContextProvider } from './context';\nimport { computeGridTemplateColumns } from './grid-template-columns';\nimport { TableRootProps } from './interfaces';\nimport StickyHeaderSlot from './sticky-header-slot';\nimport { useTableRootStickyHeader } from './use-sticky-header';\n\nimport styles from './styles.css.js';\n\nexport interface InternalTableRootProps extends TableRootProps, InternalBaseComponentProps {}\n\n// In grid layout the rows overflow the table element, so the scroller, not the table, measures the\n// scrollable width. scrollWidth is rounded to a whole pixel, so content that fits a fractional-width\n// scroller reports the scroller's own width instead, using the same tolerance as measureScrollable.\nfunction getScrollerContentInlineSize(_table: HTMLElement, scroller: HTMLElement) {\n return scroller.scrollWidth - scroller.clientWidth > 1\n ? scroller.scrollWidth\n : scroller.getBoundingClientRect().width;\n}\n\nexport default function InternalTableRoot({\n columnLayout = { type: 'auto' },\n ariaRowcount,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n stickyHeader,\n stickyHeaderVerticalOffset,\n children,\n __internalRootRef,\n ...rest\n}: InternalTableRootProps) {\n const isGrid = columnLayout.type === 'grid';\n const gridTemplateColumns = computeGridTemplateColumns(columnLayout);\n // Memoized because it is the TableContext value; a fresh object re-renders every cell. Both fields are\n // primitives compared by value, so it stays stable even when the caller passes a fresh columnLayout.\n const tableContext = useMemo(() => ({ isGrid, gridTemplateColumns }), [isGrid, gridTemplateColumns]);\n const baseProps = getBaseProps(rest);\n\n // A wide table's horizontal scroller isn't keyboard-reachable on its own, so a read-only table with no\n // focusable cell content can't be scrolled by keyboard. When the content overflows, expose the scroller\n // as a focusable region so keyboard users can scroll it horizontally, matching the existing Table's\n // getTableWrapperRoleProps.\n const scrollerRef = useRef<HTMLDivElement>(null);\n const [isScrollable, setIsScrollable] = useState(false);\n const measureScrollable = useCallback(() => {\n const node = scrollerRef.current;\n if (node) {\n setIsScrollable(node.scrollWidth - node.clientWidth > 1);\n }\n }, []);\n // Observe the scroller and the table it wraps: a viewport resize changes the scroller box, and\n // auto-layout content growth changes the table box — either can start or stop the horizontal overflow.\n useResizeObserver(scrollerRef, measureScrollable);\n useResizeObserver(() => scrollerRef.current?.firstElementChild ?? null, measureScrollable);\n // Grid column templates change the tracks' overflow without resizing either observed box, so no observer\n // fires — re-measure when the template changes.\n useEffect(() => {\n if (isGrid) {\n measureScrollable();\n }\n }, [isGrid, gridTemplateColumns, measureScrollable]);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRootRef = useMergeRefs(rootRef, __internalRootRef);\n const sticky = useTableRootStickyHeader({\n enabled: !!stickyHeader,\n verticalOffset: stickyHeaderVerticalOffset,\n isGrid,\n rootRef,\n scrollerRef,\n });\n const scrollbarRef = useRef<HTMLDivElement>(null);\n const handleScroll = useScrollSync([scrollerRef, scrollbarRef, sticky.copyScrollerRef]);\n\n // Set role=\"region\" whenever scrollable (label passes through even if undefined), matching the\n // existing Table's getTableWrapperRoleProps rather than gating the role on a label.\n const scrollRegionProps = isScrollable\n ? {\n role: 'region' as const,\n tabIndex: 0,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n }\n : {};\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRootRef}>\n {/* TableContext supplies this table's column layout to every part. */}\n <TableContextProvider value={tableContext}>\n {sticky.isSticky && (\n <StickyHeaderSlot\n slotRef={sticky.slotRef}\n copyScrollerRef={sticky.copyScrollerRef}\n copyTableRef={sticky.copyTableRef}\n onScroll={handleScroll}\n onFocus={sticky.onCopyFocus}\n isStuck={sticky.isStuck}\n isGrid={isGrid}\n style={sticky.stickyStyles.style}\n >\n {stickyHeader}\n </StickyHeaderSlot>\n )}\n {/* The page owns vertical scroll; this wrapper reintroduces an inline scroll viewport so a wide table scrolls horizontally instead of spilling out. */}\n <div\n className={styles['body-scroller']}\n ref={scrollerRef}\n onScroll={handleScroll}\n onFocus={sticky.onScrollerFocus}\n onBlur={sticky.onScrollerBlur}\n {...scrollRegionProps}\n >\n <table\n ref={sticky.realTableRef}\n // Without an explicit role, browsers guess whether a table holds data or is only for layout.\n role=\"table\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-rowcount={ariaRowcount}\n className={clsx(styles.table, isGrid ? styles['table-grid'] : styles['table-auto'])}\n >\n {stickyHeader}\n {children}\n </table>\n </div>\n <StickyScrollbar\n ref={scrollbarRef}\n wrapperRef={scrollerRef}\n tableRef={sticky.realTableRef}\n onScroll={handleScroll}\n getContentInlineSize={getScrollerContentInlineSize}\n contentKey={gridTemplateColumns}\n />\n </TableContextProvider>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface StickyHeaderSlotProps {
|
|
3
|
+
slotRef: React.Ref<HTMLDivElement>;
|
|
4
|
+
copyScrollerRef: React.Ref<HTMLDivElement>;
|
|
5
|
+
copyTableRef: React.Ref<HTMLTableElement>;
|
|
6
|
+
onScroll: React.UIEventHandler<HTMLDivElement>;
|
|
7
|
+
onFocus: React.FocusEventHandler<HTMLDivElement>;
|
|
8
|
+
isStuck: boolean;
|
|
9
|
+
isGrid: boolean;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export default function StickyHeaderSlot({
|
|
14
|
+
slotRef,
|
|
15
|
+
copyScrollerRef,
|
|
16
|
+
copyTableRef,
|
|
17
|
+
onScroll,
|
|
18
|
+
onFocus,
|
|
19
|
+
isStuck,
|
|
20
|
+
isGrid,
|
|
21
|
+
style,
|
|
22
|
+
children
|
|
23
|
+
}: StickyHeaderSlotProps): JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sticky-header-slot.d.ts","sourceRoot":"","sources":["../../../src/table-root/sticky-header-slot.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,qBAAqB;IAC7B,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACnC,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC3C,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC1C,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAC/C,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAID,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,OAAO,EACP,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,QAAQ,GACT,EAAE,qBAAqB,eAoBvB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import styles from './styles.css.js';
|
|
6
|
+
// Hidden from assistive technology and the tab order, but clickable: it covers the real header. Focus that
|
|
7
|
+
// lands in it is moved to the real header.
|
|
8
|
+
export default function StickyHeaderSlot({ slotRef, copyScrollerRef, copyTableRef, onScroll, onFocus, isStuck, isGrid, style, children, }) {
|
|
9
|
+
return (React.createElement("div", { ref: slotRef, "aria-hidden": true, className: clsx(styles['sticky-slot'], isStuck && styles['sticky-slot-stuck']), style: style, onFocus: onFocus },
|
|
10
|
+
React.createElement("div", { className: styles['sticky-copy-scroller'], ref: copyScrollerRef, onScroll: onScroll, tabIndex: -1 },
|
|
11
|
+
React.createElement("table", { ref: copyTableRef, role: "table", className: clsx(styles.table, isGrid ? styles['table-grid'] : styles['table-copy-fixed']) }, children))));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=sticky-header-slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sticky-header-slot.js","sourceRoot":"","sources":["../../../src/table-root/sticky-header-slot.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAcrC,2GAA2G;AAC3G,2CAA2C;AAC3C,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,OAAO,EACP,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,QAAQ,GACc;IACtB,OAAO,CACL,6BACE,GAAG,EAAE,OAAO,iBACC,IAAI,EACjB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAAC,EAC9E,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO;QAEhB,6BAAK,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;YACpG,+BACE,GAAG,EAAE,YAAY,EACjB,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAExF,QAAQ,CACH,CACJ,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport styles from './styles.css.js';\n\ninterface StickyHeaderSlotProps {\n slotRef: React.Ref<HTMLDivElement>;\n copyScrollerRef: React.Ref<HTMLDivElement>;\n copyTableRef: React.Ref<HTMLTableElement>;\n onScroll: React.UIEventHandler<HTMLDivElement>;\n onFocus: React.FocusEventHandler<HTMLDivElement>;\n isStuck: boolean;\n isGrid: boolean;\n style?: React.CSSProperties;\n children: React.ReactNode;\n}\n\n// Hidden from assistive technology and the tab order, but clickable: it covers the real header. Focus that\n// lands in it is moved to the real header.\nexport default function StickyHeaderSlot({\n slotRef,\n copyScrollerRef,\n copyTableRef,\n onScroll,\n onFocus,\n isStuck,\n isGrid,\n style,\n children,\n}: StickyHeaderSlotProps) {\n return (\n <div\n ref={slotRef}\n aria-hidden={true}\n className={clsx(styles['sticky-slot'], isStuck && styles['sticky-slot-stuck'])}\n style={style}\n onFocus={onFocus}\n >\n <div className={styles['sticky-copy-scroller']} ref={copyScrollerRef} onScroll={onScroll} tabIndex={-1}>\n <table\n ref={copyTableRef}\n role=\"table\"\n className={clsx(styles.table, isGrid ? styles['table-grid'] : styles['table-copy-fixed'])}\n >\n {children}\n </table>\n </div>\n </div>\n );\n}\n"]}
|
package/table-root/styles.css.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"body-scroller": "awsui_body-
|
|
6
|
-
"table": "
|
|
7
|
-
"table-auto": "awsui_table-
|
|
8
|
-
"table-grid": "awsui_table-
|
|
4
|
+
"root": "awsui_root_1pkvc_fhcug_9",
|
|
5
|
+
"body-scroller": "awsui_body-scroller_1pkvc_fhcug_46",
|
|
6
|
+
"table": "awsui_table_1pkvc_fhcug_63",
|
|
7
|
+
"table-auto": "awsui_table-auto_1pkvc_fhcug_69",
|
|
8
|
+
"table-grid": "awsui_table-grid_1pkvc_fhcug_73",
|
|
9
|
+
"table-copy-fixed": "awsui_table-copy-fixed_1pkvc_fhcug_77",
|
|
10
|
+
"sticky-slot": "awsui_sticky-slot_1pkvc_fhcug_81",
|
|
11
|
+
"sticky-slot-stuck": "awsui_sticky-slot-stuck_1pkvc_fhcug_88",
|
|
12
|
+
"sticky-copy-scroller": "awsui_sticky-copy-scroller_1pkvc_fhcug_92",
|
|
13
|
+
"sticky-copy-focus": "awsui_sticky-copy-focus_1pkvc_fhcug_100"
|
|
9
14
|
};
|
|
10
15
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
|
|
7
7
|
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
8
8
|
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
9
|
-
.
|
|
9
|
+
.awsui_root_1pkvc_fhcug_9:not(#\9) {
|
|
10
10
|
border-collapse: separate;
|
|
11
11
|
border-spacing: 0;
|
|
12
12
|
box-sizing: border-box;
|
|
@@ -43,14 +43,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
43
43
|
background: var(--color-background-container-content-0odjoo, #ffffff);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.awsui_body-
|
|
46
|
+
.awsui_body-scroller_1pkvc_fhcug_46:not(#\9) {
|
|
47
47
|
overflow-x: auto;
|
|
48
48
|
scrollbar-width: none; /* Firefox */
|
|
49
49
|
}
|
|
50
|
-
.awsui_body-
|
|
50
|
+
.awsui_body-scroller_1pkvc_fhcug_46:not(#\9)::-webkit-scrollbar {
|
|
51
51
|
display: none; /* Safari and Chrome */
|
|
52
52
|
}
|
|
53
|
-
body[data-awsui-focus-visible=true] .awsui_body-
|
|
53
|
+
body[data-awsui-focus-visible=true] .awsui_body-scroller_1pkvc_fhcug_46:not(#\9):focus {
|
|
54
54
|
outline: 2px dotted transparent;
|
|
55
55
|
outline-offset: 2px;
|
|
56
56
|
border-start-start-radius: var(--border-radius-container-cjce5i, 16px);
|
|
@@ -60,16 +60,61 @@ body[data-awsui-focus-visible=true] .awsui_body-scroller_1pkvc_abtwi_46:not(#\9)
|
|
|
60
60
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-sb1fs0, #006ce0);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
.
|
|
63
|
+
.awsui_table_1pkvc_fhcug_63:not(#\9) {
|
|
64
64
|
inline-size: 100%;
|
|
65
65
|
border-collapse: separate;
|
|
66
66
|
border-spacing: 0;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
.awsui_table-
|
|
69
|
+
.awsui_table-auto_1pkvc_fhcug_69:not(#\9) {
|
|
70
70
|
table-layout: auto;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
.awsui_table-
|
|
73
|
+
.awsui_table-grid_1pkvc_fhcug_73:not(#\9) {
|
|
74
74
|
display: block;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.awsui_table-copy-fixed_1pkvc_fhcug_77:not(#\9) {
|
|
78
|
+
table-layout: fixed;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.awsui_sticky-slot_1pkvc_fhcug_81:not(#\9) {
|
|
82
|
+
position: sticky;
|
|
83
|
+
inset-block-start: 0;
|
|
84
|
+
z-index: 800;
|
|
85
|
+
background: var(--color-background-table-header-dbczmh, #ffffff);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.awsui_sticky-slot-stuck_1pkvc_fhcug_88:not(#\9) {
|
|
89
|
+
box-shadow: var(--shadow-sticky-embedded-4e1jeb, 0px 2px 0px 0px #e9ebed, 0px 16px 16px -12px rgba(0, 7, 22, 0.1));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.awsui_sticky-copy-scroller_1pkvc_fhcug_92:not(#\9) {
|
|
93
|
+
overflow: auto;
|
|
94
|
+
scrollbar-width: none; /* Firefox */
|
|
95
|
+
}
|
|
96
|
+
.awsui_sticky-copy-scroller_1pkvc_fhcug_92:not(#\9)::-webkit-scrollbar {
|
|
97
|
+
display: none; /* Safari and Chrome */
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
body[data-awsui-focus-visible=true] .awsui_sticky-copy-focus_1pkvc_fhcug_100:not(#\9) {
|
|
101
|
+
position: relative;
|
|
102
|
+
}
|
|
103
|
+
body[data-awsui-focus-visible=true] .awsui_sticky-copy-focus_1pkvc_fhcug_100:not(#\9) {
|
|
104
|
+
outline: 2px dotted transparent;
|
|
105
|
+
outline-offset: calc(var(--space-none-9jj7fe, 0px) - 1px);
|
|
106
|
+
}
|
|
107
|
+
body[data-awsui-focus-visible=true] .awsui_sticky-copy-focus_1pkvc_fhcug_100:not(#\9)::before {
|
|
108
|
+
content: " ";
|
|
109
|
+
display: block;
|
|
110
|
+
position: absolute;
|
|
111
|
+
inset-inline-start: calc(-1 * var(--space-none-9jj7fe, 0px));
|
|
112
|
+
inset-block-start: calc(-1 * var(--space-none-9jj7fe, 0px));
|
|
113
|
+
inline-size: calc(100% + var(--space-none-9jj7fe, 0px) + var(--space-none-9jj7fe, 0px));
|
|
114
|
+
block-size: calc(100% + var(--space-none-9jj7fe, 0px) + var(--space-none-9jj7fe, 0px));
|
|
115
|
+
border-start-start-radius: var(--border-radius-control-default-focus-ring-hkazgq, 4px);
|
|
116
|
+
border-start-end-radius: var(--border-radius-control-default-focus-ring-hkazgq, 4px);
|
|
117
|
+
border-end-start-radius: var(--border-radius-control-default-focus-ring-hkazgq, 4px);
|
|
118
|
+
border-end-end-radius: var(--border-radius-control-default-focus-ring-hkazgq, 4px);
|
|
119
|
+
box-shadow: 0 0 0 2px var(--color-border-item-focused-sb1fs0, #006ce0);
|
|
75
120
|
}
|