@cloudscape-design/components-themeable 3.0.1258 → 3.0.1260
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/{internal/components/dropdown → dropdown}/motion.scss +2 -2
- package/lib/internal/scss/dropdown/styles.scss +127 -0
- package/lib/internal/scss/dropdown/test-classes/styles.scss +16 -0
- package/lib/internal/scss/internal/components/dropdown/styles.scss +2 -113
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +155 -152
- package/lib/internal/scss/internal/styles/forms/mixins.scss +15 -11
- package/lib/internal/template/alert/styles.css.js +27 -27
- package/lib/internal/template/alert/styles.scoped.css +50 -50
- package/lib/internal/template/alert/styles.selectors.js +27 -27
- package/lib/internal/template/annotation-context/annotation/styles.css.js +13 -13
- package/lib/internal/template/annotation-context/annotation/styles.scoped.css +21 -21
- package/lib/internal/template/annotation-context/annotation/styles.selectors.js +13 -13
- package/lib/internal/template/app-layout/notifications/styles.css.js +3 -3
- package/lib/internal/template/app-layout/notifications/styles.scoped.css +7 -7
- package/lib/internal/template/app-layout/notifications/styles.selectors.js +3 -3
- package/lib/internal/template/app-layout/visual-refresh/styles.css.js +86 -86
- package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +258 -258
- package/lib/internal/template/app-layout/visual-refresh/styles.selectors.js +86 -86
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.css.js +32 -32
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +89 -89
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +32 -32
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +7 -7
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +27 -27
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +54 -54
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +27 -27
- package/lib/internal/template/attribute-editor/styles.css.js +15 -15
- package/lib/internal/template/attribute-editor/styles.scoped.css +28 -28
- package/lib/internal/template/attribute-editor/styles.selectors.js +15 -15
- package/lib/internal/template/autosuggest/interfaces.d.ts +1 -1
- package/lib/internal/template/autosuggest/interfaces.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/interfaces.js.map +1 -1
- package/lib/internal/template/autosuggest/internal.js.map +1 -1
- package/lib/internal/template/autosuggest/load-more-controller.d.ts +1 -1
- package/lib/internal/template/autosuggest/load-more-controller.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/load-more-controller.js.map +1 -1
- package/lib/internal/template/breadcrumb-group/item/styles.css.js +7 -7
- package/lib/internal/template/breadcrumb-group/item/styles.scoped.css +28 -28
- package/lib/internal/template/breadcrumb-group/item/styles.selectors.js +7 -7
- package/lib/internal/template/button/styles.css.js +22 -22
- package/lib/internal/template/button/styles.scoped.css +256 -256
- package/lib/internal/template/button/styles.selectors.js +22 -22
- package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.js +1 -1
- package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
- package/lib/internal/template/button-dropdown/interfaces.d.ts +1 -1
- package/lib/internal/template/button-dropdown/interfaces.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/interfaces.js.map +1 -1
- package/lib/internal/template/button-dropdown/internal.js +1 -1
- package/lib/internal/template/button-dropdown/internal.js.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.js +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.js.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/styles.css.js +21 -21
- package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +37 -37
- package/lib/internal/template/button-dropdown/item-element/styles.selectors.js +21 -21
- package/lib/internal/template/checkbox/styles.css.js +3 -3
- package/lib/internal/template/checkbox/styles.scoped.css +11 -11
- package/lib/internal/template/checkbox/styles.selectors.js +3 -3
- package/lib/internal/template/content-layout/styles.css.js +14 -14
- package/lib/internal/template/content-layout/styles.scoped.css +27 -27
- package/lib/internal/template/content-layout/styles.selectors.js +14 -14
- package/lib/internal/template/date-picker/index.js +1 -1
- package/lib/internal/template/date-picker/index.js.map +1 -1
- package/lib/internal/template/date-picker/interfaces.d.ts +1 -1
- package/lib/internal/template/date-picker/interfaces.d.ts.map +1 -1
- package/lib/internal/template/date-picker/interfaces.js.map +1 -1
- package/lib/internal/template/date-range-picker/index.js +1 -1
- package/lib/internal/template/date-range-picker/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/interfaces.d.ts +1 -1
- package/lib/internal/template/date-range-picker/interfaces.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/interfaces.js.map +1 -1
- package/lib/internal/template/dropdown/context.d.ts.map +1 -0
- package/lib/internal/template/dropdown/context.js.map +1 -0
- package/lib/internal/template/{internal/components/dropdown → dropdown}/dropdown-fit-handler.d.ts +1 -1
- package/lib/internal/template/dropdown/dropdown-fit-handler.d.ts.map +1 -0
- package/lib/internal/template/{internal/components/dropdown → dropdown}/dropdown-fit-handler.js +1 -1
- package/lib/internal/template/dropdown/dropdown-fit-handler.js.map +1 -0
- package/lib/internal/template/dropdown/dropdown-position.d.ts.map +1 -0
- package/lib/internal/template/dropdown/dropdown-position.js.map +1 -0
- package/lib/internal/template/dropdown/index.d.ts +7 -0
- package/lib/internal/template/dropdown/index.d.ts.map +1 -0
- package/lib/internal/template/dropdown/index.js +16 -0
- package/lib/internal/template/dropdown/index.js.map +1 -0
- package/lib/internal/template/{internal/components/dropdown → dropdown}/interfaces.d.ts +54 -82
- package/lib/internal/template/dropdown/interfaces.d.ts.map +1 -0
- package/lib/internal/template/dropdown/interfaces.js.map +1 -0
- package/lib/internal/template/dropdown/internal.d.ts +24 -0
- package/lib/internal/template/dropdown/internal.d.ts.map +1 -0
- package/lib/internal/template/{internal/components/dropdown/index.js → dropdown/internal.js} +29 -21
- package/lib/internal/template/dropdown/internal.js.map +1 -0
- package/lib/internal/template/dropdown/style.d.ts +9 -0
- package/lib/internal/template/dropdown/style.d.ts.map +1 -0
- package/lib/internal/template/dropdown/style.js +16 -0
- package/lib/internal/template/dropdown/style.js.map +1 -0
- package/lib/internal/template/dropdown/styles.css.js +25 -0
- package/lib/internal/template/dropdown/styles.scoped.css +380 -0
- package/lib/internal/template/dropdown/styles.selectors.js +26 -0
- package/lib/internal/template/dropdown/test-classes/styles.css.js +8 -0
- package/lib/internal/template/dropdown/test-classes/styles.scoped.css +15 -0
- package/lib/internal/template/dropdown/test-classes/styles.selectors.js +9 -0
- package/lib/internal/template/file-token-group/styles.css.js +23 -23
- package/lib/internal/template/file-token-group/styles.scoped.css +36 -36
- package/lib/internal/template/file-token-group/styles.selectors.js +23 -23
- package/lib/internal/template/flashbar/styles.css.js +50 -50
- package/lib/internal/template/flashbar/styles.scoped.css +187 -187
- package/lib/internal/template/flashbar/styles.selectors.js +50 -50
- package/lib/internal/template/help-panel/styles.css.js +6 -6
- package/lib/internal/template/help-panel/styles.scoped.css +73 -73
- package/lib/internal/template/help-panel/styles.selectors.js +6 -6
- package/lib/internal/template/index.d.ts +1 -0
- package/lib/internal/template/index.d.ts.map +1 -1
- package/lib/internal/template/index.js +1 -0
- package/lib/internal/template/index.js.map +1 -1
- package/lib/internal/template/input/styles.css.js +13 -13
- package/lib/internal/template/input/styles.scoped.css +74 -74
- package/lib/internal/template/input/styles.selectors.js +13 -13
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/autosuggest-input/index.d.ts +1 -1
- package/lib/internal/template/internal/components/autosuggest-input/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/autosuggest-input/index.js +2 -2
- package/lib/internal/template/internal/components/autosuggest-input/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.css.js +30 -30
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.scoped.css +58 -58
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.selectors.js +30 -30
- package/lib/internal/template/internal/components/dropdown/styles.css.js +2 -20
- package/lib/internal/template/internal/components/dropdown/styles.scoped.css +4 -373
- package/lib/internal/template/internal/components/dropdown/styles.selectors.js +2 -20
- package/lib/internal/template/internal/components/radio-button/styles.css.js +7 -7
- package/lib/internal/template/internal/components/radio-button/styles.scoped.css +18 -18
- package/lib/internal/template/internal/components/radio-button/styles.selectors.js +7 -7
- package/lib/internal/template/internal/components/token-list/styles.css.js +10 -10
- package/lib/internal/template/internal/components/token-list/styles.scoped.css +25 -25
- package/lib/internal/template/internal/components/token-list/styles.selectors.js +10 -10
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts +3 -0
- package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/lib/internal/template/internal/generated/custom-css-properties/index.js +154 -151
- package/lib/internal/template/internal/generated/custom-css-properties/index.js.map +1 -1
- package/lib/internal/template/internal/utils/browser-scrollbar-size.js +1 -1
- package/lib/internal/template/internal/utils/browser-scrollbar-size.js.map +1 -1
- package/lib/internal/template/internal/utils/get-dropdown-min-width.d.ts +1 -1
- package/lib/internal/template/internal/utils/get-dropdown-min-width.d.ts.map +1 -1
- package/lib/internal/template/internal/utils/get-dropdown-min-width.js.map +1 -1
- package/lib/internal/template/link/styles.css.js +20 -20
- package/lib/internal/template/link/styles.scoped.css +103 -103
- package/lib/internal/template/link/styles.selectors.js +20 -20
- package/lib/internal/template/list/interfaces.d.ts +2 -2
- package/lib/internal/template/list/interfaces.d.ts.map +1 -1
- package/lib/internal/template/list/interfaces.js.map +1 -1
- package/lib/internal/template/modal/styles.css.js +31 -31
- package/lib/internal/template/modal/styles.scoped.css +48 -48
- package/lib/internal/template/modal/styles.selectors.js +31 -31
- package/lib/internal/template/multiselect/embedded.d.ts +1 -1
- package/lib/internal/template/multiselect/internal.d.ts +1 -1
- package/lib/internal/template/multiselect/internal.js +1 -1
- package/lib/internal/template/multiselect/internal.js.map +1 -1
- package/lib/internal/template/multiselect/use-multiselect.d.ts +1 -1
- package/lib/internal/template/package.json +1 -0
- package/lib/internal/template/progress-bar/styles.css.js +18 -18
- package/lib/internal/template/progress-bar/styles.scoped.css +48 -48
- package/lib/internal/template/progress-bar/styles.selectors.js +18 -18
- package/lib/internal/template/prompt-input/styles.css.js +17 -17
- package/lib/internal/template/prompt-input/styles.scoped.css +79 -79
- package/lib/internal/template/prompt-input/styles.selectors.js +17 -17
- package/lib/internal/template/property-filter/interfaces.d.ts +1 -1
- package/lib/internal/template/property-filter/interfaces.d.ts.map +1 -1
- package/lib/internal/template/property-filter/interfaces.js.map +1 -1
- package/lib/internal/template/property-filter/property-filter-autosuggest.d.ts.map +1 -1
- package/lib/internal/template/property-filter/property-filter-autosuggest.js.map +1 -1
- package/lib/internal/template/property-filter/use-load-items.d.ts +1 -1
- package/lib/internal/template/segmented-control/styles.css.js +16 -16
- package/lib/internal/template/segmented-control/styles.scoped.css +46 -46
- package/lib/internal/template/segmented-control/styles.selectors.js +16 -16
- package/lib/internal/template/select/interfaces.d.ts +1 -1
- 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.js +1 -1
- package/lib/internal/template/select/internal.js.map +1 -1
- package/lib/internal/template/select/utils/use-select.d.ts +2 -2
- package/lib/internal/template/select/utils/use-select.d.ts.map +1 -1
- package/lib/internal/template/select/utils/use-select.js.map +1 -1
- package/lib/internal/template/slider/styles.css.js +26 -26
- package/lib/internal/template/slider/styles.scoped.css +165 -165
- package/lib/internal/template/slider/styles.selectors.js +26 -26
- package/lib/internal/template/spinner/styles.css.js +13 -13
- package/lib/internal/template/spinner/styles.scoped.css +39 -39
- package/lib/internal/template/spinner/styles.selectors.js +13 -13
- package/lib/internal/template/tabs/styles.css.js +30 -30
- package/lib/internal/template/tabs/styles.scoped.css +76 -76
- package/lib/internal/template/tabs/styles.selectors.js +30 -30
- package/lib/internal/template/tag-editor/styles.css.js +3 -3
- package/lib/internal/template/tag-editor/styles.scoped.css +13 -13
- package/lib/internal/template/tag-editor/styles.selectors.js +3 -3
- package/lib/internal/template/test-utils/dom/autosuggest/index.js +18 -17
- package/lib/internal/template/test-utils/dom/autosuggest/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/button-dropdown/index.js +3 -2
- package/lib/internal/template/test-utils/dom/button-dropdown/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/dropdown/index.d.ts +41 -0
- package/lib/internal/template/test-utils/dom/dropdown/index.js +65 -0
- package/lib/internal/template/test-utils/dom/dropdown/index.js.map +1 -0
- package/lib/internal/template/test-utils/dom/index.d.ts +28 -0
- package/lib/internal/template/test-utils/dom/index.js +21 -2
- package/lib/internal/template/test-utils/dom/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/internal/autosuggest-input.js +7 -6
- package/lib/internal/template/test-utils/dom/internal/autosuggest-input.js.map +1 -1
- package/lib/internal/template/test-utils/dom/internal/dropdown-host.d.ts +3 -3
- package/lib/internal/template/test-utils/dom/internal/dropdown-host.js +24 -23
- package/lib/internal/template/test-utils/dom/internal/dropdown-host.js.map +1 -1
- package/lib/internal/template/test-utils/dom/internal/dropdown.d.ts +1 -0
- package/lib/internal/template/test-utils/dom/internal/dropdown.js +7 -2
- package/lib/internal/template/test-utils/dom/internal/dropdown.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/autosuggest/index.js +18 -17
- package/lib/internal/template/test-utils/selectors/autosuggest/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/button-dropdown/index.js +3 -2
- package/lib/internal/template/test-utils/selectors/button-dropdown/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/dropdown/index.d.ts +41 -0
- package/lib/internal/template/test-utils/selectors/dropdown/index.js +65 -0
- package/lib/internal/template/test-utils/selectors/dropdown/index.js.map +1 -0
- package/lib/internal/template/test-utils/selectors/index.d.ts +18 -0
- package/lib/internal/template/test-utils/selectors/index.js +16 -2
- package/lib/internal/template/test-utils/selectors/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/internal/autosuggest-input.js +7 -6
- package/lib/internal/template/test-utils/selectors/internal/autosuggest-input.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/internal/dropdown-host.d.ts +3 -3
- package/lib/internal/template/test-utils/selectors/internal/dropdown-host.js +23 -22
- package/lib/internal/template/test-utils/selectors/internal/dropdown-host.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/internal/dropdown.d.ts +1 -0
- package/lib/internal/template/test-utils/selectors/internal/dropdown.js +7 -2
- package/lib/internal/template/test-utils/selectors/internal/dropdown.js.map +1 -1
- package/lib/internal/template/text-content/styles.css.js +1 -1
- package/lib/internal/template/text-content/styles.scoped.css +66 -66
- package/lib/internal/template/text-content/styles.selectors.js +1 -1
- package/lib/internal/template/textarea/styles.css.js +5 -5
- package/lib/internal/template/textarea/styles.scoped.css +45 -45
- package/lib/internal/template/textarea/styles.selectors.js +5 -5
- package/lib/internal/template/toggle/styles.css.js +10 -10
- package/lib/internal/template/toggle/styles.scoped.css +23 -23
- package/lib/internal/template/toggle/styles.selectors.js +10 -10
- package/lib/internal/template/token/styles.css.js +14 -14
- package/lib/internal/template/token/styles.scoped.css +48 -48
- package/lib/internal/template/token/styles.selectors.js +14 -14
- package/package.json +1 -1
- package/lib/internal/template/internal/components/dropdown/context.d.ts.map +0 -1
- package/lib/internal/template/internal/components/dropdown/context.js.map +0 -1
- package/lib/internal/template/internal/components/dropdown/dropdown-fit-handler.d.ts.map +0 -1
- package/lib/internal/template/internal/components/dropdown/dropdown-fit-handler.js.map +0 -1
- package/lib/internal/template/internal/components/dropdown/dropdown-position.d.ts.map +0 -1
- package/lib/internal/template/internal/components/dropdown/dropdown-position.js.map +0 -1
- package/lib/internal/template/internal/components/dropdown/index.d.ts +0 -4
- package/lib/internal/template/internal/components/dropdown/index.d.ts.map +0 -1
- package/lib/internal/template/internal/components/dropdown/index.js.map +0 -1
- package/lib/internal/template/internal/components/dropdown/interfaces.d.ts.map +0 -1
- package/lib/internal/template/internal/components/dropdown/interfaces.js.map +0 -1
- /package/lib/internal/template/{internal/components/dropdown → dropdown}/context.d.ts +0 -0
- /package/lib/internal/template/{internal/components/dropdown → dropdown}/context.js +0 -0
- /package/lib/internal/template/{internal/components/dropdown → dropdown}/dropdown-position.d.ts +0 -0
- /package/lib/internal/template/{internal/components/dropdown → dropdown}/dropdown-position.js +0 -0
- /package/lib/internal/template/{internal/components/dropdown → dropdown}/interfaces.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-picker/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { CalendarProps } from '../calendar/interfaces';\nimport {
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-picker/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { CalendarProps } from '../calendar/interfaces';\nimport { ExpandToViewport } from '../dropdown/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DateFormat, DateGranularity, EditableDateFormat } from '../internal/utils/date-time/interfaces';\n\nexport interface DatePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n CalendarProps {\n /**\n * Specifies the placeholder text rendered when the value is an empty string.\n */\n placeholder?: string;\n\n /**\n * Specifies a function that generates the `aria-label` for the 'open calendar' button. The `selectedDate` parameter is\n * a human-readable localised string representing the current value of the input.\n * (for example, ``selectedDate => 'Choose Date' + (selectedDate ? `, selected date is ${selectedDate}` : '')``)\n * @deprecated Use `i18nStrings.openCalendarAriaLabel` instead.\n */\n openCalendarAriaLabel?: DatePickerProps.OpenCalendarAriaLabel;\n\n /**\n * Specifies the name of the control used in HTML forms.\n */\n name?: string;\n\n /**\n * Specifies if the control is disabled, which prevents the\n * user from modifying the value and prevents the value from\n * being included in a form submission. A disabled control can't\n * receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies if the control is read-only, which prevents the\n * user from modifying the value but includes it in a form\n * submission. A read-only control can receive focus.\n *\n * Do not use read-only inputs outside of a form.\n */\n readOnly?: boolean;\n\n /**\n * Indicates whether the control should be focused as\n * soon as the page loads, which enables the user to\n * start typing without having to manually focus the control. Don't\n * use this option on pages where the control may be\n * scrolled out of the viewport.\n */\n autoFocus?: boolean;\n\n /**\n * Adds an `aria-label` to the native control.\n *\n * Use this if you don't have a visible label for this control.\n */\n ariaLabel?: string;\n\n /**\n * Specifies whether to add `aria-required` to the native control.\n */\n ariaRequired?: boolean;\n\n /**\n * The format as it is displayed. It can take the following values:\n * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01)\n * * `long-localized`: a more human-readable, localized format, e.g.: January 30, 2024 (or January, 2024)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n *\n * @default 'slashed'\n */\n format?: DatePickerProps.Format;\n\n /**\n * Specifies the date format to use when the format is 'long-localized' and the user needs to edit the date.\n *\n * The format of the input as it is being interacted with. It can take the following values:\n * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n *\n * @default 'slashed'.\n */\n inputFormat?: DatePickerProps.InputFormat;\n\n /**\n * Called when input focus is moved to the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * An object containing all the necessary localized strings required by\n * the component.\n * @i18n\n */\n i18nStrings?: DatePickerProps.I18nStrings;\n}\n\nexport namespace DatePickerProps {\n export interface ChangeDetail {\n /**\n * The new value of this date-picker.\n */\n value: string;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export interface OpenCalendarAriaLabel {\n (selectedDate: string | null): string;\n }\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export interface I18nStrings extends CalendarProps.I18nStrings {\n /**\n * Specifies a function that generates the `aria-label` for the 'open calendar' button. The `selectedDate` parameter is\n * a human-readable localised string representing the current value of the input, or `null` when no date is selected.\n * @i18n\n */\n openCalendarAriaLabel?: OpenCalendarAriaLabel;\n }\n\n export type Granularity = DateGranularity;\n\n export type Format = DateFormat;\n\n export type InputFormat = EditableDateFormat;\n}\n"]}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
7
|
+
import Dropdown from '../dropdown/internal';
|
|
7
8
|
import { useInternalI18n } from '../i18n/context';
|
|
8
9
|
import InternalIcon from '../icon/internal';
|
|
9
10
|
import { getBaseProps } from '../internal/base-component';
|
|
10
11
|
import ButtonTrigger from '../internal/components/button-trigger';
|
|
11
|
-
import Dropdown from '../internal/components/dropdown';
|
|
12
12
|
import { useFormFieldContext } from '../internal/context/form-field-context';
|
|
13
13
|
import ResetContextsForModal from '../internal/context/reset-contexts-for-modal.js';
|
|
14
14
|
import { fireNonCancelableEvent } from '../internal/events';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src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C,UAAU,EAAE,UAAU,EACtB,OAAO;YACL,6GAA6G;YAC7G,oBAAC,qBAAqB,QACnB,cAAc,IAAI,CACjB,oBAAC,uBAAuB,IACtB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,EACzC,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,EAChC,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,0BAA0B,EAAE,0BAA0B,EACtD,wBAAwB,EAAE,wBAAwB,EAClD,0BAA0B,EAAE,0BAA0B,EACtD,WAAW,EAAE,WAAW,GACxB,CACH,CACqB,GAE1B;QACF,6BAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,IAC/B,SAAS,KAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS,CAAA,CAChC,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;AACrD,eAAe,eAAe,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React, { Ref, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport InternalIcon from '../icon/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport ButtonTrigger from '../internal/components/button-trigger';\nimport Dropdown from '../internal/components/dropdown';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal.js';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useFocusTracker } from '../internal/hooks/use-focus-tracker';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { usePrevious } from '../internal/hooks/use-previous';\nimport { isDevelopment } from '../internal/is-development.js';\nimport { KeyCode } from '../internal/keycode';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { formatDateTimeWithOffset } from '../internal/utils/date-time/format-date-time-with-offset';\nimport { normalizeLocale } from '../internal/utils/locale';\nimport { joinStrings } from '../internal/utils/strings/join-strings';\nimport { DateRangePickerDropdown } from './dropdown';\nimport { DateRangePickerProps } from './interfaces';\nimport { normalizeTimeOffset } from './time-offset';\nimport { formatInitialValue, formatValue } from './utils';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\nexport { DateRangePickerProps };\n\nfunction renderDateRange({\n locale,\n range,\n placeholder = '',\n formatRelativeRange,\n absoluteFormat,\n hideTimeOffset,\n timeOffset,\n}: {\n locale?: string;\n range: null | DateRangePickerProps.Value;\n placeholder?: string;\n formatRelativeRange: DateRangePickerProps.I18nStrings['formatRelativeRange'];\n absoluteFormat: DateRangePickerProps.AbsoluteFormat;\n hideTimeOffset?: boolean;\n timeOffset: { startDate?: number; endDate?: number };\n}) {\n const firstPart = range\n ? range.type === 'relative'\n ? (formatRelativeRange?.(range) ?? '')\n : formatDateTimeWithOffset({\n date: range.startDate,\n timeOffset: timeOffset.startDate,\n hideTimeOffset,\n format: absoluteFormat,\n locale,\n })\n : placeholder;\n\n const secondPart =\n range?.type === 'absolute'\n ? formatDateTimeWithOffset({\n date: range.endDate,\n timeOffset: timeOffset.endDate,\n hideTimeOffset,\n format: absoluteFormat,\n locale,\n })\n : '';\n\n return (\n <span className={(!range && styles['label-text']) || undefined} aria-disabled={!range}>\n <span className={range?.type === 'absolute' ? styles['label-token-nowrap'] : undefined}>{firstPart}</span>\n <span>{secondPart && ' — '}</span>\n <span className={styles['label-token-nowrap']}>{secondPart}</span>\n </span>\n );\n}\n\nconst DateRangePicker = React.forwardRef(\n (\n {\n locale = '',\n startOfWeek,\n isDateEnabled = () => true,\n dateDisabledReason,\n value,\n placeholder,\n readOnly = false,\n disabled = false,\n onChange,\n onBlur,\n onFocus,\n relativeOptions = [],\n i18nStrings,\n isValidRange = () => ({ valid: true }),\n showClearButton = true,\n dateOnly = false,\n ariaLabel,\n timeOffset,\n getTimeOffset,\n timeInputFormat = 'hh:mm:ss',\n dateInputFormat = 'slashed',\n expandToViewport = false,\n rangeSelectorMode = 'default',\n customAbsoluteRangeControl,\n absoluteFormat = 'iso',\n hideTimeOffset,\n customRelativeRangeUnits,\n renderRelativeRangeContent,\n granularity = 'day',\n ...rest\n }: DateRangePickerProps,\n ref: Ref<DateRangePickerProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('DateRangePicker', {\n props: {\n absoluteFormat,\n dateOnly,\n expandToViewport,\n rangeSelectorMode,\n readOnly,\n showClearButton,\n timeInputFormat,\n dateInputFormat,\n hideTimeOffset,\n granularity,\n },\n metadata: { hasDisabledReasons: Boolean(dateDisabledReason) },\n });\n const isMonthOnly = granularity === 'month';\n const hideTime = dateOnly || isMonthOnly;\n checkControlled('DateRangePicker', 'value', value, 'onChange', onChange);\n\n const normalizedTimeOffset = hideTime\n ? { startDate: undefined, endDate: undefined }\n : normalizeTimeOffset(value, getTimeOffset, timeOffset);\n value = formatInitialValue(value, dateOnly, isMonthOnly, normalizedTimeOffset);\n\n const baseProps = getBaseProps(rest);\n const ariaLabelId = useUniqueId('date-range-picker-arialabel-');\n const {\n invalid,\n warning,\n controlId,\n ariaDescribedby,\n ariaLabelledby: contextAriaLabelledby,\n } = useFormFieldContext({\n ariaLabelledby: rest.ariaLabelledby ?? i18nStrings?.ariaLabelledby,\n ariaDescribedby: rest.ariaDescribedby ?? i18nStrings?.ariaDescribedby,\n ...rest,\n });\n const ariaLabelledby = joinStrings(contextAriaLabelledby, ariaLabelId);\n\n const isSingleGrid = useMobile();\n\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n useForwardFocus(ref, triggerRef);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const dropdownId = useUniqueId('date-range-picker-dropdown');\n const triggerContentId = useUniqueId('date-range-picker-trigger');\n\n useFocusTracker({ rootRef, onBlur, onFocus });\n\n const [isDropDownOpen, setIsDropDownOpen] = useState<boolean>(false);\n\n const normalizedLocale = normalizeLocale('DateRangePicker', locale);\n\n const closeDropdown = (focusTrigger = false) => {\n setIsDropDownOpen(false);\n if (focusTrigger) {\n triggerRef.current?.focus();\n }\n };\n\n const onWrapperKeyDownHandler = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.keyCode === KeyCode.escape) {\n if (isDropDownOpen) {\n event.stopPropagation();\n }\n closeDropdown(true);\n }\n };\n\n const onClear = () => {\n fireNonCancelableEvent(onChange, { value: null });\n };\n\n const onApply = (newValue: null | DateRangePickerProps.Value): DateRangePickerProps.ValidationResult => {\n const formattedValue = formatValue(newValue, {\n dateOnly,\n monthOnly: isMonthOnly,\n timeOffset: hideTime\n ? { startDate: undefined, endDate: undefined }\n : normalizeTimeOffset(newValue, getTimeOffset, timeOffset),\n });\n\n const validationResult = isValidRange(formattedValue);\n if (validationResult?.valid === false) {\n return validationResult;\n }\n\n if (isDevelopment) {\n if (newValue?.type === 'absolute') {\n const [startDateWithoutTime] = newValue.startDate.split('T');\n const [endDateWithoutTime] = newValue.endDate.split('T');\n if (!startDateWithoutTime || !endDateWithoutTime) {\n warnOnce(\n 'DateRangePicker',\n 'You have provided an `isValidRange` prop that did not catch a missing start or end date.'\n );\n }\n }\n }\n fireNonCancelableEvent(onChange, { value: formattedValue });\n return validationResult || { valid: true };\n };\n\n const prevDateOnly = usePrevious(dateOnly);\n useEffect(() => {\n if (prevDateOnly !== undefined && prevDateOnly !== dateOnly) {\n warnOnce(\n 'DateRangePicker',\n `The provided \\`dateOnly\\` flag has been changed from \"${prevDateOnly}\" to \"${dateOnly}\" which can lead to unexpected value format. Consider using separate components.`\n );\n }\n }, [prevDateOnly, dateOnly]);\n\n if (value && value.type !== 'absolute' && value.type !== 'relative') {\n warnOnce('DateRangePicker', 'You provided an invalid value. Reverting back to default.');\n value = null;\n }\n\n if (\n (value?.type === 'absolute' && rangeSelectorMode === 'relative-only') ||\n (value?.type === 'relative' && rangeSelectorMode === 'absolute-only')\n ) {\n warnOnce(\n 'DateRangePicker',\n 'The provided value does not correspond to the current range selector mode. Reverting back to default.'\n );\n value = null;\n }\n\n const i18n = useInternalI18n('date-range-picker');\n const formatRelativeRange = i18n(\n 'i18nStrings.formatRelativeRange',\n i18nStrings?.formatRelativeRange,\n format =>\n ({ amount, unit }) =>\n format({ amount, unit })\n );\n\n if (isDevelopment) {\n if (!formatRelativeRange && rangeSelectorMode !== 'absolute-only') {\n warnOnce(\n 'DateRangePicker',\n 'A function for i18nStrings.formatRelativeRange was not provided. Relative ranges will not be correctly rendered.'\n );\n }\n }\n\n const formattedDate: string | JSX.Element = renderDateRange({\n locale: normalizedLocale,\n range: value,\n placeholder,\n formatRelativeRange,\n absoluteFormat,\n hideTimeOffset: hideTime || hideTimeOffset,\n timeOffset: normalizedTimeOffset,\n });\n\n const trigger = (\n <ButtonTrigger\n ref={triggerRef}\n id={controlId}\n invalid={invalid}\n warning={warning}\n ariaLabelledby={joinStrings(ariaLabelledby, triggerContentId)}\n ariaDescribedby={ariaDescribedby}\n className={clsx(testutilStyles.label, styles.label, {\n [styles['label-enabled']]: !readOnly && !disabled,\n })}\n hideCaret={true}\n onClick={() => {\n setIsDropDownOpen(true);\n }}\n disabled={disabled}\n readOnly={readOnly}\n ariaHasPopup=\"dialog\"\n >\n <span className={styles['trigger-flexbox']}>\n <span className={styles['icon-wrapper']}>\n <InternalIcon name=\"calendar\" variant={disabled || readOnly ? 'disabled' : 'normal'} />\n </span>\n <span id={triggerContentId}>{formattedDate}</span>\n </span>\n </ButtonTrigger>\n );\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(\n baseProps.className,\n styles.root,\n testutilStyles.root,\n absoluteFormat === 'long-localized' && !dateOnly && !isMonthOnly && styles.wide\n )}\n onKeyDown={onWrapperKeyDownHandler}\n >\n <Dropdown\n stretchHeight={true}\n open={isDropDownOpen}\n onOutsideClick={() => closeDropdown()}\n trigger={trigger}\n expandToViewport={expandToViewport}\n dropdownId={dropdownId}\n content={\n /* Reset form field context to prevent a wrapper form field from labelling all inputs inside the dropdown. */\n <ResetContextsForModal>\n {isDropDownOpen && (\n <DateRangePickerDropdown\n startOfWeek={startOfWeek}\n locale={normalizedLocale}\n isSingleGrid={isSingleGrid}\n onOutsideClick={() => closeDropdown(true)}\n value={value}\n showClearButton={showClearButton}\n isDateEnabled={isDateEnabled}\n dateDisabledReason={dateDisabledReason}\n i18nStrings={i18nStrings}\n onClear={onClear}\n onApply={onApply}\n getTimeOffset={getTimeOffset}\n timeOffset={timeOffset}\n relativeOptions={relativeOptions}\n isValidRange={isValidRange}\n dateOnly={dateOnly}\n absoluteFormat={absoluteFormat}\n timeInputFormat={timeInputFormat}\n dateInputFormat={dateInputFormat}\n rangeSelectorMode={rangeSelectorMode}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n customAbsoluteRangeControl={customAbsoluteRangeControl}\n customRelativeRangeUnits={customRelativeRangeUnits}\n renderRelativeRangeContent={renderRelativeRangeContent}\n granularity={granularity}\n />\n )}\n </ResetContextsForModal>\n }\n />\n <div id={ariaLabelId} hidden={true}>\n {ariaLabel || i18nStrings?.ariaLabel}\n </div>\n </div>\n );\n }\n);\n\napplyDisplayName(DateRangePicker, 'DateRangePicker');\nexport default DateRangePicker;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date-range-picker/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,EAAE,EAAO,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEpG,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,qBAAqB,MAAM,iDAAiD,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAA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,eAAe,EAAE,iBAAiB,CAAC,CAAC;AACrD,eAAe,eAAe,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React, { Ref, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport Dropdown from '../dropdown/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport InternalIcon from '../icon/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport ButtonTrigger from '../internal/components/button-trigger';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal.js';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useFocusTracker } from '../internal/hooks/use-focus-tracker';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { usePrevious } from '../internal/hooks/use-previous';\nimport { isDevelopment } from '../internal/is-development.js';\nimport { KeyCode } from '../internal/keycode';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { formatDateTimeWithOffset } from '../internal/utils/date-time/format-date-time-with-offset';\nimport { normalizeLocale } from '../internal/utils/locale';\nimport { joinStrings } from '../internal/utils/strings/join-strings';\nimport { DateRangePickerDropdown } from './dropdown';\nimport { DateRangePickerProps } from './interfaces';\nimport { normalizeTimeOffset } from './time-offset';\nimport { formatInitialValue, formatValue } from './utils';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\nexport { DateRangePickerProps };\n\nfunction renderDateRange({\n locale,\n range,\n placeholder = '',\n formatRelativeRange,\n absoluteFormat,\n hideTimeOffset,\n timeOffset,\n}: {\n locale?: string;\n range: null | DateRangePickerProps.Value;\n placeholder?: string;\n formatRelativeRange: DateRangePickerProps.I18nStrings['formatRelativeRange'];\n absoluteFormat: DateRangePickerProps.AbsoluteFormat;\n hideTimeOffset?: boolean;\n timeOffset: { startDate?: number; endDate?: number };\n}) {\n const firstPart = range\n ? range.type === 'relative'\n ? (formatRelativeRange?.(range) ?? '')\n : formatDateTimeWithOffset({\n date: range.startDate,\n timeOffset: timeOffset.startDate,\n hideTimeOffset,\n format: absoluteFormat,\n locale,\n })\n : placeholder;\n\n const secondPart =\n range?.type === 'absolute'\n ? formatDateTimeWithOffset({\n date: range.endDate,\n timeOffset: timeOffset.endDate,\n hideTimeOffset,\n format: absoluteFormat,\n locale,\n })\n : '';\n\n return (\n <span className={(!range && styles['label-text']) || undefined} aria-disabled={!range}>\n <span className={range?.type === 'absolute' ? styles['label-token-nowrap'] : undefined}>{firstPart}</span>\n <span>{secondPart && ' — '}</span>\n <span className={styles['label-token-nowrap']}>{secondPart}</span>\n </span>\n );\n}\n\nconst DateRangePicker = React.forwardRef(\n (\n {\n locale = '',\n startOfWeek,\n isDateEnabled = () => true,\n dateDisabledReason,\n value,\n placeholder,\n readOnly = false,\n disabled = false,\n onChange,\n onBlur,\n onFocus,\n relativeOptions = [],\n i18nStrings,\n isValidRange = () => ({ valid: true }),\n showClearButton = true,\n dateOnly = false,\n ariaLabel,\n timeOffset,\n getTimeOffset,\n timeInputFormat = 'hh:mm:ss',\n dateInputFormat = 'slashed',\n expandToViewport = false,\n rangeSelectorMode = 'default',\n customAbsoluteRangeControl,\n absoluteFormat = 'iso',\n hideTimeOffset,\n customRelativeRangeUnits,\n renderRelativeRangeContent,\n granularity = 'day',\n ...rest\n }: DateRangePickerProps,\n ref: Ref<DateRangePickerProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('DateRangePicker', {\n props: {\n absoluteFormat,\n dateOnly,\n expandToViewport,\n rangeSelectorMode,\n readOnly,\n showClearButton,\n timeInputFormat,\n dateInputFormat,\n hideTimeOffset,\n granularity,\n },\n metadata: { hasDisabledReasons: Boolean(dateDisabledReason) },\n });\n const isMonthOnly = granularity === 'month';\n const hideTime = dateOnly || isMonthOnly;\n checkControlled('DateRangePicker', 'value', value, 'onChange', onChange);\n\n const normalizedTimeOffset = hideTime\n ? { startDate: undefined, endDate: undefined }\n : normalizeTimeOffset(value, getTimeOffset, timeOffset);\n value = formatInitialValue(value, dateOnly, isMonthOnly, normalizedTimeOffset);\n\n const baseProps = getBaseProps(rest);\n const ariaLabelId = useUniqueId('date-range-picker-arialabel-');\n const {\n invalid,\n warning,\n controlId,\n ariaDescribedby,\n ariaLabelledby: contextAriaLabelledby,\n } = useFormFieldContext({\n ariaLabelledby: rest.ariaLabelledby ?? i18nStrings?.ariaLabelledby,\n ariaDescribedby: rest.ariaDescribedby ?? i18nStrings?.ariaDescribedby,\n ...rest,\n });\n const ariaLabelledby = joinStrings(contextAriaLabelledby, ariaLabelId);\n\n const isSingleGrid = useMobile();\n\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n useForwardFocus(ref, triggerRef);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const dropdownId = useUniqueId('date-range-picker-dropdown');\n const triggerContentId = useUniqueId('date-range-picker-trigger');\n\n useFocusTracker({ rootRef, onBlur, onFocus });\n\n const [isDropDownOpen, setIsDropDownOpen] = useState<boolean>(false);\n\n const normalizedLocale = normalizeLocale('DateRangePicker', locale);\n\n const closeDropdown = (focusTrigger = false) => {\n setIsDropDownOpen(false);\n if (focusTrigger) {\n triggerRef.current?.focus();\n }\n };\n\n const onWrapperKeyDownHandler = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.keyCode === KeyCode.escape) {\n if (isDropDownOpen) {\n event.stopPropagation();\n }\n closeDropdown(true);\n }\n };\n\n const onClear = () => {\n fireNonCancelableEvent(onChange, { value: null });\n };\n\n const onApply = (newValue: null | DateRangePickerProps.Value): DateRangePickerProps.ValidationResult => {\n const formattedValue = formatValue(newValue, {\n dateOnly,\n monthOnly: isMonthOnly,\n timeOffset: hideTime\n ? { startDate: undefined, endDate: undefined }\n : normalizeTimeOffset(newValue, getTimeOffset, timeOffset),\n });\n\n const validationResult = isValidRange(formattedValue);\n if (validationResult?.valid === false) {\n return validationResult;\n }\n\n if (isDevelopment) {\n if (newValue?.type === 'absolute') {\n const [startDateWithoutTime] = newValue.startDate.split('T');\n const [endDateWithoutTime] = newValue.endDate.split('T');\n if (!startDateWithoutTime || !endDateWithoutTime) {\n warnOnce(\n 'DateRangePicker',\n 'You have provided an `isValidRange` prop that did not catch a missing start or end date.'\n );\n }\n }\n }\n fireNonCancelableEvent(onChange, { value: formattedValue });\n return validationResult || { valid: true };\n };\n\n const prevDateOnly = usePrevious(dateOnly);\n useEffect(() => {\n if (prevDateOnly !== undefined && prevDateOnly !== dateOnly) {\n warnOnce(\n 'DateRangePicker',\n `The provided \\`dateOnly\\` flag has been changed from \"${prevDateOnly}\" to \"${dateOnly}\" which can lead to unexpected value format. Consider using separate components.`\n );\n }\n }, [prevDateOnly, dateOnly]);\n\n if (value && value.type !== 'absolute' && value.type !== 'relative') {\n warnOnce('DateRangePicker', 'You provided an invalid value. Reverting back to default.');\n value = null;\n }\n\n if (\n (value?.type === 'absolute' && rangeSelectorMode === 'relative-only') ||\n (value?.type === 'relative' && rangeSelectorMode === 'absolute-only')\n ) {\n warnOnce(\n 'DateRangePicker',\n 'The provided value does not correspond to the current range selector mode. Reverting back to default.'\n );\n value = null;\n }\n\n const i18n = useInternalI18n('date-range-picker');\n const formatRelativeRange = i18n(\n 'i18nStrings.formatRelativeRange',\n i18nStrings?.formatRelativeRange,\n format =>\n ({ amount, unit }) =>\n format({ amount, unit })\n );\n\n if (isDevelopment) {\n if (!formatRelativeRange && rangeSelectorMode !== 'absolute-only') {\n warnOnce(\n 'DateRangePicker',\n 'A function for i18nStrings.formatRelativeRange was not provided. Relative ranges will not be correctly rendered.'\n );\n }\n }\n\n const formattedDate: string | JSX.Element = renderDateRange({\n locale: normalizedLocale,\n range: value,\n placeholder,\n formatRelativeRange,\n absoluteFormat,\n hideTimeOffset: hideTime || hideTimeOffset,\n timeOffset: normalizedTimeOffset,\n });\n\n const trigger = (\n <ButtonTrigger\n ref={triggerRef}\n id={controlId}\n invalid={invalid}\n warning={warning}\n ariaLabelledby={joinStrings(ariaLabelledby, triggerContentId)}\n ariaDescribedby={ariaDescribedby}\n className={clsx(testutilStyles.label, styles.label, {\n [styles['label-enabled']]: !readOnly && !disabled,\n })}\n hideCaret={true}\n onClick={() => {\n setIsDropDownOpen(true);\n }}\n disabled={disabled}\n readOnly={readOnly}\n ariaHasPopup=\"dialog\"\n >\n <span className={styles['trigger-flexbox']}>\n <span className={styles['icon-wrapper']}>\n <InternalIcon name=\"calendar\" variant={disabled || readOnly ? 'disabled' : 'normal'} />\n </span>\n <span id={triggerContentId}>{formattedDate}</span>\n </span>\n </ButtonTrigger>\n );\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(\n baseProps.className,\n styles.root,\n testutilStyles.root,\n absoluteFormat === 'long-localized' && !dateOnly && !isMonthOnly && styles.wide\n )}\n onKeyDown={onWrapperKeyDownHandler}\n >\n <Dropdown\n stretchHeight={true}\n open={isDropDownOpen}\n onOutsideClick={() => closeDropdown()}\n trigger={trigger}\n expandToViewport={expandToViewport}\n dropdownId={dropdownId}\n content={\n /* Reset form field context to prevent a wrapper form field from labelling all inputs inside the dropdown. */\n <ResetContextsForModal>\n {isDropDownOpen && (\n <DateRangePickerDropdown\n startOfWeek={startOfWeek}\n locale={normalizedLocale}\n isSingleGrid={isSingleGrid}\n onOutsideClick={() => closeDropdown(true)}\n value={value}\n showClearButton={showClearButton}\n isDateEnabled={isDateEnabled}\n dateDisabledReason={dateDisabledReason}\n i18nStrings={i18nStrings}\n onClear={onClear}\n onApply={onApply}\n getTimeOffset={getTimeOffset}\n timeOffset={timeOffset}\n relativeOptions={relativeOptions}\n isValidRange={isValidRange}\n dateOnly={dateOnly}\n absoluteFormat={absoluteFormat}\n timeInputFormat={timeInputFormat}\n dateInputFormat={dateInputFormat}\n rangeSelectorMode={rangeSelectorMode}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n customAbsoluteRangeControl={customAbsoluteRangeControl}\n customRelativeRangeUnits={customRelativeRangeUnits}\n renderRelativeRangeContent={renderRelativeRangeContent}\n granularity={granularity}\n />\n )}\n </ResetContextsForModal>\n }\n />\n <div id={ariaLabelId} hidden={true}>\n {ariaLabel || i18nStrings?.ariaLabel}\n </div>\n </div>\n );\n }\n);\n\napplyDisplayName(DateRangePicker, 'DateRangePicker');\nexport default DateRangePicker;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CalendarProps } from '../calendar/interfaces';
|
|
3
|
+
import { ExpandToViewport } from '../dropdown/interfaces';
|
|
3
4
|
import { BaseComponentProps } from '../internal/base-component';
|
|
4
|
-
import { ExpandToViewport } from '../internal/components/dropdown/interfaces';
|
|
5
5
|
import { FormFieldValidationControlProps } from '../internal/context/form-field-context';
|
|
6
6
|
import { NonCancelableEventHandler } from '../internal/events';
|
|
7
7
|
import { DateFormat, EditableDateFormat } from '../internal/utils/date-time/interfaces';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4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AqB,CAAC,EAAE,MAAM,CAAC;QAE/B;;;WAGG;QACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAE3B;;;WAGG;QACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAE/B;;;;;WAKG;QACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAE5B;;;;;WAKG;QACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;QAEhC;;;;;WAKG;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;IAED,KAAY,cAAc,GAAG,UAAU,CAAC;IAExC,KAAY,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAC;IAE7D,KAAY,eAAe,GAAG,cAAc,CAAC,MAAM,CAAC;CACrD;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { CalendarProps } from '../calendar/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DateFormat, EditableDateFormat } from '../internal/utils/date-time/interfaces';\nimport { TimeInputProps } from '../time-input/interfaces';\n\nexport interface DateRangePickerBaseProps {\n /**\n * The current date range value. Can be either an absolute time range\n * or a relative time range.\n */\n value: null | DateRangePickerProps.Value;\n\n /**\n * A list of relative time ranges that are shown as suggestions.\n */\n relativeOptions: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n\n /**\n * A function that defines whether a particular date should be enabled\n * in the calendar or not. Note that disabling a date in the calendar\n * still allows users to enter this date via keyboard. We therefore\n * recommend that you also validate these constraints client- and\n * server-side, in the same way as for other form elements.\n */\n isDateEnabled?: DateRangePickerProps.IsDateEnabledFunction;\n\n /**\n * Provides a reason why a particular date in the calendar is not enabled (only when `isDateEnabled` returns `false`).\n * If provided, the date becomes focusable.\n * @param date\n */\n dateDisabledReason?: DateRangePickerProps.DateDisabledReasonFunction;\n\n /**\n * The locale to be used for rendering month names and defining the\n * starting date of the week. If not provided, it will be determined\n * from the page and browser locales. Supported values and formats\n * are as-per the [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Starting day of the week. [0-6] maps to [Sunday-Saturday].\n * By default the starting day of the week is defined by the locale,\n * but you can override it using this property.\n */\n startOfWeek?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: DateRangePickerProps.I18nStrings;\n\n /**\n * Hides time inputs and changes the input format to date-only, e.g. 2021-04-06.\n *\n * Do not use `dateOnly` flag conditionally. The component does not trigger the value update\n * when the flag changes which means the value format can become inconsistent.\n *\n * This does not apply when the 'granularity' is set to 'month'\n *\n * Default: `false`.\n */\n dateOnly?: boolean;\n\n /**\n * Determines the range selector mode as follows:\n *\n * * `default` for combined absolute/relative range selector.\n * * `absolute-only` for absolute-only range selector.\n * * `relative-only` for relative-only range selector.\n *\n * By default, the range selector mode is `default`.\n */\n rangeSelectorMode?: DateRangePickerProps.RangeSelectorMode;\n\n /**\n * Specifies the date format to use on the date inputs in the absolute dropdown.\n *\n * The format of the input as it is being interacted with. It can take the following values:\n * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n dateInputFormat?: DateRangePickerProps.DateInputFormat;\n\n /**\n * Specifies the format of the time input for absolute ranges.\n *\n * Use to restrict the granularity of time that the user can enter.\n *\n * Has no effect when `dateOnly` is true or `granularity` is set to 'month'.\n */\n timeInputFormat?: DateRangePickerProps.TimeInputFormat;\n\n /**\n * Fired whenever a user changes the component's value.\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<DateRangePickerProps.ChangeDetail>;\n\n /**\n * The time offset from UTC in minutes that should be used to\n * display and produce values.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n *\n * @deprecated Use `getTimeOffset` instead.\n */\n timeOffset?: number;\n\n /**\n * A function that defines timezone offset from UTC in minutes for selected dates.\n * Use it to define time relative to the desired timezone.\n *\n * The function is called for the start date and the end date and takes a UTC date\n * corresponding the selected value as an argument.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n */\n getTimeOffset?: DateRangePickerProps.GetTimeOffsetFunction;\n}\nexport interface DateRangePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n DateRangePickerBaseProps,\n Pick<CalendarProps, 'granularity'> {\n /**\n * Specifies the placeholder text that is rendered when the value is empty.\n */\n placeholder?: string;\n\n /**\n * Specifies that the component is disabled, preventing the user from\n * modifying the value. A disabled component cannot receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies that the component is read-only, preventing the user from\n * modifying the value. A read-only component can receive focus.\n */\n readOnly?: boolean;\n\n /**\n * Fired when keyboard focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Fired when keyboard focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * A function that defines whether a particular range is valid or not.\n *\n * Ensure that your function checks for missing fields in the value.\n */\n isValidRange: DateRangePickerProps.ValidationFunction;\n\n /**\n * Specifies whether the component should show a button that\n * allows the user to clear the selected value.\n */\n showClearButton?: boolean;\n\n /**\n * Specifies an additional control displayed in the dropdown, located below the range calendar.\n */\n customAbsoluteRangeControl?: DateRangePickerProps.AbsoluteRangeControl;\n\n /**\n * Specifies which time units to allow in the custom relative range control.\n */\n customRelativeRangeUnits?: DateRangePickerProps.TimeUnit[];\n\n /**\n * Specifies custom content to fully override the relative range tab.\n * When provided, all default relative range functionality is replaced.\n */\n renderRelativeRangeContent?: DateRangePickerProps.RelativeRangeControl;\n\n /**\n * Specifies the time format to use for displaying the absolute time range.\n *\n * It can take the following values:\n * * `iso`: ISO 8601 format, e.g.: 2024-01-30T13:32:32+01:00 (or 2024-01-30 when `dateOnly` is true)\n * * `long-localized`: a more human-readable, localized format, e.g.: January 30, 2024, 13:32:32 (UTC+1) (or January 30, 2024 when `dateOnly` is true)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n absoluteFormat?: DateRangePickerProps.AbsoluteFormat;\n\n /**\n * Specifies whether to hide the time offset in the displayed absolute time range.\n * Defaults to `false`.\n */\n hideTimeOffset?: boolean;\n\n /**\n * Adds `aria-label` to the trigger and dropdown.\n */\n ariaLabel?: string;\n}\n\nexport namespace DateRangePickerProps {\n export type Value = AbsoluteValue | RelativeValue;\n export interface AbsoluteValue {\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n startDate: string;\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n endDate: string;\n type: 'absolute';\n }\n\n export interface RelativeValue {\n /**\n * If provided, used to match this value\n * to a provided relative option.\n */\n key?: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n export interface RelativeOption {\n /**\n * Used to uniquely identify this relative option.\n */\n key: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n\n export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\n export type ValidationFunction = (value: Value | null) => ValidationResult;\n\n export type ValidationResult = ValidRangeResult | InvalidRangeResult;\n\n export interface ValidRangeResult {\n valid: true;\n }\n\n export interface InvalidRangeResult {\n valid: false;\n errorMessage: string;\n }\n\n export interface ChangeDetail {\n /**\n * The newly selected range of this date range picker.\n */\n value: null | Value;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export interface DateDisabledReasonFunction {\n (date: Date): string;\n }\n\n export interface GetTimeOffsetFunction {\n (date: Date): number;\n }\n\n export interface DateTimeStrings {\n date: string;\n time: string;\n }\n\n export interface PendingAbsoluteValue {\n start: DateTimeStrings;\n end: DateTimeStrings;\n }\n\n export type AbsoluteRangeControl = (\n selectedRange: PendingAbsoluteValue,\n setSelectedRange: React.Dispatch<React.SetStateAction<PendingAbsoluteValue>>\n ) => React.ReactNode;\n\n export type RelativeRangeControl = (\n selectedRange: RelativeValue | null,\n setSelectedRange: (value: RelativeValue) => void\n ) => React.ReactNode;\n\n export type RangeSelectorMode = 'default' | 'absolute-only' | 'relative-only';\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /**\n * Adds `aria-label` to the trigger and dropdown.\n * @deprecated Use `ariaLabel` on the component instead.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n * @deprecated Use `ariaLabelledby` on the component instead.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\n * @deprecated Use `ariaDescribedby` on the component instead.\n */\n ariaDescribedby?: string;\n\n /**\n * Label of the mode selection group. In the standard view, it adds 'aria-label' to the group of segments.\n * In a narrow container the label is visible and attached to the select component.\n * @i18n\n */\n modeSelectionLabel?: string;\n\n /**\n * Segment title of the relative range selection mode\n * @i18n\n */\n relativeModeTitle?: string;\n\n /**\n * Segment title of the absolute range selection mode\n * @i18n\n */\n absoluteModeTitle?: string;\n\n /**\n * Heading for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionHeading?: string;\n\n /**\n * Description for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionMonthlyDescription?: string;\n\n /**\n * Visible label of the Cancel button\n * @i18n\n */\n cancelButtonLabel?: string;\n\n /**\n * Visible label of the Clear and dismiss button\n * @i18n\n */\n clearButtonLabel?: string;\n\n /**\n * Visible label of the Apply button\n * @i18n\n */\n applyButtonLabel?: string;\n\n /**\n * Formatting function for relative ranges.\n * This function must convert a relative range to a human-readable string.\n * @i18n\n */\n formatRelativeRange?: (value: RelativeValue) => string;\n\n /**\n * Formatting function for time units.\n *\n * This function must return a localized form of the unit that fits the provided time value.\n * @i18n\n */\n formatUnit?: (unit: TimeUnit, value: number) => string;\n\n /**\n * Visible label for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionLabel?: string;\n\n /**\n * Visible description for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionDescription?: string;\n\n /**\n * Visible label for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationLabel?: string;\n\n /**\n * Placeholder for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationPlaceholder?: string;\n\n /**\n * Visible label for the unit selector for the\n * custom relative range.\n * @i18n\n */\n customRelativeRangeUnitLabel?: string;\n\n /**\n * Visible label for the Start Month input for the\n * absolute range.\n * @i18n\n */\n startMonthLabel?: string;\n\n /**\n * Visible label for the Start Date input for the\n * absolute range.\n * @i18n\n */\n startDateLabel?: string;\n\n /**\n * Visible label for the Start Time input for the\n * absolute range.\n * @i18n\n */\n startTimeLabel?: string;\n\n /**\n * Visible label for the End Month input for the\n * absolute range.\n * @i18n\n */\n endMonthLabel?: string;\n\n /**\n * Visible label for the End Date input for the\n * absolute range.\n * @i18n\n */\n endDateLabel?: string;\n\n /**\n * Visible label for the End Time input for the absolute range.\n * This serves as a fallback if no format specific date constraint test is provided\n *\n * @i18n\n */\n endTimeLabel?: string;\n\n /**\n * Constraint text for the date input field for the\n * absolute range with no time option.\n * @i18n\n */\n dateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'slashed' format with no time option.\n * @i18n\n */\n slashedDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'iso' format with no time option.\n * @i18n\n */\n isoDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range.\n * This serves as a fallback if no format specific datetime constraint test is provided\n *\n * @i18n\n */\n dateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'iso' format with.\n * @i18n\n */\n isoDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range.\n * This serves as a fallback if no format specific month constraint test is provided.\n *\n * @i18n\n */\n monthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedMonthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'iso' format.\n * @i18n\n */\n isoMonthConstraintText?: string;\n\n /**\n * Provides a text alternative for the error icon in the error alert.\n * @i18n\n */\n errorIconAriaLabel?: string;\n\n /**\n * When the property is set, screen readers announce the selected range when the absolute range gets selected.\n */\n renderSelectedAbsoluteRangeAriaLive?: (startDate: string, endDate: string) => string;\n\n /**\n * Used as part of the `aria-label` for today's date in the calendar.\n * @i18n\n */\n todayAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next month' button.\n * @i18n\n */\n nextMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous month' button.\n * @i18n\n */\n previousMonthAriaLabel?: string;\n\n /**\n * Used as part of the `aria-label` for the current month in the calendar.\n * @i18n\n */\n currentMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next year' button.\n * @i18n\n */\n nextYearAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous year' button.\n * @i18n\n */\n previousYearAriaLabel?: string;\n\n /**\n * Placeholder text for date inputs in absolute mode with 'iso' format (dashes).\n * Should match the expected date format (for example \"YYYY-MM-DD\", \"JJJJ-MM-TT\" for German).\n * Used for both start and end date inputs.\n * @i18n\n */\n isoDatePlaceholder?: string;\n\n /**\n * Placeholder text for date inputs in absolute mode with 'slashed' format (slashes).\n * Should match the expected date format (for example \"YYYY/MM/DD\", \"JJJJ/MM/TT\" for German).\n * Used for both start and end date inputs.\n * @i18n\n */\n slashedDatePlaceholder?: string;\n\n /**\n * Placeholder text for time inputs in absolute mode.\n * Should match the expected time format (for example \"hh:mm:ss\", \"HH:MM:SS\").\n * Used for both start and end time inputs.\n * @i18n\n */\n timePlaceholder?: string;\n }\n\n export type AbsoluteFormat = DateFormat;\n\n export type DateInputFormat = EditableDateFormat | undefined;\n\n export type TimeInputFormat = TimeInputProps.Format;\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type QuarterIndex = 0 | 1 | 2;\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { CalendarProps } from '../calendar/interfaces';\nimport { ExpandToViewport } from '../dropdown/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DateFormat, EditableDateFormat } from '../internal/utils/date-time/interfaces';\nimport { TimeInputProps } from '../time-input/interfaces';\n\nexport interface DateRangePickerBaseProps {\n /**\n * The current date range value. Can be either an absolute time range\n * or a relative time range.\n */\n value: null | DateRangePickerProps.Value;\n\n /**\n * A list of relative time ranges that are shown as suggestions.\n */\n relativeOptions: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n\n /**\n * A function that defines whether a particular date should be enabled\n * in the calendar or not. Note that disabling a date in the calendar\n * still allows users to enter this date via keyboard. We therefore\n * recommend that you also validate these constraints client- and\n * server-side, in the same way as for other form elements.\n */\n isDateEnabled?: DateRangePickerProps.IsDateEnabledFunction;\n\n /**\n * Provides a reason why a particular date in the calendar is not enabled (only when `isDateEnabled` returns `false`).\n * If provided, the date becomes focusable.\n * @param date\n */\n dateDisabledReason?: DateRangePickerProps.DateDisabledReasonFunction;\n\n /**\n * The locale to be used for rendering month names and defining the\n * starting date of the week. If not provided, it will be determined\n * from the page and browser locales. Supported values and formats\n * are as-per the [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Starting day of the week. [0-6] maps to [Sunday-Saturday].\n * By default the starting day of the week is defined by the locale,\n * but you can override it using this property.\n */\n startOfWeek?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: DateRangePickerProps.I18nStrings;\n\n /**\n * Hides time inputs and changes the input format to date-only, e.g. 2021-04-06.\n *\n * Do not use `dateOnly` flag conditionally. The component does not trigger the value update\n * when the flag changes which means the value format can become inconsistent.\n *\n * This does not apply when the 'granularity' is set to 'month'\n *\n * Default: `false`.\n */\n dateOnly?: boolean;\n\n /**\n * Determines the range selector mode as follows:\n *\n * * `default` for combined absolute/relative range selector.\n * * `absolute-only` for absolute-only range selector.\n * * `relative-only` for relative-only range selector.\n *\n * By default, the range selector mode is `default`.\n */\n rangeSelectorMode?: DateRangePickerProps.RangeSelectorMode;\n\n /**\n * Specifies the date format to use on the date inputs in the absolute dropdown.\n *\n * The format of the input as it is being interacted with. It can take the following values:\n * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n dateInputFormat?: DateRangePickerProps.DateInputFormat;\n\n /**\n * Specifies the format of the time input for absolute ranges.\n *\n * Use to restrict the granularity of time that the user can enter.\n *\n * Has no effect when `dateOnly` is true or `granularity` is set to 'month'.\n */\n timeInputFormat?: DateRangePickerProps.TimeInputFormat;\n\n /**\n * Fired whenever a user changes the component's value.\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<DateRangePickerProps.ChangeDetail>;\n\n /**\n * The time offset from UTC in minutes that should be used to\n * display and produce values.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n *\n * @deprecated Use `getTimeOffset` instead.\n */\n timeOffset?: number;\n\n /**\n * A function that defines timezone offset from UTC in minutes for selected dates.\n * Use it to define time relative to the desired timezone.\n *\n * The function is called for the start date and the end date and takes a UTC date\n * corresponding the selected value as an argument.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n */\n getTimeOffset?: DateRangePickerProps.GetTimeOffsetFunction;\n}\nexport interface DateRangePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n DateRangePickerBaseProps,\n Pick<CalendarProps, 'granularity'> {\n /**\n * Specifies the placeholder text that is rendered when the value is empty.\n */\n placeholder?: string;\n\n /**\n * Specifies that the component is disabled, preventing the user from\n * modifying the value. A disabled component cannot receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies that the component is read-only, preventing the user from\n * modifying the value. A read-only component can receive focus.\n */\n readOnly?: boolean;\n\n /**\n * Fired when keyboard focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Fired when keyboard focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * A function that defines whether a particular range is valid or not.\n *\n * Ensure that your function checks for missing fields in the value.\n */\n isValidRange: DateRangePickerProps.ValidationFunction;\n\n /**\n * Specifies whether the component should show a button that\n * allows the user to clear the selected value.\n */\n showClearButton?: boolean;\n\n /**\n * Specifies an additional control displayed in the dropdown, located below the range calendar.\n */\n customAbsoluteRangeControl?: DateRangePickerProps.AbsoluteRangeControl;\n\n /**\n * Specifies which time units to allow in the custom relative range control.\n */\n customRelativeRangeUnits?: DateRangePickerProps.TimeUnit[];\n\n /**\n * Specifies custom content to fully override the relative range tab.\n * When provided, all default relative range functionality is replaced.\n */\n renderRelativeRangeContent?: DateRangePickerProps.RelativeRangeControl;\n\n /**\n * Specifies the time format to use for displaying the absolute time range.\n *\n * It can take the following values:\n * * `iso`: ISO 8601 format, e.g.: 2024-01-30T13:32:32+01:00 (or 2024-01-30 when `dateOnly` is true)\n * * `long-localized`: a more human-readable, localized format, e.g.: January 30, 2024, 13:32:32 (UTC+1) (or January 30, 2024 when `dateOnly` is true)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n absoluteFormat?: DateRangePickerProps.AbsoluteFormat;\n\n /**\n * Specifies whether to hide the time offset in the displayed absolute time range.\n * Defaults to `false`.\n */\n hideTimeOffset?: boolean;\n\n /**\n * Adds `aria-label` to the trigger and dropdown.\n */\n ariaLabel?: string;\n}\n\nexport namespace DateRangePickerProps {\n export type Value = AbsoluteValue | RelativeValue;\n export interface AbsoluteValue {\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n startDate: string;\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n endDate: string;\n type: 'absolute';\n }\n\n export interface RelativeValue {\n /**\n * If provided, used to match this value\n * to a provided relative option.\n */\n key?: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n export interface RelativeOption {\n /**\n * Used to uniquely identify this relative option.\n */\n key: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n\n export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\n export type ValidationFunction = (value: Value | null) => ValidationResult;\n\n export type ValidationResult = ValidRangeResult | InvalidRangeResult;\n\n export interface ValidRangeResult {\n valid: true;\n }\n\n export interface InvalidRangeResult {\n valid: false;\n errorMessage: string;\n }\n\n export interface ChangeDetail {\n /**\n * The newly selected range of this date range picker.\n */\n value: null | Value;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export interface DateDisabledReasonFunction {\n (date: Date): string;\n }\n\n export interface GetTimeOffsetFunction {\n (date: Date): number;\n }\n\n export interface DateTimeStrings {\n date: string;\n time: string;\n }\n\n export interface PendingAbsoluteValue {\n start: DateTimeStrings;\n end: DateTimeStrings;\n }\n\n export type AbsoluteRangeControl = (\n selectedRange: PendingAbsoluteValue,\n setSelectedRange: React.Dispatch<React.SetStateAction<PendingAbsoluteValue>>\n ) => React.ReactNode;\n\n export type RelativeRangeControl = (\n selectedRange: RelativeValue | null,\n setSelectedRange: (value: RelativeValue) => void\n ) => React.ReactNode;\n\n export type RangeSelectorMode = 'default' | 'absolute-only' | 'relative-only';\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /**\n * Adds `aria-label` to the trigger and dropdown.\n * @deprecated Use `ariaLabel` on the component instead.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n * @deprecated Use `ariaLabelledby` on the component instead.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\n * @deprecated Use `ariaDescribedby` on the component instead.\n */\n ariaDescribedby?: string;\n\n /**\n * Label of the mode selection group. In the standard view, it adds 'aria-label' to the group of segments.\n * In a narrow container the label is visible and attached to the select component.\n * @i18n\n */\n modeSelectionLabel?: string;\n\n /**\n * Segment title of the relative range selection mode\n * @i18n\n */\n relativeModeTitle?: string;\n\n /**\n * Segment title of the absolute range selection mode\n * @i18n\n */\n absoluteModeTitle?: string;\n\n /**\n * Heading for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionHeading?: string;\n\n /**\n * Description for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionMonthlyDescription?: string;\n\n /**\n * Visible label of the Cancel button\n * @i18n\n */\n cancelButtonLabel?: string;\n\n /**\n * Visible label of the Clear and dismiss button\n * @i18n\n */\n clearButtonLabel?: string;\n\n /**\n * Visible label of the Apply button\n * @i18n\n */\n applyButtonLabel?: string;\n\n /**\n * Formatting function for relative ranges.\n * This function must convert a relative range to a human-readable string.\n * @i18n\n */\n formatRelativeRange?: (value: RelativeValue) => string;\n\n /**\n * Formatting function for time units.\n *\n * This function must return a localized form of the unit that fits the provided time value.\n * @i18n\n */\n formatUnit?: (unit: TimeUnit, value: number) => string;\n\n /**\n * Visible label for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionLabel?: string;\n\n /**\n * Visible description for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionDescription?: string;\n\n /**\n * Visible label for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationLabel?: string;\n\n /**\n * Placeholder for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationPlaceholder?: string;\n\n /**\n * Visible label for the unit selector for the\n * custom relative range.\n * @i18n\n */\n customRelativeRangeUnitLabel?: string;\n\n /**\n * Visible label for the Start Month input for the\n * absolute range.\n * @i18n\n */\n startMonthLabel?: string;\n\n /**\n * Visible label for the Start Date input for the\n * absolute range.\n * @i18n\n */\n startDateLabel?: string;\n\n /**\n * Visible label for the Start Time input for the\n * absolute range.\n * @i18n\n */\n startTimeLabel?: string;\n\n /**\n * Visible label for the End Month input for the\n * absolute range.\n * @i18n\n */\n endMonthLabel?: string;\n\n /**\n * Visible label for the End Date input for the\n * absolute range.\n * @i18n\n */\n endDateLabel?: string;\n\n /**\n * Visible label for the End Time input for the absolute range.\n * This serves as a fallback if no format specific date constraint test is provided\n *\n * @i18n\n */\n endTimeLabel?: string;\n\n /**\n * Constraint text for the date input field for the\n * absolute range with no time option.\n * @i18n\n */\n dateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'slashed' format with no time option.\n * @i18n\n */\n slashedDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'iso' format with no time option.\n * @i18n\n */\n isoDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range.\n * This serves as a fallback if no format specific datetime constraint test is provided\n *\n * @i18n\n */\n dateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'iso' format with.\n * @i18n\n */\n isoDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range.\n * This serves as a fallback if no format specific month constraint test is provided.\n *\n * @i18n\n */\n monthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedMonthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'iso' format.\n * @i18n\n */\n isoMonthConstraintText?: string;\n\n /**\n * Provides a text alternative for the error icon in the error alert.\n * @i18n\n */\n errorIconAriaLabel?: string;\n\n /**\n * When the property is set, screen readers announce the selected range when the absolute range gets selected.\n */\n renderSelectedAbsoluteRangeAriaLive?: (startDate: string, endDate: string) => string;\n\n /**\n * Used as part of the `aria-label` for today's date in the calendar.\n * @i18n\n */\n todayAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next month' button.\n * @i18n\n */\n nextMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous month' button.\n * @i18n\n */\n previousMonthAriaLabel?: string;\n\n /**\n * Used as part of the `aria-label` for the current month in the calendar.\n * @i18n\n */\n currentMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next year' button.\n * @i18n\n */\n nextYearAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous year' button.\n * @i18n\n */\n previousYearAriaLabel?: string;\n\n /**\n * Placeholder text for date inputs in absolute mode with 'iso' format (dashes).\n * Should match the expected date format (for example \"YYYY-MM-DD\", \"JJJJ-MM-TT\" for German).\n * Used for both start and end date inputs.\n * @i18n\n */\n isoDatePlaceholder?: string;\n\n /**\n * Placeholder text for date inputs in absolute mode with 'slashed' format (slashes).\n * Should match the expected date format (for example \"YYYY/MM/DD\", \"JJJJ/MM/TT\" for German).\n * Used for both start and end date inputs.\n * @i18n\n */\n slashedDatePlaceholder?: string;\n\n /**\n * Placeholder text for time inputs in absolute mode.\n * Should match the expected time format (for example \"hh:mm:ss\", \"HH:MM:SS\").\n * Used for both start and end time inputs.\n * @i18n\n */\n timePlaceholder?: string;\n }\n\n export type AbsoluteFormat = DateFormat;\n\n export type DateInputFormat = EditableDateFormat | undefined;\n\n export type TimeInputFormat = TimeInputProps.Format;\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type QuarterIndex = 0 | 1 | 2;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/dropdown/context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,KAAK,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;AAM1E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,QAAyB,EAAE,EAAE,4BAA4B,eAE5G;AAED,wBAAgB,kBAAkB;cAbsB,QAAQ;EAe/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/dropdown/context.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAI1C,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAAyB;IAClE,QAAQ,EAAE,cAAc;CACzB,CAAC,CAAC;AAOH,MAAM,UAAU,uBAAuB,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,cAAc,EAAgC;IAC3G,OAAO,oBAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAG,QAAQ,CAA4B,CAAC;AAC9F,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,UAAU,CAAC,eAAe,CAAC,CAAC;AACrC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext } from 'react';\n\ntype Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\n\nconst DropdownContext = React.createContext<{ position: Position }>({\n position: 'bottom-right',\n});\n\nexport interface DropdownContextProviderProps {\n position?: Position;\n children?: React.ReactNode;\n}\n\nexport function DropdownContextProvider({ children, position = 'bottom-right' }: DropdownContextProviderProps) {\n return <DropdownContext.Provider value={{ position }}>{children}</DropdownContext.Provider>;\n}\n\nexport function useDropdownContext() {\n return useContext(DropdownContext);\n}\n"]}
|
package/lib/internal/template/{internal/components/dropdown → dropdown}/dropdown-fit-handler.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BoundingBox } from '
|
|
1
|
+
import { BoundingBox } from '../internal/utils/scrollable-containers';
|
|
2
2
|
import { LogicalDOMRect } from './dropdown-position';
|
|
3
3
|
import { DropdownWidthConstraint } from './interfaces';
|
|
4
4
|
export interface DropdownPosition {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-fit-handler.d.ts","sourceRoot":"","sources":["../../../src/dropdown/dropdown-fit-handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAmD,MAAM,yCAAyC,CAAC;AACvH,OAA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UAAU,OAAO,EACjB,kBAAkB,OAAO,EACzB,cAAc,OAAO,EACrB,mBAAmB,OAAO,EAC1B,eAAe,OAAO,EACtB,UAAU,OAAO,EACjB,WAAW,uBAAuB,EAClC,WAAW,uBAAuB,EAClC,YAAY,MAAM,KACjB,CAAC,gBAAgB,EAAE,cAAc,CAoCnC,CAAC"}
|
package/lib/internal/template/{internal/components/dropdown → dropdown}/dropdown-fit-handler.js
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';
|
|
4
|
-
import { getOverflowParentDimensions, getOverflowParents } from '
|
|
4
|
+
import { getOverflowParentDimensions, getOverflowParents } from '../internal/utils/scrollable-containers';
|
|
5
5
|
import styles from './styles.css.js';
|
|
6
6
|
const AVAILABLE_SPACE_RESERVE_DEFAULT = 50;
|
|
7
7
|
const AVAILABLE_SPACE_RESERVE_MOBILE_VERTICAL = 19; // 50 - 31
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-fit-handler.js","sourceRoot":"","sources":["../../../src/dropdown/dropdown-fit-handler.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAE7F,OAAO,EAAe,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAIvH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAC3C,MAAM,uCAAuC,GAAG,EAAE,CAAC,CAAC,UAAU;AAC9D,MAAM,yCAAyC,GAAG,EAAE,CAAC;AAoBrD,MAAM,0BAA0B,GAAG,CAAC,OAAoB,EAAO,EAAE;IAC/D,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,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gBAAgB;QAChB,wBAAwB,EAAE,aAAa;KACxC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAgD,QAAQ;QACpE,CAAC,CAAC,2BAA2B,CAAC,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,CAAC;QACzF,CAAC,CAAC,mBAAmB,CAAC;YAClB,cAAc;YACd,eAAe;YACf,eAAe;YACf,QAAQ;YACR,QAAQ;YACR,YAAY;YACZ,iBAAiB;YACjB,aAAa;YACb,QAAQ;YACR,SAAS;SACV,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,4BAA4B,CAAC,cAAc,CAAC,CAAC;IAChE,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAChC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getLogicalBoundingClientRect } from '@cloudscape-design/component-toolkit/internal';\n\nimport { BoundingBox, getOverflowParentDimensions, getOverflowParents } from '../internal/utils/scrollable-containers';\nimport { LogicalDOMRect } from './dropdown-position';\nimport { DropdownWidthConstraint } from './interfaces';\n\nimport styles from './styles.css.js';\n\nconst AVAILABLE_SPACE_RESERVE_DEFAULT = 50;\nconst AVAILABLE_SPACE_RESERVE_MOBILE_VERTICAL = 19; // 50 - 31\nconst AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL = 20;\n\ninterface AvailableSpace {\n blockStart: number;\n blockEnd: number;\n inlineStart: number;\n inlineEnd: number;\n}\nexport interface DropdownPosition {\n blockSize: string;\n inlineSize: string;\n dropBlockStart: boolean;\n dropInlineStart: boolean;\n insetInlineStart: string;\n}\nexport interface InteriorDropdownPosition extends DropdownPosition {\n insetBlockEnd: string;\n insetBlockStart: string;\n}\n\nconst getClosestParentDimensions = (element: HTMLElement): any => {\n const parents = getOverflowParents(element).map(element => {\n const { blockSize, inlineSize, insetBlockStart, insetInlineStart } = getLogicalBoundingClientRect(element);\n return {\n blockSize,\n inlineSize,\n insetBlockStart,\n insetInlineStart,\n };\n });\n\n return parents.shift();\n};\n\nconst getAvailableSpace = ({\n trigger,\n overflowParents,\n stretchWidth = false,\n stretchHeight = false,\n isMobile,\n}: {\n trigger: HTMLElement;\n overflowParents: ReadonlyArray<BoundingBox>;\n stretchWidth?: boolean;\n stretchHeight?: boolean;\n isMobile?: boolean;\n}): AvailableSpace => {\n const availableSpaceReserveVertical = stretchHeight\n ? 0\n : isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_VERTICAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const availableSpaceReserveHorizontal = stretchWidth\n ? 0\n : isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const {\n insetBlockEnd: triggerBlockEnd,\n insetInlineStart: triggerInlineStart,\n insetInlineEnd: triggerInlineEnd,\n } = getLogicalBoundingClientRect(trigger);\n\n return overflowParents.reduce(\n ({ blockStart, blockEnd, inlineStart, inlineEnd }, overflowParent) => {\n const offsetTop = triggerBlockEnd - overflowParent.insetBlockStart;\n const currentBlockStart = offsetTop - trigger.offsetHeight - availableSpaceReserveVertical;\n const currentBlockEnd = overflowParent.blockSize - offsetTop - availableSpaceReserveVertical;\n const currentInlineStart = triggerInlineEnd - overflowParent.insetInlineStart - availableSpaceReserveHorizontal;\n const currentInlineEnd =\n overflowParent.insetInlineStart +\n overflowParent.inlineSize -\n triggerInlineStart -\n availableSpaceReserveHorizontal;\n\n return {\n blockStart: Math.min(blockStart, currentBlockStart),\n blockEnd: Math.min(blockEnd, currentBlockEnd),\n inlineStart: Math.min(inlineStart, currentInlineStart),\n inlineEnd: Math.min(inlineEnd, currentInlineEnd),\n };\n },\n {\n blockStart: Number.MAX_VALUE,\n blockEnd: Number.MAX_VALUE,\n inlineStart: Number.MAX_VALUE,\n inlineEnd: Number.MAX_VALUE,\n }\n );\n};\n\nconst getInteriorAvailableSpace = ({\n trigger,\n overflowParents,\n isMobile,\n}: {\n trigger: HTMLElement;\n overflowParents: ReadonlyArray<BoundingBox>;\n isMobile?: boolean;\n}): AvailableSpace => {\n const AVAILABLE_SPACE_RESERVE_VERTICAL = isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_VERTICAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const AVAILABLE_SPACE_RESERVE_HORIZONTAL = isMobile\n ? AVAILABLE_SPACE_RESERVE_MOBILE_HORIZONTAL\n : AVAILABLE_SPACE_RESERVE_DEFAULT;\n const {\n insetBlockEnd: triggerBlockEnd,\n insetBlockStart: triggerBlockStart,\n insetInlineStart: triggerInlineStart,\n insetInlineEnd: triggerInlineEnd,\n } = getLogicalBoundingClientRect(trigger);\n\n return overflowParents.reduce(\n ({ blockStart, blockEnd, inlineStart, inlineEnd }, overflowParent) => {\n const currentBlockStart = triggerBlockEnd - overflowParent.insetBlockStart - AVAILABLE_SPACE_RESERVE_VERTICAL;\n const currentBlockEnd =\n overflowParent.blockSize -\n triggerBlockStart +\n overflowParent.insetBlockStart -\n AVAILABLE_SPACE_RESERVE_VERTICAL;\n const currentInlineStart =\n triggerInlineStart - overflowParent.insetInlineStart - AVAILABLE_SPACE_RESERVE_HORIZONTAL;\n const currentInlineEnd =\n overflowParent.insetInlineStart +\n overflowParent.inlineSize -\n triggerInlineEnd -\n AVAILABLE_SPACE_RESERVE_HORIZONTAL;\n\n return {\n blockStart: Math.min(blockStart, currentBlockStart),\n blockEnd: Math.min(blockEnd, currentBlockEnd),\n inlineStart: Math.min(inlineStart, currentInlineStart),\n inlineEnd: Math.min(inlineEnd, currentInlineEnd),\n };\n },\n {\n blockStart: Number.MAX_VALUE,\n blockEnd: Number.MAX_VALUE,\n inlineStart: Number.MAX_VALUE,\n inlineEnd: Number.MAX_VALUE,\n }\n );\n};\n\nconst resolveWidthConstraint = (\n constraint: DropdownWidthConstraint | undefined,\n triggerWidth: number,\n fallback: number\n): number => {\n if (constraint === 'trigger') {\n return triggerWidth;\n }\n if (typeof constraint === 'number') {\n return constraint;\n }\n return fallback;\n};\n\nconst getWidths = ({\n triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n}: {\n triggerElement: HTMLElement;\n dropdownElement: HTMLElement;\n minWidthConstraint?: DropdownWidthConstraint;\n maxWidthConstraint?: DropdownWidthConstraint;\n}) => {\n const { inlineSize: triggerInlineSize } = getLogicalBoundingClientRect(triggerElement);\n const { inlineSize: requiredWidth } = getLogicalBoundingClientRect(dropdownElement);\n\n const minWidth = resolveWidthConstraint(minWidthConstraint, triggerInlineSize, 0);\n const maxWidth = resolveWidthConstraint(maxWidthConstraint, triggerInlineSize, Number.MAX_VALUE);\n\n const idealWidth = Math.min(Math.max(requiredWidth, minWidth), maxWidth);\n return { idealWidth, minWidth, triggerInlineSize };\n};\n\nexport const hasEnoughSpaceForFlexibleWidth = ({\n triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n expandToViewport,\n stretchHeight,\n isMobile,\n}: {\n triggerElement: HTMLElement;\n dropdownElement: HTMLElement;\n minWidthConstraint?: DropdownWidthConstraint;\n maxWidthConstraint?: DropdownWidthConstraint;\n expandToViewport: boolean;\n stretchHeight: boolean;\n isMobile: boolean;\n}) => {\n const overflowParents = getOverflowParentDimensions({\n element: dropdownElement,\n excludeClosestParent: false,\n expandToViewport,\n canExpandOutsideViewport: stretchHeight,\n });\n const { idealWidth } = getWidths({\n triggerElement: triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n });\n const availableSpace = getAvailableSpace({\n trigger: triggerElement,\n overflowParents,\n stretchHeight,\n isMobile,\n });\n return idealWidth <= availableSpace.inlineStart || idealWidth <= availableSpace.inlineEnd;\n};\n\nexport const getDropdownPosition = ({\n triggerElement,\n dropdownElement,\n overflowParents,\n minWidth: minWidthConstraint,\n maxWidth: maxWidthConstraint,\n preferCenter = false,\n matchTriggerWidth = false,\n stretchHeight = false,\n isMobile = false,\n maxHeight,\n}: {\n triggerElement: HTMLElement;\n dropdownElement: HTMLElement;\n overflowParents: ReadonlyArray<BoundingBox>;\n minWidth?: DropdownWidthConstraint;\n maxWidth?: DropdownWidthConstraint;\n preferCenter?: boolean;\n matchTriggerWidth?: boolean;\n stretchHeight?: boolean;\n isMobile?: boolean;\n maxHeight?: number;\n}): DropdownPosition => {\n // Determine the space available around the dropdown that it can grow in\n const availableSpace = getAvailableSpace({\n trigger: triggerElement,\n overflowParents,\n stretchWidth: matchTriggerWidth,\n stretchHeight,\n isMobile,\n });\n const { idealWidth, minWidth, triggerInlineSize } = getWidths({\n triggerElement,\n dropdownElement,\n minWidthConstraint,\n maxWidthConstraint,\n });\n\n let dropInlineStart: boolean;\n let insetInlineStart: number | null = null;\n let inlineSize = idealWidth;\n\n //1. Can it be positioned with ideal width to the right?\n if (idealWidth <= availableSpace.inlineEnd) {\n dropInlineStart = false;\n //2. Can it be positioned with ideal width to the left?\n } else if (idealWidth <= availableSpace.inlineStart) {\n dropInlineStart = true;\n //3. Fit into biggest available space either on left or right\n } else {\n dropInlineStart = availableSpace.inlineStart > availableSpace.inlineEnd;\n inlineSize = Math.max(availableSpace.inlineStart, availableSpace.inlineEnd, minWidth);\n }\n\n if (preferCenter) {\n const spillOver = (idealWidth - triggerInlineSize) / 2;\n\n // availableSpace always includes the trigger width, but we want to exclude that\n const availableOutsideLeft = availableSpace.inlineStart - triggerInlineSize;\n const availableOutsideRight = availableSpace.inlineEnd - triggerInlineSize;\n\n const fitsInCenter = availableOutsideLeft >= spillOver && availableOutsideRight >= spillOver;\n if (fitsInCenter) {\n insetInlineStart = -spillOver;\n }\n }\n\n const dropBlockStart =\n availableSpace.blockEnd < dropdownElement.offsetHeight && availableSpace.blockStart > availableSpace.blockEnd;\n const availableHeight = dropBlockStart ? availableSpace.blockStart : availableSpace.blockEnd;\n // Try and crop the bottom item when all options can't be displayed, affordance for \"there's more\"\n const croppedHeight = Math.max(stretchHeight ? availableHeight : Math.floor(availableHeight / 31) * 31 + 16, 15);\n\n const blockSize = maxHeight ? `min(${croppedHeight}px, ${maxHeight}px)` : `${croppedHeight}px`;\n\n return {\n dropBlockStart,\n dropInlineStart,\n insetInlineStart: insetInlineStart === null ? 'auto' : `${insetInlineStart}px`,\n blockSize,\n inlineSize: `${inlineSize}px`,\n };\n};\n\nconst getInteriorDropdownPosition = (\n trigger: HTMLElement,\n dropdown: HTMLElement,\n overflowParents: ReadonlyArray<BoundingBox>,\n isMobile?: boolean\n): InteriorDropdownPosition => {\n const availableSpace = getInteriorAvailableSpace({ trigger, overflowParents, isMobile });\n const {\n insetBlockEnd: triggerBlockEnd,\n insetBlockStart: triggerBlockStart,\n inlineSize: triggerInlineSize,\n } = getLogicalBoundingClientRect(trigger);\n const { insetBlockStart: parentDropdownBlockStart, blockSize: parentDropdownHeight } =\n getClosestParentDimensions(trigger);\n\n let dropInlineStart;\n\n let { inlineSize } = getLogicalBoundingClientRect(dropdown);\n const insetBlockStart = triggerBlockStart - parentDropdownBlockStart;\n if (inlineSize <= availableSpace.inlineEnd) {\n dropInlineStart = false;\n } else if (inlineSize <= availableSpace.inlineStart) {\n dropInlineStart = true;\n } else {\n dropInlineStart = availableSpace.inlineStart > availableSpace.inlineEnd;\n inlineSize = Math.max(availableSpace.inlineStart, availableSpace.inlineEnd);\n }\n\n const insetInlineStart = dropInlineStart ? 0 - inlineSize : triggerInlineSize;\n\n const dropBlockStart =\n availableSpace.blockEnd < dropdown.offsetHeight && availableSpace.blockStart > availableSpace.blockEnd;\n const insetBlockEnd = dropBlockStart ? parentDropdownBlockStart + parentDropdownHeight - triggerBlockEnd : 0;\n const availableHeight = dropBlockStart ? availableSpace.blockStart : availableSpace.blockEnd;\n // Try and crop the bottom item when all options can't be displayed, affordance for \"there's more\"\n const croppedHeight = Math.floor(availableHeight / 31) * 31 + 16;\n\n return {\n dropBlockStart,\n dropInlineStart,\n blockSize: `${croppedHeight}px`,\n inlineSize: `${inlineSize}px`,\n insetBlockStart: `${insetBlockStart}px`,\n insetBlockEnd: `${insetBlockEnd}px`,\n insetInlineStart: `${insetInlineStart}px`,\n };\n};\n\nexport const calculatePosition = (\n dropdownElement: HTMLDivElement,\n triggerElement: HTMLElement,\n verticalContainerElement: HTMLDivElement,\n interior: boolean,\n expandToViewport: boolean,\n preferCenter: boolean,\n matchTriggerWidth: boolean,\n stretchHeight: boolean,\n isMobile: boolean,\n minWidth?: DropdownWidthConstraint,\n maxWidth?: DropdownWidthConstraint,\n maxHeight?: number\n): [DropdownPosition, LogicalDOMRect] => {\n // cleaning previously assigned values,\n // so that they are not reused in case of screen resize and similar events\n verticalContainerElement.style.maxBlockSize = '';\n dropdownElement.style.inlineSize = '';\n dropdownElement.style.insetBlockStart = '';\n dropdownElement.style.insetBlockEnd = '';\n dropdownElement.style.insetInlineStart = '';\n\n dropdownElement.classList.remove(styles['dropdown-drop-left']);\n dropdownElement.classList.remove(styles['dropdown-drop-right']);\n dropdownElement.classList.remove(styles['dropdown-drop-up']);\n\n const overflowParents = getOverflowParentDimensions({\n element: dropdownElement,\n excludeClosestParent: interior,\n expandToViewport,\n canExpandOutsideViewport: stretchHeight,\n });\n const position: DropdownPosition | InteriorDropdownPosition = interior\n ? getInteriorDropdownPosition(triggerElement, dropdownElement, overflowParents, isMobile)\n : getDropdownPosition({\n triggerElement,\n dropdownElement,\n overflowParents,\n minWidth,\n maxWidth,\n preferCenter,\n matchTriggerWidth,\n stretchHeight,\n isMobile,\n maxHeight,\n });\n\n const triggerBox = getLogicalBoundingClientRect(triggerElement);\n return [position, triggerBox];\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-position.d.ts","sourceRoot":"","sources":["../../../src/dropdown/dropdown-position.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EA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e,GAAG,GAAG,oBAAoB,GAAG,WAAW,CAAC,aAAa,IAAI,CAAC;IAClG,CAAC;IACD,IAAI,QAAQ,CAAC,eAAe,EAAE,CAAC;QAC7B,4FAA4F;QAC5F,yFAAyF;QACzF,MAAM,WAAW,GAAG,eAAe,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAC;QAClE,eAAe,CAAC,KAAK,CAAC,gBAAgB,GAAG,QAAQ,sBAAsB,GAAG,WAAW,CAAC,cAAc,QAAQ,WAAW,KAAK,CAAC;IAC/H,CAAC;SAAM,CAAC;QACN,eAAe,CAAC,KAAK,CAAC,gBAAgB,GAAG,GAAG,sBAAsB,GAAG,WAAW,CAAC,gBAAgB,IAAI,CAAC;IACxG,CAAC;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { DropdownPosition } from './dropdown-fit-handler';\n\nexport interface LogicalDOMRect {\n blockSize: number;\n inlineSize: number;\n insetBlockStart: number;\n insetBlockEnd: number;\n insetInlineStart: number;\n insetInlineEnd: number;\n}\n\n// Applies its position to the dropdown element when expandToViewport is set to true.\nexport function applyDropdownPositionRelativeToViewport({\n position,\n dropdownElement,\n triggerRect,\n isMobile,\n}: {\n position: DropdownPosition;\n dropdownElement: HTMLElement;\n triggerRect: LogicalDOMRect;\n isMobile: boolean;\n}) {\n // Fixed positions are not respected in iOS when the virtual keyboard is being displayed.\n // For this reason we use absolute positioning in mobile.\n const useAbsolutePositioning = isMobile;\n\n // Since when using expandToViewport=true the dropdown is attached to the root of the body,\n // the same coordinates can be used for fixed or absolute position,\n // except when using absolute position we need to take into account the scroll position of the body itself.\n const verticalScrollOffset = useAbsolutePositioning ? document.documentElement.scrollTop : 0;\n const horizontalScrollOffset = useAbsolutePositioning ? document.documentElement.scrollLeft : 0;\n\n dropdownElement.style.position = useAbsolutePositioning ? 'absolute' : 'fixed';\n\n if (position.dropBlockStart) {\n dropdownElement.style.insetBlockEnd = `calc(100% - ${verticalScrollOffset + triggerRect.insetBlockStart}px)`;\n } else {\n dropdownElement.style.insetBlockStart = `${verticalScrollOffset + triggerRect.insetBlockEnd}px`;\n }\n if (position.dropInlineStart) {\n // For right-aligned dropdowns, use the actual rendered width when flexible width is enabled\n // to ensure proper alignment even when CSS constraints differ from calculated inlineSize\n const actualWidth = dropdownElement.getBoundingClientRect().width;\n dropdownElement.style.insetInlineStart = `calc(${horizontalScrollOffset + triggerRect.insetInlineEnd}px - ${actualWidth}px)`;\n } else {\n dropdownElement.style.insetInlineStart = `${horizontalScrollOffset + triggerRect.insetInlineStart}px`;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dropdown/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,eAGlE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
+
import InternalDropdown from './internal';
|
|
8
|
+
/**
|
|
9
|
+
* @awsuiSystem core
|
|
10
|
+
*/
|
|
11
|
+
export default function Dropdown({ style, ...props }) {
|
|
12
|
+
const baseComponentProps = useBaseComponent('Dropdown');
|
|
13
|
+
return React.createElement(InternalDropdown, { ...props, style: style, ...baseComponentProps });
|
|
14
|
+
}
|
|
15
|
+
applyDisplayName(Dropdown, 'Dropdown');
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dropdown/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,gBAAgB,MAAM,YAAY,CAAC;AAI1C;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAiB;IACjE,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxD,OAAO,oBAAC,gBAAgB,OAAK,KAAK,EAAE,KAAK,EAAE,KAAK,KAAM,kBAAkB,GAAI,CAAC;AAC/E,CAAC;AACD,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { DropdownProps } from './interfaces';\nimport InternalDropdown from './internal';\n\nexport { DropdownProps };\n\n/**\n * @awsuiSystem core\n */\nexport default function Dropdown({ style, ...props }: DropdownProps) {\n const baseComponentProps = useBaseComponent('Dropdown');\n return <InternalDropdown {...props} style={style} {...baseComponentProps} />;\n}\napplyDisplayName(Dropdown, 'Dropdown');\n"]}
|