@cloudscape-design/components-themeable 3.0.1391 → 3.0.1392
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/box/visual-accent.scss +0 -24
- package/lib/internal/scss/button/constants.scss +15 -0
- package/lib/internal/scss/button/styles.scss +21 -1
- package/lib/internal/scss/input/styles.scss +15 -29
- package/lib/internal/scss/internal/components/autosuggest-input/styles.scss +138 -0
- package/lib/internal/scss/internal/components/autosuggest-input/test-classes/styles.scss +19 -0
- package/lib/internal/scss/internal/components/button-trigger/styles.scss +20 -1
- package/lib/internal/scss/internal/components/control-group/styles.scss +39 -15
- package/lib/internal/scss/internal/components/control-group/test-classes/styles.scss +16 -0
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/scss/internal/styles/forms/grouped-control.scss +65 -0
- package/lib/internal/scss/internal/styles/forms/index.scss +1 -0
- package/lib/internal/scss/internal/styles/forms/mixins.scss +41 -43
- package/lib/internal/scss/internal/styles/utils/mixins.scss +10 -0
- package/lib/internal/template/autosuggest/i18n-utils.d.ts +12 -0
- package/lib/internal/template/autosuggest/i18n-utils.d.ts.map +1 -0
- package/lib/internal/template/autosuggest/i18n-utils.js +15 -0
- package/lib/internal/template/autosuggest/i18n-utils.js.map +1 -0
- package/lib/internal/template/autosuggest/index.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/index.js +3 -0
- package/lib/internal/template/autosuggest/index.js.map +1 -1
- package/lib/internal/template/autosuggest/interfaces.d.ts +94 -1
- package/lib/internal/template/autosuggest/interfaces.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/interfaces.js.map +1 -1
- package/lib/internal/template/autosuggest/internal.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/internal.js +21 -12
- package/lib/internal/template/autosuggest/internal.js.map +1 -1
- package/lib/internal/template/autosuggest/options-controller.d.ts +2 -1
- package/lib/internal/template/autosuggest/options-controller.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/options-controller.js +3 -6
- package/lib/internal/template/autosuggest/options-controller.js.map +1 -1
- package/lib/internal/template/box/interfaces.d.ts +4 -1
- package/lib/internal/template/box/interfaces.d.ts.map +1 -1
- package/lib/internal/template/box/interfaces.js.map +1 -1
- package/lib/internal/template/box/styles.css.js +214 -220
- package/lib/internal/template/box/styles.scoped.css +259 -289
- package/lib/internal/template/box/styles.selectors.js +214 -220
- package/lib/internal/template/button/internal.d.ts +2 -2
- package/lib/internal/template/button/internal.d.ts.map +1 -1
- package/lib/internal/template/button/internal.js +9 -1
- package/lib/internal/template/button/internal.js.map +1 -1
- package/lib/internal/template/button/styles.css.js +24 -23
- package/lib/internal/template/button/styles.scoped.css +116 -70
- package/lib/internal/template/button/styles.selectors.js +24 -23
- package/lib/internal/template/button-dropdown/filter.d.ts +1 -1
- package/lib/internal/template/button-dropdown/filter.d.ts.map +1 -1
- package/lib/internal/template/i18n/messages/all.all.js +1 -1
- package/lib/internal/template/i18n/messages/all.all.json +1 -1
- package/lib/internal/template/i18n/messages/all.de.js +1 -1
- package/lib/internal/template/i18n/messages/all.de.json +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.js +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.json +1 -1
- package/lib/internal/template/i18n/messages/all.en.js +1 -1
- package/lib/internal/template/i18n/messages/all.en.json +1 -1
- package/lib/internal/template/i18n/messages/all.es.js +1 -1
- package/lib/internal/template/i18n/messages/all.es.json +1 -1
- package/lib/internal/template/i18n/messages/all.fr.js +1 -1
- package/lib/internal/template/i18n/messages/all.fr.json +1 -1
- package/lib/internal/template/i18n/messages/all.id.js +1 -1
- package/lib/internal/template/i18n/messages/all.id.json +1 -1
- package/lib/internal/template/i18n/messages/all.it.js +1 -1
- package/lib/internal/template/i18n/messages/all.it.json +1 -1
- package/lib/internal/template/i18n/messages/all.ja.js +1 -1
- package/lib/internal/template/i18n/messages/all.ja.json +1 -1
- package/lib/internal/template/i18n/messages/all.ko.js +1 -1
- package/lib/internal/template/i18n/messages/all.ko.json +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.js +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.json +1 -1
- package/lib/internal/template/i18n/messages/all.tr.js +1 -1
- package/lib/internal/template/i18n/messages/all.tr.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.json +1 -1
- package/lib/internal/template/i18n/messages-types.d.ts +13 -0
- package/lib/internal/template/i18n/messages-types.d.ts.map +1 -1
- package/lib/internal/template/i18n/messages-types.js.map +1 -1
- package/lib/internal/template/input/internal.d.ts +1 -0
- package/lib/internal/template/input/internal.d.ts.map +1 -1
- package/lib/internal/template/input/internal.js +2 -2
- package/lib/internal/template/input/internal.js.map +1 -1
- package/lib/internal/template/input/styles.css.js +38 -36
- package/lib/internal/template/input/styles.scoped.css +89 -76
- package/lib/internal/template/input/styles.selectors.js +38 -36
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/base-theme/styles.scoped.css +0 -61
- package/lib/internal/template/internal/components/autosuggest-input/index.d.ts +5 -0
- package/lib/internal/template/internal/components/autosuggest-input/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/autosuggest-input/index.js +154 -11
- package/lib/internal/template/internal/components/autosuggest-input/index.js.map +1 -1
- package/lib/internal/template/internal/components/autosuggest-input/inline-tokens.d.ts +21 -0
- package/lib/internal/template/internal/components/autosuggest-input/inline-tokens.d.ts.map +1 -0
- package/lib/internal/template/internal/components/autosuggest-input/inline-tokens.js +95 -0
- package/lib/internal/template/internal/components/autosuggest-input/inline-tokens.js.map +1 -0
- package/lib/internal/template/internal/components/autosuggest-input/overflow-dropdown.d.ts +16 -0
- package/lib/internal/template/internal/components/autosuggest-input/overflow-dropdown.d.ts.map +1 -0
- package/lib/internal/template/internal/components/autosuggest-input/overflow-dropdown.js +94 -0
- package/lib/internal/template/internal/components/autosuggest-input/overflow-dropdown.js.map +1 -0
- package/lib/internal/template/internal/components/autosuggest-input/styles.css.js +27 -2
- package/lib/internal/template/internal/components/autosuggest-input/styles.scoped.css +195 -2
- package/lib/internal/template/internal/components/autosuggest-input/styles.selectors.js +27 -2
- package/lib/internal/template/internal/components/autosuggest-input/test-classes/styles.css.js +9 -0
- package/lib/internal/template/internal/components/autosuggest-input/test-classes/styles.scoped.css +19 -0
- package/lib/internal/template/internal/components/autosuggest-input/test-classes/styles.selectors.js +10 -0
- package/lib/internal/template/internal/components/autosuggest-input/use-token-overflow.d.ts +21 -0
- package/lib/internal/template/internal/components/autosuggest-input/use-token-overflow.d.ts.map +1 -0
- package/lib/internal/template/internal/components/autosuggest-input/use-token-overflow.js +63 -0
- package/lib/internal/template/internal/components/autosuggest-input/use-token-overflow.js.map +1 -0
- package/lib/internal/template/internal/components/button-trigger/index.d.ts +4 -1
- package/lib/internal/template/internal/components/button-trigger/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/index.js +5 -3
- package/lib/internal/template/internal/components/button-trigger/index.js.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/styles.css.js +23 -21
- package/lib/internal/template/internal/components/button-trigger/styles.scoped.css +79 -36
- package/lib/internal/template/internal/components/button-trigger/styles.selectors.js +23 -21
- package/lib/internal/template/internal/components/control-group/grouped-control-styles.d.ts +1 -1
- package/lib/internal/template/internal/components/control-group/grouped-control-styles.d.ts.map +1 -1
- package/lib/internal/template/internal/components/control-group/grouped-control-styles.js +3 -2
- package/lib/internal/template/internal/components/control-group/grouped-control-styles.js.map +1 -1
- package/lib/internal/template/internal/components/control-group/index.d.ts +3 -9
- package/lib/internal/template/internal/components/control-group/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/control-group/index.js +16 -10
- package/lib/internal/template/internal/components/control-group/index.js.map +1 -1
- package/lib/internal/template/internal/components/control-group/interfaces.d.ts +43 -0
- package/lib/internal/template/internal/components/control-group/interfaces.d.ts.map +1 -0
- package/lib/internal/template/internal/components/control-group/interfaces.js +2 -0
- package/lib/internal/template/internal/components/control-group/interfaces.js.map +1 -0
- package/lib/internal/template/internal/components/control-group/styles.css.js +16 -11
- package/lib/internal/template/internal/components/control-group/styles.scoped.css +34 -14
- package/lib/internal/template/internal/components/control-group/styles.selectors.js +16 -11
- package/lib/internal/template/internal/components/control-group/test-classes/styles.css.js +8 -0
- package/lib/internal/template/internal/components/control-group/test-classes/styles.scoped.css +15 -0
- package/lib/internal/template/internal/components/control-group/test-classes/styles.selectors.js +9 -0
- package/lib/internal/template/internal/context/control-group-context.d.ts +5 -0
- package/lib/internal/template/internal/context/control-group-context.d.ts.map +1 -1
- package/lib/internal/template/internal/context/control-group-context.js +1 -0
- package/lib/internal/template/internal/context/control-group-context.js.map +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/segmented-control/styles.css.js +27 -26
- package/lib/internal/template/segmented-control/styles.scoped.css +51 -47
- package/lib/internal/template/segmented-control/styles.selectors.js +27 -26
- package/lib/internal/template/select/parts/filter.d.ts +1 -1
- package/lib/internal/template/select/parts/filter.d.ts.map +1 -1
- package/lib/internal/template/test-utils/dom/autosuggest/index.d.ts +39 -0
- package/lib/internal/template/test-utils/dom/autosuggest/index.js +68 -16
- package/lib/internal/template/test-utils/dom/autosuggest/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/internal/control-group.d.ts +5 -0
- package/lib/internal/template/test-utils/dom/internal/control-group.js +9 -2
- package/lib/internal/template/test-utils/dom/internal/control-group.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/autosuggest/index.d.ts +53 -0
- package/lib/internal/template/test-utils/selectors/autosuggest/index.js +84 -16
- package/lib/internal/template/test-utils/selectors/autosuggest/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/internal/control-group.d.ts +5 -0
- package/lib/internal/template/test-utils/selectors/internal/control-group.js +9 -2
- package/lib/internal/template/test-utils/selectors/internal/control-group.js.map +1 -1
- package/lib/internal/template/token/dismiss-button.d.ts.map +1 -1
- package/lib/internal/template/token/dismiss-button.js +6 -3
- package/lib/internal/template/token/dismiss-button.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useLayoutEffect, useState } from 'react';
|
|
4
|
+
import { useContainerQuery } from '@cloudscape-design/component-toolkit';
|
|
5
|
+
import styles from './styles.css.js';
|
|
6
|
+
/**
|
|
7
|
+
* Returns how many trailing tokens fit fully next to the input; the rest collapse into the overflow trigger.
|
|
8
|
+
*/
|
|
9
|
+
export function useTokenOverflow({ enabled, tokenCount, tokenContentKey, measureRef, measureTriggerRef, fieldRef, leadingIconRef, inputWrapperRef, layoutKey, }) {
|
|
10
|
+
const [containerWidth, containerRef] = useContainerQuery(entry => entry.borderBoxWidth);
|
|
11
|
+
const [visibleCount, setVisibleCount] = useState(tokenCount);
|
|
12
|
+
useLayoutEffect(() => {
|
|
13
|
+
var _a, _b, _c, _d;
|
|
14
|
+
const field = fieldRef.current;
|
|
15
|
+
const measure = measureRef.current;
|
|
16
|
+
if (!enabled || !field || !measure || !containerWidth) {
|
|
17
|
+
setVisibleCount(tokenCount);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
measure.inert = true;
|
|
21
|
+
const fieldStyle = getComputedStyle(field);
|
|
22
|
+
const paddingInline = parseFloat(fieldStyle.paddingInlineStart) + parseFloat(fieldStyle.paddingInlineEnd);
|
|
23
|
+
const borderInline = (parseFloat(fieldStyle.borderInlineStartWidth) || 0) + (parseFloat(fieldStyle.borderInlineEndWidth) || 0);
|
|
24
|
+
const gap = parseFloat(fieldStyle.columnGap) || 0;
|
|
25
|
+
const contentWidth = containerWidth - paddingInline - borderInline;
|
|
26
|
+
const inputMinWidth = resolveLength(inputWrapperRef.current ? getComputedStyle(inputWrapperRef.current).minInlineSize : '', contentWidth);
|
|
27
|
+
const iconWidth = (_b = (_a = leadingIconRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) !== null && _b !== void 0 ? _b : 0;
|
|
28
|
+
const triggerWidth = (_d = (_c = measureTriggerRef.current) === null || _c === void 0 ? void 0 : _c.offsetWidth) !== null && _d !== void 0 ? _d : 0;
|
|
29
|
+
const tokenWidths = Array.from(measure.querySelectorAll(`.${styles['measurement-token']}`)).map(el => el.offsetWidth);
|
|
30
|
+
const budget = contentWidth - iconWidth - inputMinWidth - 2 * gap;
|
|
31
|
+
const totalWidth = tokenWidths.reduce((sum, width) => sum + width + gap, -gap);
|
|
32
|
+
setVisibleCount(totalWidth <= budget ? tokenWidths.length : countFittingFromEnd(tokenWidths, budget - triggerWidth - gap, gap));
|
|
33
|
+
}, [
|
|
34
|
+
enabled,
|
|
35
|
+
tokenCount,
|
|
36
|
+
tokenContentKey,
|
|
37
|
+
containerWidth,
|
|
38
|
+
layoutKey,
|
|
39
|
+
fieldRef,
|
|
40
|
+
measureRef,
|
|
41
|
+
measureTriggerRef,
|
|
42
|
+
leadingIconRef,
|
|
43
|
+
inputWrapperRef,
|
|
44
|
+
]);
|
|
45
|
+
return { containerRef, visibleCount: Math.min(visibleCount, tokenCount) };
|
|
46
|
+
}
|
|
47
|
+
function countFittingFromEnd(widths, budget, gap) {
|
|
48
|
+
let used = -gap;
|
|
49
|
+
let count = 0;
|
|
50
|
+
for (let i = widths.length - 1; i >= 0 && used + gap + widths[i] <= budget; i--) {
|
|
51
|
+
used += gap + widths[i];
|
|
52
|
+
count++;
|
|
53
|
+
}
|
|
54
|
+
return count;
|
|
55
|
+
}
|
|
56
|
+
function resolveLength(value, base) {
|
|
57
|
+
const number = parseFloat(value);
|
|
58
|
+
if (isNaN(number)) {
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
return value.trim().endsWith('%') ? (base * number) / 100 : number;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=use-token-overflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-token-overflow.js","sourceRoot":"","sources":["../../../../../src/internal/components/autosuggest-input/use-token-overflow.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAmBrC;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,OAAO,EACP,UAAU,EACV,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,SAAS,GACe;IACxB,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACxF,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IAE7D,eAAe,CAAC,GAAG,EAAE;;QACnB,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC;QAC/B,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QACnC,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;YACtD,eAAe,CAAC,UAAU,CAAC,CAAC;YAC5B,OAAO;QACT,CAAC;QACD,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;QAErB,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,aAAa,GAAG,UAAU,CAAC,UAAU,CAAC,kBAAkB,CAAC,GAAG,UAAU,CAAC,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AM,GAAG,YAAY,GAAG,GAAG,EAAE,GAAG,CAAC,CAC/G,CAAC;IACJ,CAAC,EAAE;QACD,OAAO;QACP,UAAU;QACV,eAAe;QACf,cAAc;QACd,SAAS;QACT,QAAQ;QACR,UAAU;QACV,iBAAiB;QACjB,cAAc;QACd,eAAe;KAChB,CAAC,CAAC;IAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,EAAE,CAAC;AAC5E,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAgB,EAAE,MAAc,EAAE,GAAW;IACxE,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC;IAChB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChF,IAAI,IAAI,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,EAAE,CAAC;IACV,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,aAAa,CAAC,KAAa,EAAE,IAAY;IAChD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;AACrE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useLayoutEffect, useState } from 'react';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\n\nimport styles from './styles.css.js';\n\ninterface UseTokenOverflowOptions {\n enabled: boolean;\n tokenCount: number;\n tokenContentKey: string;\n measureRef: React.RefObject<HTMLElement>;\n measureTriggerRef: React.RefObject<HTMLElement>;\n fieldRef: React.RefObject<HTMLElement>;\n leadingIconRef: React.RefObject<HTMLElement>;\n inputWrapperRef: React.RefObject<HTMLElement>;\n layoutKey: string;\n}\n\ninterface UseTokenOverflowResult {\n containerRef: React.Ref<HTMLDivElement>;\n visibleCount: number;\n}\n\n/**\n * Returns how many trailing tokens fit fully next to the input; the rest collapse into the overflow trigger.\n */\nexport function useTokenOverflow({\n enabled,\n tokenCount,\n tokenContentKey,\n measureRef,\n measureTriggerRef,\n fieldRef,\n leadingIconRef,\n inputWrapperRef,\n layoutKey,\n}: UseTokenOverflowOptions): UseTokenOverflowResult {\n const [containerWidth, containerRef] = useContainerQuery(entry => entry.borderBoxWidth);\n const [visibleCount, setVisibleCount] = useState(tokenCount);\n\n useLayoutEffect(() => {\n const field = fieldRef.current;\n const measure = measureRef.current;\n if (!enabled || !field || !measure || !containerWidth) {\n setVisibleCount(tokenCount);\n return;\n }\n measure.inert = true;\n\n const fieldStyle = getComputedStyle(field);\n const paddingInline = parseFloat(fieldStyle.paddingInlineStart) + parseFloat(fieldStyle.paddingInlineEnd);\n const borderInline =\n (parseFloat(fieldStyle.borderInlineStartWidth) || 0) + (parseFloat(fieldStyle.borderInlineEndWidth) || 0);\n const gap = parseFloat(fieldStyle.columnGap) || 0;\n const contentWidth = containerWidth - paddingInline - borderInline;\n const inputMinWidth = resolveLength(\n inputWrapperRef.current ? getComputedStyle(inputWrapperRef.current).minInlineSize : '',\n contentWidth\n );\n const iconWidth = leadingIconRef.current?.offsetWidth ?? 0;\n const triggerWidth = measureTriggerRef.current?.offsetWidth ?? 0;\n const tokenWidths = Array.from(measure.querySelectorAll<HTMLElement>(`.${styles['measurement-token']}`)).map(\n el => el.offsetWidth\n );\n\n const budget = contentWidth - iconWidth - inputMinWidth - 2 * gap;\n const totalWidth = tokenWidths.reduce((sum, width) => sum + width + gap, -gap);\n setVisibleCount(\n totalWidth <= budget ? tokenWidths.length : countFittingFromEnd(tokenWidths, budget - triggerWidth - gap, gap)\n );\n }, [\n enabled,\n tokenCount,\n tokenContentKey,\n containerWidth,\n layoutKey,\n fieldRef,\n measureRef,\n measureTriggerRef,\n leadingIconRef,\n inputWrapperRef,\n ]);\n\n return { containerRef, visibleCount: Math.min(visibleCount, tokenCount) };\n}\n\nfunction countFittingFromEnd(widths: number[], budget: number, gap: number) {\n let used = -gap;\n let count = 0;\n for (let i = widths.length - 1; i >= 0 && used + gap + widths[i] <= budget; i--) {\n used += gap + widths[i];\n count++;\n }\n return count;\n}\n\nfunction resolveLength(value: string, base: number) {\n const number = parseFloat(value);\n if (isNaN(number)) {\n return 0;\n }\n return value.trim().endsWith('%') ? (base * number) / 100 : number;\n}\n"]}
|
|
@@ -12,7 +12,10 @@ export interface ButtonTriggerProps extends BaseComponentProps {
|
|
|
12
12
|
warning?: boolean;
|
|
13
13
|
inFilteringToken?: 'root' | 'nested';
|
|
14
14
|
inlineTokens?: boolean;
|
|
15
|
-
|
|
15
|
+
compact?: boolean;
|
|
16
|
+
tabIndex?: number;
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
ariaHasPopup?: 'true' | 'listbox' | 'dialog' | false;
|
|
16
19
|
ariaControls?: string;
|
|
17
20
|
ariaLabelledby?: string;
|
|
18
21
|
ariaDescribedby?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/button-trigger/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAAE,0BAA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C;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;IAClD,OAAO,CAAC,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;IAChD,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,MAAM,CAAC,EAAE,sBAAsB,CAAC;QAAE,aAAa,EAAE,IAAI,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAChE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mBAAmB,CAAC,EAAE,0BAA0B,CAAC;CAClD;AAkHD,yBAAiB,kBAAkB,CAAC;IAClC,UAAiB,GAAG;QAClB,KAAK,IAAI,IAAI,CAAC;KACf;CACF;;AAED,wBAA+C"}
|
|
@@ -10,17 +10,19 @@ import { fireCancelableEvent, fireKeyboardEvent } from '../../events';
|
|
|
10
10
|
import { getGroupedControlClassNames } from '../control-group/grouped-control-styles';
|
|
11
11
|
import analyticsSelectors from './analytics-metadata/styles.css.js';
|
|
12
12
|
import styles from './styles.css.js';
|
|
13
|
-
const ButtonTrigger = ({ children, pressed, hideCaret = false, disabled = false, readOnly = false, invalid = false, warning = false, inlineTokens, inFilteringToken, ariaHasPopup, ariaLabelledby, ariaDescribedby, ariaControls, onKeyDown, onKeyUp, onMouseDown, onClick, onFocus, onBlur, hasCustomContent = false, autoFocus, groupedControlProps = { position: null, direction: 'horizontal' }, ...restProps }, ref) => {
|
|
13
|
+
const ButtonTrigger = ({ children, pressed, hideCaret = false, disabled = false, readOnly = false, invalid = false, warning = false, inlineTokens, compact, tabIndex, ariaLabel, inFilteringToken, ariaHasPopup, ariaLabelledby, ariaDescribedby, ariaControls, onKeyDown, onKeyUp, onMouseDown, onClick, onFocus, onBlur, hasCustomContent = false, autoFocus, groupedControlProps = { position: null, direction: 'horizontal' }, ...restProps }, ref) => {
|
|
14
14
|
const baseProps = getBaseProps(restProps);
|
|
15
15
|
let attributes = {
|
|
16
16
|
...baseProps,
|
|
17
17
|
type: 'button',
|
|
18
|
-
className: clsx(styles['button-trigger'], analyticsSelectors['button-trigger'], baseProps.className, pressed && styles.pressed, disabled && styles.disabled, invalid && styles.invalid, warning && !invalid && styles.warning, !hideCaret && styles['has-caret'], readOnly && styles.readonly, inFilteringToken && styles['in-filtering-token'], inFilteringToken && styles[`in-filtering-token-${inFilteringToken}`], inlineTokens && styles['inline-tokens'], ...getGroupedControlClassNames(styles, groupedControlProps), !!hasCustomContent && styles['custom-option']),
|
|
18
|
+
className: clsx(styles['button-trigger'], analyticsSelectors['button-trigger'], baseProps.className, pressed && styles.pressed, disabled && styles.disabled, invalid && styles.invalid, warning && !invalid && styles.warning, !hideCaret && styles['has-caret'], readOnly && styles.readonly, inFilteringToken && styles['in-filtering-token'], inFilteringToken && styles[`in-filtering-token-${inFilteringToken}`], inlineTokens && styles['inline-tokens'], compact && styles.compact, ...getGroupedControlClassNames(styles, groupedControlProps), !!hasCustomContent && styles['custom-option']),
|
|
19
19
|
disabled: disabled,
|
|
20
|
+
tabIndex,
|
|
21
|
+
'aria-label': ariaLabel,
|
|
20
22
|
'aria-expanded': pressed,
|
|
21
23
|
'aria-labelledby': ariaLabelledby,
|
|
22
24
|
'aria-describedby': ariaDescribedby,
|
|
23
|
-
'aria-haspopup': ariaHasPopup !== null && ariaHasPopup !== void 0 ? ariaHasPopup : 'listbox',
|
|
25
|
+
'aria-haspopup': ariaHasPopup === false ? undefined : (ariaHasPopup !== null && ariaHasPopup !== void 0 ? ariaHasPopup : 'listbox'),
|
|
24
26
|
'aria-controls': ariaControls,
|
|
25
27
|
'aria-disabled': readOnly && !disabled ? 'true' : undefined,
|
|
26
28
|
autoFocus,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/button-trigger/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAMtF,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/button-trigger/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACt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All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ButtonHTMLAttributes } from 'react';\nimport clsx from 'clsx';\n\nimport { isThemeActive, Theme } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalIcon from '../../../icon/internal';\nimport { BaseComponentProps } from '../../../types/base-component';\nimport { BaseKeyDetail, CancelableEventHandler } from '../../../types/events';\nimport { getBaseProps } from '../../base-component';\nimport { GroupedControlContextProps } from '../../context/control-group-context';\nimport { fireCancelableEvent, fireKeyboardEvent } from '../../events';\nimport { getGroupedControlClassNames } from '../control-group/grouped-control-styles';\nimport {\n GeneratedAnalyticsMetadataButtonTriggerCollapse,\n GeneratedAnalyticsMetadataButtonTriggerExpand,\n} from './analytics-metadata/interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport interface ButtonTriggerProps extends BaseComponentProps {\n children?: React.ReactNode;\n pressed?: boolean;\n hideCaret?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n warning?: boolean;\n inFilteringToken?: 'root' | 'nested';\n inlineTokens?: boolean;\n compact?: boolean;\n tabIndex?: number;\n ariaLabel?: string;\n ariaHasPopup?: 'true' | 'listbox' | 'dialog' | false;\n ariaControls?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n onKeyDown?: CancelableEventHandler<BaseKeyDetail>;\n onKeyUp?: CancelableEventHandler<BaseKeyDetail>;\n onMouseDown?: CancelableEventHandler;\n onClick?: CancelableEventHandler;\n onFocus?: CancelableEventHandler;\n onBlur?: CancelableEventHandler<{ relatedTarget: Node | null }>;\n hasCustomContent?: boolean;\n autoFocus?: boolean;\n groupedControlProps?: GroupedControlContextProps;\n}\n\nconst ButtonTrigger = (\n {\n children,\n pressed,\n hideCaret = false,\n disabled = false,\n readOnly = false,\n invalid = false,\n warning = false,\n inlineTokens,\n compact,\n tabIndex,\n ariaLabel,\n inFilteringToken,\n ariaHasPopup,\n ariaLabelledby,\n ariaDescribedby,\n ariaControls,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onClick,\n onFocus,\n onBlur,\n hasCustomContent = false,\n autoFocus,\n groupedControlProps = { position: null, direction: 'horizontal' },\n ...restProps\n }: ButtonTriggerProps,\n ref: React.Ref<HTMLButtonElement>\n) => {\n const baseProps = getBaseProps(restProps);\n\n let attributes: ButtonHTMLAttributes<HTMLButtonElement> = {\n ...baseProps,\n type: 'button',\n className: clsx(\n styles['button-trigger'],\n analyticsSelectors['button-trigger'],\n baseProps.className,\n pressed && styles.pressed,\n disabled && styles.disabled,\n invalid && styles.invalid,\n warning && !invalid && styles.warning,\n !hideCaret && styles['has-caret'],\n readOnly && styles.readonly,\n inFilteringToken && styles['in-filtering-token'],\n inFilteringToken && styles[`in-filtering-token-${inFilteringToken}`],\n inlineTokens && styles['inline-tokens'],\n compact && styles.compact,\n ...getGroupedControlClassNames(styles, groupedControlProps),\n !!hasCustomContent && styles['custom-option']\n ),\n disabled: disabled,\n tabIndex,\n 'aria-label': ariaLabel,\n 'aria-expanded': pressed,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-haspopup': ariaHasPopup === false ? undefined : (ariaHasPopup ?? 'listbox'),\n 'aria-controls': ariaControls,\n 'aria-disabled': readOnly && !disabled ? 'true' : undefined,\n autoFocus,\n };\n\n if (!readOnly) {\n attributes = {\n ...attributes,\n onKeyDown: onKeyDown && (event => fireKeyboardEvent(onKeyDown, event)),\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n onMouseDown: onMouseDown && (event => fireCancelableEvent(onMouseDown, {}, event)),\n onClick: onClick && (event => fireCancelableEvent(onClick, {}, event)),\n onFocus: onFocus && (event => fireCancelableEvent(onFocus, {}, event)),\n onBlur: onBlur && (event => fireCancelableEvent(onBlur, { relatedTarget: event.relatedTarget }, event)),\n };\n }\n\n if (invalid) {\n attributes['aria-invalid'] = invalid;\n }\n\n const analyticsMetadata:\n | GeneratedAnalyticsMetadataButtonTriggerExpand\n | GeneratedAnalyticsMetadataButtonTriggerCollapse = {\n action: !pressed ? 'expand' : 'collapse',\n detail: {\n label: { root: 'self' },\n },\n };\n\n return (\n <button\n ref={ref}\n {...attributes}\n data-awsui-motion-trigger=\"hover\"\n {...(disabled || readOnly ? {} : getAnalyticsMetadataAttribute(analyticsMetadata))}\n >\n {children}\n {!hideCaret && (\n <span className={styles.arrow}>\n <InternalIcon\n name={isThemeActive(Theme.OneTheme) ? 'angle-down' : 'caret-down-filled'}\n size={isThemeActive(Theme.OneTheme) ? 'x-small' : 'normal'}\n variant={disabled || readOnly ? 'disabled' : 'normal'}\n nativeAttributes={{ 'data-awsui-motion-target': '' }}\n />\n </span>\n )}\n </button>\n );\n};\n\nexport namespace ButtonTriggerProps {\n export interface Ref {\n focus(): void;\n }\n}\n\nexport default React.forwardRef(ButtonTrigger);\n"]}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"button-trigger": "awsui_button-
|
|
5
|
-
"arrow": "
|
|
6
|
-
"in-filtering-token-root": "awsui_in-filtering-token-
|
|
7
|
-
"in-filtering-token-nested": "awsui_in-filtering-token-
|
|
8
|
-
"has-caret": "awsui_has-
|
|
9
|
-
"placeholder": "
|
|
10
|
-
"pressed": "
|
|
11
|
-
"disabled": "
|
|
12
|
-
"in-filtering-token": "awsui_in-filtering-
|
|
13
|
-
"readonly": "
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"grouped
|
|
20
|
-
"grouped-horizontal-
|
|
21
|
-
"grouped-horizontal-
|
|
22
|
-
"grouped-
|
|
23
|
-
"grouped-vertical-
|
|
24
|
-
"grouped-vertical-
|
|
4
|
+
"button-trigger": "awsui_button-trigger_18eso_1o7cz_17",
|
|
5
|
+
"arrow": "awsui_arrow_18eso_1o7cz_17",
|
|
6
|
+
"in-filtering-token-root": "awsui_in-filtering-token-root_18eso_1o7cz_77",
|
|
7
|
+
"in-filtering-token-nested": "awsui_in-filtering-token-nested_18eso_1o7cz_77",
|
|
8
|
+
"has-caret": "awsui_has-caret_18eso_1o7cz_113",
|
|
9
|
+
"placeholder": "awsui_placeholder_18eso_1o7cz_116",
|
|
10
|
+
"pressed": "awsui_pressed_18eso_1o7cz_129",
|
|
11
|
+
"disabled": "awsui_disabled_18eso_1o7cz_132",
|
|
12
|
+
"in-filtering-token": "awsui_in-filtering-token_18eso_1o7cz_77",
|
|
13
|
+
"readonly": "awsui_readonly_18eso_1o7cz_153",
|
|
14
|
+
"compact": "awsui_compact_18eso_1o7cz_165",
|
|
15
|
+
"invalid": "awsui_invalid_18eso_1o7cz_174",
|
|
16
|
+
"warning": "awsui_warning_18eso_1o7cz_183",
|
|
17
|
+
"custom-option": "awsui_custom-option_18eso_1o7cz_192",
|
|
18
|
+
"inline-tokens": "awsui_inline-tokens_18eso_1o7cz_197",
|
|
19
|
+
"grouped": "awsui_grouped_18eso_1o7cz_239",
|
|
20
|
+
"grouped-horizontal-first": "awsui_grouped-horizontal-first_18eso_1o7cz_245",
|
|
21
|
+
"grouped-horizontal-middle": "awsui_grouped-horizontal-middle_18eso_1o7cz_249",
|
|
22
|
+
"grouped-horizontal-last": "awsui_grouped-horizontal-last_18eso_1o7cz_255",
|
|
23
|
+
"grouped-vertical-first": "awsui_grouped-vertical-first_18eso_1o7cz_259",
|
|
24
|
+
"grouped-vertical-middle": "awsui_grouped-vertical-middle_18eso_1o7cz_263",
|
|
25
|
+
"grouped-vertical-last": "awsui_grouped-vertical-last_18eso_1o7cz_269",
|
|
26
|
+
"grouped-with-action": "awsui_grouped-with-action_18eso_1o7cz_273"
|
|
25
27
|
};
|
|
26
28
|
|
|
@@ -14,21 +14,21 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
14
14
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
15
15
|
SPDX-License-Identifier: Apache-2.0
|
|
16
16
|
*/
|
|
17
|
-
.awsui_button-
|
|
17
|
+
.awsui_button-trigger_18eso_1o7cz_17 > .awsui_arrow_18eso_1o7cz_17:not(#\9) {
|
|
18
18
|
transition: transform var(--motion-duration-rotate-180-69rh8b, 135ms) var(--motion-easing-rotate-180-nmpsiw, cubic-bezier(0.165, 0.84, 0.44, 1));
|
|
19
19
|
}
|
|
20
20
|
@media (prefers-reduced-motion: reduce) {
|
|
21
|
-
.awsui_button-
|
|
21
|
+
.awsui_button-trigger_18eso_1o7cz_17 > .awsui_arrow_18eso_1o7cz_17:not(#\9) {
|
|
22
22
|
animation: none;
|
|
23
23
|
transition: none;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
.awsui-motion-disabled .awsui_button-
|
|
26
|
+
.awsui-motion-disabled .awsui_button-trigger_18eso_1o7cz_17 > .awsui_arrow_18eso_1o7cz_17:not(#\9), .awsui-mode-entering .awsui_button-trigger_18eso_1o7cz_17 > .awsui_arrow_18eso_1o7cz_17:not(#\9) {
|
|
27
27
|
animation: none;
|
|
28
28
|
transition: none;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.awsui_button-
|
|
31
|
+
.awsui_button-trigger_18eso_1o7cz_17:not(#\9) {
|
|
32
32
|
border-collapse: separate;
|
|
33
33
|
border-spacing: 0;
|
|
34
34
|
box-sizing: border-box;
|
|
@@ -74,7 +74,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
74
74
|
border-inline: var(--border-width-field-2365x3, 1px) solid var(--color-border-input-default-jtkw9d, #687078);
|
|
75
75
|
min-block-size: var(--size-vertical-input-5g8cy5, 32px);
|
|
76
76
|
}
|
|
77
|
-
.awsui_button-
|
|
77
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_in-filtering-token-root_18eso_1o7cz_77:not(#\9), .awsui_button-trigger_18eso_1o7cz_17.awsui_in-filtering-token-nested_18eso_1o7cz_77:not(#\9) {
|
|
78
78
|
padding-block: 0px;
|
|
79
79
|
padding-inline: var(--space-field-horizontal-anki5k, 8px);
|
|
80
80
|
border-block-width: var(--border-width-token-p4a0gu, 1px);
|
|
@@ -85,14 +85,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
85
85
|
block-size: 100%;
|
|
86
86
|
min-block-size: unset;
|
|
87
87
|
}
|
|
88
|
-
body[data-awsui-focus-visible=true] .awsui_button-
|
|
88
|
+
body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1o7cz_17.awsui_in-filtering-token-root_18eso_1o7cz_77:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1o7cz_17.awsui_in-filtering-token-nested_18eso_1o7cz_77:not(#\9):focus {
|
|
89
89
|
position: relative;
|
|
90
90
|
}
|
|
91
|
-
body[data-awsui-focus-visible=true] .awsui_button-
|
|
91
|
+
body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1o7cz_17.awsui_in-filtering-token-root_18eso_1o7cz_77:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1o7cz_17.awsui_in-filtering-token-nested_18eso_1o7cz_77:not(#\9):focus {
|
|
92
92
|
outline: 2px dotted transparent;
|
|
93
93
|
outline-offset: calc(var(--space-filtering-token-operation-select-focus-outline-gutter-677p72, 0px) - 1px);
|
|
94
94
|
}
|
|
95
|
-
body[data-awsui-focus-visible=true] .awsui_button-
|
|
95
|
+
body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1o7cz_17.awsui_in-filtering-token-root_18eso_1o7cz_77:not(#\9):focus::before, body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1o7cz_17.awsui_in-filtering-token-nested_18eso_1o7cz_77:not(#\9):focus::before {
|
|
96
96
|
content: " ";
|
|
97
97
|
display: block;
|
|
98
98
|
position: absolute;
|
|
@@ -106,40 +106,40 @@ body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_15t5f_17.awsui_i
|
|
|
106
106
|
border-end-end-radius: var(--border-radius-control-default-focus-ring-akwhsf, 2px);
|
|
107
107
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-sewkzn, #0073bb);
|
|
108
108
|
}
|
|
109
|
-
.awsui_button-
|
|
109
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_in-filtering-token-nested_18eso_1o7cz_77:not(#\9) {
|
|
110
110
|
border-start-start-radius: calc(var(--border-radius-input-k1q34z, 2px) / 2);
|
|
111
111
|
border-end-start-radius: calc(var(--border-radius-input-k1q34z, 2px) / 2);
|
|
112
112
|
}
|
|
113
|
-
.awsui_button-
|
|
113
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_has-caret_18eso_1o7cz_113:not(#\9) {
|
|
114
114
|
padding-inline-end: var(--space-field-icon-offset-2wydv9, 32px);
|
|
115
115
|
}
|
|
116
|
-
.awsui_button-
|
|
116
|
+
.awsui_button-trigger_18eso_1o7cz_17 > .awsui_placeholder_18eso_1o7cz_116:not(#\9) {
|
|
117
117
|
color: var(--color-text-input-placeholder-l6klmg, #687078);
|
|
118
118
|
font-style: italic;
|
|
119
119
|
}
|
|
120
|
-
.awsui_button-
|
|
120
|
+
.awsui_button-trigger_18eso_1o7cz_17 > .awsui_arrow_18eso_1o7cz_17:not(#\9) {
|
|
121
121
|
position: absolute;
|
|
122
122
|
inset-inline-end: var(--space-field-horizontal-anki5k, 8px);
|
|
123
123
|
inset-block-start: calc(50% - var(--line-height-body-m-5xw6xo, 22px) / 2);
|
|
124
124
|
color: var(--color-text-button-inline-icon-default-yujzfi, #545b64);
|
|
125
125
|
}
|
|
126
|
-
.awsui_button-
|
|
126
|
+
.awsui_button-trigger_18eso_1o7cz_17:not(#\9):hover > .awsui_arrow_18eso_1o7cz_17 {
|
|
127
127
|
color: var(--color-text-button-inline-icon-hover-kxgkw7, #16191f);
|
|
128
128
|
}
|
|
129
|
-
.awsui_button-
|
|
129
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_pressed_18eso_1o7cz_129 > .awsui_arrow_18eso_1o7cz_17:not(#\9) {
|
|
130
130
|
transform: rotate(-180deg);
|
|
131
131
|
}
|
|
132
|
-
.awsui_button-
|
|
132
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_disabled_18eso_1o7cz_132:not(#\9) {
|
|
133
133
|
background-color: var(--color-background-input-disabled-pyvhb1, #eaeded);
|
|
134
134
|
border-block: var(--border-width-field-2365x3, 1px) solid var(--color-border-input-disabled-5m31k6, #eaeded);
|
|
135
135
|
border-inline: var(--border-width-field-2365x3, 1px) solid var(--color-border-input-disabled-5m31k6, #eaeded);
|
|
136
136
|
color: var(--color-text-input-disabled-s4k7tb, #879596);
|
|
137
137
|
cursor: auto;
|
|
138
138
|
}
|
|
139
|
-
.awsui_button-
|
|
139
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_disabled_18eso_1o7cz_132 > .awsui_arrow_18eso_1o7cz_17:not(#\9) {
|
|
140
140
|
color: var(--color-text-button-inline-icon-disabled-yeab6p, #aab7b8);
|
|
141
141
|
}
|
|
142
|
-
.awsui_button-
|
|
142
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_disabled_18eso_1o7cz_132.awsui_in-filtering-token_18eso_1o7cz_77:not(#\9) {
|
|
143
143
|
background-color: var(--color-background-input-disabled-pyvhb1, #eaeded);
|
|
144
144
|
border-block: var(--border-width-token-p4a0gu, 1px) solid var(--color-border-input-disabled-5m31k6, #eaeded);
|
|
145
145
|
border-inline: var(--border-width-token-p4a0gu, 1px) solid var(--color-border-input-disabled-5m31k6, #eaeded);
|
|
@@ -147,88 +147,131 @@ body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_15t5f_17.awsui_i
|
|
|
147
147
|
cursor: auto;
|
|
148
148
|
border-color: var(--color-border-control-disabled-dh8zaw, #d5dbdb);
|
|
149
149
|
}
|
|
150
|
-
.awsui_button-
|
|
150
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_disabled_18eso_1o7cz_132 > .awsui_placeholder_18eso_1o7cz_116:not(#\9) {
|
|
151
151
|
color: var(--color-text-input-placeholder-disabled-8cf69l, #687078);
|
|
152
152
|
}
|
|
153
|
-
.awsui_button-
|
|
153
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_readonly_18eso_1o7cz_153:not(#\9):not(.awsui_button-trigger_18eso_1o7cz_17.awsui_disabled_18eso_1o7cz_132):not(.awsui_button-trigger_18eso_1o7cz_17.awsui_in-filtering-token_18eso_1o7cz_77) {
|
|
154
154
|
background-color: var(--color-background-input-default-1u0v1p, #ffffff);
|
|
155
155
|
border-block: var(--border-width-field-2365x3, 1px) solid var(--color-border-input-disabled-5m31k6, #eaeded);
|
|
156
156
|
border-inline: var(--border-width-field-2365x3, 1px) solid var(--color-border-input-disabled-5m31k6, #eaeded);
|
|
157
157
|
}
|
|
158
|
-
.awsui_button-
|
|
158
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_readonly_18eso_1o7cz_153:not(#\9):not(.awsui_button-trigger_18eso_1o7cz_17.awsui_disabled_18eso_1o7cz_132) {
|
|
159
159
|
-webkit-user-select: text;
|
|
160
160
|
user-select: text;
|
|
161
161
|
}
|
|
162
|
-
.awsui_button-
|
|
162
|
+
.awsui_button-trigger_18eso_1o7cz_17:not(#\9):focus {
|
|
163
163
|
outline: none;
|
|
164
164
|
text-decoration: none;
|
|
165
165
|
}
|
|
166
|
-
body[data-awsui-focus-visible=true] .awsui_button-
|
|
166
|
+
body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1o7cz_17:not(#\9):not(.awsui_in-filtering-token_18eso_1o7cz_77):not(.awsui_compact_18eso_1o7cz_165):focus {
|
|
167
167
|
outline: 2px dotted transparent;
|
|
168
168
|
border-block: var(--border-width-field-2365x3, 1px) solid var(--color-border-input-focused-ppoq5z, #0073bb);
|
|
169
169
|
border-inline: var(--border-width-field-2365x3, 1px) solid var(--color-border-input-focused-ppoq5z, #0073bb);
|
|
170
170
|
box-shadow: 0 0 0 var(--border-control-focus-ring-shadow-spread-iijyo6, 1px) var(--color-border-item-focused-sewkzn, #0073bb);
|
|
171
171
|
}
|
|
172
|
-
.awsui_button-
|
|
172
|
+
.awsui_button-trigger_18eso_1o7cz_17:not(#\9):not(.awsui_in-filtering-token_18eso_1o7cz_77):not(.awsui_compact_18eso_1o7cz_165):invalid {
|
|
173
173
|
box-shadow: none;
|
|
174
174
|
}
|
|
175
|
-
.awsui_button-
|
|
175
|
+
.awsui_button-trigger_18eso_1o7cz_17:not(#\9):not(.awsui_in-filtering-token_18eso_1o7cz_77):not(.awsui_compact_18eso_1o7cz_165).awsui_invalid_18eso_1o7cz_174, .awsui_button-trigger_18eso_1o7cz_17:not(#\9):not(.awsui_in-filtering-token_18eso_1o7cz_77):not(.awsui_compact_18eso_1o7cz_165).awsui_invalid_18eso_1o7cz_174:focus {
|
|
176
176
|
color: var(--color-text-status-error-ri38gt, #d13212);
|
|
177
177
|
border-color: var(--color-text-status-error-ri38gt, #d13212);
|
|
178
178
|
padding-inline-start: calc(var(--space-field-horizontal-anki5k, 8px) - (var(--border-invalid-width-b183os, 4px) - var(--border-width-field-2365x3, 1px)));
|
|
179
179
|
border-inline-start-width: var(--border-invalid-width-b183os, 4px);
|
|
180
180
|
}
|
|
181
|
-
.awsui_button-
|
|
181
|
+
.awsui_button-trigger_18eso_1o7cz_17:not(#\9):not(.awsui_in-filtering-token_18eso_1o7cz_77):not(.awsui_compact_18eso_1o7cz_165).awsui_invalid_18eso_1o7cz_174:focus, .awsui_button-trigger_18eso_1o7cz_17:not(#\9):not(.awsui_in-filtering-token_18eso_1o7cz_77):not(.awsui_compact_18eso_1o7cz_165).awsui_invalid_18eso_1o7cz_174:focus:focus {
|
|
182
182
|
box-shadow: 0 0 0 var(--border-control-invalid-focus-ring-shadow-spread-bl5nmx, 1px) var(--color-border-item-focused-sewkzn, #0073bb);
|
|
183
183
|
}
|
|
184
|
-
.awsui_button-
|
|
184
|
+
.awsui_button-trigger_18eso_1o7cz_17:not(#\9):not(.awsui_in-filtering-token_18eso_1o7cz_77):not(.awsui_compact_18eso_1o7cz_165).awsui_warning_18eso_1o7cz_183, .awsui_button-trigger_18eso_1o7cz_17:not(#\9):not(.awsui_in-filtering-token_18eso_1o7cz_77):not(.awsui_compact_18eso_1o7cz_165).awsui_warning_18eso_1o7cz_183:focus {
|
|
185
185
|
color: var(--color-text-status-warning-fabq6h, #906806);
|
|
186
186
|
border-color: var(--color-text-status-warning-fabq6h, #906806);
|
|
187
187
|
padding-inline-start: calc(var(--space-field-horizontal-anki5k, 8px) - (var(--border-invalid-width-b183os, 4px) - var(--border-width-field-2365x3, 1px)));
|
|
188
188
|
border-inline-start-width: var(--border-invalid-width-b183os, 4px);
|
|
189
189
|
}
|
|
190
|
-
.awsui_button-
|
|
190
|
+
.awsui_button-trigger_18eso_1o7cz_17:not(#\9):not(.awsui_in-filtering-token_18eso_1o7cz_77):not(.awsui_compact_18eso_1o7cz_165).awsui_warning_18eso_1o7cz_183:focus, .awsui_button-trigger_18eso_1o7cz_17:not(#\9):not(.awsui_in-filtering-token_18eso_1o7cz_77):not(.awsui_compact_18eso_1o7cz_165).awsui_warning_18eso_1o7cz_183:focus:focus {
|
|
191
191
|
box-shadow: 0 0 0 var(--border-control-invalid-focus-ring-shadow-spread-bl5nmx, 1px) var(--color-border-item-focused-sewkzn, #0073bb);
|
|
192
192
|
}
|
|
193
|
-
.awsui_button-
|
|
193
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_custom-option_18eso_1o7cz_192:not(#\9) {
|
|
194
194
|
padding-block: 0;
|
|
195
195
|
padding-inline-start: 0;
|
|
196
196
|
overflow: clip;
|
|
197
197
|
}
|
|
198
|
-
.awsui_button-
|
|
198
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_inline-tokens_18eso_1o7cz_197:not(#\9) {
|
|
199
199
|
padding-block: 0;
|
|
200
200
|
}
|
|
201
|
-
.awsui_button-
|
|
201
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_compact_18eso_1o7cz_165:not(#\9) {
|
|
202
|
+
font-size: var(--font-size-body-s-89y7qg, 12px);
|
|
203
|
+
line-height: var(--line-height-body-s-gako33, 16px);
|
|
204
|
+
letter-spacing: var(--letter-spacing-body-s-dzcybc, normal);
|
|
205
|
+
column-gap: var(--space-xxs-3o1yoq, 4px);
|
|
206
|
+
block-size: 20px;
|
|
207
|
+
min-block-size: unset;
|
|
208
|
+
padding-block: 0;
|
|
209
|
+
padding-inline: var(--space-xs-m9b7jf, 8px);
|
|
210
|
+
white-space: nowrap;
|
|
211
|
+
border-start-start-radius: var(--border-radius-token-inline-09715z, 2px);
|
|
212
|
+
border-start-end-radius: var(--border-radius-token-inline-09715z, 2px);
|
|
213
|
+
border-end-start-radius: var(--border-radius-token-inline-09715z, 2px);
|
|
214
|
+
border-end-end-radius: var(--border-radius-token-inline-09715z, 2px);
|
|
215
|
+
}
|
|
216
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_compact_18eso_1o7cz_165 > .awsui_arrow_18eso_1o7cz_17:not(#\9) {
|
|
217
|
+
position: static;
|
|
218
|
+
}
|
|
219
|
+
body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1o7cz_17.awsui_compact_18eso_1o7cz_165:not(#\9):focus {
|
|
220
|
+
position: relative;
|
|
221
|
+
}
|
|
222
|
+
body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1o7cz_17.awsui_compact_18eso_1o7cz_165:not(#\9):focus {
|
|
223
|
+
outline: 2px dotted transparent;
|
|
224
|
+
outline-offset: calc(0px - 1px);
|
|
225
|
+
}
|
|
226
|
+
body[data-awsui-focus-visible=true] .awsui_button-trigger_18eso_1o7cz_17.awsui_compact_18eso_1o7cz_165:not(#\9):focus::before {
|
|
227
|
+
content: " ";
|
|
228
|
+
display: block;
|
|
229
|
+
position: absolute;
|
|
230
|
+
inset-inline-start: calc(-1 * 0px);
|
|
231
|
+
inset-block-start: calc(-1 * 0px);
|
|
232
|
+
inline-size: calc(100% + 0px + 0px);
|
|
233
|
+
block-size: calc(100% + 0px + 0px);
|
|
234
|
+
border-start-start-radius: var(--border-radius-control-default-focus-ring-akwhsf, 2px);
|
|
235
|
+
border-start-end-radius: var(--border-radius-control-default-focus-ring-akwhsf, 2px);
|
|
236
|
+
border-end-start-radius: var(--border-radius-control-default-focus-ring-akwhsf, 2px);
|
|
237
|
+
border-end-end-radius: var(--border-radius-control-default-focus-ring-akwhsf, 2px);
|
|
238
|
+
box-shadow: 0 0 0 2px var(--color-border-item-focused-sewkzn, #0073bb);
|
|
239
|
+
}
|
|
240
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_grouped_18eso_1o7cz_239:not(#\9) {
|
|
202
241
|
border-start-start-radius: var(--border-radius-input-k1q34z, 2px);
|
|
203
242
|
border-start-end-radius: var(--border-radius-input-k1q34z, 2px);
|
|
204
243
|
border-end-start-radius: var(--border-radius-input-k1q34z, 2px);
|
|
205
244
|
border-end-end-radius: var(--border-radius-input-k1q34z, 2px);
|
|
206
245
|
}
|
|
207
|
-
.awsui_button-
|
|
246
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_grouped-horizontal-first_18eso_1o7cz_245:not(#\9) {
|
|
208
247
|
border-start-end-radius: 0;
|
|
209
248
|
border-end-end-radius: 0;
|
|
210
249
|
}
|
|
211
|
-
.awsui_button-
|
|
250
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_grouped-horizontal-middle_18eso_1o7cz_249:not(#\9) {
|
|
212
251
|
border-start-start-radius: 0;
|
|
213
252
|
border-start-end-radius: 0;
|
|
214
253
|
border-end-start-radius: 0;
|
|
215
254
|
border-end-end-radius: 0;
|
|
216
255
|
}
|
|
217
|
-
.awsui_button-
|
|
256
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_grouped-horizontal-last_18eso_1o7cz_255:not(#\9) {
|
|
218
257
|
border-start-start-radius: 0;
|
|
219
258
|
border-end-start-radius: 0;
|
|
220
259
|
}
|
|
221
|
-
.awsui_button-
|
|
260
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_grouped-vertical-first_18eso_1o7cz_259:not(#\9) {
|
|
222
261
|
border-end-start-radius: 0;
|
|
223
262
|
border-end-end-radius: 0;
|
|
224
263
|
}
|
|
225
|
-
.awsui_button-
|
|
264
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_grouped-vertical-middle_18eso_1o7cz_263:not(#\9) {
|
|
226
265
|
border-start-start-radius: 0;
|
|
227
266
|
border-start-end-radius: 0;
|
|
228
267
|
border-end-start-radius: 0;
|
|
229
268
|
border-end-end-radius: 0;
|
|
230
269
|
}
|
|
231
|
-
.awsui_button-
|
|
270
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_grouped-vertical-last_18eso_1o7cz_269:not(#\9) {
|
|
232
271
|
border-start-start-radius: 0;
|
|
233
272
|
border-start-end-radius: 0;
|
|
273
|
+
}
|
|
274
|
+
.awsui_button-trigger_18eso_1o7cz_17.awsui_grouped-with-action_18eso_1o7cz_273:not(#\9) {
|
|
275
|
+
border-start-end-radius: 0;
|
|
276
|
+
border-end-end-radius: 0;
|
|
234
277
|
}
|
|
@@ -2,26 +2,28 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"button-trigger": "awsui_button-
|
|
6
|
-
"arrow": "
|
|
7
|
-
"in-filtering-token-root": "awsui_in-filtering-token-
|
|
8
|
-
"in-filtering-token-nested": "awsui_in-filtering-token-
|
|
9
|
-
"has-caret": "awsui_has-
|
|
10
|
-
"placeholder": "
|
|
11
|
-
"pressed": "
|
|
12
|
-
"disabled": "
|
|
13
|
-
"in-filtering-token": "awsui_in-filtering-
|
|
14
|
-
"readonly": "
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"grouped
|
|
21
|
-
"grouped-horizontal-
|
|
22
|
-
"grouped-horizontal-
|
|
23
|
-
"grouped-
|
|
24
|
-
"grouped-vertical-
|
|
25
|
-
"grouped-vertical-
|
|
5
|
+
"button-trigger": "awsui_button-trigger_18eso_1o7cz_17",
|
|
6
|
+
"arrow": "awsui_arrow_18eso_1o7cz_17",
|
|
7
|
+
"in-filtering-token-root": "awsui_in-filtering-token-root_18eso_1o7cz_77",
|
|
8
|
+
"in-filtering-token-nested": "awsui_in-filtering-token-nested_18eso_1o7cz_77",
|
|
9
|
+
"has-caret": "awsui_has-caret_18eso_1o7cz_113",
|
|
10
|
+
"placeholder": "awsui_placeholder_18eso_1o7cz_116",
|
|
11
|
+
"pressed": "awsui_pressed_18eso_1o7cz_129",
|
|
12
|
+
"disabled": "awsui_disabled_18eso_1o7cz_132",
|
|
13
|
+
"in-filtering-token": "awsui_in-filtering-token_18eso_1o7cz_77",
|
|
14
|
+
"readonly": "awsui_readonly_18eso_1o7cz_153",
|
|
15
|
+
"compact": "awsui_compact_18eso_1o7cz_165",
|
|
16
|
+
"invalid": "awsui_invalid_18eso_1o7cz_174",
|
|
17
|
+
"warning": "awsui_warning_18eso_1o7cz_183",
|
|
18
|
+
"custom-option": "awsui_custom-option_18eso_1o7cz_192",
|
|
19
|
+
"inline-tokens": "awsui_inline-tokens_18eso_1o7cz_197",
|
|
20
|
+
"grouped": "awsui_grouped_18eso_1o7cz_239",
|
|
21
|
+
"grouped-horizontal-first": "awsui_grouped-horizontal-first_18eso_1o7cz_245",
|
|
22
|
+
"grouped-horizontal-middle": "awsui_grouped-horizontal-middle_18eso_1o7cz_249",
|
|
23
|
+
"grouped-horizontal-last": "awsui_grouped-horizontal-last_18eso_1o7cz_255",
|
|
24
|
+
"grouped-vertical-first": "awsui_grouped-vertical-first_18eso_1o7cz_259",
|
|
25
|
+
"grouped-vertical-middle": "awsui_grouped-vertical-middle_18eso_1o7cz_263",
|
|
26
|
+
"grouped-vertical-last": "awsui_grouped-vertical-last_18eso_1o7cz_269",
|
|
27
|
+
"grouped-with-action": "awsui_grouped-with-action_18eso_1o7cz_273"
|
|
26
28
|
};
|
|
27
29
|
|
|
@@ -6,5 +6,5 @@ import { GroupedControlContextProps } from '../../context/control-group-context'
|
|
|
6
6
|
* otherwise the `grouped` base class plus the position/direction modifier.
|
|
7
7
|
* Spread the result into `clsx(...)` at the call site.
|
|
8
8
|
*/
|
|
9
|
-
export declare function getGroupedControlClassNames(styles: Record<string, string>, { position, direction }: GroupedControlContextProps): string[];
|
|
9
|
+
export declare function getGroupedControlClassNames(styles: Record<string, string>, { position, direction, hasAction }: GroupedControlContextProps): string[];
|
|
10
10
|
//# sourceMappingURL=grouped-control-styles.d.ts.map
|
package/lib/internal/template/internal/components/control-group/grouped-control-styles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grouped-control-styles.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/grouped-control-styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"grouped-control-styles.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/grouped-control-styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,0BAA0B,GAC7D,MAAM,EAAE,CAMV"}
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* otherwise the `grouped` base class plus the position/direction modifier.
|
|
6
6
|
* Spread the result into `clsx(...)` at the call site.
|
|
7
7
|
*/
|
|
8
|
-
export function getGroupedControlClassNames(styles, { position, direction }) {
|
|
8
|
+
export function getGroupedControlClassNames(styles, { position, direction, hasAction }) {
|
|
9
9
|
if (!position) {
|
|
10
10
|
return [];
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
const baseClassNames = [styles.grouped, styles[`grouped-${direction}-${position}`]];
|
|
13
|
+
return hasAction ? [...baseClassNames, styles['grouped-with-action']] : baseClassNames;
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=grouped-control-styles.js.map
|
package/lib/internal/template/internal/components/control-group/grouped-control-styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grouped-control-styles.js","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/grouped-control-styles.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAA8B,EAC9B,EAAE,QAAQ,EAAE,SAAS,EAA8B;
|
|
1
|
+
{"version":3,"file":"grouped-control-styles.js","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/grouped-control-styles.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAA8B,EAC9B,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAA8B;IAE9D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,SAAS,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC;IACpF,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,EAAE,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;AACzF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { GroupedControlContextProps } from '../../context/control-group-context';\n\n/**\n * Builds the shared grouped-control CSS classes for a consumer.\n *\n * Returns an empty list when the control is not in a group (falsy `position`),\n * otherwise the `grouped` base class plus the position/direction modifier.\n * Spread the result into `clsx(...)` at the call site.\n */\nexport function getGroupedControlClassNames(\n styles: Record<string, string>,\n { position, direction, hasAction }: GroupedControlContextProps\n): string[] {\n if (!position) {\n return [];\n }\n const baseClassNames = [styles.grouped, styles[`grouped-${direction}-${position}`]];\n return hasAction ? [...baseClassNames, styles['grouped-with-action']] : baseClassNames;\n}\n"]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface InternalControlGroupProps extends BaseComponentProps {
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
direction?: GroupedControlDirection;
|
|
7
|
-
inlineLabelText?: string;
|
|
8
|
-
}
|
|
9
|
-
export default function InternalControlGroup({ children, direction, inlineLabelText, ...props }: InternalControlGroupProps): JSX.Element;
|
|
1
|
+
import { ControlGroupProps } from './interfaces';
|
|
2
|
+
export { ControlGroupProps };
|
|
3
|
+
export default function ControlGroup({ children, direction, inlineLabelText, actionButton, ...props }: ControlGroupProps): JSX.Element;
|
|
10
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/control-group/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAKjD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,QAAQ,EACR,SAAwB,EACxB,eAAe,EACf,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,iBAAiB,eAyEnB"}
|