@cloudscape-design/components-themeable 3.0.1340 → 3.0.1342
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/expandable-section/styles.scss +142 -0
- package/lib/internal/scss/input/styles.scss +228 -37
- package/lib/internal/scss/internal/components/chart-legend/styles.scss +1 -0
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/scss/multiselect/styles.scss +14 -0
- package/lib/internal/scss/pagination/styles.scss +9 -2
- package/lib/internal/scss/pagination/test-classes/styles.scss +8 -0
- package/lib/internal/scss/select/styles.scss +14 -1
- package/lib/internal/scss/side-navigation/styles.scss +62 -24
- package/lib/internal/scss/textarea/styles.scss +21 -2
- 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/button-dropdown/internal.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/internal.js +2 -2
- package/lib/internal/template/button-dropdown/internal.js.map +1 -1
- package/lib/internal/template/button-dropdown/utils/use-button-dropdown.d.ts +1 -0
- package/lib/internal/template/button-dropdown/utils/use-button-dropdown.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/utils/use-button-dropdown.js +9 -0
- package/lib/internal/template/button-dropdown/utils/use-button-dropdown.js.map +1 -1
- package/lib/internal/template/expandable-section/expandable-section-header.d.ts +2 -1
- package/lib/internal/template/expandable-section/expandable-section-header.d.ts.map +1 -1
- package/lib/internal/template/expandable-section/expandable-section-header.js +57 -13
- package/lib/internal/template/expandable-section/expandable-section-header.js.map +1 -1
- package/lib/internal/template/expandable-section/interfaces.d.ts +1 -1
- package/lib/internal/template/expandable-section/interfaces.js.map +1 -1
- package/lib/internal/template/expandable-section/internal.d.ts +14 -1
- package/lib/internal/template/expandable-section/internal.d.ts.map +1 -1
- package/lib/internal/template/expandable-section/internal.js +3 -3
- package/lib/internal/template/expandable-section/internal.js.map +1 -1
- package/lib/internal/template/expandable-section/styles.css.js +42 -35
- package/lib/internal/template/expandable-section/styles.scoped.css +177 -69
- package/lib/internal/template/expandable-section/styles.selectors.js +42 -35
- package/lib/internal/template/i18n/context.d.ts +16 -4
- package/lib/internal/template/i18n/context.d.ts.map +1 -1
- package/lib/internal/template/i18n/context.js +10 -4
- package/lib/internal/template/i18n/context.js.map +1 -1
- package/lib/internal/template/i18n/index.d.ts +2 -0
- package/lib/internal/template/i18n/index.d.ts.map +1 -1
- package/lib/internal/template/i18n/index.js +1 -0
- package/lib/internal/template/i18n/index.js.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.ar.js +1 -1
- package/lib/internal/template/i18n/messages/all.ar.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 +5 -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/index.d.ts.map +1 -1
- package/lib/internal/template/input/index.js +4 -2
- package/lib/internal/template/input/index.js.map +1 -1
- package/lib/internal/template/input/interfaces.d.ts +9 -0
- package/lib/internal/template/input/interfaces.d.ts.map +1 -1
- package/lib/internal/template/input/interfaces.js.map +1 -1
- package/lib/internal/template/input/internal.d.ts +5 -5
- package/lib/internal/template/input/internal.d.ts.map +1 -1
- package/lib/internal/template/input/internal.js +60 -24
- package/lib/internal/template/input/internal.js.map +1 -1
- package/lib/internal/template/input/styles.css.js +28 -18
- package/lib/internal/template/input/styles.scoped.css +213 -52
- package/lib/internal/template/input/styles.selectors.js +28 -18
- package/lib/internal/template/input/utils.js +3 -3
- package/lib/internal/template/input/utils.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +297 -289
- package/lib/internal/template/internal/components/cartesian-chart/styles.css.js +28 -28
- package/lib/internal/template/internal/components/cartesian-chart/styles.scoped.css +35 -35
- package/lib/internal/template/internal/components/cartesian-chart/styles.selectors.js +28 -28
- package/lib/internal/template/internal/components/chart-legend/styles.css.js +6 -6
- package/lib/internal/template/internal/components/chart-legend/styles.scoped.css +16 -14
- package/lib/internal/template/internal/components/chart-legend/styles.selectors.js +6 -6
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/generated/styles/tokens.d.ts +1 -0
- package/lib/internal/template/internal/generated/styles/tokens.js +1 -0
- package/lib/internal/template/internal/generated/theming/index.cjs +31 -0
- package/lib/internal/template/internal/generated/theming/index.js +31 -0
- package/lib/internal/template/multiselect/embedded.d.ts +1 -1
- package/lib/internal/template/multiselect/index.d.ts.map +1 -1
- package/lib/internal/template/multiselect/index.js +4 -0
- package/lib/internal/template/multiselect/index.js.map +1 -1
- package/lib/internal/template/multiselect/interfaces.d.ts +8 -1
- package/lib/internal/template/multiselect/interfaces.d.ts.map +1 -1
- package/lib/internal/template/multiselect/interfaces.js.map +1 -1
- package/lib/internal/template/multiselect/internal.d.ts.map +1 -1
- package/lib/internal/template/multiselect/internal.js +22 -2
- package/lib/internal/template/multiselect/internal.js.map +1 -1
- package/lib/internal/template/multiselect/styles.css.js +5 -3
- package/lib/internal/template/multiselect/styles.scoped.css +13 -3
- package/lib/internal/template/multiselect/styles.selectors.js +5 -3
- package/lib/internal/template/multiselect/use-multiselect.d.ts +3 -2
- package/lib/internal/template/multiselect/use-multiselect.d.ts.map +1 -1
- package/lib/internal/template/multiselect/use-multiselect.js +5 -3
- package/lib/internal/template/multiselect/use-multiselect.js.map +1 -1
- package/lib/internal/template/pagination/index.d.ts.map +1 -1
- package/lib/internal/template/pagination/index.js +3 -3
- package/lib/internal/template/pagination/index.js.map +1 -1
- package/lib/internal/template/pagination/interfaces.d.ts +19 -3
- package/lib/internal/template/pagination/interfaces.d.ts.map +1 -1
- package/lib/internal/template/pagination/interfaces.js.map +1 -1
- package/lib/internal/template/pagination/internal.d.ts.map +1 -1
- package/lib/internal/template/pagination/internal.js +18 -6
- package/lib/internal/template/pagination/internal.js.map +1 -1
- package/lib/internal/template/pagination/styles.css.js +12 -11
- package/lib/internal/template/pagination/styles.scoped.css +34 -25
- package/lib/internal/template/pagination/styles.selectors.js +12 -11
- package/lib/internal/template/pagination/test-classes/styles.css.js +6 -0
- package/lib/internal/template/pagination/test-classes/styles.scoped.css +7 -0
- package/lib/internal/template/pagination/test-classes/styles.selectors.js +7 -0
- package/lib/internal/template/prompt-input/internal.d.ts.map +1 -1
- package/lib/internal/template/prompt-input/internal.js +14 -2
- package/lib/internal/template/prompt-input/internal.js.map +1 -1
- package/lib/internal/template/select/index.d.ts.map +1 -1
- package/lib/internal/template/select/index.js +4 -0
- package/lib/internal/template/select/index.js.map +1 -1
- package/lib/internal/template/select/interfaces.d.ts +39 -0
- package/lib/internal/template/select/interfaces.d.ts.map +1 -1
- package/lib/internal/template/select/interfaces.js.map +1 -1
- package/lib/internal/template/select/internal.d.ts.map +1 -1
- package/lib/internal/template/select/internal.js +20 -4
- package/lib/internal/template/select/internal.js.map +1 -1
- 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/select/styles.css.js +3 -1
- package/lib/internal/template/select/styles.scoped.css +11 -1
- package/lib/internal/template/select/styles.selectors.js +3 -1
- package/lib/internal/template/select/utils/dropdown-customization.d.ts +20 -0
- package/lib/internal/template/select/utils/dropdown-customization.d.ts.map +1 -0
- package/lib/internal/template/select/utils/dropdown-customization.js +22 -0
- package/lib/internal/template/select/utils/dropdown-customization.js.map +1 -0
- package/lib/internal/template/select/utils/use-select.d.ts +4 -1
- package/lib/internal/template/select/utils/use-select.d.ts.map +1 -1
- package/lib/internal/template/select/utils/use-select.js +21 -4
- package/lib/internal/template/select/utils/use-select.js.map +1 -1
- package/lib/internal/template/side-navigation/parts.d.ts.map +1 -1
- package/lib/internal/template/side-navigation/parts.js +3 -2
- package/lib/internal/template/side-navigation/parts.js.map +1 -1
- package/lib/internal/template/side-navigation/styles.css.js +50 -48
- package/lib/internal/template/side-navigation/styles.scoped.css +106 -93
- package/lib/internal/template/side-navigation/styles.selectors.js +50 -48
- package/lib/internal/template/status-indicator/interfaces.d.ts +1 -1
- package/lib/internal/template/status-indicator/interfaces.d.ts.map +1 -1
- package/lib/internal/template/status-indicator/interfaces.js.map +1 -1
- package/lib/internal/template/status-indicator/internal.d.ts +2 -6
- package/lib/internal/template/status-indicator/internal.d.ts.map +1 -1
- package/lib/internal/template/status-indicator/internal.js.map +1 -1
- package/lib/internal/template/steps/interfaces.d.ts +2 -2
- package/lib/internal/template/steps/interfaces.d.ts.map +1 -1
- package/lib/internal/template/steps/interfaces.js.map +1 -1
- package/lib/internal/template/test-utils/dom/input/index.d.ts +2 -0
- package/lib/internal/template/test-utils/dom/input/index.js +6 -0
- package/lib/internal/template/test-utils/dom/input/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/multiselect/index.d.ts +16 -0
- package/lib/internal/template/test-utils/dom/multiselect/index.js +16 -0
- package/lib/internal/template/test-utils/dom/multiselect/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/pagination/index.d.ts +5 -1
- package/lib/internal/template/test-utils/dom/pagination/index.js +7 -0
- package/lib/internal/template/test-utils/dom/pagination/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/select/index.d.ts +16 -0
- package/lib/internal/template/test-utils/dom/select/index.js +16 -0
- package/lib/internal/template/test-utils/dom/select/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/input/index.d.ts +2 -0
- package/lib/internal/template/test-utils/selectors/input/index.js +6 -0
- package/lib/internal/template/test-utils/selectors/input/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/multiselect/index.d.ts +16 -0
- package/lib/internal/template/test-utils/selectors/multiselect/index.js +20 -0
- package/lib/internal/template/test-utils/selectors/multiselect/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/pagination/index.d.ts +5 -1
- package/lib/internal/template/test-utils/selectors/pagination/index.js +7 -0
- package/lib/internal/template/test-utils/selectors/pagination/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/select/index.d.ts +16 -0
- package/lib/internal/template/test-utils/selectors/select/index.js +20 -0
- package/lib/internal/template/test-utils/selectors/select/index.js.map +1 -1
- package/lib/internal/template/textarea/index.d.ts.map +1 -1
- package/lib/internal/template/textarea/index.js +11 -3
- package/lib/internal/template/textarea/index.js.map +1 -1
- package/lib/internal/template/textarea/interfaces.d.ts +12 -0
- package/lib/internal/template/textarea/interfaces.d.ts.map +1 -1
- package/lib/internal/template/textarea/interfaces.js.map +1 -1
- package/lib/internal/template/textarea/styles.css.js +9 -5
- package/lib/internal/template/textarea/styles.scoped.css +26 -14
- package/lib/internal/template/textarea/styles.selectors.js +9 -5
- package/package.json +1 -1
- package/lib/internal/template/status-indicator/internal-interfaces.d.ts +0 -3
- package/lib/internal/template/status-indicator/internal-interfaces.d.ts.map +0 -1
- package/lib/internal/template/status-indicator/internal-interfaces.js +0 -2
- package/lib/internal/template/status-indicator/internal-interfaces.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsD,MAAM,OAAO,CAAC;AAiB3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AASjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAShD,UAAU,wBACR,SAAQ,YAAY,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAAC,EAC3D,0BAA0B;CAAG;AAEjC,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsD,MAAM,OAAO,CAAC;AAiB3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AASjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAShD,UAAU,wBACR,SAAQ,YAAY,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAAC,EAC3D,0BAA0B;CAAG;AAEjC,QAAA,MAAM,mBAAmB,gJA2cxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -73,7 +73,12 @@ const InternalPromptInput = React.forwardRef(({ value: valueProp, actionButtonAr
|
|
|
73
73
|
const scrollTop = element.scrollTop;
|
|
74
74
|
// this is required so the scrollHeight becomes dynamic, otherwise it will be locked at the highest value for the size it reached e.g. 500px
|
|
75
75
|
element.style.height = 'auto';
|
|
76
|
-
|
|
76
|
+
// The native textarea already grows to its `rows={minRows}` attribute, so this
|
|
77
|
+
// formula only needs to act as a one-line floor there. The contentEditable div used
|
|
78
|
+
// in token mode has no equivalent native sizing, so it must scale with minRows directly.
|
|
79
|
+
const minRowsHeight = isTokenMode
|
|
80
|
+
? `calc(${minRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`
|
|
81
|
+
: `calc(${LINE_HEIGHT} + ${designTokens.spaceFieldVertical} * 2)`;
|
|
77
82
|
const scrollHeight = `calc(${element.scrollHeight}px)`;
|
|
78
83
|
if (maxRows === -1) {
|
|
79
84
|
element.style.height = `max(${scrollHeight}, ${minRowsHeight})`;
|
|
@@ -94,11 +99,18 @@ const InternalPromptInput = React.forwardRef(({ value: valueProp, actionButtonAr
|
|
|
94
99
|
requestAnimationFrame(() => adjustInputHeight());
|
|
95
100
|
}
|
|
96
101
|
}, [isTokenMode, tokens, adjustInputHeight, isCompactMode, placeholder]);
|
|
102
|
+
// When minRows/maxRows change, recalculate height synchronously — these prop
|
|
103
|
+
// changes don't involve caret position so no RAF deferral is needed.
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if (isTokenMode) {
|
|
106
|
+
adjustInputHeight();
|
|
107
|
+
}
|
|
108
|
+
}, [isTokenMode, adjustInputHeight, minRows, maxRows]);
|
|
97
109
|
useEffect(() => {
|
|
98
110
|
if (!isTokenMode) {
|
|
99
111
|
adjustInputHeight();
|
|
100
112
|
}
|
|
101
|
-
}, [isTokenMode, value, adjustInputHeight, isCompactMode, placeholder]);
|
|
113
|
+
}, [isTokenMode, value, adjustInputHeight, isCompactMode, placeholder, minRows, maxRows]);
|
|
102
114
|
// Observe width changes on the component's root element to handle container resizes.
|
|
103
115
|
// We need a separate RefObject because __internalRootRef may be a callback ref,
|
|
104
116
|
// and useWidthChange needs a RefObject with .current to read the DOM node.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,QAAQ,GACT,MAAM,+CAA+C,CAAC;AAEvD,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,KAAK,YAAY,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAA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AAI,CACnB,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;gBACvC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;gBACzB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;aAC1B,CAAC;YAEF,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC,mBAAmB,CAAC,EAAE;oBAChF,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,+BAA+B;oBAC3D,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC,EAAE,CAAC,+BAA+B,IAAI,eAAe;oBAC1F,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;oBACzB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;iBAC1B,CAAC,IAED,gBAAgB,CACb;YACN,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,WAAC,OAAA,MAAA,gBAAgB,EAAE,0CAAE,KAAK,EAAE,CAAA,EAAA,GAAI;YAC5E,eAAe,IAAI,YAAY,CAC5B,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport {\n useDensityMode,\n useMergeRefs,\n useStableCallback,\n warnOnce,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { convertAutoComplete } from '../input/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireCancelableEvent, fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport * as designTokens from '../internal/generated/styles/tokens';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useWidthChange } from '../internal/hooks/use-width-change';\nimport { isDevelopment } from '../internal/is-development';\nimport { SomeRequired } from '../internal/types';\nimport InternalLiveRegion from '../live-region/internal';\nimport TextareaMode from './components/textarea-mode';\nimport TokenMode from './components/token-mode';\nimport { CaretController } from './core/caret-controller';\nimport { DEFAULT_MAX_ROWS } from './core/constants';\nimport { getPromptText } from './core/token-operations';\nimport { supportsTokenMode } from './core/token-renderer';\nimport { isPinnedReferenceToken } from './core/type-guards';\nimport { PromptInputProps } from './interfaces';\nimport { PromptInputInternalStyle } from './internal-interfaces';\nimport { getPromptInputStyles } from './styles';\nimport { useTokenMode } from './tokens/use-token-mode';\nimport { insertTextIntoContentEditable } from './utils/insert-text-content-editable';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\ninterface InternalPromptInputProps\n extends SomeRequired<PromptInputProps, 'maxRows' | 'minRows'>,\n InternalBaseComponentProps {}\n\nconst InternalPromptInput = React.forwardRef(\n (\n {\n value: valueProp,\n actionButtonAriaLabel,\n actionButtonIconName,\n actionButtonIconUrl,\n actionButtonIconSvg,\n actionButtonIconAlt,\n ariaLabel,\n autoFocus,\n autoComplete,\n disableActionButton,\n disableBrowserAutocorrect,\n disabled,\n maxRows,\n minRows,\n name,\n onAction,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n placeholder,\n readOnly,\n spellcheck,\n customPrimaryAction,\n secondaryActions,\n secondaryContent,\n disableSecondaryActionsPaddings,\n disableSecondaryContentPaddings,\n nativeTextareaAttributes,\n style,\n tokens,\n tokensToText,\n menus,\n maxMenuHeight,\n onMenuItemSelect,\n onMenuFilter,\n onMenuLoadItems,\n onTriggerDetected,\n i18nStrings,\n __internalRootRef,\n ...rest\n }: InternalPromptInputProps,\n ref: Ref<PromptInputProps.Ref | HTMLTextAreaElement | HTMLInputElement>\n ) => {\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, warning } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n\n const i18n = useInternalI18n('prompt-input');\n\n const effectiveI18nStrings: PromptInputProps.I18nStrings = {\n actionButtonAriaLabel: i18n(\n 'i18nStrings.actionButtonAriaLabel',\n i18nStrings?.actionButtonAriaLabel ?? actionButtonAriaLabel\n ),\n menuErrorIconAriaLabel: i18n('i18nStrings.menuErrorIconAriaLabel', i18nStrings?.menuErrorIconAriaLabel),\n menuRecoveryText: i18n('i18nStrings.menuRecoveryText', i18nStrings?.menuRecoveryText),\n menuLoadingText: i18n('i18nStrings.menuLoadingText', i18nStrings?.menuLoadingText),\n menuFinishedText: i18n('i18nStrings.menuFinishedText', i18nStrings?.menuFinishedText),\n menuErrorText: i18n('i18nStrings.menuErrorText', i18nStrings?.menuErrorText),\n tokenInsertedAriaLabel: i18n(\n 'i18nStrings.tokenInsertedAriaLabel',\n i18nStrings?.tokenInsertedAriaLabel,\n format => token => format({ token__label: token.label || token.value })\n ),\n tokenPinnedAriaLabel: i18n(\n 'i18nStrings.tokenPinnedAriaLabel',\n i18nStrings?.tokenPinnedAriaLabel,\n format => token => format({ token__label: token.label || token.value })\n ),\n tokenRemovedAriaLabel: i18n(\n 'i18nStrings.tokenRemovedAriaLabel',\n i18nStrings?.tokenRemovedAriaLabel,\n format => token => format({ token__label: token.label || token.value })\n ),\n };\n\n // Empty tokens array is valid token-mode state; only fall back to\n // textarea mode when the prop is absent.\n const isTokenMode = tokens !== undefined && supportsTokenMode;\n\n if (isDevelopment) {\n if ((menus || tokens) && !supportsTokenMode) {\n warnOnce(\n 'PromptInput',\n 'Shortcuts features require React 18 or later. The `menus` and `tokens` props will be ignored and shortcuts features will not function.'\n );\n }\n }\n\n const value = valueProp ?? '';\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const editableElementRef = useRef<HTMLDivElement>(null);\n const caretControllerRef = useRef<CaretController | null>(null);\n\n const isRefresh = useVisualRefresh();\n const textareaDensityMode = useDensityMode(textareaRef);\n const editableDensityMode = useDensityMode(editableElementRef);\n const isCompactMode = (isTokenMode ? editableDensityMode : textareaDensityMode) === 'compact';\n\n const PADDING = isRefresh ? designTokens.spaceXxs : designTokens.spaceXxxs;\n const LINE_HEIGHT = designTokens.lineHeightBodyM;\n\n const getActiveElement = useStableCallback(() => {\n return isTokenMode ? editableElementRef.current : textareaRef.current;\n });\n\n /**\n * Dynamically adjusts the input height based on content and row constraints.\n */\n const adjustInputHeight = useStableCallback(() => {\n const element = getActiveElement();\n if (!element) {\n return;\n }\n\n const scrollTop = element.scrollTop;\n // this is required so the scrollHeight becomes dynamic, otherwise it will be locked at the highest value for the size it reached e.g. 500px\n element.style.height = 'auto';\n\n const minRowsHeight = `calc(${LINE_HEIGHT} + ${designTokens.spaceFieldVertical} * 2)`;\n const scrollHeight = `calc(${element.scrollHeight}px)`;\n\n if (maxRows === -1) {\n element.style.height = `max(${scrollHeight}, ${minRowsHeight})`;\n } else {\n const maxRowsHeight = `calc(${maxRows <= 0 ? DEFAULT_MAX_ROWS : maxRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`;\n element.style.height = `min(max(${scrollHeight}, ${minRowsHeight}), ${maxRowsHeight})`;\n }\n\n if (isTokenMode) {\n element.scrollTop = scrollTop;\n }\n });\n\n // Height is adjusted per-mode. `value` must not be a dependency in token\n // mode — it's unused there, and re-running the effect on `value` changes\n // resets the contentEditable caret to offset 0.\n useEffect(() => {\n if (isTokenMode) {\n requestAnimationFrame(() => adjustInputHeight());\n }\n }, [isTokenMode, tokens, adjustInputHeight, isCompactMode, placeholder]);\n\n useEffect(() => {\n if (!isTokenMode) {\n adjustInputHeight();\n }\n }, [isTokenMode, value, adjustInputHeight, isCompactMode, placeholder]);\n\n // Observe width changes on the component's root element to handle container resizes.\n // We need a separate RefObject because __internalRootRef may be a callback ref,\n // and useWidthChange needs a RefObject with .current to read the DOM node.\n const rootElementRef = useRef<HTMLDivElement>(null);\n const mergedRootRef = useMergeRefs(__internalRootRef, rootElementRef);\n useWidthChange(rootElementRef, adjustInputHeight);\n\n const plainTextValue = isTokenMode\n ? tokensToText\n ? tokensToText(tokens ?? [])\n : getPromptText(tokens ?? [])\n : value;\n\n const tokenMode = useTokenMode({\n editableElementRef,\n caretControllerRef,\n tokens,\n tokensToText,\n menus,\n disabled,\n readOnly,\n autoFocus,\n placeholder,\n invalid,\n warning,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n ariaRequired: rest.ariaRequired,\n disableBrowserAutocorrect,\n spellcheck,\n onChange: (detail: { value: string; tokens: PromptInputProps.InputToken[] }) => {\n fireNonCancelableEvent(onChange, detail);\n },\n onTriggerDetected: onTriggerDetected ? detail => fireCancelableEvent(onTriggerDetected, detail) : undefined,\n onAction,\n onBlur,\n onFocus,\n onKeyDown,\n onKeyUp,\n onMenuItemSelect,\n onMenuFilter,\n onMenuLoadItems,\n i18nStrings: effectiveI18nStrings,\n adjustInputHeight,\n });\n\n const handleInsertText = useStableCallback((text: string, caretStart?: number, caretEnd?: number) => {\n if (disabled || readOnly) {\n return;\n }\n\n if (!isTokenMode || !editableElementRef.current || !tokens || !caretControllerRef.current) {\n return;\n }\n\n let adjustedCaretStart: number;\n let adjustedCaretEnd: number | undefined;\n\n if (caretStart === undefined) {\n const currentPos = caretControllerRef.current.getPosition();\n const pinnedCount = tokens.filter(isPinnedReferenceToken).length;\n\n // If the caret is before or between pinned tokens, move it after them.\n // Text inserted here would get pushed after pinned tokens by enforcePinnedTokenOrdering,\n // but the caret wouldn't follow — so we preemptively position it correctly.\n adjustedCaretStart = pinnedCount > 0 && currentPos < pinnedCount ? pinnedCount : currentPos;\n adjustedCaretEnd = undefined;\n } else {\n const pinnedTokens = tokens.filter(isPinnedReferenceToken);\n const pinnedOffset = pinnedTokens.length;\n\n adjustedCaretStart = caretStart + pinnedOffset;\n adjustedCaretEnd = caretEnd !== undefined ? caretEnd + pinnedOffset : undefined;\n }\n\n insertTextIntoContentEditable(\n editableElementRef.current,\n text,\n adjustedCaretStart,\n adjustedCaretEnd,\n caretControllerRef.current\n );\n });\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n getActiveElement()?.focus(...args);\n },\n select() {\n if (isTokenMode) {\n if (editableElementRef.current && caretControllerRef.current) {\n caretControllerRef.current.selectAll();\n }\n } else {\n textareaRef.current?.select();\n }\n },\n setSelectionRange(...args: Parameters<HTMLTextAreaElement['setSelectionRange']>) {\n if (isTokenMode && caretControllerRef.current) {\n const [start, end] = args;\n const actualEnd = end ?? undefined;\n caretControllerRef.current.setPosition(start ?? 0, actualEnd);\n } else {\n textareaRef.current?.setSelectionRange(...args);\n }\n },\n insertText: handleInsertText,\n }),\n [getActiveElement, isTokenMode, handleInsertText]\n );\n\n const handleTextareaKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n fireKeyboardEvent(onKeyDown, event);\n\n if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {\n if (event.currentTarget.form && !event.isDefaultPrevented()) {\n event.currentTarget.form.requestSubmit();\n }\n event.preventDefault();\n fireNonCancelableEvent(onAction, {\n value: plainTextValue,\n });\n }\n };\n\n const handleTextareaChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (isTokenMode) {\n tokenMode.markTokensAsSent(tokens ?? []);\n }\n const detail: PromptInputProps.ChangeDetail = {\n value: event.target.value,\n };\n fireNonCancelableEvent(onChange, detail);\n adjustInputHeight();\n };\n\n const hasActionButton = !!(\n actionButtonIconName ||\n actionButtonIconSvg ||\n actionButtonIconUrl ||\n customPrimaryAction\n );\n\n const textareaAttributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, testutilStyles.textarea, {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n autoCorrect: disableBrowserAutocorrect ? 'off' : undefined,\n autoCapitalize: disableBrowserAutocorrect ? 'off' : undefined,\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: minRows,\n value: value || '',\n onKeyDown: handleTextareaKeyDown,\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n onChange: handleTextareaChange,\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n const actionButton = (\n <div className={clsx(styles['primary-action'], testutilStyles['primary-action'])}>\n {customPrimaryAction ?? (\n <InternalButton\n className={clsx(styles['action-button'], testutilStyles['action-button'])}\n ariaLabel={effectiveI18nStrings.actionButtonAriaLabel}\n disabled={disabled || readOnly || disableActionButton}\n __focusable={readOnly}\n iconName={actionButtonIconName}\n iconUrl={actionButtonIconUrl}\n iconSvg={actionButtonIconSvg}\n iconAlt={actionButtonIconAlt}\n onClick={() => {\n fireNonCancelableEvent(onAction, {\n value: plainTextValue,\n ...(isTokenMode && { tokens: tokens ?? [] }),\n });\n }}\n variant=\"icon\"\n />\n )}\n </div>\n );\n\n return (\n <div\n {...baseProps}\n aria-label={ariaLabel}\n className={clsx(styles.root, testutilStyles.root, baseProps.className, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n [styles['textarea-warning']]: warning && !invalid,\n [styles.disabled]: disabled,\n })}\n ref={mergedRootRef}\n role=\"region\"\n style={getPromptInputStyles(style)}\n >\n <InternalLiveRegion tagName=\"span\" hidden={true} assertive={true} delay={0}>\n {tokenMode.tokenOperationAnnouncement}\n </InternalLiveRegion>\n\n {secondaryContent && (\n <div\n className={clsx(styles['secondary-content'], testutilStyles['secondary-content'], {\n [styles['with-paddings']]: !disableSecondaryContentPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryContent}\n </div>\n )}\n\n <div className={styles['textarea-wrapper']}>\n {isTokenMode ? (\n <TokenMode\n editableElementRef={editableElementRef}\n triggerWrapperRef={tokenMode.triggerWrapperRef}\n controlId={controlId}\n menuListId={tokenMode.menuListId}\n menuFooterControlId={tokenMode.menuFooterControlId}\n highlightedMenuOptionId={tokenMode.highlightedMenuOptionId}\n name={name}\n plainTextValue={plainTextValue}\n menuIsOpen={tokenMode.menuIsOpen}\n triggerWrapperReady={tokenMode.triggerWrapperReady}\n shouldRenderMenuDropdown={tokenMode.shouldRenderMenuDropdown}\n activeMenu={tokenMode.activeMenu}\n activeTriggerToken={tokenMode.activeTriggerToken}\n menuFilterText={tokenMode.menuFilterText}\n menuItemsState={tokenMode.menuItemsState}\n menuItemsHandlers={tokenMode.menuItemsHandlers}\n menuDropdownStatus={tokenMode.menuDropdownStatus}\n maxMenuHeight={maxMenuHeight}\n menuStyle={(style as PromptInputInternalStyle | undefined)?._menu}\n handleInput={tokenMode.handleInput}\n handleLoadMore={tokenMode.handleLoadMore}\n editableElementAttributes={tokenMode.editableElementAttributes}\n i18nStrings={effectiveI18nStrings}\n />\n ) : (\n <TextareaMode\n textareaRef={textareaRef}\n controlId={controlId}\n textareaAttributes={textareaAttributes}\n nativeTextareaAttributes={nativeTextareaAttributes}\n />\n )}\n {hasActionButton && !secondaryActions && actionButton}\n </div>\n\n {/* Render reference tokens into their DOM containers via portals */}\n {isTokenMode && tokenMode.portals}\n\n {secondaryActions && (\n <div\n className={clsx(styles['action-stripe'], {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n <div\n className={clsx(styles['secondary-actions'], testutilStyles['secondary-actions'], {\n [styles['with-paddings']]: !disableSecondaryActionsPaddings,\n [styles['with-paddings-and-actions']]: !disableSecondaryActionsPaddings && hasActionButton,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryActions}\n </div>\n <div className={styles.buffer} onClick={() => getActiveElement()?.focus()} />\n {hasActionButton && actionButton}\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default InternalPromptInput;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,QAAQ,GACT,MAAM,+CAA+C,CAAC;AAEvD,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,KAAK,YAAY,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,s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,oBAAoB,GACjC,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,YAAY,IACX,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,wBAAwB,EAAE,wBAAwB,GAClD,CACH;YACA,eAAe,IAAI,CAAC,gBAAgB,IAAI,YAAY,CACjD;QAGL,WAAW,IAAI,SAAS,CAAC,OAAO;QAEhC,gBAAgB,IAAI,CACnB,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;gBACvC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;gBACzB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;aAC1B,CAAC;YAEF,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC,mBAAmB,CAAC,EAAE;oBAChF,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,+BAA+B;oBAC3D,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC,EAAE,CAAC,+BAA+B,IAAI,eAAe;oBAC1F,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;oBACzB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;iBAC1B,CAAC,IAED,gBAAgB,CACb;YACN,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,WAAC,OAAA,MAAA,gBAAgB,EAAE,0CAAE,KAAK,EAAE,CAAA,EAAA,GAAI;YAC5E,eAAe,IAAI,YAAY,CAC5B,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport {\n useDensityMode,\n useMergeRefs,\n useStableCallback,\n warnOnce,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { convertAutoComplete } from '../input/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireCancelableEvent, fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport * as designTokens from '../internal/generated/styles/tokens';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useWidthChange } from '../internal/hooks/use-width-change';\nimport { isDevelopment } from '../internal/is-development';\nimport { SomeRequired } from '../internal/types';\nimport InternalLiveRegion from '../live-region/internal';\nimport TextareaMode from './components/textarea-mode';\nimport TokenMode from './components/token-mode';\nimport { CaretController } from './core/caret-controller';\nimport { DEFAULT_MAX_ROWS } from './core/constants';\nimport { getPromptText } from './core/token-operations';\nimport { supportsTokenMode } from './core/token-renderer';\nimport { isPinnedReferenceToken } from './core/type-guards';\nimport { PromptInputProps } from './interfaces';\nimport { PromptInputInternalStyle } from './internal-interfaces';\nimport { getPromptInputStyles } from './styles';\nimport { useTokenMode } from './tokens/use-token-mode';\nimport { insertTextIntoContentEditable } from './utils/insert-text-content-editable';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\ninterface InternalPromptInputProps\n extends SomeRequired<PromptInputProps, 'maxRows' | 'minRows'>,\n InternalBaseComponentProps {}\n\nconst InternalPromptInput = React.forwardRef(\n (\n {\n value: valueProp,\n actionButtonAriaLabel,\n actionButtonIconName,\n actionButtonIconUrl,\n actionButtonIconSvg,\n actionButtonIconAlt,\n ariaLabel,\n autoFocus,\n autoComplete,\n disableActionButton,\n disableBrowserAutocorrect,\n disabled,\n maxRows,\n minRows,\n name,\n onAction,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n placeholder,\n readOnly,\n spellcheck,\n customPrimaryAction,\n secondaryActions,\n secondaryContent,\n disableSecondaryActionsPaddings,\n disableSecondaryContentPaddings,\n nativeTextareaAttributes,\n style,\n tokens,\n tokensToText,\n menus,\n maxMenuHeight,\n onMenuItemSelect,\n onMenuFilter,\n onMenuLoadItems,\n onTriggerDetected,\n i18nStrings,\n __internalRootRef,\n ...rest\n }: InternalPromptInputProps,\n ref: Ref<PromptInputProps.Ref | HTMLTextAreaElement | HTMLInputElement>\n ) => {\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, warning } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n\n const i18n = useInternalI18n('prompt-input');\n\n const effectiveI18nStrings: PromptInputProps.I18nStrings = {\n actionButtonAriaLabel: i18n(\n 'i18nStrings.actionButtonAriaLabel',\n i18nStrings?.actionButtonAriaLabel ?? actionButtonAriaLabel\n ),\n menuErrorIconAriaLabel: i18n('i18nStrings.menuErrorIconAriaLabel', i18nStrings?.menuErrorIconAriaLabel),\n menuRecoveryText: i18n('i18nStrings.menuRecoveryText', i18nStrings?.menuRecoveryText),\n menuLoadingText: i18n('i18nStrings.menuLoadingText', i18nStrings?.menuLoadingText),\n menuFinishedText: i18n('i18nStrings.menuFinishedText', i18nStrings?.menuFinishedText),\n menuErrorText: i18n('i18nStrings.menuErrorText', i18nStrings?.menuErrorText),\n tokenInsertedAriaLabel: i18n(\n 'i18nStrings.tokenInsertedAriaLabel',\n i18nStrings?.tokenInsertedAriaLabel,\n format => token => format({ token__label: token.label || token.value })\n ),\n tokenPinnedAriaLabel: i18n(\n 'i18nStrings.tokenPinnedAriaLabel',\n i18nStrings?.tokenPinnedAriaLabel,\n format => token => format({ token__label: token.label || token.value })\n ),\n tokenRemovedAriaLabel: i18n(\n 'i18nStrings.tokenRemovedAriaLabel',\n i18nStrings?.tokenRemovedAriaLabel,\n format => token => format({ token__label: token.label || token.value })\n ),\n };\n\n // Empty tokens array is valid token-mode state; only fall back to\n // textarea mode when the prop is absent.\n const isTokenMode = tokens !== undefined && supportsTokenMode;\n\n if (isDevelopment) {\n if ((menus || tokens) && !supportsTokenMode) {\n warnOnce(\n 'PromptInput',\n 'Shortcuts features require React 18 or later. The `menus` and `tokens` props will be ignored and shortcuts features will not function.'\n );\n }\n }\n\n const value = valueProp ?? '';\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const editableElementRef = useRef<HTMLDivElement>(null);\n const caretControllerRef = useRef<CaretController | null>(null);\n\n const isRefresh = useVisualRefresh();\n const textareaDensityMode = useDensityMode(textareaRef);\n const editableDensityMode = useDensityMode(editableElementRef);\n const isCompactMode = (isTokenMode ? editableDensityMode : textareaDensityMode) === 'compact';\n\n const PADDING = isRefresh ? designTokens.spaceXxs : designTokens.spaceXxxs;\n const LINE_HEIGHT = designTokens.lineHeightBodyM;\n\n const getActiveElement = useStableCallback(() => {\n return isTokenMode ? editableElementRef.current : textareaRef.current;\n });\n\n /**\n * Dynamically adjusts the input height based on content and row constraints.\n */\n const adjustInputHeight = useStableCallback(() => {\n const element = getActiveElement();\n if (!element) {\n return;\n }\n\n const scrollTop = element.scrollTop;\n // this is required so the scrollHeight becomes dynamic, otherwise it will be locked at the highest value for the size it reached e.g. 500px\n element.style.height = 'auto';\n\n // The native textarea already grows to its `rows={minRows}` attribute, so this\n // formula only needs to act as a one-line floor there. The contentEditable div used\n // in token mode has no equivalent native sizing, so it must scale with minRows directly.\n const minRowsHeight = isTokenMode\n ? `calc(${minRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`\n : `calc(${LINE_HEIGHT} + ${designTokens.spaceFieldVertical} * 2)`;\n const scrollHeight = `calc(${element.scrollHeight}px)`;\n\n if (maxRows === -1) {\n element.style.height = `max(${scrollHeight}, ${minRowsHeight})`;\n } else {\n const maxRowsHeight = `calc(${maxRows <= 0 ? DEFAULT_MAX_ROWS : maxRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`;\n element.style.height = `min(max(${scrollHeight}, ${minRowsHeight}), ${maxRowsHeight})`;\n }\n\n if (isTokenMode) {\n element.scrollTop = scrollTop;\n }\n });\n\n // Height is adjusted per-mode. `value` must not be a dependency in token\n // mode — it's unused there, and re-running the effect on `value` changes\n // resets the contentEditable caret to offset 0.\n useEffect(() => {\n if (isTokenMode) {\n requestAnimationFrame(() => adjustInputHeight());\n }\n }, [isTokenMode, tokens, adjustInputHeight, isCompactMode, placeholder]);\n\n // When minRows/maxRows change, recalculate height synchronously — these prop\n // changes don't involve caret position so no RAF deferral is needed.\n useEffect(() => {\n if (isTokenMode) {\n adjustInputHeight();\n }\n }, [isTokenMode, adjustInputHeight, minRows, maxRows]);\n\n useEffect(() => {\n if (!isTokenMode) {\n adjustInputHeight();\n }\n }, [isTokenMode, value, adjustInputHeight, isCompactMode, placeholder, minRows, maxRows]);\n\n // Observe width changes on the component's root element to handle container resizes.\n // We need a separate RefObject because __internalRootRef may be a callback ref,\n // and useWidthChange needs a RefObject with .current to read the DOM node.\n const rootElementRef = useRef<HTMLDivElement>(null);\n const mergedRootRef = useMergeRefs(__internalRootRef, rootElementRef);\n useWidthChange(rootElementRef, adjustInputHeight);\n\n const plainTextValue = isTokenMode\n ? tokensToText\n ? tokensToText(tokens ?? [])\n : getPromptText(tokens ?? [])\n : value;\n\n const tokenMode = useTokenMode({\n editableElementRef,\n caretControllerRef,\n tokens,\n tokensToText,\n menus,\n disabled,\n readOnly,\n autoFocus,\n placeholder,\n invalid,\n warning,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n ariaRequired: rest.ariaRequired,\n disableBrowserAutocorrect,\n spellcheck,\n onChange: (detail: { value: string; tokens: PromptInputProps.InputToken[] }) => {\n fireNonCancelableEvent(onChange, detail);\n },\n onTriggerDetected: onTriggerDetected ? detail => fireCancelableEvent(onTriggerDetected, detail) : undefined,\n onAction,\n onBlur,\n onFocus,\n onKeyDown,\n onKeyUp,\n onMenuItemSelect,\n onMenuFilter,\n onMenuLoadItems,\n i18nStrings: effectiveI18nStrings,\n adjustInputHeight,\n });\n\n const handleInsertText = useStableCallback((text: string, caretStart?: number, caretEnd?: number) => {\n if (disabled || readOnly) {\n return;\n }\n\n if (!isTokenMode || !editableElementRef.current || !tokens || !caretControllerRef.current) {\n return;\n }\n\n let adjustedCaretStart: number;\n let adjustedCaretEnd: number | undefined;\n\n if (caretStart === undefined) {\n const currentPos = caretControllerRef.current.getPosition();\n const pinnedCount = tokens.filter(isPinnedReferenceToken).length;\n\n // If the caret is before or between pinned tokens, move it after them.\n // Text inserted here would get pushed after pinned tokens by enforcePinnedTokenOrdering,\n // but the caret wouldn't follow — so we preemptively position it correctly.\n adjustedCaretStart = pinnedCount > 0 && currentPos < pinnedCount ? pinnedCount : currentPos;\n adjustedCaretEnd = undefined;\n } else {\n const pinnedTokens = tokens.filter(isPinnedReferenceToken);\n const pinnedOffset = pinnedTokens.length;\n\n adjustedCaretStart = caretStart + pinnedOffset;\n adjustedCaretEnd = caretEnd !== undefined ? caretEnd + pinnedOffset : undefined;\n }\n\n insertTextIntoContentEditable(\n editableElementRef.current,\n text,\n adjustedCaretStart,\n adjustedCaretEnd,\n caretControllerRef.current\n );\n });\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n getActiveElement()?.focus(...args);\n },\n select() {\n if (isTokenMode) {\n if (editableElementRef.current && caretControllerRef.current) {\n caretControllerRef.current.selectAll();\n }\n } else {\n textareaRef.current?.select();\n }\n },\n setSelectionRange(...args: Parameters<HTMLTextAreaElement['setSelectionRange']>) {\n if (isTokenMode && caretControllerRef.current) {\n const [start, end] = args;\n const actualEnd = end ?? undefined;\n caretControllerRef.current.setPosition(start ?? 0, actualEnd);\n } else {\n textareaRef.current?.setSelectionRange(...args);\n }\n },\n insertText: handleInsertText,\n }),\n [getActiveElement, isTokenMode, handleInsertText]\n );\n\n const handleTextareaKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n fireKeyboardEvent(onKeyDown, event);\n\n if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {\n if (event.currentTarget.form && !event.isDefaultPrevented()) {\n event.currentTarget.form.requestSubmit();\n }\n event.preventDefault();\n fireNonCancelableEvent(onAction, {\n value: plainTextValue,\n });\n }\n };\n\n const handleTextareaChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (isTokenMode) {\n tokenMode.markTokensAsSent(tokens ?? []);\n }\n const detail: PromptInputProps.ChangeDetail = {\n value: event.target.value,\n };\n fireNonCancelableEvent(onChange, detail);\n adjustInputHeight();\n };\n\n const hasActionButton = !!(\n actionButtonIconName ||\n actionButtonIconSvg ||\n actionButtonIconUrl ||\n customPrimaryAction\n );\n\n const textareaAttributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, testutilStyles.textarea, {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n autoCorrect: disableBrowserAutocorrect ? 'off' : undefined,\n autoCapitalize: disableBrowserAutocorrect ? 'off' : undefined,\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: minRows,\n value: value || '',\n onKeyDown: handleTextareaKeyDown,\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n onChange: handleTextareaChange,\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n const actionButton = (\n <div className={clsx(styles['primary-action'], testutilStyles['primary-action'])}>\n {customPrimaryAction ?? (\n <InternalButton\n className={clsx(styles['action-button'], testutilStyles['action-button'])}\n ariaLabel={effectiveI18nStrings.actionButtonAriaLabel}\n disabled={disabled || readOnly || disableActionButton}\n __focusable={readOnly}\n iconName={actionButtonIconName}\n iconUrl={actionButtonIconUrl}\n iconSvg={actionButtonIconSvg}\n iconAlt={actionButtonIconAlt}\n onClick={() => {\n fireNonCancelableEvent(onAction, {\n value: plainTextValue,\n ...(isTokenMode && { tokens: tokens ?? [] }),\n });\n }}\n variant=\"icon\"\n />\n )}\n </div>\n );\n\n return (\n <div\n {...baseProps}\n aria-label={ariaLabel}\n className={clsx(styles.root, testutilStyles.root, baseProps.className, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n [styles['textarea-warning']]: warning && !invalid,\n [styles.disabled]: disabled,\n })}\n ref={mergedRootRef}\n role=\"region\"\n style={getPromptInputStyles(style)}\n >\n <InternalLiveRegion tagName=\"span\" hidden={true} assertive={true} delay={0}>\n {tokenMode.tokenOperationAnnouncement}\n </InternalLiveRegion>\n\n {secondaryContent && (\n <div\n className={clsx(styles['secondary-content'], testutilStyles['secondary-content'], {\n [styles['with-paddings']]: !disableSecondaryContentPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryContent}\n </div>\n )}\n\n <div className={styles['textarea-wrapper']}>\n {isTokenMode ? (\n <TokenMode\n editableElementRef={editableElementRef}\n triggerWrapperRef={tokenMode.triggerWrapperRef}\n controlId={controlId}\n menuListId={tokenMode.menuListId}\n menuFooterControlId={tokenMode.menuFooterControlId}\n highlightedMenuOptionId={tokenMode.highlightedMenuOptionId}\n name={name}\n plainTextValue={plainTextValue}\n menuIsOpen={tokenMode.menuIsOpen}\n triggerWrapperReady={tokenMode.triggerWrapperReady}\n shouldRenderMenuDropdown={tokenMode.shouldRenderMenuDropdown}\n activeMenu={tokenMode.activeMenu}\n activeTriggerToken={tokenMode.activeTriggerToken}\n menuFilterText={tokenMode.menuFilterText}\n menuItemsState={tokenMode.menuItemsState}\n menuItemsHandlers={tokenMode.menuItemsHandlers}\n menuDropdownStatus={tokenMode.menuDropdownStatus}\n maxMenuHeight={maxMenuHeight}\n menuStyle={(style as PromptInputInternalStyle | undefined)?._menu}\n handleInput={tokenMode.handleInput}\n handleLoadMore={tokenMode.handleLoadMore}\n editableElementAttributes={tokenMode.editableElementAttributes}\n i18nStrings={effectiveI18nStrings}\n />\n ) : (\n <TextareaMode\n textareaRef={textareaRef}\n controlId={controlId}\n textareaAttributes={textareaAttributes}\n nativeTextareaAttributes={nativeTextareaAttributes}\n />\n )}\n {hasActionButton && !secondaryActions && actionButton}\n </div>\n\n {/* Render reference tokens into their DOM containers via portals */}\n {isTokenMode && tokenMode.portals}\n\n {secondaryActions && (\n <div\n className={clsx(styles['action-stripe'], {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n <div\n className={clsx(styles['secondary-actions'], testutilStyles['secondary-actions'], {\n [styles['with-paddings']]: !disableSecondaryActionsPaddings,\n [styles['with-paddings-and-actions']]: !disableSecondaryActionsPaddings && hasActionButton,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryActions}\n </div>\n <div className={styles.buffer} onClick={() => getActiveElement()?.focus()} />\n {hasActionButton && actionButton}\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default InternalPromptInput;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/select/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,CAAC;AAIvB,QAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/select/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,CAAC;AAIvB,QAAA,MAAM,MAAM,qFAyDX,CAAC;AAGF,eAAe,MAAM,CAAC"}
|
|
@@ -18,10 +18,14 @@ const Select = React.forwardRef(({ options = [], filteringType = 'none', statusT
|
|
|
18
18
|
triggerVariant,
|
|
19
19
|
virtualScroll: restProps.virtualScroll,
|
|
20
20
|
readOnly: restProps.readOnly,
|
|
21
|
+
dropdownRole: restProps.dropdownRole,
|
|
21
22
|
},
|
|
22
23
|
metadata: {
|
|
23
24
|
hasInlineLabel: Boolean(restProps.inlineLabelText),
|
|
24
25
|
hasDisabledReasons: options.some(option => Boolean(option.disabledReason)),
|
|
26
|
+
hasDropdownHeader: Boolean(restProps.renderDropdownHeader),
|
|
27
|
+
hasDropdownFooter: Boolean(restProps.renderDropdownFooter),
|
|
28
|
+
hasDropdownAriaDescribedby: Boolean(restProps.dropdownAriaDescribedby),
|
|
25
29
|
},
|
|
26
30
|
});
|
|
27
31
|
const externalProps = getExternalProps(restProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/select/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,cAAc,MAAM,YAAY,CAAC;AAIxC,OAAO,kBAAkB,MAAM,wEAAwE,CAAC;AAExG,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAC7B,CACE,EACE,OAAO,GAAG,EAAE,EACZ,aAAa,GAAG,MAAM,EACtB,UAAU,GAAG,UAAU,EACvB,cAAc,GAAG,OAAO,EACxB,YAAY,EACZ,GAAG,SAAS,EACA,EACd,GAA+B,EAC/B,EAAE;;IACF,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,QAAQ,EAAE;QACpD,KAA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Content":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { GeneratedAnalyticsMetadataSelectComponent } from './analytics-metadata/interfaces';\nimport { SelectProps } from './interfaces';\nimport InternalSelect from './internal';\n\nexport { SelectProps };\n\nimport analyticsSelectors from '../internal/components/button-trigger/analytics-metadata/styles.css.js';\n\nconst Select = React.forwardRef(\n (\n {\n options = [],\n filteringType = 'none',\n statusType = 'finished',\n triggerVariant = 'label',\n renderOption,\n ...restProps\n }: SelectProps,\n ref: React.Ref<SelectProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Select', {\n props: {\n autoFocus: restProps.autoFocus,\n expandToViewport: restProps.expandToViewport,\n filteringType,\n triggerVariant,\n virtualScroll: restProps.virtualScroll,\n readOnly: restProps.readOnly,\n dropdownRole: restProps.dropdownRole,\n },\n metadata: {\n hasInlineLabel: Boolean(restProps.inlineLabelText),\n hasDisabledReasons: options.some(option => Boolean(option.disabledReason)),\n hasDropdownHeader: Boolean(restProps.renderDropdownHeader),\n hasDropdownFooter: Boolean(restProps.renderDropdownFooter),\n hasDropdownAriaDescribedby: Boolean(restProps.dropdownAriaDescribedby),\n },\n });\n const externalProps = getExternalProps(restProps);\n\n const componentAnalyticsMetadata: GeneratedAnalyticsMetadataSelectComponent = {\n name: 'awsui.Select',\n label: `.${analyticsSelectors['button-trigger']}`,\n properties: {\n disabled: `${!!externalProps.disabled}`,\n selectedOptionValue: `${externalProps.selectedOption && externalProps.selectedOption.value ? externalProps.selectedOption.value : null}`,\n // Use label for display if available, fallback to value because that's what gets shown in dropdown when label is not provided\n selectedOption: `${externalProps.selectedOption?.label ?? externalProps.selectedOption?.value ?? null}`,\n },\n };\n\n return (\n <InternalSelect\n renderOption={renderOption}\n options={options}\n filteringType={filteringType}\n statusType={statusType}\n triggerVariant={triggerVariant}\n {...externalProps}\n {...baseComponentProps}\n ref={ref}\n {...getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata })}\n />\n );\n }\n);\n\napplyDisplayName(Select, 'Select');\nexport default Select;\n"]}
|
|
@@ -137,6 +137,31 @@ export interface BaseSelectProps extends BaseDropdownHostProps, BaseComponentPro
|
|
|
137
137
|
* user from both modifying the value and opening the dropdown. A read-only control is still focusable.
|
|
138
138
|
*/
|
|
139
139
|
readOnly?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Renders content at the top of the dropdown, above the filter input (when filtering is enabled) and the
|
|
142
|
+
* options list. Pinned (sticky) to the top and rendered in every state (empty, no-match, loading, error,
|
|
143
|
+
* finished).
|
|
144
|
+
*/
|
|
145
|
+
renderDropdownHeader?: SelectProps.DropdownContentRenderer;
|
|
146
|
+
/**
|
|
147
|
+
* Renders content at the bottom of the dropdown. The content is always sticky and never scrolls with the
|
|
148
|
+
* options list. It is added below the built-in status region. Receives the current filtering state and a
|
|
149
|
+
* callback to close the dropdown.
|
|
150
|
+
*/
|
|
151
|
+
renderDropdownFooter?: SelectProps.DropdownContentRenderer;
|
|
152
|
+
/**
|
|
153
|
+
* Determines the ARIA role of the dropdown.
|
|
154
|
+
*
|
|
155
|
+
* - `auto` (default): the dropdown uses a listbox role, or a dialog role wrapping the listbox when built-in
|
|
156
|
+
* filtering is enabled.
|
|
157
|
+
* - `dialog`: the dropdown always uses a dialog role wrapping the listbox, even without built-in filtering. Use
|
|
158
|
+
* this when you render interactive custom content and want assistive technologies to treat the dropdown as a dialog.
|
|
159
|
+
*/
|
|
160
|
+
dropdownRole?: SelectProps.DropdownRole;
|
|
161
|
+
/**
|
|
162
|
+
* Adds `aria-describedby` to the dropdown's listbox/dialog content.
|
|
163
|
+
*/
|
|
164
|
+
dropdownAriaDescribedby?: string;
|
|
140
165
|
}
|
|
141
166
|
export interface SelectProps extends BaseSelectProps {
|
|
142
167
|
/**
|
|
@@ -181,6 +206,20 @@ export interface SelectProps extends BaseSelectProps {
|
|
|
181
206
|
export declare namespace SelectProps {
|
|
182
207
|
type FilteringType = OptionsFilteringType;
|
|
183
208
|
type TriggerVariant = 'label' | 'option';
|
|
209
|
+
/**
|
|
210
|
+
* The argument passed to the dropdown render functions (`renderDropdownHeader`
|
|
211
|
+
* and `renderDropdownFooter`).
|
|
212
|
+
*/
|
|
213
|
+
interface DropdownContentProps {
|
|
214
|
+
filterText: string;
|
|
215
|
+
closeDropdown: () => void;
|
|
216
|
+
}
|
|
217
|
+
type DropdownRole = 'auto' | 'dialog';
|
|
218
|
+
/**
|
|
219
|
+
* A render function for custom dropdown content, used by `renderDropdownHeader` and `renderDropdownFooter`.
|
|
220
|
+
* Receives the current filtering state and a callback to close the dropdown.
|
|
221
|
+
*/
|
|
222
|
+
type DropdownContentRenderer = (props: DropdownContentProps) => ReactNode | null;
|
|
184
223
|
type Option = OptionDefinition;
|
|
185
224
|
type OptionGroup = OptionGroupDefinition;
|
|
186
225
|
type Options = ReadonlyArray<Option | OptionGroup>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/select/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,WAA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;IAElE,UAAiB,YAAY;QAC3B,cAAc,EAAE,MAAM,CAAC;KACxB;IAED,UAAiB,8BAA8B;QAC7C,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;KAC/C;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/select/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ReactNode } from 'react';\n\nimport { BaseDropdownHostProps, OptionsFilteringType, OptionsLoadItemsDetail } from '../dropdown/interfaces';\nimport { BaseComponentProps } from '../types/base-component';\nimport { DropdownStatusProps } from '../types/dropdown-status';\nimport { NonCancelableEventHandler } from '../types/events';\nimport { FormFieldValidationControlProps } from '../types/form-field';\nimport { OptionDefinition, OptionGroup as OptionGroupDefinition } from '../types/option';\n\nexport interface BaseSelectProps\n extends BaseDropdownHostProps,\n BaseComponentProps,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n *\n * #### OptionGroup\n * - `value` (string) - Used to locate option group in test utils.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * #### Shared Option and OptionGroup properties\n * - `label` (string) - (Optional) Option or group text displayed to the user.\n * - `lang` (string) - (Optional) The language of the option or group, provided as a BCP 47 language tag.\n * - `description` (string) - (Optional) Further information about the option or group that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option or group is disabled.\n * - `disabledReason` (string) - (Optional) Displays tooltip near the item when disabled. Use to provide additional context.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option or group.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option or group.\n * - `iconAriaLabel` (string) - (Optional) Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n * - `iconAlt` (string) - (Optional) **Deprecated**, replaced by \\`iconAriaLabel\\`. Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: SelectProps.Options;\n\n /**\n * Determines how filtering is applied to the list of `options`:\n *\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Determines whether the whole select component is disabled.\n */\n disabled?: boolean;\n /**\n * Specifies the placeholder to display in the filtering input if filtering is enabled.\n */\n filteringPlaceholder?: string;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n /**\n * Adds an `aria-label` on the built-in filtering input if filtering is enabled.\n */\n filteringAriaLabel?: string;\n /**\n * Adds an `aria-label` to the clear button inside the search input.\n * @i18n\n */\n filteringClearAriaLabel?: string;\n /**\n * @deprecated Has no effect.\n */\n name?: string;\n /**\n * Specifies the hint text that's displayed in the field when no option has been selected.\n */\n placeholder?: string;\n /**\n * Specifies the ID for the trigger component. It uses an automatically generated ID by default.\n */\n controlId?: string;\n /**\n * Adds `aria-required` to the native input element.\n */\n ariaRequired?: boolean;\n /**\n * Adds `aria-label` to the select element.\n * Use this if you don't have a visible label for this control.\n */\n ariaLabel?: string;\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/select/?tabId=usage#accessibility-guidelines).\n * @i18n\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedAriaLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/select/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: SelectProps.ContainingOptionAndGroupString;\n /**\n * Displayed for `filteringType=\"auto\"` when there are no matches for the filtering.\n */\n noMatch?: React.ReactNode;\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler;\n /**\n * Called when input focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler;\n\n /**\n * Specifies if the control is read-only, which prevents the\n * user from both modifying the value and opening the dropdown. A read-only control is still focusable.\n */\n readOnly?: boolean;\n}\n\nexport interface SelectProps extends BaseSelectProps {\n /**\n * Adds a small label inline with the input for saving vertical space in the UI.\n * For use with collection select filters only.\n */\n inlineLabelText?: string;\n onLoadItems?: NonCancelableEventHandler<SelectProps.LoadItemsDetail>;\n /**\n * Adds `aria-labelledby` to the component. If you're using this component within a form field,\n * don't set this property because the form field component automatically sets it.\n *\n * Use this property if the component isn't using `inlineLabelText` and isn't surrounded by a form field, or you want to override the value\n * automatically set by the form field (for example, if you have two components within a single form field).\n *\n * To use it correctly, define an ID for the element you want to use as label and set the property to that ID.\n */\n ariaLabelledby?: string;\n /**\n * Defines the variant of the trigger. You can use a simple label or the entire option (`label | option`)\n */\n triggerVariant?: SelectProps.TriggerVariant;\n /**\n * Specifies the currently selected option.\n * If you want to clear the selection, use `null`.\n */\n selectedOption: SelectProps.Option | null;\n /**\n * Called when the user selects an option.\n * The event `detail` contains the current `selectedOption`.\n */\n onChange?: NonCancelableEventHandler<SelectProps.ChangeDetail>;\n\n /**\n * Automatically focuses the trigger when component is mounted.\n */\n autoFocus?: boolean;\n /**\n * Specifies a render function to render custom options in the dropdown menu or trigger.\n */\n renderOption?: SelectProps.SelectOptionItemRenderer;\n}\n\nexport namespace SelectProps {\n export type FilteringType = OptionsFilteringType;\n export type TriggerVariant = 'label' | 'option';\n\n export type Option = OptionDefinition;\n export type OptionGroup = OptionGroupDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n\n export interface SelectOptionItem {\n type: 'item';\n index: number;\n option: Option;\n highlighted: boolean;\n selected: boolean;\n disabled: boolean;\n parent: SelectOptionGroupItem | null;\n }\n export interface SelectOptionGroupItem {\n type: 'group';\n index: number;\n option: OptionGroup;\n disabled: boolean;\n }\n export interface SelectTriggerOptionItem {\n type: 'trigger';\n option: Option;\n }\n export type SelectItem = SelectOptionItem | SelectOptionGroupItem | SelectTriggerOptionItem;\n export type SelectOptionItemRenderer = (props: { item: SelectItem; filterText?: string }) => ReactNode | null;\n\n /* eslint-disable-next-line @typescript-eslint/no-empty-object-type --\n * Required to create a distinct named type for the documenter.\n **/\n export interface LoadItemsDetail extends OptionsLoadItemsDetail {}\n\n export interface ChangeDetail {\n selectedOption: Option;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n\n export interface Ref {\n /**\n * Sets focus on the element without opening the dropdown or showing a visual focus indicator.\n */\n focus(): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/select/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ReactNode } from 'react';\n\nimport { BaseDropdownHostProps, OptionsFilteringType, OptionsLoadItemsDetail } from '../dropdown/interfaces';\nimport { BaseComponentProps } from '../types/base-component';\nimport { DropdownStatusProps } from '../types/dropdown-status';\nimport { NonCancelableEventHandler } from '../types/events';\nimport { FormFieldValidationControlProps } from '../types/form-field';\nimport { OptionDefinition, OptionGroup as OptionGroupDefinition } from '../types/option';\n\nexport interface BaseSelectProps\n extends BaseDropdownHostProps,\n BaseComponentProps,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n *\n * #### OptionGroup\n * - `value` (string) - Used to locate option group in test utils.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * #### Shared Option and OptionGroup properties\n * - `label` (string) - (Optional) Option or group text displayed to the user.\n * - `lang` (string) - (Optional) The language of the option or group, provided as a BCP 47 language tag.\n * - `description` (string) - (Optional) Further information about the option or group that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option or group is disabled.\n * - `disabledReason` (string) - (Optional) Displays tooltip near the item when disabled. Use to provide additional context.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option or group.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option or group.\n * - `iconAriaLabel` (string) - (Optional) Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n * - `iconAlt` (string) - (Optional) **Deprecated**, replaced by \\`iconAriaLabel\\`. Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: SelectProps.Options;\n\n /**\n * Determines how filtering is applied to the list of `options`:\n *\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value`, `label`, `description` or `labelTag` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Determines whether the whole select component is disabled.\n */\n disabled?: boolean;\n /**\n * Specifies the placeholder to display in the filtering input if filtering is enabled.\n */\n filteringPlaceholder?: string;\n\n /**\n * Specifies the text to display with the number of matches at the bottom of the dropdown menu while filtering.\n */\n filteringResultsText?: (matchesCount: number, totalCount: number) => string;\n /**\n * Adds an `aria-label` on the built-in filtering input if filtering is enabled.\n */\n filteringAriaLabel?: string;\n /**\n * Adds an `aria-label` to the clear button inside the search input.\n * @i18n\n */\n filteringClearAriaLabel?: string;\n /**\n * @deprecated Has no effect.\n */\n name?: string;\n /**\n * Specifies the hint text that's displayed in the field when no option has been selected.\n */\n placeholder?: string;\n /**\n * Specifies the ID for the trigger component. It uses an automatically generated ID by default.\n */\n controlId?: string;\n /**\n * Adds `aria-required` to the native input element.\n */\n ariaRequired?: boolean;\n /**\n * Adds `aria-label` to the select element.\n * Use this if you don't have a visible label for this control.\n */\n ariaLabel?: string;\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/select/?tabId=usage#accessibility-guidelines).\n * @i18n\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedAriaLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/select/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: SelectProps.ContainingOptionAndGroupString;\n /**\n * Displayed for `filteringType=\"auto\"` when there are no matches for the filtering.\n */\n noMatch?: React.ReactNode;\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler;\n /**\n * Called when input focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler;\n\n /**\n * Specifies if the control is read-only, which prevents the\n * user from both modifying the value and opening the dropdown. A read-only control is still focusable.\n */\n readOnly?: boolean;\n\n /**\n * Renders content at the top of the dropdown, above the filter input (when filtering is enabled) and the\n * options list. Pinned (sticky) to the top and rendered in every state (empty, no-match, loading, error,\n * finished).\n */\n renderDropdownHeader?: SelectProps.DropdownContentRenderer;\n\n /**\n * Renders content at the bottom of the dropdown. The content is always sticky and never scrolls with the\n * options list. It is added below the built-in status region. Receives the current filtering state and a\n * callback to close the dropdown.\n */\n renderDropdownFooter?: SelectProps.DropdownContentRenderer;\n\n /**\n * Determines the ARIA role of the dropdown.\n *\n * - `auto` (default): the dropdown uses a listbox role, or a dialog role wrapping the listbox when built-in\n * filtering is enabled.\n * - `dialog`: the dropdown always uses a dialog role wrapping the listbox, even without built-in filtering. Use\n * this when you render interactive custom content and want assistive technologies to treat the dropdown as a dialog.\n */\n dropdownRole?: SelectProps.DropdownRole;\n\n /**\n * Adds `aria-describedby` to the dropdown's listbox/dialog content.\n */\n dropdownAriaDescribedby?: string;\n}\n\nexport interface SelectProps extends BaseSelectProps {\n /**\n * Adds a small label inline with the input for saving vertical space in the UI.\n * For use with collection select filters only.\n */\n inlineLabelText?: string;\n onLoadItems?: NonCancelableEventHandler<SelectProps.LoadItemsDetail>;\n /**\n * Adds `aria-labelledby` to the component. If you're using this component within a form field,\n * don't set this property because the form field component automatically sets it.\n *\n * Use this property if the component isn't using `inlineLabelText` and isn't surrounded by a form field, or you want to override the value\n * automatically set by the form field (for example, if you have two components within a single form field).\n *\n * To use it correctly, define an ID for the element you want to use as label and set the property to that ID.\n */\n ariaLabelledby?: string;\n /**\n * Defines the variant of the trigger. You can use a simple label or the entire option (`label | option`)\n */\n triggerVariant?: SelectProps.TriggerVariant;\n /**\n * Specifies the currently selected option.\n * If you want to clear the selection, use `null`.\n */\n selectedOption: SelectProps.Option | null;\n /**\n * Called when the user selects an option.\n * The event `detail` contains the current `selectedOption`.\n */\n onChange?: NonCancelableEventHandler<SelectProps.ChangeDetail>;\n\n /**\n * Automatically focuses the trigger when component is mounted.\n */\n autoFocus?: boolean;\n /**\n * Specifies a render function to render custom options in the dropdown menu or trigger.\n */\n renderOption?: SelectProps.SelectOptionItemRenderer;\n}\n\nexport namespace SelectProps {\n export type FilteringType = OptionsFilteringType;\n export type TriggerVariant = 'label' | 'option';\n\n /**\n * The argument passed to the dropdown render functions (`renderDropdownHeader`\n * and `renderDropdownFooter`).\n */\n export interface DropdownContentProps {\n filterText: string;\n\n closeDropdown: () => void;\n }\n\n export type DropdownRole = 'auto' | 'dialog';\n\n /**\n * A render function for custom dropdown content, used by `renderDropdownHeader` and `renderDropdownFooter`.\n * Receives the current filtering state and a callback to close the dropdown.\n */\n export type DropdownContentRenderer = (props: DropdownContentProps) => ReactNode | null;\n\n export type Option = OptionDefinition;\n export type OptionGroup = OptionGroupDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n\n export interface SelectOptionItem {\n type: 'item';\n index: number;\n option: Option;\n highlighted: boolean;\n selected: boolean;\n disabled: boolean;\n parent: SelectOptionGroupItem | null;\n }\n export interface SelectOptionGroupItem {\n type: 'group';\n index: number;\n option: OptionGroup;\n disabled: boolean;\n }\n export interface SelectTriggerOptionItem {\n type: 'trigger';\n option: Option;\n }\n export type SelectItem = SelectOptionItem | SelectOptionGroupItem | SelectTriggerOptionItem;\n export type SelectOptionItemRenderer = (props: { item: SelectItem; filterText?: string }) => ReactNode | null;\n\n /* eslint-disable-next-line @typescript-eslint/no-empty-object-type --\n * Required to create a distinct named type for the documenter.\n **/\n export interface LoadItemsDetail extends OptionsLoadItemsDetail {}\n\n export interface ChangeDetail {\n selectedOption: Option;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n\n export interface Ref {\n /**\n * Sets focus on the element without opening the dropdown or showing a visual focus indicator.\n */\n focus(): void;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/select/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAe3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/select/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAe3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAc3C,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,0BAA0B;IAC3G,kBAAkB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACxC;AAED,QAAA,MAAM,cAAc,6FA4RnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -20,12 +20,13 @@ import PlainList from './parts/plain-list';
|
|
|
20
20
|
import Trigger from './parts/trigger';
|
|
21
21
|
import VirtualList from './parts/virtual-list';
|
|
22
22
|
import { checkOptionValueField } from './utils/check-option-value-field';
|
|
23
|
+
import { composeDropdownContent } from './utils/dropdown-customization';
|
|
23
24
|
import { useAnnouncement } from './utils/use-announcement';
|
|
24
25
|
import { useLoadItems } from './utils/use-load-items';
|
|
25
26
|
import { useNativeSearch } from './utils/use-native-search';
|
|
26
27
|
import { useSelect } from './utils/use-select';
|
|
27
28
|
import styles from './styles.css.js';
|
|
28
|
-
const InternalSelect = React.forwardRef(({ options, filteringType = 'none', filteringPlaceholder, filteringAriaLabel, filteringClearAriaLabel, filteringResultsText, inlineLabelText, ariaRequired, placeholder, disabled, readOnly, ariaLabel, statusType = 'finished', empty, loadingText, finishedText, errorText, noMatch, triggerVariant = 'label', renderHighlightedAriaLive, selectedOption, onBlur, onFocus, onLoadItems, onChange, virtualScroll, expandToViewport, autoFocus, __inFilteringToken, __internalRootRef, renderOption, ...restProps }, externalRef) => {
|
|
29
|
+
const InternalSelect = React.forwardRef(({ options, filteringType = 'none', filteringPlaceholder, filteringAriaLabel, filteringClearAriaLabel, filteringResultsText, inlineLabelText, ariaRequired, placeholder, disabled, readOnly, ariaLabel, statusType = 'finished', empty, loadingText, finishedText, errorText, noMatch, triggerVariant = 'label', renderHighlightedAriaLive, selectedOption, onBlur, onFocus, onLoadItems, onChange, virtualScroll, expandToViewport, autoFocus, __inFilteringToken, __internalRootRef, renderOption, renderDropdownHeader, renderDropdownFooter, dropdownRole, dropdownAriaDescribedby, ...restProps }, externalRef) => {
|
|
29
30
|
var _a;
|
|
30
31
|
const baseProps = getBaseProps(restProps);
|
|
31
32
|
const formFieldContext = useFormFieldContext(restProps);
|
|
@@ -52,7 +53,7 @@ const InternalSelect = React.forwardRef(({ options, filteringType = 'none', filt
|
|
|
52
53
|
const selfControlId = useUniqueId('trigger');
|
|
53
54
|
const controlId = (_a = formFieldContext.controlId) !== null && _a !== void 0 ? _a : selfControlId;
|
|
54
55
|
const scrollToIndex = useRef(null);
|
|
55
|
-
const { isOpen, highlightType, highlightedOption, highlightedIndex, getTriggerProps, getDropdownProps, getFilterProps, getMenuProps, getOptionProps, highlightOption, selectOption, announceSelected, focusActiveRef, } = useSelect({
|
|
56
|
+
const { isOpen, highlightType, highlightedOption, highlightedIndex, getTriggerProps, getDropdownProps, getFilterProps, getMenuProps, getOptionProps, highlightOption, selectOption, announceSelected, focusActiveRef, closeDropdown, } = useSelect({
|
|
56
57
|
selectedOptions: selectedOption ? [selectedOption] : [],
|
|
57
58
|
updateSelectedOption: option => fireNonCancelableEvent(onChange, { selectedOption: option }),
|
|
58
59
|
options: filteredOptions,
|
|
@@ -63,6 +64,7 @@ const InternalSelect = React.forwardRef(({ options, filteringType = 'none', filt
|
|
|
63
64
|
fireLoadItems,
|
|
64
65
|
setFilteringValue,
|
|
65
66
|
statusType,
|
|
67
|
+
dropdownRole,
|
|
66
68
|
});
|
|
67
69
|
const handleNativeSearch = useNativeSearch({
|
|
68
70
|
isEnabled: filteringType === 'none' && !readOnly,
|
|
@@ -76,6 +78,9 @@ const InternalSelect = React.forwardRef(({ options, filteringType = 'none', filt
|
|
|
76
78
|
var _a;
|
|
77
79
|
(_a = scrollToIndex.current) === null || _a === void 0 ? void 0 : _a.call(scrollToIndex, highlightedIndex);
|
|
78
80
|
}, [highlightedIndex]);
|
|
81
|
+
const dropdownContentProps = { filterText: filteringValue, closeDropdown };
|
|
82
|
+
const customDropdownHeader = renderDropdownHeader === null || renderDropdownHeader === void 0 ? void 0 : renderDropdownHeader(dropdownContentProps);
|
|
83
|
+
const customDropdownFooter = renderDropdownFooter === null || renderDropdownFooter === void 0 ? void 0 : renderDropdownFooter(dropdownContentProps);
|
|
79
84
|
const filter = (React.createElement(Filter, { clearAriaLabel: filteringClearAriaLabel, filteringType: filteringType, placeholder: filteringPlaceholder, ariaLabel: filteringAriaLabel, ariaRequired: ariaRequired, value: filteringValue, ...getFilterProps() }));
|
|
80
85
|
const trigger = (React.createElement(Trigger, { renderOption: renderOption, ref: triggerRef, placeholder: placeholder, disabled: disabled, readOnly: readOnly, triggerVariant: triggerVariant, triggerProps: getTriggerProps(disabled, autoFocus), selectedOption: selectedOption, isOpen: isOpen, inFilteringToken: __inFilteringToken, inlineLabelText: inlineLabelText, ...formFieldContext, controlId: controlId, ariaLabelledby: joinStrings(formFieldContext.ariaLabelledby, selectAriaLabelId) }));
|
|
81
86
|
const isEmpty = !options || options.length === 0;
|
|
@@ -100,11 +105,20 @@ const InternalSelect = React.forwardRef(({ options, filteringType = 'none', filt
|
|
|
100
105
|
},
|
|
101
106
|
hasRecoveryCallback: !!onLoadItems,
|
|
102
107
|
});
|
|
108
|
+
const statusFooter = dropdownStatus.isSticky ? (React.createElement(DropdownFooter, { content: isOpen ? dropdownStatus.content : null, id: footerId })) : null;
|
|
109
|
+
const { header: dropdownHeader, footer: dropdownFooter } = composeDropdownContent({
|
|
110
|
+
filter,
|
|
111
|
+
customDropdownHeader,
|
|
112
|
+
customDropdownFooter,
|
|
113
|
+
statusFooter,
|
|
114
|
+
dropdownHeaderClass: styles['dropdown-header'],
|
|
115
|
+
dropdownFooterClass: styles['dropdown-footer'],
|
|
116
|
+
});
|
|
103
117
|
const menuProps = {
|
|
104
118
|
...getMenuProps(),
|
|
105
119
|
onLoadMore: handleLoadMore,
|
|
106
120
|
ariaLabelledby: joinStrings(selectAriaLabelId, controlId),
|
|
107
|
-
ariaDescribedby: dropdownStatus.content ? footerId : undefined,
|
|
121
|
+
ariaDescribedby: joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby),
|
|
108
122
|
ariaRequired,
|
|
109
123
|
};
|
|
110
124
|
const announcement = useAnnouncement({
|
|
@@ -127,7 +141,9 @@ const InternalSelect = React.forwardRef(({ options, filteringType = 'none', filt
|
|
|
127
141
|
const hasOptions = useRef(options.length > 0);
|
|
128
142
|
hasOptions.current = hasOptions.current || options.length > 0;
|
|
129
143
|
return (React.createElement("div", { ...baseProps, ref: mergedRef, className: clsx(styles.root, baseProps.className), onKeyDown: handleNativeSearch },
|
|
130
|
-
React.createElement(Dropdown, { ...dropdownProps, ariaLabelledby: dropdownProps.ariaRole ? joinStrings(selectAriaLabelId, controlId) : undefined, ariaDescribedby: dropdownProps.ariaRole
|
|
144
|
+
React.createElement(Dropdown, { ...dropdownProps, ariaLabelledby: dropdownProps.ariaRole ? joinStrings(selectAriaLabelId, controlId) : undefined, ariaDescribedby: dropdownProps.ariaRole
|
|
145
|
+
? joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby)
|
|
146
|
+
: undefined, open: isOpen, stretchTriggerHeight: !!__inFilteringToken, minWidth: getDropdownMinWidth({ expandToViewport, triggerWidth }), maxWidth: getBreakpointValue('xxs'), trigger: trigger, header: dropdownHeader, onMouseDown: handleMouseDown, footer: dropdownFooter, expandToViewport: expandToViewport,
|
|
131
147
|
// Forces dropdown position recalculation when new options are loaded
|
|
132
148
|
contentKey: hasOptions.current.toString(), content: React.createElement(ListComponent, { listBottom: !dropdownStatus.isSticky ? (React.createElement(DropdownFooter, { content: isOpen ? dropdownStatus.content : null, id: footerId })) : null, renderOption: renderOption, menuProps: menuProps, getOptionProps: getOptionProps, filteredOptions: filteredOptions, filteringValue: filteringValue, ref: scrollToIndex, hasDropdownStatus: dropdownStatus.content !== null, screenReaderContent: announcement, highlightType: highlightType }) }),
|
|
133
149
|
React.createElement("div", { hidden: true, id: selectAriaLabelId }, ariaLabel || inlineLabelText)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/select/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,M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J,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useResizeObserver, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport Dropdown from '../dropdown/internal';\nimport { useInternalI18n } from '../i18n/context.js';\nimport { getBaseProps } from '../internal/base-component';\nimport { getBreakpointValue } from '../internal/breakpoints';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options.js';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SomeRequired } from '../internal/types';\nimport { getDropdownMinWidth } from '../internal/utils/get-dropdown-min-width';\nimport { joinStrings } from '../internal/utils/strings/join-strings.js';\nimport { OptionGroup } from '../types/option';\nimport { SelectProps } from './interfaces';\nimport Filter from './parts/filter';\nimport PlainList, { SelectListProps } from './parts/plain-list';\nimport Trigger from './parts/trigger';\nimport VirtualList from './parts/virtual-list';\nimport { checkOptionValueField } from './utils/check-option-value-field';\nimport { useAnnouncement } from './utils/use-announcement';\nimport { useLoadItems } from './utils/use-load-items';\nimport { useNativeSearch } from './utils/use-native-search';\nimport { useSelect } from './utils/use-select';\n\nimport styles from './styles.css.js';\n\nexport interface InternalSelectProps extends SomeRequired<SelectProps, 'options'>, InternalBaseComponentProps {\n __inFilteringToken?: 'root' | 'nested';\n}\n\nconst InternalSelect = React.forwardRef(\n (\n {\n options,\n filteringType = 'none',\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n filteringResultsText,\n inlineLabelText,\n ariaRequired,\n placeholder,\n disabled,\n readOnly,\n ariaLabel,\n statusType = 'finished',\n empty,\n loadingText,\n finishedText,\n errorText,\n noMatch,\n triggerVariant = 'label',\n renderHighlightedAriaLive,\n selectedOption,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n virtualScroll,\n expandToViewport,\n autoFocus,\n __inFilteringToken,\n __internalRootRef,\n renderOption,\n ...restProps\n }: InternalSelectProps,\n externalRef: React.Ref<SelectProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n\n const i18n = useInternalI18n('select');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Select', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n\n checkControlled('Select', 'selectedOption', selectedOption, 'onChange', onChange);\n\n checkOptionValueField('Select', 'options', options);\n\n const [filteringValue, setFilteringValue] = useState('');\n\n const { filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(\n options,\n filteringType,\n filteringValue\n );\n\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [triggerWidth, setTriggerWidth] = useState<number | null>(null);\n useResizeObserver(\n () => triggerRef.current,\n entry => entry.borderBoxWidth > 0 && setTriggerWidth(entry.borderBoxWidth)\n );\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightType,\n highlightedOption,\n highlightedIndex,\n getTriggerProps,\n getDropdownProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n highlightOption,\n selectOption,\n announceSelected,\n focusActiveRef,\n } = useSelect({\n selectedOptions: selectedOption ? [selectedOption] : [],\n updateSelectedOption: option => fireNonCancelableEvent(onChange, { selectedOption: option }),\n options: filteredOptions,\n filteringType,\n onBlur,\n onFocus,\n externalRef,\n fireLoadItems,\n setFilteringValue,\n statusType,\n });\n\n const handleNativeSearch = useNativeSearch({\n isEnabled: filteringType === 'none' && !readOnly,\n options: filteredOptions,\n highlightOption: !isOpen ? selectOption : highlightOption,\n highlightedOption: !isOpen ? selectedOption : highlightedOption?.option,\n });\n\n const selectAriaLabelId = useUniqueId('select-arialabel-');\n const footerId = useUniqueId('footer');\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const filter = (\n <Filter\n clearAriaLabel={filteringClearAriaLabel}\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n {...getFilterProps()}\n />\n );\n\n const trigger = (\n <Trigger\n renderOption={renderOption}\n ref={triggerRef}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n triggerVariant={triggerVariant}\n triggerProps={getTriggerProps(disabled, autoFocus)}\n selectedOption={selectedOption}\n isOpen={isOpen}\n inFilteringToken={__inFilteringToken}\n inlineLabelText={inlineLabelText}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, selectAriaLabelId)}\n />\n );\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const isFiltered =\n filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;\n const filteredText = isFiltered ? filteringResultsText?.(matchesCount, totalCount) : undefined;\n\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n filteringResultsText: filteredText,\n errorIconAriaLabel,\n onRecoveryClick: () => {\n handleRecoveryClick();\n focusActiveRef();\n },\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const menuProps = {\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: joinStrings(selectAriaLabelId, controlId),\n ariaDescribedby: dropdownStatus.content ? footerId : undefined,\n ariaRequired,\n };\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const handleMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n const dropdownProps = getDropdownProps();\n\n const hasOptions = useRef(options.length > 0);\n hasOptions.current = hasOptions.current || options.length > 0;\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(styles.root, baseProps.className)}\n onKeyDown={handleNativeSearch}\n >\n <Dropdown\n {...dropdownProps}\n ariaLabelledby={dropdownProps.ariaRole ? joinStrings(selectAriaLabelId, controlId) : undefined}\n ariaDescribedby={dropdownProps.ariaRole ? (dropdownStatus.content ? footerId : undefined) : undefined}\n open={isOpen}\n stretchTriggerHeight={!!__inFilteringToken}\n minWidth={getDropdownMinWidth({ expandToViewport, triggerWidth })}\n maxWidth={getBreakpointValue('xxs')} // AWSUI-19898\n trigger={trigger}\n header={filter}\n onMouseDown={handleMouseDown}\n footer={\n dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n expandToViewport={expandToViewport}\n // Forces dropdown position recalculation when new options are loaded\n contentKey={hasOptions.current.toString()}\n content={\n <ListComponent\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n renderOption={renderOption}\n menuProps={menuProps}\n getOptionProps={getOptionProps}\n filteredOptions={filteredOptions}\n filteringValue={filteringValue}\n ref={scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n screenReaderContent={announcement}\n highlightType={highlightType}\n />\n }\n />\n <div hidden={true} id={selectAriaLabelId}>\n {ariaLabel || inlineLabelText}\n </div>\n </div>\n );\n }\n);\n\nexport default InternalSelect;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/select/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEvH,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAGjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAGxE,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,SAA8B,MAAM,oBAAoB,CAAC;AAChE,OAAO,OAA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React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useResizeObserver, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport Dropdown from '../dropdown/internal';\nimport { useInternalI18n } from '../i18n/context.js';\nimport { getBaseProps } from '../internal/base-component';\nimport { getBreakpointValue } from '../internal/breakpoints';\nimport DropdownFooter from '../internal/components/dropdown-footer';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options.js';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SomeRequired } from '../internal/types';\nimport { getDropdownMinWidth } from '../internal/utils/get-dropdown-min-width';\nimport { joinStrings } from '../internal/utils/strings/join-strings.js';\nimport { OptionGroup } from '../types/option';\nimport { SelectProps } from './interfaces';\nimport Filter from './parts/filter';\nimport PlainList, { SelectListProps } from './parts/plain-list';\nimport Trigger from './parts/trigger';\nimport VirtualList from './parts/virtual-list';\nimport { checkOptionValueField } from './utils/check-option-value-field';\nimport { composeDropdownContent } from './utils/dropdown-customization';\nimport { useAnnouncement } from './utils/use-announcement';\nimport { useLoadItems } from './utils/use-load-items';\nimport { useNativeSearch } from './utils/use-native-search';\nimport { useSelect } from './utils/use-select';\n\nimport styles from './styles.css.js';\n\nexport interface InternalSelectProps extends SomeRequired<SelectProps, 'options'>, InternalBaseComponentProps {\n __inFilteringToken?: 'root' | 'nested';\n}\n\nconst InternalSelect = React.forwardRef(\n (\n {\n options,\n filteringType = 'none',\n filteringPlaceholder,\n filteringAriaLabel,\n filteringClearAriaLabel,\n filteringResultsText,\n inlineLabelText,\n ariaRequired,\n placeholder,\n disabled,\n readOnly,\n ariaLabel,\n statusType = 'finished',\n empty,\n loadingText,\n finishedText,\n errorText,\n noMatch,\n triggerVariant = 'label',\n renderHighlightedAriaLive,\n selectedOption,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n virtualScroll,\n expandToViewport,\n autoFocus,\n __inFilteringToken,\n __internalRootRef,\n renderOption,\n renderDropdownHeader,\n renderDropdownFooter,\n dropdownRole,\n dropdownAriaDescribedby,\n ...restProps\n }: InternalSelectProps,\n externalRef: React.Ref<SelectProps.Ref>\n ) => {\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n\n const i18n = useInternalI18n('select');\n const errorIconAriaLabel = i18n('errorIconAriaLabel', restProps.errorIconAriaLabel);\n const selectedAriaLabel = i18n('selectedAriaLabel', restProps.selectedAriaLabel);\n const recoveryText = i18n('recoveryText', restProps.recoveryText);\n\n if (restProps.recoveryText && !onLoadItems) {\n warnOnce('Select', '`onLoadItems` must be provided for `recoveryText` to be displayed.');\n }\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n\n checkControlled('Select', 'selectedOption', selectedOption, 'onChange', onChange);\n\n checkOptionValueField('Select', 'options', options);\n\n const [filteringValue, setFilteringValue] = useState('');\n\n const { filteredOptions, parentMap, totalCount, matchesCount } = prepareOptions(\n options,\n filteringType,\n filteringValue\n );\n\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [triggerWidth, setTriggerWidth] = useState<number | null>(null);\n useResizeObserver(\n () => triggerRef.current,\n entry => entry.borderBoxWidth > 0 && setTriggerWidth(entry.borderBoxWidth)\n );\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightType,\n highlightedOption,\n highlightedIndex,\n getTriggerProps,\n getDropdownProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n highlightOption,\n selectOption,\n announceSelected,\n focusActiveRef,\n closeDropdown,\n } = useSelect({\n selectedOptions: selectedOption ? [selectedOption] : [],\n updateSelectedOption: option => fireNonCancelableEvent(onChange, { selectedOption: option }),\n options: filteredOptions,\n filteringType,\n onBlur,\n onFocus,\n externalRef,\n fireLoadItems,\n setFilteringValue,\n statusType,\n dropdownRole,\n });\n\n const handleNativeSearch = useNativeSearch({\n isEnabled: filteringType === 'none' && !readOnly,\n options: filteredOptions,\n highlightOption: !isOpen ? selectOption : highlightOption,\n highlightedOption: !isOpen ? selectedOption : highlightedOption?.option,\n });\n\n const selectAriaLabelId = useUniqueId('select-arialabel-');\n const footerId = useUniqueId('footer');\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const dropdownContentProps: SelectProps.DropdownContentProps = { filterText: filteringValue, closeDropdown };\n const customDropdownHeader = renderDropdownHeader?.(dropdownContentProps);\n const customDropdownFooter = renderDropdownFooter?.(dropdownContentProps);\n\n const filter = (\n <Filter\n clearAriaLabel={filteringClearAriaLabel}\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n {...getFilterProps()}\n />\n );\n\n const trigger = (\n <Trigger\n renderOption={renderOption}\n ref={triggerRef}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n triggerVariant={triggerVariant}\n triggerProps={getTriggerProps(disabled, autoFocus)}\n selectedOption={selectedOption}\n isOpen={isOpen}\n inFilteringToken={__inFilteringToken}\n inlineLabelText={inlineLabelText}\n {...formFieldContext}\n controlId={controlId}\n ariaLabelledby={joinStrings(formFieldContext.ariaLabelledby, selectAriaLabelId)}\n />\n );\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const isFiltered =\n filteringType !== 'none' && filteringValue.length > 0 && filteredOptions && filteredOptions.length > 0;\n const filteredText = isFiltered ? filteringResultsText?.(matchesCount, totalCount) : undefined;\n\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n filteringResultsText: filteredText,\n errorIconAriaLabel,\n onRecoveryClick: () => {\n handleRecoveryClick();\n focusActiveRef();\n },\n hasRecoveryCallback: !!onLoadItems,\n });\n\n const statusFooter = dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null;\n const { header: dropdownHeader, footer: dropdownFooter } = composeDropdownContent({\n filter,\n customDropdownHeader,\n customDropdownFooter,\n statusFooter,\n dropdownHeaderClass: styles['dropdown-header'],\n dropdownFooterClass: styles['dropdown-footer'],\n });\n\n const menuProps = {\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: joinStrings(selectAriaLabelId, controlId),\n ariaDescribedby: joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby),\n ariaRequired,\n };\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const handleMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n const dropdownProps = getDropdownProps();\n\n const hasOptions = useRef(options.length > 0);\n hasOptions.current = hasOptions.current || options.length > 0;\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(styles.root, baseProps.className)}\n onKeyDown={handleNativeSearch}\n >\n <Dropdown\n {...dropdownProps}\n ariaLabelledby={dropdownProps.ariaRole ? joinStrings(selectAriaLabelId, controlId) : undefined}\n ariaDescribedby={\n dropdownProps.ariaRole\n ? joinStrings(dropdownStatus.content ? footerId : undefined, dropdownAriaDescribedby)\n : undefined\n }\n open={isOpen}\n stretchTriggerHeight={!!__inFilteringToken}\n minWidth={getDropdownMinWidth({ expandToViewport, triggerWidth })}\n maxWidth={getBreakpointValue('xxs')} // AWSUI-19898\n trigger={trigger}\n header={dropdownHeader}\n onMouseDown={handleMouseDown}\n footer={dropdownFooter}\n expandToViewport={expandToViewport}\n // Forces dropdown position recalculation when new options are loaded\n contentKey={hasOptions.current.toString()}\n content={\n <ListComponent\n listBottom={\n !dropdownStatus.isSticky ? (\n <DropdownFooter content={isOpen ? dropdownStatus.content : null} id={footerId} />\n ) : null\n }\n renderOption={renderOption}\n menuProps={menuProps}\n getOptionProps={getOptionProps}\n filteredOptions={filteredOptions}\n filteringValue={filteringValue}\n ref={scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n screenReaderContent={announcement}\n highlightType={highlightType}\n />\n }\n />\n <div hidden={true} id={selectAriaLabelId}>\n {ariaLabel || inlineLabelText}\n </div>\n </div>\n );\n }\n);\n\nexport default InternalSelect;\n"]}
|
|
@@ -5,6 +5,6 @@ export interface FilterProps extends InternalInputProps {
|
|
|
5
5
|
ref?: React.Ref<HTMLInputElement>;
|
|
6
6
|
filteringType: SelectProps.FilteringType;
|
|
7
7
|
}
|
|
8
|
-
declare const Filter: React.ForwardRefExoticComponent<Pick<FilterProps, "style" | "disabled" | "className" | "id" | "name" | "type" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "placeholder" | "inputMode" | "autoFocus" | "value" | "autoComplete" | "readOnly" | "step" | "invalid" | "ariaLabel" | "ariaDescribedby" | "__internalRootRef" | "warning" | "ariaLabelledby" | "filteringType" | "
|
|
8
|
+
declare const Filter: React.ForwardRefExoticComponent<Pick<FilterProps, "style" | "disabled" | "className" | "id" | "name" | "type" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "placeholder" | "prefix" | "inputMode" | "autoFocus" | "value" | "autoComplete" | "readOnly" | "step" | "invalid" | "ariaLabel" | "ariaDescribedby" | "__internalRootRef" | "warning" | "ariaLabelledby" | "filteringType" | "__injectAnalyticsComponentMetadata" | "__skipNativeAttributesWarnings" | "ariaRequired" | "controlId" | "suffix" | "nativeInputAttributes" | "disableBrowserAutocorrect" | "spellcheck" | "clearAriaLabel" | "__startIcon" | "__startIconVariant" | "__onStartIconClick" | "__endIcon" | "__onEndIconClick" | "__noBorderRadius" | "__onDelayedInput" | "__onBlurWithDetail" | "__inheritFormFieldProps" | "__inlineLabelText" | "__fullWidth"> & React.RefAttributes<HTMLInputElement>>;
|
|
9
9
|
export default Filter;
|
|
10
10
|
//# sourceMappingURL=filter.d.ts.map
|