@cloudscape-design/components 3.0.633 → 3.0.635
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/app-layout/split-panel/styles.css.js +2 -2
- package/app-layout/split-panel/styles.scoped.css +3 -2
- package/app-layout/split-panel/styles.selectors.js +2 -2
- package/cards/index.d.ts.map +1 -1
- package/cards/index.js +6 -6
- package/cards/index.js.map +1 -1
- package/cards/interfaces.d.ts +1 -1
- package/cards/interfaces.js.map +1 -1
- package/form-field/internal.js +1 -1
- package/form-field/internal.js.map +1 -1
- package/form-field/styles.css.js +24 -23
- package/form-field/styles.scoped.css +40 -37
- package/form-field/styles.selectors.js +24 -23
- package/internal/direction.d.ts +1 -1
- package/internal/direction.d.ts.map +1 -1
- package/internal/direction.js +3 -0
- package/internal/direction.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/mixed-line-bar-chart/bar-series.d.ts +2 -1
- package/mixed-line-bar-chart/bar-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/bar-series.js +6 -3
- package/mixed-line-bar-chart/bar-series.js.map +1 -1
- package/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
- package/mixed-line-bar-chart/chart-container.js +3 -3
- package/mixed-line-bar-chart/chart-container.js.map +1 -1
- package/mixed-line-bar-chart/data-series.d.ts +2 -1
- package/mixed-line-bar-chart/data-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/data-series.js +2 -2
- package/mixed-line-bar-chart/data-series.js.map +1 -1
- package/package.json +1 -1
- package/progress-bar/index.d.ts.map +1 -1
- package/progress-bar/index.js +1 -1
- package/progress-bar/index.js.map +1 -1
- package/progress-bar/internal.d.ts +2 -1
- package/progress-bar/internal.d.ts.map +1 -1
- package/progress-bar/internal.js +2 -2
- package/progress-bar/internal.js.map +1 -1
- package/progress-bar/styles.css.js +19 -18
- package/progress-bar/styles.scoped.css +36 -32
- package/progress-bar/styles.selectors.js +19 -18
- package/property-filter/index.d.ts.map +1 -1
- package/property-filter/index.js +8 -2
- package/property-filter/index.js.map +1 -1
- package/property-filter/interfaces.d.ts +5 -0
- package/property-filter/interfaces.d.ts.map +1 -1
- package/property-filter/interfaces.js.map +1 -1
- package/property-filter/styles.css.js +32 -31
- package/property-filter/styles.scoped.css +41 -33
- package/property-filter/styles.selectors.js +32 -31
- package/table/interfaces.d.ts +13 -11
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +9 -4
- package/table/internal.js.map +1 -1
- package/table/selection/interfaces.d.ts +1 -0
- package/table/selection/interfaces.d.ts.map +1 -1
- package/table/selection/interfaces.js.map +1 -1
- package/table/selection/use-selection.d.ts +5 -4
- package/table/selection/use-selection.d.ts.map +1 -1
- package/table/selection/use-selection.js +55 -36
- package/table/selection/use-selection.js.map +1 -1
- package/table/thead.d.ts +1 -1
- package/table/thead.d.ts.map +1 -1
- package/table/thead.js +1 -1
- package/table/thead.js.map +1 -1
- package/test-utils/dom/progress-bar/index.d.ts +1 -0
- package/test-utils/dom/progress-bar/index.js +3 -0
- package/test-utils/dom/progress-bar/index.js.map +1 -1
- package/test-utils/dom/property-filter/index.d.ts +4 -0
- package/test-utils/dom/property-filter/index.js +6 -0
- package/test-utils/dom/property-filter/index.js.map +1 -1
- package/test-utils/selectors/progress-bar/index.d.ts +1 -0
- package/test-utils/selectors/progress-bar/index.js +3 -0
- package/test-utils/selectors/progress-bar/index.js.map +1 -1
- package/test-utils/selectors/property-filter/index.d.ts +4 -0
- package/test-utils/selectors/property-filter/index.js +6 -0
- package/test-utils/selectors/property-filter/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"drawer-displayed": "awsui_drawer-
|
|
5
|
-
"drawer-content": "awsui_drawer-
|
|
4
|
+
"drawer-displayed": "awsui_drawer-displayed_1lh3u_17q8n_103",
|
|
5
|
+
"drawer-content": "awsui_drawer-content_1lh3u_17q8n_107"
|
|
6
6
|
};
|
|
7
7
|
|
|
@@ -100,10 +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_drawer-
|
|
103
|
+
.awsui_drawer-displayed_1lh3u_17q8n_103:not(#\9) {
|
|
104
104
|
min-inline-size: 40px;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
.awsui_drawer-
|
|
107
|
+
.awsui_drawer-content_1lh3u_17q8n_107:not(#\9) {
|
|
108
108
|
position: fixed;
|
|
109
|
+
z-index: 830;
|
|
109
110
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"drawer-displayed": "awsui_drawer-
|
|
6
|
-
"drawer-content": "awsui_drawer-
|
|
5
|
+
"drawer-displayed": "awsui_drawer-displayed_1lh3u_17q8n_103",
|
|
6
|
+
"drawer-content": "awsui_drawer-content_1lh3u_17q8n_107"
|
|
7
7
|
};
|
|
8
8
|
|
package/cards/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA+B/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA+B/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,qBA4Kc,CAAC;AAE1B,eAAe,KAAK,CAAC"}
|
package/cards/index.js
CHANGED
|
@@ -45,7 +45,7 @@ const Cards = React.forwardRef(function (_a, ref) {
|
|
|
45
45
|
const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);
|
|
46
46
|
const getMouseDownTarget = useMouseDownTarget();
|
|
47
47
|
const i18n = useInternalI18n('cards');
|
|
48
|
-
const { isItemSelected, getItemSelectionProps
|
|
48
|
+
const { isItemSelected, getItemSelectionProps } = useSelection({
|
|
49
49
|
items,
|
|
50
50
|
trackBy,
|
|
51
51
|
selectedItems,
|
|
@@ -94,10 +94,10 @@ const Cards = React.forwardRef(function (_a, ref) {
|
|
|
94
94
|
React.createElement(ToolsHeader, { header: header, filter: filter, pagination: pagination, preferences: preferences })))), footer: hasFooterPagination && React.createElement("div", { className: styles['footer-pagination'] }, pagination), disableContentPaddings: true, disableHeaderPaddings: computedVariant === 'full-page', variant: computedVariant === 'container' ? 'cards' : computedVariant, __stickyHeader: stickyHeader, __stickyOffset: stickyHeaderVerticalOffset, __headerRef: headerRef, __darkHeader: computedVariant === 'full-page', __disableFooterDivider: true },
|
|
95
95
|
React.createElement("div", { className: clsx(hasToolsHeader && styles['has-header'], isRefresh && styles.refresh, styles[`header-variant-${computedVariant}`], shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header']) },
|
|
96
96
|
!!renderAriaLive && !!firstIndex && (React.createElement(LiveRegion, null,
|
|
97
|
-
React.createElement("span", null, renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })))), status !== null && status !== void 0 ? status : (React.createElement(CardsList, { items: items, cardDefinition: cardDefinition, trackBy: trackBy, selectionType: selectionType, columns: columns, isItemSelected: isItemSelected, getItemSelectionProps: getItemSelectionProps, visibleSections: visibleSections,
|
|
97
|
+
React.createElement("span", null, renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })))), status !== null && status !== void 0 ? status : (React.createElement(CardsList, { items: items, cardDefinition: cardDefinition, trackBy: trackBy, selectionType: selectionType, columns: columns, isItemSelected: isItemSelected, getItemSelectionProps: getItemSelectionProps, visibleSections: visibleSections, onFocus: onCardFocus, ariaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.cardsLabel, ariaLabelledby: isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined, entireCardClickable: entireCardClickable }))))))));
|
|
98
98
|
});
|
|
99
99
|
export default Cards;
|
|
100
|
-
const CardsList = ({ items, cardDefinition, trackBy, selectionType, columns, isItemSelected, getItemSelectionProps, visibleSections,
|
|
100
|
+
const CardsList = ({ items, cardDefinition, trackBy, selectionType, columns, isItemSelected, getItemSelectionProps, visibleSections, onFocus, ariaLabelledby, ariaLabel, entireCardClickable, }) => {
|
|
101
101
|
const selectable = !!selectionType;
|
|
102
102
|
const canClickEntireCard = selectable && entireCardClickable;
|
|
103
103
|
const isRefresh = useVisualRefresh();
|
|
@@ -119,15 +119,15 @@ const CardsList = ({ items, cardDefinition, trackBy, selectionType, columns, isI
|
|
|
119
119
|
React.createElement("div", { className: clsx(styles['card-inner'], isRefresh && styles.refresh), onClick: canClickEntireCard
|
|
120
120
|
? event => {
|
|
121
121
|
var _a;
|
|
122
|
-
getItemSelectionProps(item).onChange();
|
|
122
|
+
getItemSelectionProps === null || getItemSelectionProps === void 0 ? void 0 : getItemSelectionProps(item).onChange();
|
|
123
123
|
// Manually move focus to the native input (checkbox or radio button)
|
|
124
124
|
(_a = event.currentTarget.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
|
125
125
|
}
|
|
126
126
|
: undefined },
|
|
127
127
|
React.createElement("div", { className: styles['card-header'] },
|
|
128
128
|
React.createElement("div", { className: styles['card-header-inner'] }, cardDefinition.header ? cardDefinition.header(item) : ''),
|
|
129
|
-
|
|
130
|
-
React.createElement(SelectionControl, Object.assign({ onFocusDown: moveFocusDown, onFocusUp: moveFocusUp
|
|
129
|
+
getItemSelectionProps && (React.createElement("div", { className: styles['selection-control'] },
|
|
130
|
+
React.createElement(SelectionControl, Object.assign({ onFocusDown: moveFocusDown, onFocusUp: moveFocusUp }, getItemSelectionProps(item)))))),
|
|
131
131
|
visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (React.createElement("div", { key: id || index, className: styles.section, style: { width: `${width}%` } },
|
|
132
132
|
header ? React.createElement("div", { className: styles['section-header'] }, header) : '',
|
|
133
133
|
content ? React.createElement("div", { className: styles['section-content'] }, content(item)) : '')))))))));
|
package/cards/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAqB,WAAW,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3F,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAEhB,YAAY,EACZ,qBAAqB,EACrB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,eAAe,MAAM,2BAA2B,CAAC;AACxD,OAAO,gBAAgB,MAAM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CAAC,gBAAgB,CAAC,IAAG,MAAM,CAAO,CAAC,CAAC,CAAC,EAAE;gBACtE,OAAO,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAAG,OAAO,CAAC,IAAI,CAAC,CAAO,CAAC,CAAC,CAAC,EAAE,CAC5E,CACP,CAAC,CACE,CACH,CACN,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { FocusEventHandler, useCallback, useImperativeHandle, useRef } from 'react';\nimport { CardsForwardRefType, CardsProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { getCardsPerRow } from './cards-layout-helper';\nimport { getBaseProps } from '../internal/base-component';\nimport ToolsHeader from '../table/tools-header';\nimport { getItemKey } from '../table/utils';\nimport {\n SelectionControl,\n SelectionControlProps,\n focusMarkers,\n useSelectionFocusMove,\n useSelection,\n} from '../table/selection';\nimport { InternalContainerAsSubstep } from '../container/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport stickyScrolling from '../table/sticky-scrolling';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport LiveRegion from '../internal/components/live-region';\nimport useMouseDownTarget from '../internal/hooks/use-mouse-down-target';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { supportsStickyPosition } from '../internal/utils/dom';\nimport { useInternalI18n } from '../i18n/context';\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { shouldRemoveHighContrastHeader } from '../internal/utils/content-header-utils';\n\nexport { CardsProps };\n\nconst Cards = React.forwardRef(function <T = any>(\n {\n items = [],\n cardDefinition,\n cardsPerRow = [],\n header,\n filter,\n pagination,\n preferences,\n empty,\n loading,\n loadingText,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n visibleSections,\n stickyHeader,\n stickyHeaderVerticalOffset,\n variant = 'container',\n renderAriaLive,\n firstIndex = 1,\n totalItemsCount,\n entireCardClickable,\n ...rest\n }: CardsProps<T>,\n ref: React.Ref<CardsProps.Ref>\n) {\n const { __internalRootRef } = useBaseComponent('Cards', {\n props: { entireCardClickable, selectionType, stickyHeader, variant },\n });\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n const isMobile = useMobile();\n\n const computedVariant = isRefresh ? variant : 'container';\n\n const headerIdRef = useRef<string | undefined>(undefined);\n const setHeaderRef = useCallback((id: string) => {\n headerIdRef.current = id;\n }, []);\n const isLabelledByHeader = !ariaLabels?.cardsLabel && !!header;\n\n const [columns, measureRef] = useContainerQuery<number>(\n ({ contentBoxWidth }) => getCardsPerRow(contentBoxWidth, cardsPerRow),\n [cardsPerRow]\n );\n const refObject = useRef(null);\n const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);\n const getMouseDownTarget = useMouseDownTarget();\n\n const i18n = useInternalI18n('cards');\n const { isItemSelected, getItemSelectionProps, updateShiftToggle } = useSelection({\n items,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels: {\n itemSelectionLabel: ariaLabels?.itemSelectionLabel,\n selectionGroupLabel: i18n('ariaLabels.selectionGroupLabel', ariaLabels?.selectionGroupLabel),\n },\n });\n const hasToolsHeader = header || filter || pagination || preferences;\n const hasFooterPagination = isMobile && variant === 'full-page' && !!pagination;\n const headerRef = useRef<HTMLDivElement>(null);\n\n const { scrollToTop, scrollToItem } = stickyScrolling(refObject, headerRef);\n stickyHeader = supportsStickyPosition() && !isMobile && stickyHeader;\n const onCardFocus: FocusEventHandler<HTMLElement> = event => {\n // When an element inside card receives focus we want to adjust the scroll.\n // However, that behavior is unwanted when the focus is received as result of a click\n // as it causes the click to never reach the target element.\n if (stickyHeader && !event.currentTarget.contains(getMouseDownTarget())) {\n scrollToItem(event.currentTarget);\n }\n };\n useImperativeHandle(\n ref,\n () => ({\n scrollToTop: () => {\n if (stickyHeader) {\n scrollToTop();\n }\n },\n }),\n [stickyHeader, scrollToTop]\n );\n let status;\n if (loading) {\n status = (\n <div className={styles.loading}>\n <InternalStatusIndicator type=\"loading\">\n <LiveRegion visible={true}>{loadingText}</LiveRegion>\n </InternalStatusIndicator>\n </div>\n );\n } else if (empty && !items.length) {\n status = <div className={styles.empty}>{empty}</div>;\n }\n\n return (\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <AnalyticsFunnelSubStep>\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <InternalContainerAsSubstep\n header={\n hasToolsHeader && (\n <div\n className={clsx(\n styles.header,\n isRefresh && styles['header-refresh'],\n styles[`header-variant-${computedVariant}`],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header']\n )}\n >\n <CollectionLabelContext.Provider value={{ assignId: setHeaderRef }}>\n <ToolsHeader header={header} filter={filter} pagination={pagination} preferences={preferences} />\n </CollectionLabelContext.Provider>\n </div>\n )\n }\n footer={hasFooterPagination && <div className={styles['footer-pagination']}>{pagination}</div>}\n disableContentPaddings={true}\n disableHeaderPaddings={computedVariant === 'full-page'}\n variant={computedVariant === 'container' ? 'cards' : computedVariant}\n __stickyHeader={stickyHeader}\n __stickyOffset={stickyHeaderVerticalOffset}\n __headerRef={headerRef}\n __darkHeader={computedVariant === 'full-page'}\n __disableFooterDivider={true}\n >\n <div\n className={clsx(\n hasToolsHeader && styles['has-header'],\n isRefresh && styles.refresh,\n styles[`header-variant-${computedVariant}`],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header']\n )}\n >\n {!!renderAriaLive && !!firstIndex && (\n <LiveRegion>\n <span>\n {renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })}\n </span>\n </LiveRegion>\n )}\n {status ?? (\n <CardsList\n items={items}\n cardDefinition={cardDefinition}\n trackBy={trackBy}\n selectionType={selectionType}\n columns={columns}\n isItemSelected={isItemSelected}\n getItemSelectionProps={getItemSelectionProps}\n visibleSections={visibleSections}\n updateShiftToggle={updateShiftToggle}\n onFocus={onCardFocus}\n ariaLabel={ariaLabels?.cardsLabel}\n ariaLabelledby={isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined}\n entireCardClickable={entireCardClickable}\n />\n )}\n </div>\n </InternalContainerAsSubstep>\n </div>\n </AnalyticsFunnelSubStep>\n </LinkDefaultVariantContext.Provider>\n );\n}) as CardsForwardRefType;\n\nexport default Cards;\n\nconst CardsList = <T,>({\n items,\n cardDefinition,\n trackBy,\n selectionType,\n columns,\n isItemSelected,\n getItemSelectionProps,\n visibleSections,\n updateShiftToggle,\n onFocus,\n ariaLabelledby,\n ariaLabel,\n entireCardClickable,\n}: Pick<\n CardsProps<T>,\n 'items' | 'cardDefinition' | 'trackBy' | 'selectionType' | 'visibleSections' | 'entireCardClickable'\n> & {\n columns: number | null;\n isItemSelected: (item: T) => boolean;\n getItemSelectionProps: (item: T) => SelectionControlProps;\n updateShiftToggle: (state: boolean) => void;\n onFocus: FocusEventHandler<HTMLElement>;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}) => {\n const selectable = !!selectionType;\n const canClickEntireCard = selectable && entireCardClickable;\n const isRefresh = useVisualRefresh();\n\n const { moveFocusDown, moveFocusUp } = useSelectionFocusMove(selectionType, items.length);\n\n let visibleSectionsDefinition = cardDefinition.sections || [];\n visibleSectionsDefinition = visibleSections\n ? visibleSectionsDefinition.filter(\n (section: CardsProps.SectionDefinition<T>) => section.id && visibleSections.indexOf(section.id) !== -1\n )\n : visibleSectionsDefinition;\n\n let listRole: 'group' | undefined = undefined;\n let listItemRole: 'presentation' | undefined = undefined;\n\n if (selectable) {\n listRole = 'group';\n listItemRole = 'presentation';\n }\n\n return (\n <ol\n className={clsx(styles.list, styles[`list-grid-${columns || 1}`])}\n role={listRole}\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n {...(focusMarkers && focusMarkers.root)}\n >\n {items.map((item, index) => (\n <li\n className={clsx(styles.card, {\n [styles['card-selectable']]: selectable,\n [styles['card-selected']]: selectable && isItemSelected(item),\n })}\n key={getItemKey(trackBy, item, index)}\n onFocus={onFocus}\n {...(focusMarkers && focusMarkers.item)}\n role={listItemRole}\n >\n <div\n className={clsx(styles['card-inner'], isRefresh && styles.refresh)}\n onClick={\n canClickEntireCard\n ? event => {\n getItemSelectionProps(item).onChange();\n // Manually move focus to the native input (checkbox or radio button)\n event.currentTarget.querySelector('input')?.focus();\n }\n : undefined\n }\n >\n <div className={styles['card-header']}>\n <div className={styles['card-header-inner']}>\n {cardDefinition.header ? cardDefinition.header(item) : ''}\n </div>\n {selectable && (\n <div className={styles['selection-control']}>\n <SelectionControl\n onFocusDown={moveFocusDown}\n onFocusUp={moveFocusUp}\n onShiftToggle={updateShiftToggle}\n {...getItemSelectionProps(item)}\n />\n </div>\n )}\n </div>\n {visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (\n <div key={id || index} className={styles.section} style={{ width: `${width}%` }}>\n {header ? <div className={styles['section-header']}>{header}</div> : ''}\n {content ? <div className={styles['section-content']}>{content(item)}</div> : ''}\n </div>\n ))}\n </div>\n </li>\n ))}\n </ol>\n );\n};\n\napplyDisplayName(Cards, 'Cards');\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,K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AAC,CAAC,EAAE,CACrD;gBACL,qBAAqB,IAAI,CACxB,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;oBACzC,oBAAC,gBAAgB,kBACf,WAAW,EAAE,aAAa,EAC1B,SAAS,EAAE,WAAW,IAClB,qBAAqB,CAAC,IAAI,CAAC,EAC/B,CACE,CACP,CACG;YACL,yBAAyB,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9E,6BAAK,GAAG,EAAE,EAAE,IAAI,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE;gBAC5E,MAAM,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAG,MAAM,CAAO,CAAC,CAAC,CAAC,EAAE;gBACtE,OAAO,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAAG,OAAO,CAAC,IAAI,CAAC,CAAO,CAAC,CAAC,CAAC,EAAE,CAC5E,CACP,CAAC,CACE,CACH,CACN,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { FocusEventHandler, useCallback, useImperativeHandle, useRef } from 'react';\nimport { CardsForwardRefType, CardsProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { getCardsPerRow } from './cards-layout-helper';\nimport { getBaseProps } from '../internal/base-component';\nimport ToolsHeader from '../table/tools-header';\nimport { getItemKey } from '../table/utils';\nimport {\n SelectionControl,\n SelectionControlProps,\n focusMarkers,\n useSelectionFocusMove,\n useSelection,\n} from '../table/selection';\nimport { InternalContainerAsSubstep } from '../container/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport stickyScrolling from '../table/sticky-scrolling';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport LiveRegion from '../internal/components/live-region';\nimport useMouseDownTarget from '../internal/hooks/use-mouse-down-target';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { supportsStickyPosition } from '../internal/utils/dom';\nimport { useInternalI18n } from '../i18n/context';\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { shouldRemoveHighContrastHeader } from '../internal/utils/content-header-utils';\n\nexport { CardsProps };\n\nconst Cards = React.forwardRef(function <T = any>(\n {\n items = [],\n cardDefinition,\n cardsPerRow = [],\n header,\n filter,\n pagination,\n preferences,\n empty,\n loading,\n loadingText,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n visibleSections,\n stickyHeader,\n stickyHeaderVerticalOffset,\n variant = 'container',\n renderAriaLive,\n firstIndex = 1,\n totalItemsCount,\n entireCardClickable,\n ...rest\n }: CardsProps<T>,\n ref: React.Ref<CardsProps.Ref>\n) {\n const { __internalRootRef } = useBaseComponent('Cards', {\n props: { entireCardClickable, selectionType, stickyHeader, variant },\n });\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n const isMobile = useMobile();\n\n const computedVariant = isRefresh ? variant : 'container';\n\n const headerIdRef = useRef<string | undefined>(undefined);\n const setHeaderRef = useCallback((id: string) => {\n headerIdRef.current = id;\n }, []);\n const isLabelledByHeader = !ariaLabels?.cardsLabel && !!header;\n\n const [columns, measureRef] = useContainerQuery<number>(\n ({ contentBoxWidth }) => getCardsPerRow(contentBoxWidth, cardsPerRow),\n [cardsPerRow]\n );\n const refObject = useRef(null);\n const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);\n const getMouseDownTarget = useMouseDownTarget();\n\n const i18n = useInternalI18n('cards');\n const { isItemSelected, getItemSelectionProps } = useSelection({\n items,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels: {\n itemSelectionLabel: ariaLabels?.itemSelectionLabel,\n selectionGroupLabel: i18n('ariaLabels.selectionGroupLabel', ariaLabels?.selectionGroupLabel),\n },\n });\n const hasToolsHeader = header || filter || pagination || preferences;\n const hasFooterPagination = isMobile && variant === 'full-page' && !!pagination;\n const headerRef = useRef<HTMLDivElement>(null);\n\n const { scrollToTop, scrollToItem } = stickyScrolling(refObject, headerRef);\n stickyHeader = supportsStickyPosition() && !isMobile && stickyHeader;\n const onCardFocus: FocusEventHandler<HTMLElement> = event => {\n // When an element inside card receives focus we want to adjust the scroll.\n // However, that behavior is unwanted when the focus is received as result of a click\n // as it causes the click to never reach the target element.\n if (stickyHeader && !event.currentTarget.contains(getMouseDownTarget())) {\n scrollToItem(event.currentTarget);\n }\n };\n useImperativeHandle(\n ref,\n () => ({\n scrollToTop: () => {\n if (stickyHeader) {\n scrollToTop();\n }\n },\n }),\n [stickyHeader, scrollToTop]\n );\n let status;\n if (loading) {\n status = (\n <div className={styles.loading}>\n <InternalStatusIndicator type=\"loading\">\n <LiveRegion visible={true}>{loadingText}</LiveRegion>\n </InternalStatusIndicator>\n </div>\n );\n } else if (empty && !items.length) {\n status = <div className={styles.empty}>{empty}</div>;\n }\n\n return (\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <AnalyticsFunnelSubStep>\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <InternalContainerAsSubstep\n header={\n hasToolsHeader && (\n <div\n className={clsx(\n styles.header,\n isRefresh && styles['header-refresh'],\n styles[`header-variant-${computedVariant}`],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header']\n )}\n >\n <CollectionLabelContext.Provider value={{ assignId: setHeaderRef }}>\n <ToolsHeader header={header} filter={filter} pagination={pagination} preferences={preferences} />\n </CollectionLabelContext.Provider>\n </div>\n )\n }\n footer={hasFooterPagination && <div className={styles['footer-pagination']}>{pagination}</div>}\n disableContentPaddings={true}\n disableHeaderPaddings={computedVariant === 'full-page'}\n variant={computedVariant === 'container' ? 'cards' : computedVariant}\n __stickyHeader={stickyHeader}\n __stickyOffset={stickyHeaderVerticalOffset}\n __headerRef={headerRef}\n __darkHeader={computedVariant === 'full-page'}\n __disableFooterDivider={true}\n >\n <div\n className={clsx(\n hasToolsHeader && styles['has-header'],\n isRefresh && styles.refresh,\n styles[`header-variant-${computedVariant}`],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header']\n )}\n >\n {!!renderAriaLive && !!firstIndex && (\n <LiveRegion>\n <span>\n {renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })}\n </span>\n </LiveRegion>\n )}\n {status ?? (\n <CardsList\n items={items}\n cardDefinition={cardDefinition}\n trackBy={trackBy}\n selectionType={selectionType}\n columns={columns}\n isItemSelected={isItemSelected}\n getItemSelectionProps={getItemSelectionProps}\n visibleSections={visibleSections}\n onFocus={onCardFocus}\n ariaLabel={ariaLabels?.cardsLabel}\n ariaLabelledby={isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined}\n entireCardClickable={entireCardClickable}\n />\n )}\n </div>\n </InternalContainerAsSubstep>\n </div>\n </AnalyticsFunnelSubStep>\n </LinkDefaultVariantContext.Provider>\n );\n}) as CardsForwardRefType;\n\nexport default Cards;\n\nconst CardsList = <T,>({\n items,\n cardDefinition,\n trackBy,\n selectionType,\n columns,\n isItemSelected,\n getItemSelectionProps,\n visibleSections,\n onFocus,\n ariaLabelledby,\n ariaLabel,\n entireCardClickable,\n}: Pick<\n CardsProps<T>,\n 'items' | 'cardDefinition' | 'trackBy' | 'selectionType' | 'visibleSections' | 'entireCardClickable'\n> & {\n columns: number | null;\n isItemSelected: (item: T) => boolean;\n getItemSelectionProps?: (item: T) => SelectionControlProps;\n onFocus: FocusEventHandler<HTMLElement>;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}) => {\n const selectable = !!selectionType;\n const canClickEntireCard = selectable && entireCardClickable;\n const isRefresh = useVisualRefresh();\n\n const { moveFocusDown, moveFocusUp } = useSelectionFocusMove(selectionType, items.length);\n\n let visibleSectionsDefinition = cardDefinition.sections || [];\n visibleSectionsDefinition = visibleSections\n ? visibleSectionsDefinition.filter(\n (section: CardsProps.SectionDefinition<T>) => section.id && visibleSections.indexOf(section.id) !== -1\n )\n : visibleSectionsDefinition;\n\n let listRole: 'group' | undefined = undefined;\n let listItemRole: 'presentation' | undefined = undefined;\n\n if (selectable) {\n listRole = 'group';\n listItemRole = 'presentation';\n }\n\n return (\n <ol\n className={clsx(styles.list, styles[`list-grid-${columns || 1}`])}\n role={listRole}\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n {...(focusMarkers && focusMarkers.root)}\n >\n {items.map((item, index) => (\n <li\n className={clsx(styles.card, {\n [styles['card-selectable']]: selectable,\n [styles['card-selected']]: selectable && isItemSelected(item),\n })}\n key={getItemKey(trackBy, item, index)}\n onFocus={onFocus}\n {...(focusMarkers && focusMarkers.item)}\n role={listItemRole}\n >\n <div\n className={clsx(styles['card-inner'], isRefresh && styles.refresh)}\n onClick={\n canClickEntireCard\n ? event => {\n getItemSelectionProps?.(item).onChange();\n // Manually move focus to the native input (checkbox or radio button)\n event.currentTarget.querySelector('input')?.focus();\n }\n : undefined\n }\n >\n <div className={styles['card-header']}>\n <div className={styles['card-header-inner']}>\n {cardDefinition.header ? cardDefinition.header(item) : ''}\n </div>\n {getItemSelectionProps && (\n <div className={styles['selection-control']}>\n <SelectionControl\n onFocusDown={moveFocusDown}\n onFocusUp={moveFocusUp}\n {...getItemSelectionProps(item)}\n />\n </div>\n )}\n </div>\n {visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (\n <div key={id || index} className={styles.section} style={{ width: `${width}%` }}>\n {header ? <div className={styles['section-header']}>{header}</div> : ''}\n {content ? <div className={styles['section-content']}>{content(item)}</div> : ''}\n </div>\n ))}\n </div>\n </li>\n ))}\n </ol>\n );\n};\n\napplyDisplayName(Cards, 'Cards');\n"]}
|
package/cards/interfaces.d.ts
CHANGED
|
@@ -177,8 +177,8 @@ export interface CardsProps<T = any> extends BaseComponentProps {
|
|
|
177
177
|
* Use this function to announce page changes to screen reader users.
|
|
178
178
|
* The function argument takes the following properties:
|
|
179
179
|
* * `firstIndex` (number) - The provided `firstIndex` property which defaults to 1 when not defined.
|
|
180
|
-
* * `totalItemsCount` (optional, number) - The provided `totalItemsCount` property.
|
|
181
180
|
* * `lastIndex` (number) - The index of the last visible item of the table.
|
|
181
|
+
* * `totalItemsCount` (optional, number) - The provided `totalItemsCount` property.
|
|
182
182
|
*/
|
|
183
183
|
renderAriaLive?: (data: CardsProps.LiveAnnouncement) => string;
|
|
184
184
|
/**
|
package/cards/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/cards/interfaces.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface CardsForwardRefType {\n <T>(props: CardsProps<T> & { ref?: React.Ref<CardsProps.Ref> }): JSX.Element;\n}\n\nexport interface CardsProps<T = any> extends BaseComponentProps {\n /**\n * Displayed only when the list of items is empty.\n */\n empty?: React.ReactNode;\n\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Use this slot to add filtering controls to the component.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the component.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the component.\n */\n preferences?: React.ReactNode;\n\n /**\n * Specifies the items that serve as data source for a card.\n *\n * The `cardDefinition` property handles the display of this data.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the cards in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text to display when in loading state.\n */\n loadingText?: string;\n\n /**\n * Defines what to display in each card. It has the following properties:\n * * `header` ((item) => ReactNode) - Responsible for displaying the card header. You receive the current item as an argument.\n * Use `fontSize=\"inherit\"` on [link](/components/link/) components inside card header.\n * * `sections` (array) - Responsible for displaying the card content. Cards can have many sections in their\n * body. Each entry in the array is responsible for displaying a section. An entry has the following properties:\n * * `id`: (string) - A unique identifier for the section. The property is used as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys)\n * source for React rendering, and to match entries in the `visibleSections` property (if it's defined).\n * * `header`: (ReactNode) - Responsible for displaying the section header.\n * * `content`: ((item) => ReactNode) - Responsible for displaying the section content. You receive the current item as an argument.\n * * `width`: (number) - Specifies the width of the card section in percent. Use this to display multiple sections in\n * the same row. The default value is 100%.\n *\n * All of the above properties are optional.\n */\n cardDefinition: CardsProps.CardDefinition<T>;\n /**\n * Determines the number of cards per row for any interval of container width.\n * It's an array whose entries are objects containing the following:\n * - `cards` (number) - Specifies the number of cards per row.\n * - `minWidth` (number) - Specifies the minimum container width (in pixels) for which this configuration object should apply.\n *\n * For example, with this configuration:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 500,\n * cards: 2\n * }, {\n * minWidth: 800,\n * cards: 3\n * }]\n * ```\n *\n * the cards component displays:\n * * 1 card per row when the container width is below 500px.\n * * 2 cards per row when the container width is between 500px and 799px.\n * * 3 cards per row when the container width is 800px or wider.\n *\n * The number of cards per row can't be greater than 20.\n *\n * Default value:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 768,\n * cards: 2\n * }, {\n * minWidth: 992,\n * cards: 3\n * }, {\n * minWidth: 1200,\n * cards: 4\n * }, {\n * minWidth: 1400,\n * cards: 5\n * }, {\n * minWidth: 1920,\n * cards: 6\n * }]\n * ```\n */\n cardsPerRow?: ReadonlyArray<CardsProps.CardsLayout>;\n /**\n * Specifies the property inside items that uniquely identifies them.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used for connecting `items` and `selectedItems` values when they don't reference the same object.\n */\n trackBy?: CardsProps.TrackBy<T>;\n /**\n * Specifies the selection mode. It can be either `single` or `multi`.\n */\n selectionType?: CardsProps.SelectionType;\n /**\n * Specifies the list of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n /**\n * Determines which items are disabled. If an item is disabled, users can't select it.\n */\n isItemDisabled?: CardsProps.IsItemDisabled<T>;\n /**\n * Adds labels to the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Determines the label for an item.\n * * `selectionGroupLabel` (string) - Specifies the label for the group selection control.\n * * `cardsLabel` (string) - Provides alternative text for the cards list.\n * By default the contents of the `header` are used.\n *\n * You can use the first arguments of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The label function for individual\n * items also receives the corresponding `Item` object. You can use the group label to\n * add a meaningful description to the whole selection.\n * @i18n\n */\n ariaLabels?: CardsProps.AriaLabels<T>;\n /**\n * Specifies an array containing the `id` of each visible section. If not set, all sections are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of `id`s doesn't influence the order of display of sections, which is controlled by the `cardDefinition` property.\n */\n visibleSections?: ReadonlyArray<string>;\n /**\n * Called when a user interaction causes a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<CardsProps.SelectionChangeDetail<T>>;\n /**\n * If set to true, the cards header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n /**\n * Optionally provide a vertical offset (in pixels) for the sticky header, for example if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Use this property to inform screen readers how many cards there are.\n * It specifies the total number of cards.\n * If there is an unknown total number of cards, leave this property undefined.\n */\n totalItemsCount?: number;\n /**\n * Use this property to inform screen readers which range of cards is currently displayed.\n * It specifies the index (1-based) of the first card.\n */\n firstIndex?: number;\n /**\n * Use this function to announce page changes to screen reader users.\n * The function argument takes the following properties:\n * * `firstIndex` (number) - The provided `firstIndex` property which defaults to 1 when not defined.\n * * `totalItemsCount` (optional, number) - The provided `totalItemsCount` property.\n * * `lastIndex` (number) - The index of the last visible item of the table.\n */\n renderAriaLive?: (data: CardsProps.LiveAnnouncement) => string;\n\n /**\n * Specify a cards variant with one of the following:\n * * `container` - Use this variant to have the cards displayed as a container.\n * * `full-page` – Use this variant when cards are the entire content of a page. Full page variants\n * implement the high contrast header and content behavior automatically.\n * @visualrefresh `full-page` variant\n */\n variant?: 'container' | 'full-page';\n\n /**\n * Activating this property makes the entire card clickable to select it.\n * Don't use this property if the card has any other interactive elements.\n */\n entireCardClickable?: boolean;\n}\n\nexport namespace CardsProps {\n export interface CardDefinition<T> {\n header?(item: T): React.ReactNode;\n sections?: ReadonlyArray<SectionDefinition<T>>;\n }\n\n export interface SectionDefinition<T> {\n id?: string;\n header?: React.ReactNode;\n content?(item: T): React.ReactNode;\n width?: number;\n }\n\n export interface CardsLayout {\n cards: number;\n minWidth?: number;\n }\n\n export type TrackBy<T> = string | ((item: T) => string);\n\n export type SelectionType = 'single' | 'multi';\n\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n\n export type IsItemDisabled<T> = (item: T) => boolean;\n\n export interface AriaLabels<T> {\n itemSelectionLabel: (data: CardsProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel: string;\n cardsLabel?: string;\n }\n\n export interface LiveAnnouncement {\n firstIndex: number;\n lastIndex: number;\n totalItemsCount?: number;\n }\n\n export interface Ref {\n /**\n * When the sticky header is enabled, calling this function scrolls cards's\n * scroll parent up to reveal the first card or row of cards.\n */\n scrollToTop(): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/cards/interfaces.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface CardsForwardRefType {\n <T>(props: CardsProps<T> & { ref?: React.Ref<CardsProps.Ref> }): JSX.Element;\n}\n\nexport interface CardsProps<T = any> extends BaseComponentProps {\n /**\n * Displayed only when the list of items is empty.\n */\n empty?: React.ReactNode;\n\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Use this slot to add filtering controls to the component.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the component.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the component.\n */\n preferences?: React.ReactNode;\n\n /**\n * Specifies the items that serve as data source for a card.\n *\n * The `cardDefinition` property handles the display of this data.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the cards in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text to display when in loading state.\n */\n loadingText?: string;\n\n /**\n * Defines what to display in each card. It has the following properties:\n * * `header` ((item) => ReactNode) - Responsible for displaying the card header. You receive the current item as an argument.\n * Use `fontSize=\"inherit\"` on [link](/components/link/) components inside card header.\n * * `sections` (array) - Responsible for displaying the card content. Cards can have many sections in their\n * body. Each entry in the array is responsible for displaying a section. An entry has the following properties:\n * * `id`: (string) - A unique identifier for the section. The property is used as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys)\n * source for React rendering, and to match entries in the `visibleSections` property (if it's defined).\n * * `header`: (ReactNode) - Responsible for displaying the section header.\n * * `content`: ((item) => ReactNode) - Responsible for displaying the section content. You receive the current item as an argument.\n * * `width`: (number) - Specifies the width of the card section in percent. Use this to display multiple sections in\n * the same row. The default value is 100%.\n *\n * All of the above properties are optional.\n */\n cardDefinition: CardsProps.CardDefinition<T>;\n /**\n * Determines the number of cards per row for any interval of container width.\n * It's an array whose entries are objects containing the following:\n * - `cards` (number) - Specifies the number of cards per row.\n * - `minWidth` (number) - Specifies the minimum container width (in pixels) for which this configuration object should apply.\n *\n * For example, with this configuration:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 500,\n * cards: 2\n * }, {\n * minWidth: 800,\n * cards: 3\n * }]\n * ```\n *\n * the cards component displays:\n * * 1 card per row when the container width is below 500px.\n * * 2 cards per row when the container width is between 500px and 799px.\n * * 3 cards per row when the container width is 800px or wider.\n *\n * The number of cards per row can't be greater than 20.\n *\n * Default value:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 768,\n * cards: 2\n * }, {\n * minWidth: 992,\n * cards: 3\n * }, {\n * minWidth: 1200,\n * cards: 4\n * }, {\n * minWidth: 1400,\n * cards: 5\n * }, {\n * minWidth: 1920,\n * cards: 6\n * }]\n * ```\n */\n cardsPerRow?: ReadonlyArray<CardsProps.CardsLayout>;\n /**\n * Specifies the property inside items that uniquely identifies them.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used for connecting `items` and `selectedItems` values when they don't reference the same object.\n */\n trackBy?: CardsProps.TrackBy<T>;\n /**\n * Specifies the selection mode. It can be either `single` or `multi`.\n */\n selectionType?: CardsProps.SelectionType;\n /**\n * Specifies the list of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n /**\n * Determines which items are disabled. If an item is disabled, users can't select it.\n */\n isItemDisabled?: CardsProps.IsItemDisabled<T>;\n /**\n * Adds labels to the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Determines the label for an item.\n * * `selectionGroupLabel` (string) - Specifies the label for the group selection control.\n * * `cardsLabel` (string) - Provides alternative text for the cards list.\n * By default the contents of the `header` are used.\n *\n * You can use the first arguments of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The label function for individual\n * items also receives the corresponding `Item` object. You can use the group label to\n * add a meaningful description to the whole selection.\n * @i18n\n */\n ariaLabels?: CardsProps.AriaLabels<T>;\n /**\n * Specifies an array containing the `id` of each visible section. If not set, all sections are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of `id`s doesn't influence the order of display of sections, which is controlled by the `cardDefinition` property.\n */\n visibleSections?: ReadonlyArray<string>;\n /**\n * Called when a user interaction causes a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<CardsProps.SelectionChangeDetail<T>>;\n /**\n * If set to true, the cards header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n /**\n * Optionally provide a vertical offset (in pixels) for the sticky header, for example if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Use this property to inform screen readers how many cards there are.\n * It specifies the total number of cards.\n * If there is an unknown total number of cards, leave this property undefined.\n */\n totalItemsCount?: number;\n /**\n * Use this property to inform screen readers which range of cards is currently displayed.\n * It specifies the index (1-based) of the first card.\n */\n firstIndex?: number;\n /**\n * Use this function to announce page changes to screen reader users.\n * The function argument takes the following properties:\n * * `firstIndex` (number) - The provided `firstIndex` property which defaults to 1 when not defined.\n * * `lastIndex` (number) - The index of the last visible item of the table.\n * * `totalItemsCount` (optional, number) - The provided `totalItemsCount` property.\n */\n renderAriaLive?: (data: CardsProps.LiveAnnouncement) => string;\n\n /**\n * Specify a cards variant with one of the following:\n * * `container` - Use this variant to have the cards displayed as a container.\n * * `full-page` – Use this variant when cards are the entire content of a page. Full page variants\n * implement the high contrast header and content behavior automatically.\n * @visualrefresh `full-page` variant\n */\n variant?: 'container' | 'full-page';\n\n /**\n * Activating this property makes the entire card clickable to select it.\n * Don't use this property if the card has any other interactive elements.\n */\n entireCardClickable?: boolean;\n}\n\nexport namespace CardsProps {\n export interface CardDefinition<T> {\n header?(item: T): React.ReactNode;\n sections?: ReadonlyArray<SectionDefinition<T>>;\n }\n\n export interface SectionDefinition<T> {\n id?: string;\n header?: React.ReactNode;\n content?(item: T): React.ReactNode;\n width?: number;\n }\n\n export interface CardsLayout {\n cards: number;\n minWidth?: number;\n }\n\n export type TrackBy<T> = string | ((item: T) => string);\n\n export type SelectionType = 'single' | 'multi';\n\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n\n export type IsItemDisabled<T> = (item: T) => boolean;\n\n export interface AriaLabels<T> {\n itemSelectionLabel: (data: CardsProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel: string;\n cardsLabel?: string;\n }\n\n export interface LiveAnnouncement {\n firstIndex: number;\n lastIndex: number;\n totalItemsCount?: number;\n }\n\n export interface Ref {\n /**\n * When the sticky header is enabled, calling this function scrolls cards's\n * scroll parent up to reveal the first card or row of cards.\n */\n scrollToTop(): void;\n }\n}\n"]}
|
package/form-field/internal.js
CHANGED
|
@@ -110,7 +110,7 @@ export default function InternalFormField(_a) {
|
|
|
110
110
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
111
|
}, [funnelInteractionId, errorText, submissionAttempt, errorCount]);
|
|
112
112
|
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }, analyticsAttributes),
|
|
113
|
-
React.createElement("div", { className: clsx(__hideLabel && styles['visually-hidden']) },
|
|
113
|
+
React.createElement("div", { className: clsx(styles['label-wrapper'], __hideLabel && styles['visually-hidden']) },
|
|
114
114
|
label && (React.createElement("label", { className: styles.label, id: slotIds.label, htmlFor: generatedControlId }, label)),
|
|
115
115
|
React.createElement(InfoLinkLabelContext.Provider, { value: slotIds.label }, !__hideLabel && info && React.createElement("span", { className: styles.info }, info))),
|
|
116
116
|
description && (React.createElement("div", { className: styles.description, id: slotIds.description }, description)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAA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A,cAAc,IAAI,CACjB,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,WAAW,IACpF,cAAc,CACA,CAClB,CACG,CACP,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalGrid from '../grid/internal';\nimport InternalIcon from '../icon/internal';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport styles from './styles.css.js';\nimport { InternalFormFieldProps } from './interfaces';\nimport { joinStrings } from '../internal/utils/strings';\nimport { useInternalI18n } from '../i18n/context';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FIELD_ERROR,\n DATA_ATTR_FIELD_LABEL,\n getFieldSlotSeletor,\n getNameFromSelector,\n getSubStepAllSelector,\n} from '../internal/analytics/selectors';\nimport LiveRegion from '../internal/components/live-region';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n errorIconAriaLabel?: string;\n}\n\ninterface FormFieldWarningProps {\n id?: string;\n children?: React.ReactNode;\n warningIconAriaLabel?: string;\n}\n\nexport function FormFieldError({ id, children, errorIconAriaLabel }: FormFieldErrorProps) {\n const i18n = useInternalI18n('form-field');\n const contentRef = useRef<HTMLDivElement | null>(null);\n const i18nErrorIconAriaLabel = i18n('i18nStrings.errorIconAriaLabel', errorIconAriaLabel);\n\n return (\n <>\n <div id={id} className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div role=\"img\" aria-label={i18nErrorIconAriaLabel} className={styles['error-icon-scale-wrapper']}>\n <InternalIcon name=\"status-negative\" size=\"small\" />\n </div>\n </div>\n <span className={styles.error__message} ref={contentRef}>\n {children}\n </span>\n </div>\n\n <LiveRegion assertive={true} source={[i18nErrorIconAriaLabel, contentRef]} />\n </>\n );\n}\n\nexport function FormFieldWarning({ id, children, warningIconAriaLabel }: FormFieldWarningProps) {\n const i18n = useInternalI18n('form-field');\n const contentRef = useRef<HTMLDivElement | null>(null);\n const i18nWarningIconAriaLabel = i18n('i18nStrings.warningIconAriaLabel', warningIconAriaLabel);\n\n return (\n <>\n <div id={id} className={styles.warning}>\n <div className={styles['warning-icon-shake-wrapper']}>\n <div role=\"img\" aria-label={i18nWarningIconAriaLabel} className={styles['warning-icon-scale-wrapper']}>\n <InternalIcon name=\"status-warning\" size=\"small\" />\n </div>\n </div>\n <span className={styles.warning__message} ref={contentRef}>\n {children}\n </span>\n </div>\n\n <LiveRegion assertive={true} source={[i18nWarningIconAriaLabel, contentRef]} />\n </>\n );\n}\n\nexport function ConstraintText({\n id,\n hasValidationText,\n children,\n}: {\n id?: string;\n hasValidationText: boolean;\n children: React.ReactNode;\n}) {\n return (\n <div id={id} className={clsx(styles.constraint, hasValidationText && styles['constraint-has-validation-text'])}>\n {children}\n </div>\n );\n}\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n i18nStrings,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n warningText,\n __hideLabel,\n __internalRootRef = null,\n __disableGutters = false,\n __analyticsMetadata = undefined,\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const { funnelIdentifier, funnelInteractionId, submissionAttempt, funnelState, errorCount } = useFunnel();\n const { stepIdentifier, stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepErrorContext, subStepIdentifier, subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const showWarning = warningText && !errorText;\n\n if (warningText && errorText) {\n warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');\n }\n\n const slotIds = getSlotIds(\n formFieldId,\n label,\n description,\n constraintText,\n errorText,\n showWarning ? warningText : undefined\n );\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n warning: parentWarning,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n warning: (!!warningText && !errorText) || (!!parentWarning && !parentInvalid),\n };\n\n const analyticsAttributes = {\n [DATA_ATTR_FIELD_LABEL]: slotIds.label ? getFieldSlotSeletor(slotIds.label) : undefined,\n [DATA_ATTR_FIELD_ERROR]: slotIds.error ? getFieldSlotSeletor(slotIds.error) : undefined,\n };\n\n useEffect(() => {\n if (funnelInteractionId && errorText && funnelState.current !== 'complete') {\n const stepName = getNameFromSelector(stepNameSelector);\n const subStepName = getNameFromSelector(subStepNameSelector);\n\n errorCount.current++;\n\n // We don't want to report an error if it is hidden, e.g. inside an Expandable Section.\n const errorIsVisible = (__internalRootRef?.current?.getBoundingClientRect()?.width ?? 0) > 0;\n\n if (errorIsVisible) {\n FunnelMetrics.funnelSubStepError({\n funnelInteractionId,\n funnelIdentifier,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n subStepIdentifier,\n stepNumber,\n stepName,\n stepNameSelector,\n stepIdentifier,\n subStepErrorContext,\n fieldErrorSelector: `${getFieldSlotSeletor(slotIds.error)} .${styles.error__message}`,\n fieldLabelSelector: getFieldSlotSeletor(slotIds.label),\n subStepAllSelector: getSubStepAllSelector(),\n fieldIdentifier: __analyticsMetadata?.instanceIdentifier,\n fieldErrorContext: __analyticsMetadata?.errorContext,\n });\n }\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n errorCount.current--;\n };\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [funnelInteractionId, errorText, submissionAttempt, errorCount]);\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={__internalRootRef}\n {...analyticsAttributes}\n >\n <div className={clsx(__hideLabel && styles['visually-hidden'])}>\n {label && (\n <label className={styles.label} id={slotIds.label} htmlFor={generatedControlId}>\n {label}\n </label>\n )}\n <InfoLinkLabelContext.Provider value={slotIds.label}>\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition} disableGutters={__disableGutters}>\n <FormFieldContext.Provider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldContext.Provider>\n\n {secondaryControl && (\n <FormFieldContext.Provider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldContext.Provider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText || warningText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={slotIds.error} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning id={slotIds.warning} warningIconAriaLabel={i18nStrings?.warningIconAriaLabel}>\n {warningText}\n </FormFieldWarning>\n )}\n {constraintText && (\n <ConstraintText id={slotIds.constraint} hasValidationText={!!errorText || !!warningText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE3E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAEnF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACpG,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AACz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AAc,EAAE,gBAAgB;gBAC5E,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,kBACH,SAAS,EAAE,kBAAkB,IAC1B,6BAA6B,KAGjC,QAAQ,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CACnC;gBAE3B,gBAAgB,IAAI,CACnB,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,6BAA6B;oBAC7D,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAG,gBAAgB,CAAO,CAC3C,CAC7B,CACY,CACX;QAEL,CAAC,cAAc,IAAI,SAAS,IAAI,WAAW,CAAC,IAAI,CAC/C,6BAAK,SAAS,EAAE,MAAM,CAAC,KAAK;YACzB,SAAS,IAAI,CACZ,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,IACnF,SAAS,CACK,CAClB;YACA,WAAW,IAAI,CACd,oBAAC,gBAAgB,IAAC,EAAE,EAAE,OAAO,CAAC,OAAO,EAAE,oBAAoB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,IAC3F,WAAW,CACK,CACpB;YACA,cAAc,IAAI,CACjB,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,WAAW,IACpF,cAAc,CACA,CAClB,CACG,CACP,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalGrid from '../grid/internal';\nimport InternalIcon from '../icon/internal';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport styles from './styles.css.js';\nimport { InternalFormFieldProps } from './interfaces';\nimport { joinStrings } from '../internal/utils/strings';\nimport { useInternalI18n } from '../i18n/context';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FIELD_ERROR,\n DATA_ATTR_FIELD_LABEL,\n getFieldSlotSeletor,\n getNameFromSelector,\n getSubStepAllSelector,\n} from '../internal/analytics/selectors';\nimport LiveRegion from '../internal/components/live-region';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n errorIconAriaLabel?: string;\n}\n\ninterface FormFieldWarningProps {\n id?: string;\n children?: React.ReactNode;\n warningIconAriaLabel?: string;\n}\n\nexport function FormFieldError({ id, children, errorIconAriaLabel }: FormFieldErrorProps) {\n const i18n = useInternalI18n('form-field');\n const contentRef = useRef<HTMLDivElement | null>(null);\n const i18nErrorIconAriaLabel = i18n('i18nStrings.errorIconAriaLabel', errorIconAriaLabel);\n\n return (\n <>\n <div id={id} className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div role=\"img\" aria-label={i18nErrorIconAriaLabel} className={styles['error-icon-scale-wrapper']}>\n <InternalIcon name=\"status-negative\" size=\"small\" />\n </div>\n </div>\n <span className={styles.error__message} ref={contentRef}>\n {children}\n </span>\n </div>\n\n <LiveRegion assertive={true} source={[i18nErrorIconAriaLabel, contentRef]} />\n </>\n );\n}\n\nexport function FormFieldWarning({ id, children, warningIconAriaLabel }: FormFieldWarningProps) {\n const i18n = useInternalI18n('form-field');\n const contentRef = useRef<HTMLDivElement | null>(null);\n const i18nWarningIconAriaLabel = i18n('i18nStrings.warningIconAriaLabel', warningIconAriaLabel);\n\n return (\n <>\n <div id={id} className={styles.warning}>\n <div className={styles['warning-icon-shake-wrapper']}>\n <div role=\"img\" aria-label={i18nWarningIconAriaLabel} className={styles['warning-icon-scale-wrapper']}>\n <InternalIcon name=\"status-warning\" size=\"small\" />\n </div>\n </div>\n <span className={styles.warning__message} ref={contentRef}>\n {children}\n </span>\n </div>\n\n <LiveRegion assertive={true} source={[i18nWarningIconAriaLabel, contentRef]} />\n </>\n );\n}\n\nexport function ConstraintText({\n id,\n hasValidationText,\n children,\n}: {\n id?: string;\n hasValidationText: boolean;\n children: React.ReactNode;\n}) {\n return (\n <div id={id} className={clsx(styles.constraint, hasValidationText && styles['constraint-has-validation-text'])}>\n {children}\n </div>\n );\n}\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n i18nStrings,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n warningText,\n __hideLabel,\n __internalRootRef = null,\n __disableGutters = false,\n __analyticsMetadata = undefined,\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const { funnelIdentifier, funnelInteractionId, submissionAttempt, funnelState, errorCount } = useFunnel();\n const { stepIdentifier, stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepErrorContext, subStepIdentifier, subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const showWarning = warningText && !errorText;\n\n if (warningText && errorText) {\n warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');\n }\n\n const slotIds = getSlotIds(\n formFieldId,\n label,\n description,\n constraintText,\n errorText,\n showWarning ? warningText : undefined\n );\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n warning: parentWarning,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n warning: (!!warningText && !errorText) || (!!parentWarning && !parentInvalid),\n };\n\n const analyticsAttributes = {\n [DATA_ATTR_FIELD_LABEL]: slotIds.label ? getFieldSlotSeletor(slotIds.label) : undefined,\n [DATA_ATTR_FIELD_ERROR]: slotIds.error ? getFieldSlotSeletor(slotIds.error) : undefined,\n };\n\n useEffect(() => {\n if (funnelInteractionId && errorText && funnelState.current !== 'complete') {\n const stepName = getNameFromSelector(stepNameSelector);\n const subStepName = getNameFromSelector(subStepNameSelector);\n\n errorCount.current++;\n\n // We don't want to report an error if it is hidden, e.g. inside an Expandable Section.\n const errorIsVisible = (__internalRootRef?.current?.getBoundingClientRect()?.width ?? 0) > 0;\n\n if (errorIsVisible) {\n FunnelMetrics.funnelSubStepError({\n funnelInteractionId,\n funnelIdentifier,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n subStepIdentifier,\n stepNumber,\n stepName,\n stepNameSelector,\n stepIdentifier,\n subStepErrorContext,\n fieldErrorSelector: `${getFieldSlotSeletor(slotIds.error)} .${styles.error__message}`,\n fieldLabelSelector: getFieldSlotSeletor(slotIds.label),\n subStepAllSelector: getSubStepAllSelector(),\n fieldIdentifier: __analyticsMetadata?.instanceIdentifier,\n fieldErrorContext: __analyticsMetadata?.errorContext,\n });\n }\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n errorCount.current--;\n };\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [funnelInteractionId, errorText, submissionAttempt, errorCount]);\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={__internalRootRef}\n {...analyticsAttributes}\n >\n <div className={clsx(styles['label-wrapper'], __hideLabel && styles['visually-hidden'])}>\n {label && (\n <label className={styles.label} id={slotIds.label} htmlFor={generatedControlId}>\n {label}\n </label>\n )}\n <InfoLinkLabelContext.Provider value={slotIds.label}>\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition} disableGutters={__disableGutters}>\n <FormFieldContext.Provider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldContext.Provider>\n\n {secondaryControl && (\n <FormFieldContext.Provider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldContext.Provider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText || warningText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={slotIds.error} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning id={slotIds.warning} warningIconAriaLabel={i18nStrings?.warningIconAriaLabel}>\n {warningText}\n </FormFieldWarning>\n )}\n {constraintText && (\n <ConstraintText id={slotIds.constraint} hasValidationText={!!errorText || !!warningText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
|
package/form-field/styles.css.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
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
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
4
|
+
"error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_3lyk6_103",
|
|
5
|
+
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_3lyk6_104",
|
|
6
|
+
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_3lyk6_1",
|
|
7
|
+
"error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_3lyk6_134",
|
|
8
|
+
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_3lyk6_135",
|
|
9
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_3lyk6_1",
|
|
10
|
+
"warning": "awsui_warning_14mhv_3lyk6_104",
|
|
11
|
+
"error": "awsui_error_14mhv_3lyk6_103",
|
|
12
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_3lyk6_1",
|
|
13
|
+
"root": "awsui_root_14mhv_3lyk6_186",
|
|
14
|
+
"label": "awsui_label_14mhv_3lyk6_222",
|
|
15
|
+
"info": "awsui_info_14mhv_3lyk6_236",
|
|
16
|
+
"description": "awsui_description_14mhv_3lyk6_242",
|
|
17
|
+
"constraint": "awsui_constraint_14mhv_3lyk6_243",
|
|
18
|
+
"hints": "awsui_hints_14mhv_3lyk6_250",
|
|
19
|
+
"constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_3lyk6_251",
|
|
20
|
+
"secondary-control": "awsui_secondary-control_14mhv_3lyk6_255",
|
|
21
|
+
"controls": "awsui_controls_14mhv_3lyk6_259",
|
|
22
|
+
"label-hidden": "awsui_label-hidden_14mhv_3lyk6_259",
|
|
23
|
+
"label-wrapper": "awsui_label-wrapper_14mhv_3lyk6_262",
|
|
24
|
+
"control": "awsui_control_14mhv_3lyk6_259",
|
|
25
|
+
"error__message": "awsui_error__message_14mhv_3lyk6_289",
|
|
26
|
+
"warning__message": "awsui_warning__message_14mhv_3lyk6_290",
|
|
27
|
+
"visually-hidden": "awsui_visually-hidden_14mhv_3lyk6_294"
|
|
27
28
|
};
|
|
28
29
|
|
|
@@ -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_3lyk6_103:not(#\9),
|
|
104
|
+
.awsui_warning-icon-shake-wrapper_14mhv_3lyk6_104:not(#\9) {
|
|
105
|
+
animation: awsui_awsui-motion-shake-horizontally_14mhv_3lyk6_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_3lyk6_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_3lyk6_103:not(#\9),
|
|
122
|
+
.awsui_warning-icon-shake-wrapper_14mhv_3lyk6_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_3lyk6_103:not(#\9), .awsui-mode-entering .awsui_error-icon-shake-wrapper_14mhv_3lyk6_103:not(#\9), .awsui-motion-disabled .awsui_warning-icon-shake-wrapper_14mhv_3lyk6_104:not(#\9), .awsui-mode-entering .awsui_warning-icon-shake-wrapper_14mhv_3lyk6_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_3lyk6_134:not(#\9),
|
|
133
|
+
.awsui_warning-icon-scale-wrapper_14mhv_3lyk6_135:not(#\9) {
|
|
134
|
+
animation: awsui_awsui-motion-scale-popup_14mhv_3lyk6_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_3lyk6_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_3lyk6_134:not(#\9),
|
|
146
|
+
.awsui_warning-icon-scale-wrapper_14mhv_3lyk6_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_3lyk6_134:not(#\9), .awsui-mode-entering .awsui_error-icon-scale-wrapper_14mhv_3lyk6_134:not(#\9), .awsui-motion-disabled .awsui_warning-icon-scale-wrapper_14mhv_3lyk6_135:not(#\9), .awsui-mode-entering .awsui_warning-icon-scale-wrapper_14mhv_3lyk6_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_3lyk6_104:not(#\9),
|
|
157
|
+
.awsui_error_14mhv_3lyk6_103:not(#\9) {
|
|
158
|
+
animation: awsui_awsui-motion-fade-in-0_14mhv_3lyk6_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_3lyk6_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_3lyk6_104:not(#\9),
|
|
170
|
+
.awsui_error_14mhv_3lyk6_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_3lyk6_104:not(#\9), .awsui-mode-entering .awsui_warning_14mhv_3lyk6_104:not(#\9), .awsui-motion-disabled .awsui_error_14mhv_3lyk6_103:not(#\9), .awsui-mode-entering .awsui_error_14mhv_3lyk6_103:not(#\9) {
|
|
176
176
|
animation: none;
|
|
177
177
|
transition: none;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
.
|
|
180
|
+
.awsui_root_14mhv_3lyk6_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_3lyk6_222:not(#\9) {
|
|
218
218
|
box-sizing: border-box;
|
|
219
219
|
color: var(--color-text-form-label-ktbzsd, #000716);
|
|
220
220
|
display: inline;
|
|
@@ -223,44 +223,47 @@ 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_3lyk6_222:not(#\9):only-child {
|
|
227
227
|
margin-block: 0;
|
|
228
228
|
margin-inline: 0;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
.
|
|
231
|
+
.awsui_info_14mhv_3lyk6_236:not(#\9) {
|
|
232
232
|
display: inline-flex;
|
|
233
233
|
padding-inline-start: var(--space-xs-zb16t3, 8px);
|
|
234
234
|
border-inline-start: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-divider-default-j74lyz, #b6bec9);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
.
|
|
238
|
-
.
|
|
237
|
+
.awsui_description_14mhv_3lyk6_242:not(#\9),
|
|
238
|
+
.awsui_constraint_14mhv_3lyk6_243:not(#\9) {
|
|
239
239
|
color: var(--color-text-form-secondary-dxc248, #5f6b7a);
|
|
240
240
|
font-size: var(--font-size-body-s-asqx2i, 12px);
|
|
241
241
|
line-height: var(--line-height-body-s-7zv1j5, 16px);
|
|
242
242
|
letter-spacing: var(--letter-spacing-body-s-z9jkwp, 0.005em);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
.
|
|
246
|
-
.awsui_constraint-has-validation-
|
|
245
|
+
.awsui_hints_14mhv_3lyk6_250:not(#\9),
|
|
246
|
+
.awsui_constraint-has-validation-text_14mhv_3lyk6_251:not(#\9) {
|
|
247
247
|
padding-block-start: var(--space-xxs-p8yyaw, 4px);
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
.awsui_secondary-
|
|
250
|
+
.awsui_secondary-control_14mhv_3lyk6_255:not(#\9) {
|
|
251
251
|
/* used in test-utils */
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
.
|
|
254
|
+
.awsui_controls_14mhv_3lyk6_259:not(#\9):not(.awsui_label-hidden_14mhv_3lyk6_259) {
|
|
255
255
|
padding-block-start: var(--space-xxs-p8yyaw, 4px);
|
|
256
256
|
}
|
|
257
|
+
.awsui_label-wrapper_14mhv_3lyk6_262:not(#\9):empty + .awsui_controls_14mhv_3lyk6_259 {
|
|
258
|
+
padding-block-start: 0;
|
|
259
|
+
}
|
|
257
260
|
|
|
258
|
-
.
|
|
261
|
+
.awsui_control_14mhv_3lyk6_259:not(#\9) {
|
|
259
262
|
min-inline-size: 0;
|
|
260
263
|
word-break: break-word;
|
|
261
264
|
}
|
|
262
265
|
|
|
263
|
-
.
|
|
266
|
+
.awsui_error_14mhv_3lyk6_103:not(#\9) {
|
|
264
267
|
color: var(--color-text-status-error-wdvepn, #d91515);
|
|
265
268
|
font-size: var(--font-size-body-s-asqx2i, 12px);
|
|
266
269
|
line-height: var(--line-height-body-s-7zv1j5, 16px);
|
|
@@ -269,7 +272,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
269
272
|
align-items: flex-start;
|
|
270
273
|
}
|
|
271
274
|
|
|
272
|
-
.
|
|
275
|
+
.awsui_warning_14mhv_3lyk6_104:not(#\9) {
|
|
273
276
|
color: var(--color-text-status-warning-yik8vi, #8d6605);
|
|
274
277
|
font-size: var(--font-size-body-s-asqx2i, 12px);
|
|
275
278
|
line-height: var(--line-height-body-s-7zv1j5, 16px);
|
|
@@ -278,12 +281,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
278
281
|
align-items: flex-start;
|
|
279
282
|
}
|
|
280
283
|
|
|
281
|
-
.
|
|
282
|
-
.
|
|
284
|
+
.awsui_error__message_14mhv_3lyk6_289:not(#\9),
|
|
285
|
+
.awsui_warning__message_14mhv_3lyk6_290:not(#\9) {
|
|
283
286
|
margin-inline-start: var(--space-xxs-p8yyaw, 4px);
|
|
284
287
|
}
|
|
285
288
|
|
|
286
|
-
.awsui_visually-
|
|
289
|
+
.awsui_visually-hidden_14mhv_3lyk6_294:not(#\9) {
|
|
287
290
|
position: absolute !important;
|
|
288
291
|
inset-block-start: -9999px !important;
|
|
289
292
|
inset-inline-start: -9999px !important;
|