@danske/sapphire-react-lab 0.105.2 → 0.106.2
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/build/cjs/index.js +1607 -2284
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Accordion/index.js.map +1 -1
- package/build/esm/Accordion/src/Accordion.js +44 -75
- package/build/esm/Accordion/src/Accordion.js.map +1 -1
- package/build/esm/Accordion/src/AccordionContext.js +3 -1
- package/build/esm/Accordion/src/AccordionContext.js.map +1 -1
- package/build/esm/Accordion/src/AccordionHeading.js +23 -55
- package/build/esm/Accordion/src/AccordionHeading.js.map +1 -1
- package/build/esm/Accordion/src/AccordionItem.js +18 -44
- package/build/esm/Accordion/src/AccordionItem.js.map +1 -1
- package/build/esm/Accordion/src/AccordionPanel.js +28 -45
- package/build/esm/Accordion/src/AccordionPanel.js.map +1 -1
- package/build/esm/Accordion/src/utils.js.map +1 -1
- package/build/esm/Alert/src/Alert.js +27 -65
- package/build/esm/Alert/src/Alert.js.map +1 -1
- package/build/esm/Amount/src/Amount.js +41 -63
- package/build/esm/Amount/src/Amount.js.map +1 -1
- package/build/esm/Amount/src/useGroupAmount.js +4 -1
- package/build/esm/Amount/src/useGroupAmount.js.map +1 -1
- package/build/esm/Autocomplete/i18n/da-DK.json.js +6 -0
- package/build/esm/Autocomplete/i18n/da-DK.json.js.map +1 -0
- package/build/esm/Autocomplete/i18n/de-DE.json.js +6 -0
- package/build/esm/Autocomplete/i18n/de-DE.json.js.map +1 -0
- package/build/esm/Autocomplete/i18n/en-US.json.js +6 -0
- package/build/esm/Autocomplete/i18n/en-US.json.js.map +1 -0
- package/build/esm/Autocomplete/i18n/fi-FI.json.js +6 -0
- package/build/esm/Autocomplete/i18n/fi-FI.json.js.map +1 -0
- package/build/esm/Autocomplete/i18n/index.js +9 -9
- package/build/esm/Autocomplete/i18n/index.js.map +1 -1
- package/build/esm/Autocomplete/i18n/nb-NO.json.js +6 -0
- package/build/esm/Autocomplete/i18n/nb-NO.json.js.map +1 -0
- package/build/esm/Autocomplete/i18n/pl-PL.json.js +6 -0
- package/build/esm/Autocomplete/i18n/pl-PL.json.js.map +1 -0
- package/build/esm/Autocomplete/i18n/sv-SE.json.js +6 -0
- package/build/esm/Autocomplete/i18n/sv-SE.json.js.map +1 -0
- package/build/esm/Autocomplete/src/Autocomplete.js +57 -76
- package/build/esm/Autocomplete/src/Autocomplete.js.map +1 -1
- package/build/esm/Breadcrumbs/src/BreadcrumbItem.js +46 -52
- package/build/esm/Breadcrumbs/src/BreadcrumbItem.js.map +1 -1
- package/build/esm/Breadcrumbs/src/BreadcrumbItemLink.js +17 -45
- package/build/esm/Breadcrumbs/src/BreadcrumbItemLink.js.map +1 -1
- package/build/esm/Breadcrumbs/src/BreadcrumbItemStatic.js +25 -46
- package/build/esm/Breadcrumbs/src/BreadcrumbItemStatic.js.map +1 -1
- package/build/esm/Breadcrumbs/src/BreadcrumbOverflowMenu.js +18 -11
- package/build/esm/Breadcrumbs/src/BreadcrumbOverflowMenu.js.map +1 -1
- package/build/esm/Breadcrumbs/src/Breadcrumbs.js +47 -64
- package/build/esm/Breadcrumbs/src/Breadcrumbs.js.map +1 -1
- package/build/esm/Breadcrumbs/src/BreadcrumbsSeparator.js +8 -6
- package/build/esm/Breadcrumbs/src/BreadcrumbsSeparator.js.map +1 -1
- package/build/esm/Breadcrumbs/src/useBreadcrumbThreshold.js +6 -6
- package/build/esm/Breadcrumbs/src/useBreadcrumbThreshold.js.map +1 -1
- package/build/esm/FileDropzone/i18n/{da-DK.js → da-DK.json.js} +3 -3
- package/build/esm/FileDropzone/i18n/da-DK.json.js.map +1 -0
- package/build/esm/FileDropzone/i18n/{de-DE.js → de-DE.json.js} +3 -3
- package/build/esm/FileDropzone/i18n/de-DE.json.js.map +1 -0
- package/build/esm/FileDropzone/i18n/{en-US.js → en-US.json.js} +3 -3
- package/build/esm/FileDropzone/i18n/en-US.json.js.map +1 -0
- package/build/esm/FileDropzone/i18n/{fi-FI.js → fi-FI.json.js} +3 -3
- package/build/esm/FileDropzone/i18n/fi-FI.json.js.map +1 -0
- package/build/esm/FileDropzone/i18n/index.js +9 -9
- package/build/esm/FileDropzone/i18n/index.js.map +1 -1
- package/build/esm/FileDropzone/i18n/{nb-NO.js → nb-NO.json.js} +3 -3
- package/build/esm/FileDropzone/i18n/nb-NO.json.js.map +1 -0
- package/build/esm/FileDropzone/i18n/{pl-PL.js → pl-PL.json.js} +3 -3
- package/build/esm/FileDropzone/i18n/pl-PL.json.js.map +1 -0
- package/build/esm/FileDropzone/i18n/{sv-SE.js → sv-SE.json.js} +3 -3
- package/build/esm/FileDropzone/i18n/sv-SE.json.js.map +1 -0
- package/build/esm/FileDropzone/src/FileDropzone.js +68 -88
- package/build/esm/FileDropzone/src/FileDropzone.js.map +1 -1
- package/build/esm/FileDropzone/src/FileTrigger.js +29 -61
- package/build/esm/FileDropzone/src/FileTrigger.js.map +1 -1
- package/build/esm/FileDropzone/src/utils.js.map +1 -1
- package/build/esm/Filtering/src/FilterDropdown.js +91 -113
- package/build/esm/Filtering/src/FilterDropdown.js.map +1 -1
- package/build/esm/Filtering/src/SearchableSelectFilter.js +53 -70
- package/build/esm/Filtering/src/SearchableSelectFilter.js.map +1 -1
- package/build/esm/Flag/src/Flag.js +5 -37
- package/build/esm/Flag/src/Flag.js.map +1 -1
- package/build/esm/LabeledValue/src/LabeledValue.js +21 -55
- package/build/esm/LabeledValue/src/LabeledValue.js.map +1 -1
- package/build/esm/NumberField/i18n/da-DK.json.js +9 -0
- package/build/esm/NumberField/i18n/da-DK.json.js.map +1 -0
- package/build/esm/NumberField/i18n/de-DE.json.js +9 -0
- package/build/esm/NumberField/i18n/de-DE.json.js.map +1 -0
- package/build/esm/NumberField/i18n/en-US.json.js +9 -0
- package/build/esm/NumberField/i18n/en-US.json.js.map +1 -0
- package/build/esm/NumberField/i18n/fi-FI.json.js +9 -0
- package/build/esm/NumberField/i18n/fi-FI.json.js.map +1 -0
- package/build/esm/NumberField/i18n/index.js +9 -9
- package/build/esm/NumberField/i18n/index.js.map +1 -1
- package/build/esm/NumberField/i18n/nb-NO.json.js +9 -0
- package/build/esm/NumberField/i18n/nb-NO.json.js.map +1 -0
- package/build/esm/NumberField/i18n/pl-PL.json.js +9 -0
- package/build/esm/NumberField/i18n/pl-PL.json.js.map +1 -0
- package/build/esm/NumberField/i18n/sv-SE.json.js +9 -0
- package/build/esm/NumberField/i18n/sv-SE.json.js.map +1 -0
- package/build/esm/NumberField/src/NumberField.js +130 -111
- package/build/esm/NumberField/src/NumberField.js.map +1 -1
- package/build/esm/NumberField/src/StepperButton.js +32 -53
- package/build/esm/NumberField/src/StepperButton.js.map +1 -1
- package/build/esm/NumberField/src/cursorHelpers.js +13 -8
- package/build/esm/NumberField/src/cursorHelpers.js.map +1 -1
- package/build/esm/NumberField/src/formatHelpers.js +15 -18
- package/build/esm/NumberField/src/formatHelpers.js.map +1 -1
- package/build/esm/NumberField/src/keyboardHelpers.js +13 -8
- package/build/esm/NumberField/src/keyboardHelpers.js.map +1 -1
- package/build/esm/NumberField/src/useAutofillStyle.js.map +1 -1
- package/build/esm/NumberField/src/useNumberFieldFormatting.js +79 -45
- package/build/esm/NumberField/src/useNumberFieldFormatting.js.map +1 -1
- package/build/esm/NumberField/src/useSapphireNumberField.js +16 -42
- package/build/esm/NumberField/src/useSapphireNumberField.js.map +1 -1
- package/build/esm/ProgressIndicator/src/ProgressIndicator.js +23 -35
- package/build/esm/ProgressIndicator/src/ProgressIndicator.js.map +1 -1
- package/build/esm/Sidebar/index.js.map +1 -1
- package/build/esm/Sidebar/src/Body.js +19 -44
- package/build/esm/Sidebar/src/Body.js.map +1 -1
- package/build/esm/Sidebar/src/ExpandableItem.js +89 -97
- package/build/esm/Sidebar/src/ExpandableItem.js.map +1 -1
- package/build/esm/Sidebar/src/Header.js +14 -44
- package/build/esm/Sidebar/src/Header.js.map +1 -1
- package/build/esm/Sidebar/src/Item.js +17 -44
- package/build/esm/Sidebar/src/Item.js.map +1 -1
- package/build/esm/Sidebar/src/List.js +14 -43
- package/build/esm/Sidebar/src/List.js.map +1 -1
- package/build/esm/Sidebar/src/Panel.js +56 -69
- package/build/esm/Sidebar/src/Panel.js.map +1 -1
- package/build/esm/Sidebar/src/ResponsiveSidebarContext.js +17 -9
- package/build/esm/Sidebar/src/ResponsiveSidebarContext.js.map +1 -1
- package/build/esm/Sidebar/src/SecondarySidebarContext.js +15 -12
- package/build/esm/Sidebar/src/SecondarySidebarContext.js.map +1 -1
- package/build/esm/Sidebar/src/Section.js +38 -51
- package/build/esm/Sidebar/src/Section.js.map +1 -1
- package/build/esm/Sidebar/src/Sidebar.js +65 -93
- package/build/esm/Sidebar/src/Sidebar.js.map +1 -1
- package/build/esm/Sidebar/src/useSidebar.js.map +1 -1
- package/build/esm/Slider/index.js.map +1 -1
- package/build/esm/Slider/src/Slider.js +46 -71
- package/build/esm/Slider/src/Slider.js.map +1 -1
- package/build/esm/TagGroup/src/Tag.js +71 -86
- package/build/esm/TagGroup/src/Tag.js.map +1 -1
- package/build/esm/TagGroup/src/TagGroup.js +46 -67
- package/build/esm/TagGroup/src/TagGroup.js.map +1 -1
- package/build/esm/TagGroup/src/TagItem.js +1 -1
- package/build/esm/TagGroup/src/TagItem.js.map +1 -1
- package/build/esm/TimeField/i18n/da-DK.json.js +7 -0
- package/build/esm/TimeField/i18n/da-DK.json.js.map +1 -0
- package/build/esm/TimeField/i18n/de-DE.json.js +7 -0
- package/build/esm/TimeField/i18n/de-DE.json.js.map +1 -0
- package/build/esm/TimeField/i18n/en-US.json.js +7 -0
- package/build/esm/TimeField/i18n/en-US.json.js.map +1 -0
- package/build/esm/TimeField/i18n/fi-FI.json.js +7 -0
- package/build/esm/TimeField/i18n/fi-FI.json.js.map +1 -0
- package/build/esm/TimeField/i18n/index.js +7 -7
- package/build/esm/TimeField/i18n/index.js.map +1 -1
- package/build/esm/TimeField/i18n/nb-NO.json.js +7 -0
- package/build/esm/TimeField/i18n/nb-NO.json.js.map +1 -0
- package/build/esm/TimeField/i18n/pl-PL.json.js +7 -0
- package/build/esm/TimeField/i18n/pl-PL.json.js.map +1 -0
- package/build/esm/TimeField/i18n/{sv-SE.js → sv-SE.json.js} +1 -1
- package/build/esm/TimeField/i18n/sv-SE.json.js.map +1 -0
- package/build/esm/TimeField/src/TimeField.js +67 -84
- package/build/esm/TimeField/src/TimeField.js.map +1 -1
- package/build/esm/TimeField/src/TimeFieldSegment.js +25 -37
- package/build/esm/TimeField/src/TimeFieldSegment.js.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/index.d.ts +19 -17
- package/package.json +16 -39
- package/build/esm/Autocomplete/i18n/da-DK.js +0 -6
- package/build/esm/Autocomplete/i18n/da-DK.js.map +0 -1
- package/build/esm/Autocomplete/i18n/de-DE.js +0 -6
- package/build/esm/Autocomplete/i18n/de-DE.js.map +0 -1
- package/build/esm/Autocomplete/i18n/en-US.js +0 -6
- package/build/esm/Autocomplete/i18n/en-US.js.map +0 -1
- package/build/esm/Autocomplete/i18n/fi-FI.js +0 -6
- package/build/esm/Autocomplete/i18n/fi-FI.js.map +0 -1
- package/build/esm/Autocomplete/i18n/nb-NO.js +0 -6
- package/build/esm/Autocomplete/i18n/nb-NO.js.map +0 -1
- package/build/esm/Autocomplete/i18n/pl-PL.js +0 -6
- package/build/esm/Autocomplete/i18n/pl-PL.js.map +0 -1
- package/build/esm/Autocomplete/i18n/sv-SE.js +0 -6
- package/build/esm/Autocomplete/i18n/sv-SE.js.map +0 -1
- package/build/esm/FileDropzone/i18n/da-DK.js.map +0 -1
- package/build/esm/FileDropzone/i18n/de-DE.js.map +0 -1
- package/build/esm/FileDropzone/i18n/en-US.js.map +0 -1
- package/build/esm/FileDropzone/i18n/fi-FI.js.map +0 -1
- package/build/esm/FileDropzone/i18n/nb-NO.js.map +0 -1
- package/build/esm/FileDropzone/i18n/pl-PL.js.map +0 -1
- package/build/esm/FileDropzone/i18n/sv-SE.js.map +0 -1
- package/build/esm/NumberField/i18n/da-DK.js +0 -9
- package/build/esm/NumberField/i18n/da-DK.js.map +0 -1
- package/build/esm/NumberField/i18n/de-DE.js +0 -9
- package/build/esm/NumberField/i18n/de-DE.js.map +0 -1
- package/build/esm/NumberField/i18n/en-US.js +0 -9
- package/build/esm/NumberField/i18n/en-US.js.map +0 -1
- package/build/esm/NumberField/i18n/fi-FI.js +0 -9
- package/build/esm/NumberField/i18n/fi-FI.js.map +0 -1
- package/build/esm/NumberField/i18n/nb-NO.js +0 -9
- package/build/esm/NumberField/i18n/nb-NO.js.map +0 -1
- package/build/esm/NumberField/i18n/pl-PL.js +0 -9
- package/build/esm/NumberField/i18n/pl-PL.js.map +0 -1
- package/build/esm/NumberField/i18n/sv-SE.js +0 -9
- package/build/esm/NumberField/i18n/sv-SE.js.map +0 -1
- package/build/esm/TimeField/i18n/da-DK.js +0 -7
- package/build/esm/TimeField/i18n/da-DK.js.map +0 -1
- package/build/esm/TimeField/i18n/de-DE.js +0 -7
- package/build/esm/TimeField/i18n/de-DE.js.map +0 -1
- package/build/esm/TimeField/i18n/en-US.js +0 -7
- package/build/esm/TimeField/i18n/en-US.js.map +0 -1
- package/build/esm/TimeField/i18n/fi-FI.js +0 -7
- package/build/esm/TimeField/i18n/fi-FI.js.map +0 -1
- package/build/esm/TimeField/i18n/nb-NO.js +0 -7
- package/build/esm/TimeField/i18n/nb-NO.js.map +0 -1
- package/build/esm/TimeField/i18n/pl-PL.js +0 -7
- package/build/esm/TimeField/i18n/pl-PL.js.map +0 -1
- package/build/esm/TimeField/i18n/sv-SE.js.map +0 -1
package/build/cjs/index.js
CHANGED
|
@@ -1,70 +1,66 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var React = require('react');
|
|
6
4
|
var clsx = require('clsx');
|
|
7
|
-
var
|
|
5
|
+
var filterDOMProps = require('react-aria/filterDOMProps');
|
|
6
|
+
var useObjectRef = require('react-aria/useObjectRef');
|
|
8
7
|
var styles = require('@danske/sapphire-css/components/accordion/accordion.module.css');
|
|
9
8
|
var sapphireReact = require('@danske/sapphire-react');
|
|
10
|
-
var
|
|
9
|
+
var FocusScope = require('react-aria/FocusScope');
|
|
11
10
|
var reactAriaComponents = require('react-aria-components');
|
|
12
11
|
var react = require('@danske/sapphire-icons/react');
|
|
12
|
+
var useEvent = require('react-aria/private/utils/useEvent');
|
|
13
13
|
var alertStyles = require('@danske/sapphire-css/components/alert/alert.module.css');
|
|
14
|
-
var
|
|
14
|
+
var I18nProvider = require('react-aria/I18nProvider');
|
|
15
15
|
var styles$1 = require('@danske/sapphire-css/components/amount/amount.module.css');
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
16
|
+
var useComboBox = require('react-aria/useComboBox');
|
|
17
|
+
var i18n = require('@react-aria/i18n');
|
|
18
|
+
var utils = require('@react-spectrum/utils');
|
|
19
|
+
var useBreadcrumbs = require('react-aria/useBreadcrumbs');
|
|
20
|
+
var Collection = require('react-aria/Collection');
|
|
21
|
+
var CollectionBuilder = require('react-aria/CollectionBuilder');
|
|
22
|
+
var mergeProps = require('react-aria/mergeProps');
|
|
23
|
+
var useResizeObserver = require('react-aria/private/utils/useResizeObserver');
|
|
20
24
|
var styles$2 = require('@danske/sapphire-css/components/breadcrumbs/breadcrumbs.module.css');
|
|
25
|
+
var BaseCollection = require('react-aria/private/collections/BaseCollection');
|
|
26
|
+
var mergeRefs = require('react-aria/mergeRefs');
|
|
21
27
|
var styles$3 = require('@danske/sapphire-css/components/dropzone/dropzone.module.css');
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
28
|
+
var useHover = require('react-aria/useHover');
|
|
29
|
+
var Pressable = require('react-aria/Pressable');
|
|
30
|
+
var useId = require('react-aria/useId');
|
|
31
|
+
var PressResponder = require('react-aria/private/interactions/PressResponder');
|
|
32
|
+
var useDrop = require('react-aria/useDrop');
|
|
33
|
+
var useClipboard = require('react-aria/useClipboard');
|
|
34
|
+
var useFocusRing = require('react-aria/useFocusRing');
|
|
35
|
+
var VisuallyHidden = require('react-aria/VisuallyHidden');
|
|
36
|
+
var useEffectEvent = require('react-aria/private/utils/useEffectEvent');
|
|
37
|
+
var useControlledState = require('react-stately/useControlledState');
|
|
26
38
|
var styles$4 = require('@danske/sapphire-css/components/filterDropdown/filterDropdown.module.css');
|
|
27
39
|
var styles$5 = require('@danske/sapphire-css/components/flag/flag.module.css');
|
|
28
|
-
var
|
|
40
|
+
var useField = require('react-aria/useField');
|
|
29
41
|
var textFieldStyles = require('@danske/sapphire-css/components/textField/textField.module.css');
|
|
30
|
-
var
|
|
31
|
-
var
|
|
42
|
+
var useNumberField = require('react-aria/useNumberField');
|
|
43
|
+
var useNumberFieldState = require('react-stately/useNumberFieldState');
|
|
32
44
|
var styles$6 = require('@danske/sapphire-css/components/sidebar/sidebar.module.css');
|
|
45
|
+
var useFocusWithin = require('react-aria/useFocusWithin');
|
|
33
46
|
var buttonStyles = require('@danske/sapphire-css/components/button/button.module.css');
|
|
34
47
|
var reactTransitionGroup = require('react-transition-group');
|
|
35
|
-
var
|
|
48
|
+
var useListBox = require('react-aria/useListBox');
|
|
36
49
|
var styles$7 = require('@danske/sapphire-css/components/progressIndicator/progressIndicator.module.css');
|
|
37
|
-
var
|
|
50
|
+
var useProgressBar = require('react-aria/useProgressBar');
|
|
38
51
|
var styles$8 = require('@danske/sapphire-css/components/slider/slider.module.css');
|
|
39
|
-
var
|
|
40
|
-
var
|
|
52
|
+
var useTagGroup = require('react-aria/useTagGroup');
|
|
53
|
+
var useListState = require('react-stately/useListState');
|
|
41
54
|
var styles$9 = require('@danske/sapphire-css/components/tag/tag.module.css');
|
|
42
|
-
var
|
|
43
|
-
var
|
|
55
|
+
var useButton = require('react-aria/useButton');
|
|
56
|
+
var FocusRing = require('react-aria/FocusRing');
|
|
57
|
+
var Item = require('react-stately/Item');
|
|
44
58
|
var styles$a = require('@danske/sapphire-css/components/dateField/dateField.module.css');
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
51
|
-
var clsx__default = /*#__PURE__*/_interopDefaultLegacy(clsx);
|
|
52
|
-
var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
|
|
53
|
-
var alertStyles__default = /*#__PURE__*/_interopDefaultLegacy(alertStyles);
|
|
54
|
-
var styles__default$1 = /*#__PURE__*/_interopDefaultLegacy(styles$1);
|
|
55
|
-
var styles__default$2 = /*#__PURE__*/_interopDefaultLegacy(styles$2);
|
|
56
|
-
var styles__default$3 = /*#__PURE__*/_interopDefaultLegacy(styles$3);
|
|
57
|
-
var styles__default$4 = /*#__PURE__*/_interopDefaultLegacy(styles$4);
|
|
58
|
-
var styles__default$5 = /*#__PURE__*/_interopDefaultLegacy(styles$5);
|
|
59
|
-
var textFieldStyles__default = /*#__PURE__*/_interopDefaultLegacy(textFieldStyles);
|
|
60
|
-
var styles__default$6 = /*#__PURE__*/_interopDefaultLegacy(styles$6);
|
|
61
|
-
var buttonStyles__default = /*#__PURE__*/_interopDefaultLegacy(buttonStyles);
|
|
62
|
-
var styles__default$7 = /*#__PURE__*/_interopDefaultLegacy(styles$7);
|
|
63
|
-
var styles__default$8 = /*#__PURE__*/_interopDefaultLegacy(styles$8);
|
|
64
|
-
var styles__default$9 = /*#__PURE__*/_interopDefaultLegacy(styles$9);
|
|
65
|
-
var styles__default$a = /*#__PURE__*/_interopDefaultLegacy(styles$a);
|
|
66
|
-
|
|
67
|
-
const AccordionContext = React__default["default"].createContext({
|
|
59
|
+
var useTimeField = require('react-aria/useTimeField');
|
|
60
|
+
var useTimeFieldState = require('react-stately/useTimeFieldState');
|
|
61
|
+
var useDateField = require('react-aria/useDateField');
|
|
62
|
+
|
|
63
|
+
const AccordionContext = React.createContext({
|
|
68
64
|
sidePadding: void 0,
|
|
69
65
|
headerLevel: 5
|
|
70
66
|
});
|
|
@@ -73,85 +69,55 @@ function useAccordionContext() {
|
|
|
73
69
|
if (context) {
|
|
74
70
|
return context;
|
|
75
71
|
}
|
|
76
|
-
throw new Error(
|
|
72
|
+
throw new Error(
|
|
73
|
+
"Accordion context can only be used within Accordion component."
|
|
74
|
+
);
|
|
77
75
|
}
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (__propIsEnum$x.call(b, prop))
|
|
93
|
-
__defNormalProp$x(a, prop, b[prop]);
|
|
94
|
-
}
|
|
95
|
-
return a;
|
|
96
|
-
};
|
|
97
|
-
var __spreadProps$u = (a, b) => __defProps$u(a, __getOwnPropDescs$u(b));
|
|
98
|
-
var __objRest$u = (source, exclude) => {
|
|
99
|
-
var target = {};
|
|
100
|
-
for (var prop in source)
|
|
101
|
-
if (__hasOwnProp$x.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
102
|
-
target[prop] = source[prop];
|
|
103
|
-
if (source != null && __getOwnPropSymbols$x)
|
|
104
|
-
for (var prop of __getOwnPropSymbols$x(source)) {
|
|
105
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$x.call(source, prop))
|
|
106
|
-
target[prop] = source[prop];
|
|
107
|
-
}
|
|
108
|
-
return target;
|
|
109
|
-
};
|
|
110
|
-
const Accordion = React.forwardRef(function Accordion2(_a, ref) {
|
|
111
|
-
var _b = _a, {
|
|
112
|
-
allowsMultipleExpanded = true,
|
|
113
|
-
headerLevel = 5,
|
|
114
|
-
hideLastDivider = false,
|
|
115
|
-
hasNegativeSideMargin = false,
|
|
116
|
-
sidePadding,
|
|
117
|
-
children,
|
|
118
|
-
expandedKeys,
|
|
119
|
-
defaultExpandedKeys,
|
|
120
|
-
onExpandedChange,
|
|
121
|
-
isDisabled
|
|
122
|
-
} = _b, props = __objRest$u(_b, [
|
|
123
|
-
"allowsMultipleExpanded",
|
|
124
|
-
"headerLevel",
|
|
125
|
-
"hideLastDivider",
|
|
126
|
-
"hasNegativeSideMargin",
|
|
127
|
-
"sidePadding",
|
|
128
|
-
"children",
|
|
129
|
-
"expandedKeys",
|
|
130
|
-
"defaultExpandedKeys",
|
|
131
|
-
"onExpandedChange",
|
|
132
|
-
"isDisabled"
|
|
133
|
-
]);
|
|
77
|
+
const Accordion = React.forwardRef(function Accordion2({
|
|
78
|
+
allowsMultipleExpanded = true,
|
|
79
|
+
headerLevel = 5,
|
|
80
|
+
hideLastDivider = false,
|
|
81
|
+
hasNegativeSideMargin = false,
|
|
82
|
+
sidePadding,
|
|
83
|
+
children,
|
|
84
|
+
expandedKeys,
|
|
85
|
+
defaultExpandedKeys,
|
|
86
|
+
onExpandedChange,
|
|
87
|
+
isDisabled,
|
|
88
|
+
...props
|
|
89
|
+
}, ref) {
|
|
134
90
|
sapphireReact.useThemeCheck();
|
|
135
91
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
136
|
-
const forwardedRef =
|
|
137
|
-
return /* @__PURE__ */
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
92
|
+
const forwardedRef = useObjectRef.useObjectRef(ref);
|
|
93
|
+
return /* @__PURE__ */ React.createElement(FocusScope.FocusScope, null, /* @__PURE__ */ React.createElement(AccordionContext.Provider, { value: { sidePadding, headerLevel } }, /* @__PURE__ */ React.createElement(
|
|
94
|
+
reactAriaComponents.DisclosureGroup,
|
|
95
|
+
{
|
|
96
|
+
...filterDOMProps.filterDOMProps(props, { global: true, labelable: true }),
|
|
97
|
+
allowsMultipleExpanded,
|
|
98
|
+
expandedKeys,
|
|
99
|
+
defaultExpandedKeys,
|
|
100
|
+
onExpandedChange,
|
|
101
|
+
isDisabled,
|
|
102
|
+
ref: forwardedRef,
|
|
103
|
+
className: clsx(
|
|
104
|
+
styles["sapphire-accordion"],
|
|
105
|
+
{
|
|
106
|
+
[styles["sapphire-accordion--without-last-divider"]]: hideLastDivider,
|
|
107
|
+
[styles["sapphire-accordion--negative-margin-self"]]: !sapphireReact.withTruthyZero(sidePadding) && hasNegativeSideMargin
|
|
108
|
+
},
|
|
109
|
+
styleProps.className
|
|
110
|
+
),
|
|
111
|
+
style: {
|
|
112
|
+
...sapphireReact.withTruthyZero(sidePadding) && hasNegativeSideMargin ? {
|
|
113
|
+
marginLeft: typeof sidePadding === "string" ? `calc(${sidePadding} * -1)` : `-${sidePadding}px`,
|
|
114
|
+
width: `calc(100% + calc(${sidePadding} * 2${typeof sidePadding === "string" ? "" : "px"}))`
|
|
115
|
+
} : {},
|
|
116
|
+
...styleProps.style
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
children
|
|
120
|
+
)));
|
|
155
121
|
});
|
|
156
122
|
|
|
157
123
|
const customPaddingStyleProps = (sidePadding) => ({
|
|
@@ -159,98 +125,36 @@ const customPaddingStyleProps = (sidePadding) => ({
|
|
|
159
125
|
paddingRight: typeof sidePadding === "string" ? sidePadding : `${sidePadding}px`
|
|
160
126
|
});
|
|
161
127
|
|
|
162
|
-
|
|
163
|
-
var __defProps$t = Object.defineProperties;
|
|
164
|
-
var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
|
|
165
|
-
var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
|
|
166
|
-
var __hasOwnProp$w = Object.prototype.hasOwnProperty;
|
|
167
|
-
var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
|
|
168
|
-
var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
169
|
-
var __spreadValues$w = (a, b) => {
|
|
170
|
-
for (var prop in b || (b = {}))
|
|
171
|
-
if (__hasOwnProp$w.call(b, prop))
|
|
172
|
-
__defNormalProp$w(a, prop, b[prop]);
|
|
173
|
-
if (__getOwnPropSymbols$w)
|
|
174
|
-
for (var prop of __getOwnPropSymbols$w(b)) {
|
|
175
|
-
if (__propIsEnum$w.call(b, prop))
|
|
176
|
-
__defNormalProp$w(a, prop, b[prop]);
|
|
177
|
-
}
|
|
178
|
-
return a;
|
|
179
|
-
};
|
|
180
|
-
var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
|
|
181
|
-
var __objRest$t = (source, exclude) => {
|
|
182
|
-
var target = {};
|
|
183
|
-
for (var prop in source)
|
|
184
|
-
if (__hasOwnProp$w.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
185
|
-
target[prop] = source[prop];
|
|
186
|
-
if (source != null && __getOwnPropSymbols$w)
|
|
187
|
-
for (var prop of __getOwnPropSymbols$w(source)) {
|
|
188
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$w.call(source, prop))
|
|
189
|
-
target[prop] = source[prop];
|
|
190
|
-
}
|
|
191
|
-
return target;
|
|
192
|
-
};
|
|
193
|
-
const AccordionHeading = React.forwardRef(function AccordionHeading2(_a, ref) {
|
|
194
|
-
var _b = _a, { children, headerLevel } = _b, props = __objRest$t(_b, ["children", "headerLevel"]);
|
|
128
|
+
const AccordionHeading = React.forwardRef(function AccordionHeading2({ children, headerLevel, ...props }, ref) {
|
|
195
129
|
const { sidePadding, headerLevel: contextHeaderLevel } = useAccordionContext();
|
|
196
|
-
return /* @__PURE__ */
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
130
|
+
return /* @__PURE__ */ React.createElement(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
role: "heading",
|
|
134
|
+
"aria-level": headerLevel ?? contextHeaderLevel,
|
|
135
|
+
...filterDOMProps.filterDOMProps(props, { global: true }),
|
|
136
|
+
ref
|
|
137
|
+
},
|
|
138
|
+
/* @__PURE__ */ React.createElement(
|
|
139
|
+
reactAriaComponents.Button,
|
|
140
|
+
{
|
|
141
|
+
slot: "trigger",
|
|
142
|
+
className: ({ isFocusVisible }) => clsx(styles["sapphire-accordion__item-header"], styles["js-focus"], {
|
|
143
|
+
[styles["is-focus"]]: isFocusVisible
|
|
144
|
+
}),
|
|
145
|
+
style: sapphireReact.withTruthyZero(sidePadding) ? customPaddingStyleProps(sidePadding) : {}
|
|
146
|
+
},
|
|
147
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Typography.Heading, { level: 6, elementType: "span" }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles["sapphire-accordion__item-heading"]) }, children)),
|
|
148
|
+
/* @__PURE__ */ React.createElement("div", { className: clsx(styles["sapphire-accordion__item-arrow"]) }, /* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: "lg" }, /* @__PURE__ */ React.createElement(react.ChevronDown, null)))
|
|
149
|
+
)
|
|
150
|
+
);
|
|
217
151
|
});
|
|
218
152
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
|
|
223
|
-
var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
224
|
-
var __spreadValues$v = (a, b) => {
|
|
225
|
-
for (var prop in b || (b = {}))
|
|
226
|
-
if (__hasOwnProp$v.call(b, prop))
|
|
227
|
-
__defNormalProp$v(a, prop, b[prop]);
|
|
228
|
-
if (__getOwnPropSymbols$v)
|
|
229
|
-
for (var prop of __getOwnPropSymbols$v(b)) {
|
|
230
|
-
if (__propIsEnum$v.call(b, prop))
|
|
231
|
-
__defNormalProp$v(a, prop, b[prop]);
|
|
232
|
-
}
|
|
233
|
-
return a;
|
|
234
|
-
};
|
|
235
|
-
var __objRest$s = (source, exclude) => {
|
|
236
|
-
var target = {};
|
|
237
|
-
for (var prop in source)
|
|
238
|
-
if (__hasOwnProp$v.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
239
|
-
target[prop] = source[prop];
|
|
240
|
-
if (source != null && __getOwnPropSymbols$v)
|
|
241
|
-
for (var prop of __getOwnPropSymbols$v(source)) {
|
|
242
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$v.call(source, prop))
|
|
243
|
-
target[prop] = source[prop];
|
|
244
|
-
}
|
|
245
|
-
return target;
|
|
246
|
-
};
|
|
247
|
-
const AccordionItem = React.forwardRef(function AccordionItem2(_a, forwardedRef) {
|
|
248
|
-
var _b = _a, { children, id } = _b, props = __objRest$s(_b, ["children", "id"]);
|
|
249
|
-
const ref = utils.useObjectRef(forwardedRef);
|
|
250
|
-
const focusManager = focus.useFocusManager();
|
|
153
|
+
const AccordionItem = React.forwardRef(function AccordionItem2({ children, id, ...props }, forwardedRef) {
|
|
154
|
+
const ref = useObjectRef.useObjectRef(forwardedRef);
|
|
155
|
+
const focusManager = FocusScope.useFocusManager();
|
|
251
156
|
const onKeyDown = (e) => {
|
|
252
|
-
if (!focusManager)
|
|
253
|
-
return;
|
|
157
|
+
if (!focusManager) return;
|
|
254
158
|
if (!(e.target instanceof Element) || e.target.getAttribute("slot") !== "trigger")
|
|
255
159
|
return;
|
|
256
160
|
switch (e.key) {
|
|
@@ -274,64 +178,50 @@ const AccordionItem = React.forwardRef(function AccordionItem2(_a, forwardedRef)
|
|
|
274
178
|
return;
|
|
275
179
|
}
|
|
276
180
|
};
|
|
277
|
-
|
|
278
|
-
return /* @__PURE__ */
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
[
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
181
|
+
useEvent.useEvent(ref, "keydown", onKeyDown);
|
|
182
|
+
return /* @__PURE__ */ React.createElement(
|
|
183
|
+
reactAriaComponents.Disclosure,
|
|
184
|
+
{
|
|
185
|
+
ref,
|
|
186
|
+
id,
|
|
187
|
+
className: ({ isExpanded, isDisabled }) => clsx(styles["sapphire-accordion__item"], {
|
|
188
|
+
[styles["sapphire-accordion__item--open"]]: isExpanded,
|
|
189
|
+
[styles["is-disabled"]]: isDisabled
|
|
190
|
+
}),
|
|
191
|
+
...props
|
|
192
|
+
},
|
|
193
|
+
/* @__PURE__ */ React.createElement("div", { className: clsx(styles["sapphire-accordion__item-content-wrapper"]) }, children)
|
|
194
|
+
);
|
|
288
195
|
});
|
|
289
196
|
|
|
290
|
-
|
|
291
|
-
var __defProps$s = Object.defineProperties;
|
|
292
|
-
var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
|
|
293
|
-
var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
|
|
294
|
-
var __hasOwnProp$u = Object.prototype.hasOwnProperty;
|
|
295
|
-
var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
|
|
296
|
-
var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
297
|
-
var __spreadValues$u = (a, b) => {
|
|
298
|
-
for (var prop in b || (b = {}))
|
|
299
|
-
if (__hasOwnProp$u.call(b, prop))
|
|
300
|
-
__defNormalProp$u(a, prop, b[prop]);
|
|
301
|
-
if (__getOwnPropSymbols$u)
|
|
302
|
-
for (var prop of __getOwnPropSymbols$u(b)) {
|
|
303
|
-
if (__propIsEnum$u.call(b, prop))
|
|
304
|
-
__defNormalProp$u(a, prop, b[prop]);
|
|
305
|
-
}
|
|
306
|
-
return a;
|
|
307
|
-
};
|
|
308
|
-
var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
|
|
309
|
-
var __objRest$r = (source, exclude) => {
|
|
310
|
-
var target = {};
|
|
311
|
-
for (var prop in source)
|
|
312
|
-
if (__hasOwnProp$u.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
313
|
-
target[prop] = source[prop];
|
|
314
|
-
if (source != null && __getOwnPropSymbols$u)
|
|
315
|
-
for (var prop of __getOwnPropSymbols$u(source)) {
|
|
316
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$u.call(source, prop))
|
|
317
|
-
target[prop] = source[prop];
|
|
318
|
-
}
|
|
319
|
-
return target;
|
|
320
|
-
};
|
|
321
|
-
const AccordionPanel = React.forwardRef(function AccordionPanel2(_a, ref) {
|
|
322
|
-
var _b = _a, { children } = _b, props = __objRest$r(_b, ["children"]);
|
|
197
|
+
const AccordionPanel = React.forwardRef(function AccordionPanel2({ children, ...props }, ref) {
|
|
323
198
|
const { sidePadding } = useAccordionContext();
|
|
324
|
-
return /* @__PURE__ */
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
199
|
+
return /* @__PURE__ */ React.createElement(
|
|
200
|
+
reactAriaComponents.DisclosurePanel,
|
|
201
|
+
{
|
|
202
|
+
ref,
|
|
203
|
+
...filterDOMProps.filterDOMProps(props, { global: true }),
|
|
204
|
+
className: clsx(styles["sapphire-accordion__item-content"]),
|
|
205
|
+
style: {
|
|
206
|
+
/**
|
|
207
|
+
* useDisclosure hook from react-aria uses css variable --disclosure-panel-height to
|
|
208
|
+
* animate the height of the panel.
|
|
209
|
+
*/
|
|
210
|
+
height: "var(--disclosure-panel-height)"
|
|
211
|
+
},
|
|
212
|
+
...props
|
|
213
|
+
},
|
|
214
|
+
/* @__PURE__ */ React.createElement(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
style: {
|
|
218
|
+
...sapphireReact.withTruthyZero(sidePadding) ? customPaddingStyleProps(sidePadding) : {}
|
|
219
|
+
},
|
|
220
|
+
className: styles["sapphire-accordion__item-content-inner"]
|
|
221
|
+
},
|
|
222
|
+
children
|
|
223
|
+
)
|
|
224
|
+
);
|
|
335
225
|
});
|
|
336
226
|
|
|
337
227
|
const _Accordion = Object.assign(Accordion, {
|
|
@@ -340,47 +230,12 @@ const _Accordion = Object.assign(Accordion, {
|
|
|
340
230
|
Panel: AccordionPanel
|
|
341
231
|
});
|
|
342
232
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
350
|
-
var __spreadValues$t = (a, b) => {
|
|
351
|
-
for (var prop in b || (b = {}))
|
|
352
|
-
if (__hasOwnProp$t.call(b, prop))
|
|
353
|
-
__defNormalProp$t(a, prop, b[prop]);
|
|
354
|
-
if (__getOwnPropSymbols$t)
|
|
355
|
-
for (var prop of __getOwnPropSymbols$t(b)) {
|
|
356
|
-
if (__propIsEnum$t.call(b, prop))
|
|
357
|
-
__defNormalProp$t(a, prop, b[prop]);
|
|
358
|
-
}
|
|
359
|
-
return a;
|
|
360
|
-
};
|
|
361
|
-
var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
|
|
362
|
-
var __objRest$q = (source, exclude) => {
|
|
363
|
-
var target = {};
|
|
364
|
-
for (var prop in source)
|
|
365
|
-
if (__hasOwnProp$t.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
366
|
-
target[prop] = source[prop];
|
|
367
|
-
if (source != null && __getOwnPropSymbols$t)
|
|
368
|
-
for (var prop of __getOwnPropSymbols$t(source)) {
|
|
369
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$t.call(source, prop))
|
|
370
|
-
target[prop] = source[prop];
|
|
371
|
-
}
|
|
372
|
-
return target;
|
|
373
|
-
};
|
|
374
|
-
function Alert(_a) {
|
|
375
|
-
var _b = _a, {
|
|
376
|
-
children,
|
|
377
|
-
title,
|
|
378
|
-
variant = "info"
|
|
379
|
-
} = _b, props = __objRest$q(_b, [
|
|
380
|
-
"children",
|
|
381
|
-
"title",
|
|
382
|
-
"variant"
|
|
383
|
-
]);
|
|
233
|
+
function Alert({
|
|
234
|
+
children,
|
|
235
|
+
title,
|
|
236
|
+
variant = "info",
|
|
237
|
+
...props
|
|
238
|
+
}) {
|
|
384
239
|
sapphireReact.useThemeCheck();
|
|
385
240
|
const {
|
|
386
241
|
styleProps: { style, className }
|
|
@@ -388,38 +243,35 @@ function Alert(_a) {
|
|
|
388
243
|
const getIcon = (variant2) => {
|
|
389
244
|
switch (variant2) {
|
|
390
245
|
case "warning":
|
|
391
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ React.createElement(react.Warning, null);
|
|
392
247
|
case "positive":
|
|
393
|
-
return /* @__PURE__ */
|
|
248
|
+
return /* @__PURE__ */ React.createElement(react.CheckmarkOutline, null);
|
|
394
249
|
case "negative":
|
|
395
|
-
return /* @__PURE__ */
|
|
250
|
+
return /* @__PURE__ */ React.createElement(react.Error, null);
|
|
396
251
|
default:
|
|
397
|
-
return /* @__PURE__ */
|
|
252
|
+
return /* @__PURE__ */ React.createElement(react.Information, null);
|
|
398
253
|
}
|
|
399
254
|
};
|
|
400
|
-
return /* @__PURE__ */
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
className:
|
|
419
|
-
|
|
420
|
-
elementType: "section",
|
|
421
|
-
size: "md"
|
|
422
|
-
}, children)));
|
|
255
|
+
return /* @__PURE__ */ React.createElement(
|
|
256
|
+
"div",
|
|
257
|
+
{
|
|
258
|
+
...filterDOMProps.filterDOMProps(props, { global: true }),
|
|
259
|
+
className: clsx.clsx(
|
|
260
|
+
alertStyles["sapphire-alert"],
|
|
261
|
+
{
|
|
262
|
+
[alertStyles["sapphire-alert--positive"]]: variant === "positive",
|
|
263
|
+
[alertStyles["sapphire-alert--negative"]]: variant === "negative",
|
|
264
|
+
[alertStyles["sapphire-alert--warning"]]: variant === "warning"
|
|
265
|
+
},
|
|
266
|
+
className
|
|
267
|
+
),
|
|
268
|
+
style,
|
|
269
|
+
role: "alert"
|
|
270
|
+
},
|
|
271
|
+
/* @__PURE__ */ React.createElement("span", { className: alertStyles["sapphire-alert__icon"] }, /* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: "sm" }, getIcon(variant))),
|
|
272
|
+
/* @__PURE__ */ React.createElement("div", { className: alertStyles["sapphire-alert__title"] }, /* @__PURE__ */ React.createElement(sapphireReact.Typography.Body, { size: "sm", isSemibold: true }, title)),
|
|
273
|
+
/* @__PURE__ */ React.createElement("div", { className: alertStyles["sapphire-alert__content"] }, /* @__PURE__ */ React.createElement(sapphireReact.Typography.Body, { elementType: "section", size: "md" }, children))
|
|
274
|
+
);
|
|
423
275
|
}
|
|
424
276
|
|
|
425
277
|
const useGroupAmount = (value, formatter) => {
|
|
@@ -449,76 +301,57 @@ const useGroupAmount = (value, formatter) => {
|
|
|
449
301
|
}
|
|
450
302
|
return result;
|
|
451
303
|
}, [numberValue, formatter]);
|
|
452
|
-
const formattedValue = React.useMemo(
|
|
304
|
+
const formattedValue = React.useMemo(
|
|
305
|
+
() => groupedParts.map((part) => part.value).join(""),
|
|
306
|
+
[groupedParts]
|
|
307
|
+
);
|
|
453
308
|
return { formattedValue, groupedParts };
|
|
454
309
|
};
|
|
455
310
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
for (var prop in b || (b = {}))
|
|
465
|
-
if (__hasOwnProp$s.call(b, prop))
|
|
466
|
-
__defNormalProp$s(a, prop, b[prop]);
|
|
467
|
-
if (__getOwnPropSymbols$s)
|
|
468
|
-
for (var prop of __getOwnPropSymbols$s(b)) {
|
|
469
|
-
if (__propIsEnum$s.call(b, prop))
|
|
470
|
-
__defNormalProp$s(a, prop, b[prop]);
|
|
471
|
-
}
|
|
472
|
-
return a;
|
|
473
|
-
};
|
|
474
|
-
var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
|
|
475
|
-
var __objRest$p = (source, exclude) => {
|
|
476
|
-
var target = {};
|
|
477
|
-
for (var prop in source)
|
|
478
|
-
if (__hasOwnProp$s.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
479
|
-
target[prop] = source[prop];
|
|
480
|
-
if (source != null && __getOwnPropSymbols$s)
|
|
481
|
-
for (var prop of __getOwnPropSymbols$s(source)) {
|
|
482
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$s.call(source, prop))
|
|
483
|
-
target[prop] = source[prop];
|
|
484
|
-
}
|
|
485
|
-
return target;
|
|
486
|
-
};
|
|
487
|
-
const Amount = (_a) => {
|
|
488
|
-
var _b = _a, {
|
|
489
|
-
emphasis = "regular",
|
|
490
|
-
variant,
|
|
491
|
-
formatOptions,
|
|
492
|
-
value,
|
|
493
|
-
size
|
|
494
|
-
} = _b, props = __objRest$p(_b, [
|
|
495
|
-
"emphasis",
|
|
496
|
-
"variant",
|
|
497
|
-
"formatOptions",
|
|
498
|
-
"value",
|
|
499
|
-
"size"
|
|
500
|
-
]);
|
|
311
|
+
const Amount = ({
|
|
312
|
+
emphasis = "regular",
|
|
313
|
+
variant,
|
|
314
|
+
formatOptions,
|
|
315
|
+
value,
|
|
316
|
+
size,
|
|
317
|
+
...props
|
|
318
|
+
}) => {
|
|
501
319
|
sapphireReact.useThemeCheck();
|
|
502
320
|
const { styleProps, filteredProps } = sapphireReact.useSapphireStyleProps(props);
|
|
503
|
-
const { locale } =
|
|
504
|
-
const formatter = React.useMemo(
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
321
|
+
const { locale } = I18nProvider.useLocale();
|
|
322
|
+
const formatter = React.useMemo(
|
|
323
|
+
() => new Intl.NumberFormat(locale, {
|
|
324
|
+
style: formatOptions?.currency ? "currency" : void 0,
|
|
325
|
+
/**
|
|
326
|
+
* Always show the sign if the value starts with '+' or '-'.
|
|
327
|
+
*/
|
|
328
|
+
signDisplay: formatOptions?.signDisplay || String(value).startsWith("+") ? "always" : "auto",
|
|
329
|
+
minimumFractionDigits: 2,
|
|
330
|
+
...formatOptions
|
|
331
|
+
}),
|
|
332
|
+
[locale, formatOptions, value]
|
|
333
|
+
);
|
|
509
334
|
const { formattedValue, groupedParts } = useGroupAmount(value, formatter);
|
|
510
|
-
return /* @__PURE__ */
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
335
|
+
return /* @__PURE__ */ React.createElement(
|
|
336
|
+
"span",
|
|
337
|
+
{
|
|
338
|
+
style: styleProps.style,
|
|
339
|
+
className: styles$1["sapphire-amount"],
|
|
340
|
+
...filteredProps,
|
|
341
|
+
"aria-label": formattedValue
|
|
342
|
+
},
|
|
343
|
+
groupedParts.map((part, index) => /* @__PURE__ */ React.createElement(
|
|
344
|
+
sapphireReact.Typography.Body,
|
|
345
|
+
{
|
|
346
|
+
elementType: "span",
|
|
347
|
+
key: index,
|
|
348
|
+
color: variant === "positive" ? "positive" : "primary",
|
|
349
|
+
isSemibold: emphasis === "primary" ? true : false,
|
|
350
|
+
size
|
|
351
|
+
},
|
|
352
|
+
part.value
|
|
353
|
+
))
|
|
354
|
+
);
|
|
522
355
|
};
|
|
523
356
|
|
|
524
357
|
var da$3 = {
|
|
@@ -559,113 +392,94 @@ var intlMessages$3 = {
|
|
|
559
392
|
"sv-SE": se$3
|
|
560
393
|
};
|
|
561
394
|
|
|
562
|
-
var __defProp$r = Object.defineProperty;
|
|
563
|
-
var __defProps$p = Object.defineProperties;
|
|
564
|
-
var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
|
|
565
|
-
var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
|
|
566
|
-
var __hasOwnProp$r = Object.prototype.hasOwnProperty;
|
|
567
|
-
var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
|
|
568
|
-
var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
569
|
-
var __spreadValues$r = (a, b) => {
|
|
570
|
-
for (var prop in b || (b = {}))
|
|
571
|
-
if (__hasOwnProp$r.call(b, prop))
|
|
572
|
-
__defNormalProp$r(a, prop, b[prop]);
|
|
573
|
-
if (__getOwnPropSymbols$r)
|
|
574
|
-
for (var prop of __getOwnPropSymbols$r(b)) {
|
|
575
|
-
if (__propIsEnum$r.call(b, prop))
|
|
576
|
-
__defNormalProp$r(a, prop, b[prop]);
|
|
577
|
-
}
|
|
578
|
-
return a;
|
|
579
|
-
};
|
|
580
|
-
var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
|
|
581
|
-
var __objRest$o = (source, exclude) => {
|
|
582
|
-
var target = {};
|
|
583
|
-
for (var prop in source)
|
|
584
|
-
if (__hasOwnProp$r.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
585
|
-
target[prop] = source[prop];
|
|
586
|
-
if (source != null && __getOwnPropSymbols$r)
|
|
587
|
-
for (var prop of __getOwnPropSymbols$r(source)) {
|
|
588
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$r.call(source, prop))
|
|
589
|
-
target[prop] = source[prop];
|
|
590
|
-
}
|
|
591
|
-
return target;
|
|
592
|
-
};
|
|
593
395
|
function Autocomplete(props) {
|
|
594
|
-
var _b;
|
|
595
396
|
sapphireReact.useThemeCheck();
|
|
596
397
|
const formatMessage = i18n.useMessageFormatter(intlMessages$3);
|
|
597
|
-
const
|
|
398
|
+
const {
|
|
598
399
|
inputValue,
|
|
599
400
|
renderInput,
|
|
600
401
|
loadingState,
|
|
601
402
|
loadingSkeletonRowsCount,
|
|
602
403
|
listboxAriaLabel,
|
|
603
404
|
onSuggestionSelected,
|
|
604
|
-
onSelectionChange
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
"renderInput",
|
|
608
|
-
"loadingState",
|
|
609
|
-
"loadingSkeletonRowsCount",
|
|
610
|
-
"listboxAriaLabel",
|
|
611
|
-
"onSuggestionSelected",
|
|
612
|
-
"onSelectionChange"
|
|
613
|
-
]);
|
|
405
|
+
onSelectionChange,
|
|
406
|
+
...otherProps
|
|
407
|
+
} = props;
|
|
614
408
|
const {
|
|
615
409
|
styleProps: { style, className }
|
|
616
410
|
} = sapphireReact.useSapphireStyleProps(props);
|
|
617
411
|
const inputRef = React.useRef(null);
|
|
618
|
-
const listBoxRef = utils
|
|
412
|
+
const listBoxRef = utils.useFocusableRef(null);
|
|
619
413
|
const popoverRef = React.useRef(null);
|
|
620
|
-
const triggerRef = utils
|
|
621
|
-
const
|
|
414
|
+
const triggerRef = utils.useFocusableRef(null);
|
|
415
|
+
const collectionRef = React.useRef(null);
|
|
416
|
+
const state = sapphireReact.useComboBoxState({
|
|
417
|
+
...props,
|
|
622
418
|
inputValue,
|
|
623
419
|
allowsEmptyCollection: loadingState === "loading",
|
|
624
420
|
allowsCustomValue: true,
|
|
625
421
|
shouldCloseOnBlur: true,
|
|
626
422
|
onSelectionChange: (key) => {
|
|
627
423
|
if (key !== null) {
|
|
628
|
-
onSelectionChange
|
|
629
|
-
onSuggestionSelected
|
|
424
|
+
onSelectionChange?.(key);
|
|
425
|
+
onSuggestionSelected?.(key);
|
|
426
|
+
const itemText = collectionRef.current?.getItem(key)?.textValue ?? "";
|
|
427
|
+
if (itemText) {
|
|
428
|
+
props.onInputChange?.(itemText);
|
|
429
|
+
}
|
|
630
430
|
}
|
|
631
431
|
}
|
|
632
|
-
})
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
432
|
+
});
|
|
433
|
+
collectionRef.current = state.collection;
|
|
434
|
+
const { inputProps, listBoxProps } = useComboBox.useComboBox(
|
|
435
|
+
{
|
|
436
|
+
...props,
|
|
437
|
+
"aria-label": listboxAriaLabel || formatMessage("listbox-suggestions"),
|
|
438
|
+
inputRef,
|
|
439
|
+
listBoxRef,
|
|
440
|
+
popoverRef
|
|
441
|
+
},
|
|
442
|
+
state
|
|
443
|
+
);
|
|
444
|
+
const inputElement = renderInput({
|
|
445
|
+
...inputProps,
|
|
640
446
|
isDisabled: props.isDisabled,
|
|
641
447
|
inputRef,
|
|
642
448
|
"aria-haspopup": "listbox",
|
|
643
449
|
"aria-expanded": state.isOpen,
|
|
644
450
|
onChange: (value) => {
|
|
645
|
-
|
|
646
|
-
(_a2 = inputProps.onChange) == null ? void 0 : _a2.call(inputProps, {
|
|
451
|
+
inputProps.onChange?.({
|
|
647
452
|
target: { value },
|
|
648
453
|
currentTarget: { value }
|
|
649
454
|
});
|
|
650
455
|
}
|
|
651
|
-
})
|
|
652
|
-
return /* @__PURE__ */
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
456
|
+
});
|
|
457
|
+
return /* @__PURE__ */ React.createElement(
|
|
458
|
+
"div",
|
|
459
|
+
{
|
|
460
|
+
ref: triggerRef,
|
|
461
|
+
...filterDOMProps.filterDOMProps(otherProps, { global: true }),
|
|
462
|
+
style: { display: "inline-flex", ...style },
|
|
463
|
+
className
|
|
464
|
+
},
|
|
465
|
+
inputElement,
|
|
466
|
+
state.isOpen && /* @__PURE__ */ React.createElement(
|
|
467
|
+
sapphireReact.ListBoxPopover,
|
|
468
|
+
{
|
|
469
|
+
state,
|
|
470
|
+
triggerRef,
|
|
471
|
+
popoverRef,
|
|
472
|
+
listBoxRef,
|
|
473
|
+
listBoxProps,
|
|
474
|
+
loadingState,
|
|
475
|
+
loadingSkeletonRowsCount,
|
|
476
|
+
selectWidth: triggerRef.current?.offsetWidth,
|
|
477
|
+
disableSelectedStyles: true,
|
|
478
|
+
isNonModal: true
|
|
479
|
+
},
|
|
480
|
+
props.children || []
|
|
481
|
+
)
|
|
482
|
+
);
|
|
669
483
|
}
|
|
670
484
|
|
|
671
485
|
const useBreadcrumbThreshold = (childrenCount, containerRef, breadcrumbRef) => {
|
|
@@ -698,9 +512,10 @@ const useBreadcrumbThreshold = (childrenCount, containerRef, breadcrumbRef) => {
|
|
|
698
512
|
};
|
|
699
513
|
}, [itemWidths, containerWidth, childrenCount]);
|
|
700
514
|
const computeItemWidths = () => {
|
|
701
|
-
if (!breadcrumbRef.current)
|
|
702
|
-
|
|
703
|
-
|
|
515
|
+
if (!breadcrumbRef.current) return;
|
|
516
|
+
const breadcrumbItems = Array.from(
|
|
517
|
+
breadcrumbRef.current.children
|
|
518
|
+
);
|
|
704
519
|
const widths = breadcrumbItems.map((item) => item.offsetWidth).filter(Boolean);
|
|
705
520
|
if (widths.length === breadcrumbItems.length) {
|
|
706
521
|
setItemWidths(widths);
|
|
@@ -711,11 +526,10 @@ const useBreadcrumbThreshold = (childrenCount, containerRef, breadcrumbRef) => {
|
|
|
711
526
|
computeItemWidths();
|
|
712
527
|
}
|
|
713
528
|
}, [containerRef.current, childrenCount]);
|
|
714
|
-
|
|
529
|
+
useResizeObserver.useResizeObserver({
|
|
715
530
|
ref: containerRef,
|
|
716
531
|
onResize: () => {
|
|
717
|
-
if (!containerRef.current)
|
|
718
|
-
return;
|
|
532
|
+
if (!containerRef.current) return;
|
|
719
533
|
setContainerWidth(containerRef.current.offsetWidth);
|
|
720
534
|
}
|
|
721
535
|
});
|
|
@@ -734,332 +548,233 @@ const useBreadcrumbThreshold = (childrenCount, containerRef, breadcrumbRef) => {
|
|
|
734
548
|
};
|
|
735
549
|
};
|
|
736
550
|
|
|
737
|
-
var __defProp$q = Object.defineProperty;
|
|
738
|
-
var __defProps$o = Object.defineProperties;
|
|
739
|
-
var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
|
|
740
|
-
var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
|
|
741
|
-
var __hasOwnProp$q = Object.prototype.hasOwnProperty;
|
|
742
|
-
var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
|
|
743
|
-
var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
744
|
-
var __spreadValues$q = (a, b) => {
|
|
745
|
-
for (var prop in b || (b = {}))
|
|
746
|
-
if (__hasOwnProp$q.call(b, prop))
|
|
747
|
-
__defNormalProp$q(a, prop, b[prop]);
|
|
748
|
-
if (__getOwnPropSymbols$q)
|
|
749
|
-
for (var prop of __getOwnPropSymbols$q(b)) {
|
|
750
|
-
if (__propIsEnum$q.call(b, prop))
|
|
751
|
-
__defNormalProp$q(a, prop, b[prop]);
|
|
752
|
-
}
|
|
753
|
-
return a;
|
|
754
|
-
};
|
|
755
|
-
var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
|
|
756
|
-
var __objRest$n = (source, exclude) => {
|
|
757
|
-
var target = {};
|
|
758
|
-
for (var prop in source)
|
|
759
|
-
if (__hasOwnProp$q.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
760
|
-
target[prop] = source[prop];
|
|
761
|
-
if (source != null && __getOwnPropSymbols$q)
|
|
762
|
-
for (var prop of __getOwnPropSymbols$q(source)) {
|
|
763
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$q.call(source, prop))
|
|
764
|
-
target[prop] = source[prop];
|
|
765
|
-
}
|
|
766
|
-
return target;
|
|
767
|
-
};
|
|
768
551
|
const BreadcrumbsContext = React.createContext({ size: "md", overflowNodes: [] });
|
|
769
|
-
const Breadcrumbs = React.forwardRef(function Breadcrumbs2(
|
|
770
|
-
var _b = _a, { maxWidth, size = "md" } = _b, props = __objRest$n(_b, ["maxWidth", "size"]);
|
|
552
|
+
const Breadcrumbs = React.forwardRef(function Breadcrumbs2({ maxWidth, size = "md", ...props }, fwdRef) {
|
|
771
553
|
const [RACprops, ref] = reactAriaComponents.useContextProps(props, fwdRef, reactAriaComponents.BreadcrumbsContext);
|
|
772
554
|
const { styleProps } = sapphireReact.useSapphireStyleProps(RACprops);
|
|
773
555
|
const containerRef = React.useRef(null);
|
|
774
556
|
const { CollectionRoot } = React.useContext(reactAriaComponents.CollectionRendererContext);
|
|
775
|
-
const { navProps } =
|
|
776
|
-
const DOMProps =
|
|
777
|
-
return /* @__PURE__ */
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
const keys = Array.from(collection.getKeys());
|
|
782
|
-
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
783
|
-
ref: containerRef,
|
|
784
|
-
style: __spreadProps$o(__spreadValues$q({}, styleProps.style), {
|
|
785
|
-
maxWidth,
|
|
786
|
-
display: "flex"
|
|
787
|
-
})
|
|
788
|
-
}, /* @__PURE__ */ React__default["default"].createElement("ol", __spreadProps$o(__spreadValues$q({
|
|
557
|
+
const { navProps } = useBreadcrumbs.useBreadcrumbs(RACprops);
|
|
558
|
+
const DOMProps = filterDOMProps.filterDOMProps(RACprops, { global: true });
|
|
559
|
+
return /* @__PURE__ */ React.createElement(CollectionBuilder.CollectionBuilder, { content: /* @__PURE__ */ React.createElement(Collection.Collection, { ...RACprops }) }, (collection) => {
|
|
560
|
+
const { overflowNodes } = useBreadcrumbThreshold(
|
|
561
|
+
collection.size,
|
|
562
|
+
containerRef,
|
|
789
563
|
ref
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
564
|
+
);
|
|
565
|
+
const keys = Array.from(collection.getKeys());
|
|
566
|
+
return /* @__PURE__ */ React.createElement(
|
|
567
|
+
"div",
|
|
568
|
+
{
|
|
569
|
+
ref: containerRef,
|
|
570
|
+
style: {
|
|
571
|
+
...styleProps.style,
|
|
572
|
+
maxWidth,
|
|
573
|
+
display: "flex"
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
/* @__PURE__ */ React.createElement(
|
|
577
|
+
"ol",
|
|
578
|
+
{
|
|
579
|
+
ref,
|
|
580
|
+
...mergeProps.mergeProps(DOMProps, navProps),
|
|
581
|
+
className: clsx(styles$2["sapphire-breadcrumbs"], {
|
|
582
|
+
[styles$2["sapphire-breadcrumbs--sm"]]: size === "sm",
|
|
583
|
+
[styles$2["sapphire-breadcrumbs--lg"]]: size === "lg"
|
|
584
|
+
})
|
|
585
|
+
},
|
|
586
|
+
/* @__PURE__ */ React.createElement(
|
|
587
|
+
BreadcrumbsContext.Provider,
|
|
588
|
+
{
|
|
589
|
+
value: {
|
|
590
|
+
size,
|
|
591
|
+
overflowNodes: overflowNodes.map(
|
|
592
|
+
(index) => collection.getItem(keys[index])
|
|
593
|
+
),
|
|
594
|
+
isDisabled: RACprops.isDisabled
|
|
595
|
+
}
|
|
596
|
+
},
|
|
597
|
+
/* @__PURE__ */ React.createElement(reactAriaComponents.BreadcrumbsContext.Provider, { value: RACprops }, /* @__PURE__ */ React.createElement(CollectionRoot, { collection }))
|
|
598
|
+
)
|
|
599
|
+
)
|
|
600
|
+
);
|
|
806
601
|
});
|
|
807
602
|
});
|
|
808
603
|
|
|
809
604
|
const BreadcrumbsSeparator = () => {
|
|
810
605
|
const { size } = React.useContext(BreadcrumbsContext);
|
|
811
606
|
const iconSize = size === "lg" ? "md" : "sm";
|
|
812
|
-
return /* @__PURE__ */
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
607
|
+
return /* @__PURE__ */ React.createElement(
|
|
608
|
+
"span",
|
|
609
|
+
{
|
|
610
|
+
className: clsx(styles$2["sapphire-breadcrumbs__separator"]),
|
|
611
|
+
"aria-hidden": "true"
|
|
612
|
+
},
|
|
613
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: iconSize }, /* @__PURE__ */ React.createElement(react.ChevronRight, null))
|
|
614
|
+
);
|
|
818
615
|
};
|
|
819
616
|
|
|
820
617
|
const BreadcrumbOverflowMenu = () => {
|
|
821
618
|
const { size, overflowNodes } = React.useContext(BreadcrumbsContext);
|
|
822
|
-
return /* @__PURE__ */
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
size
|
|
826
|
-
},
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
for (var prop in b || (b = {}))
|
|
844
|
-
if (__hasOwnProp$p.call(b, prop))
|
|
845
|
-
__defNormalProp$p(a, prop, b[prop]);
|
|
846
|
-
if (__getOwnPropSymbols$p)
|
|
847
|
-
for (var prop of __getOwnPropSymbols$p(b)) {
|
|
848
|
-
if (__propIsEnum$p.call(b, prop))
|
|
849
|
-
__defNormalProp$p(a, prop, b[prop]);
|
|
850
|
-
}
|
|
851
|
-
return a;
|
|
852
|
-
};
|
|
853
|
-
var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
|
|
854
|
-
var __objRest$m = (source, exclude) => {
|
|
855
|
-
var target = {};
|
|
856
|
-
for (var prop in source)
|
|
857
|
-
if (__hasOwnProp$p.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
858
|
-
target[prop] = source[prop];
|
|
859
|
-
if (source != null && __getOwnPropSymbols$p)
|
|
860
|
-
for (var prop of __getOwnPropSymbols$p(source)) {
|
|
861
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$p.call(source, prop))
|
|
862
|
-
target[prop] = source[prop];
|
|
863
|
-
}
|
|
864
|
-
return target;
|
|
865
|
-
};
|
|
866
|
-
const BreadcrumbItemStatic = React.forwardRef(function BreadcrumbItemStatic2(_a, ref) {
|
|
867
|
-
var _b = _a, { size } = _b, props = __objRest$m(_b, ["size"]);
|
|
619
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
620
|
+
sapphireReact.Menu,
|
|
621
|
+
{
|
|
622
|
+
triggerElement: /* @__PURE__ */ React.createElement(sapphireReact.IconButton, { "aria-label": "Show more breadcrumbs", size }, /* @__PURE__ */ React.createElement(react.OverflowMenuHorizontal, null))
|
|
623
|
+
},
|
|
624
|
+
overflowNodes.map(
|
|
625
|
+
(item) => !item ? null : /* @__PURE__ */ React.createElement(
|
|
626
|
+
sapphireReact.MenuItem,
|
|
627
|
+
{
|
|
628
|
+
key: item.key,
|
|
629
|
+
id: item.key,
|
|
630
|
+
href: item.href,
|
|
631
|
+
isDisabled: !item.href
|
|
632
|
+
},
|
|
633
|
+
item.rendered
|
|
634
|
+
)
|
|
635
|
+
)
|
|
636
|
+
), /* @__PURE__ */ React.createElement(BreadcrumbsSeparator, null));
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
const BreadcrumbItemStatic = React.forwardRef(function BreadcrumbItemStatic2({ size, ...props }, ref) {
|
|
868
640
|
sapphireReact.useThemeCheck();
|
|
869
641
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
870
|
-
return /* @__PURE__ */
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
642
|
+
return /* @__PURE__ */ React.createElement(sapphireReact.TooltipIfNeeded, { title: props.children }, (tooltipContentRef, tooltipProps) => {
|
|
643
|
+
const positioningRef = tooltipProps?.ref;
|
|
644
|
+
return /* @__PURE__ */ React.createElement(
|
|
645
|
+
"span",
|
|
646
|
+
{
|
|
647
|
+
...tooltipProps,
|
|
648
|
+
ref: mergeRefs.mergeRefs(
|
|
649
|
+
ref,
|
|
650
|
+
tooltipContentRef,
|
|
651
|
+
positioningRef
|
|
652
|
+
),
|
|
653
|
+
className: clsx(
|
|
654
|
+
styles$2["sapphire-breadcrumbs__item--static"],
|
|
655
|
+
{
|
|
656
|
+
[styles$2["sapphire-breadcrumbs__item--static--sm"]]: size === "sm",
|
|
657
|
+
[styles$2["sapphire-breadcrumbs__item--static--lg"]]: size === "lg"
|
|
658
|
+
},
|
|
659
|
+
styleProps.className
|
|
660
|
+
),
|
|
661
|
+
style: styleProps.style
|
|
662
|
+
},
|
|
663
|
+
props.children
|
|
664
|
+
);
|
|
882
665
|
});
|
|
883
666
|
});
|
|
884
667
|
|
|
885
|
-
|
|
886
|
-
var __defProps$m = Object.defineProperties;
|
|
887
|
-
var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
|
|
888
|
-
var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
|
|
889
|
-
var __hasOwnProp$o = Object.prototype.hasOwnProperty;
|
|
890
|
-
var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
|
|
891
|
-
var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
892
|
-
var __spreadValues$o = (a, b) => {
|
|
893
|
-
for (var prop in b || (b = {}))
|
|
894
|
-
if (__hasOwnProp$o.call(b, prop))
|
|
895
|
-
__defNormalProp$o(a, prop, b[prop]);
|
|
896
|
-
if (__getOwnPropSymbols$o)
|
|
897
|
-
for (var prop of __getOwnPropSymbols$o(b)) {
|
|
898
|
-
if (__propIsEnum$o.call(b, prop))
|
|
899
|
-
__defNormalProp$o(a, prop, b[prop]);
|
|
900
|
-
}
|
|
901
|
-
return a;
|
|
902
|
-
};
|
|
903
|
-
var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
|
|
904
|
-
var __objRest$l = (source, exclude) => {
|
|
905
|
-
var target = {};
|
|
906
|
-
for (var prop in source)
|
|
907
|
-
if (__hasOwnProp$o.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
908
|
-
target[prop] = source[prop];
|
|
909
|
-
if (source != null && __getOwnPropSymbols$o)
|
|
910
|
-
for (var prop of __getOwnPropSymbols$o(source)) {
|
|
911
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$o.call(source, prop))
|
|
912
|
-
target[prop] = source[prop];
|
|
913
|
-
}
|
|
914
|
-
return target;
|
|
915
|
-
};
|
|
916
|
-
const BreadcrumbItemLink = React.forwardRef(function BreadcrumbItemLink2(_a, ref) {
|
|
917
|
-
var _b = _a, { children } = _b, props = __objRest$l(_b, ["children"]);
|
|
668
|
+
const BreadcrumbItemLink = React.forwardRef(function BreadcrumbItemLink2({ children, ...props }, ref) {
|
|
918
669
|
sapphireReact.useThemeCheck();
|
|
919
670
|
const { styleProps: sapphireStyleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
920
|
-
const
|
|
671
|
+
const { style, className, ...styleProps } = sapphireStyleProps;
|
|
921
672
|
const { size } = React.useContext(BreadcrumbsContext);
|
|
922
673
|
if (!props.href && !props.UNSAFE_onClick) {
|
|
923
|
-
return /* @__PURE__ */
|
|
924
|
-
size
|
|
925
|
-
}), children);
|
|
674
|
+
return /* @__PURE__ */ React.createElement(BreadcrumbItemStatic, { ...props, size }, children);
|
|
926
675
|
}
|
|
927
|
-
return /* @__PURE__ */
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
676
|
+
return /* @__PURE__ */ React.createElement(
|
|
677
|
+
sapphireReact.Button,
|
|
678
|
+
{
|
|
679
|
+
...props,
|
|
680
|
+
...styleProps,
|
|
681
|
+
UNSAFE_className: className,
|
|
682
|
+
UNSAFE_style: { ...style },
|
|
683
|
+
ref,
|
|
684
|
+
size,
|
|
685
|
+
variant: "tertiary",
|
|
686
|
+
isDisabled: props.isDisabled
|
|
687
|
+
},
|
|
688
|
+
children
|
|
689
|
+
);
|
|
935
690
|
});
|
|
936
691
|
BreadcrumbItemLink.displayName = "BreadcrumbItemLink";
|
|
937
692
|
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
var __hasOwnProp$n = Object.prototype.hasOwnProperty;
|
|
941
|
-
var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
|
|
942
|
-
var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
943
|
-
var __spreadValues$n = (a, b) => {
|
|
944
|
-
for (var prop in b || (b = {}))
|
|
945
|
-
if (__hasOwnProp$n.call(b, prop))
|
|
946
|
-
__defNormalProp$n(a, prop, b[prop]);
|
|
947
|
-
if (__getOwnPropSymbols$n)
|
|
948
|
-
for (var prop of __getOwnPropSymbols$n(b)) {
|
|
949
|
-
if (__propIsEnum$n.call(b, prop))
|
|
950
|
-
__defNormalProp$n(a, prop, b[prop]);
|
|
951
|
-
}
|
|
952
|
-
return a;
|
|
953
|
-
};
|
|
954
|
-
class BreadcrumbItemCollectionNode extends collections.CollectionNode {
|
|
693
|
+
class BreadcrumbItemCollectionNode extends BaseCollection.CollectionNode {
|
|
694
|
+
static type = "item";
|
|
955
695
|
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
696
|
+
const BreadcrumbItem = CollectionBuilder.createLeafComponent(
|
|
697
|
+
BreadcrumbItemCollectionNode,
|
|
698
|
+
function BreadcrumbItem2(props, ref, node) {
|
|
699
|
+
sapphireReact.useThemeCheck();
|
|
700
|
+
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
701
|
+
const {
|
|
702
|
+
size,
|
|
703
|
+
overflowNodes,
|
|
704
|
+
isDisabled: breadcrumbsDisabled
|
|
705
|
+
} = React.useContext(BreadcrumbsContext);
|
|
706
|
+
const { isDisabled: individualDisabled = false } = props;
|
|
707
|
+
const isCurrent = node.nextKey == null;
|
|
708
|
+
const isDisabled = individualDisabled || breadcrumbsDisabled;
|
|
709
|
+
const shouldRender = !overflowNodes.some((item) => item?.key === node.key);
|
|
710
|
+
const showOverflowMenu = overflowNodes[0]?.key === node.key;
|
|
711
|
+
if (!shouldRender && !showOverflowMenu) {
|
|
712
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
713
|
+
}
|
|
714
|
+
if (!shouldRender && showOverflowMenu) {
|
|
715
|
+
return /* @__PURE__ */ React.createElement(BreadcrumbOverflowMenu, null);
|
|
716
|
+
}
|
|
717
|
+
node.href = props.href;
|
|
718
|
+
return /* @__PURE__ */ React.createElement(
|
|
719
|
+
"li",
|
|
720
|
+
{
|
|
721
|
+
ref,
|
|
722
|
+
className: clsx(styles$2["sapphire-breadcrumbs__item"]),
|
|
723
|
+
style: { ...styleProps.style },
|
|
724
|
+
"data-disabled": isDisabled || void 0,
|
|
725
|
+
"data-current": isCurrent || void 0
|
|
726
|
+
},
|
|
727
|
+
isCurrent ? /* @__PURE__ */ React.createElement(
|
|
728
|
+
sapphireReact.Typography.Body,
|
|
729
|
+
{
|
|
730
|
+
elementType: "span",
|
|
731
|
+
isSemibold: true,
|
|
732
|
+
size: size === "lg" ? "md" : size === "md" ? "sm" : "xs"
|
|
733
|
+
},
|
|
734
|
+
node.rendered
|
|
735
|
+
) : /* @__PURE__ */ React.createElement(BreadcrumbItemLink, { isDisabled, ...props }, node.rendered),
|
|
736
|
+
!isCurrent && /* @__PURE__ */ React.createElement(BreadcrumbsSeparator, null)
|
|
737
|
+
);
|
|
976
738
|
}
|
|
977
|
-
|
|
978
|
-
return /* @__PURE__ */ React__default["default"].createElement("li", {
|
|
979
|
-
ref,
|
|
980
|
-
className: clsx__default["default"](styles__default$2["default"]["sapphire-breadcrumbs__item"]),
|
|
981
|
-
style: __spreadValues$n({}, styleProps.style),
|
|
982
|
-
"data-disabled": isDisabled || void 0,
|
|
983
|
-
"data-current": isCurrent || void 0
|
|
984
|
-
}, isCurrent ? /* @__PURE__ */ React__default["default"].createElement(sapphireReact.Typography.Body, {
|
|
985
|
-
elementType: "span",
|
|
986
|
-
isSemibold: true,
|
|
987
|
-
size: size === "lg" ? "md" : size === "md" ? "sm" : "xs"
|
|
988
|
-
}, node.rendered) : /* @__PURE__ */ React__default["default"].createElement(BreadcrumbItemLink, __spreadValues$n({
|
|
989
|
-
isDisabled
|
|
990
|
-
}, props), node.rendered), !isCurrent && /* @__PURE__ */ React__default["default"].createElement(BreadcrumbsSeparator, null));
|
|
991
|
-
});
|
|
739
|
+
);
|
|
992
740
|
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
|
|
996
|
-
var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
|
|
997
|
-
var __hasOwnProp$m = Object.prototype.hasOwnProperty;
|
|
998
|
-
var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
|
|
999
|
-
var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1000
|
-
var __spreadValues$m = (a, b) => {
|
|
1001
|
-
for (var prop in b || (b = {}))
|
|
1002
|
-
if (__hasOwnProp$m.call(b, prop))
|
|
1003
|
-
__defNormalProp$m(a, prop, b[prop]);
|
|
1004
|
-
if (__getOwnPropSymbols$m)
|
|
1005
|
-
for (var prop of __getOwnPropSymbols$m(b)) {
|
|
1006
|
-
if (__propIsEnum$m.call(b, prop))
|
|
1007
|
-
__defNormalProp$m(a, prop, b[prop]);
|
|
1008
|
-
}
|
|
1009
|
-
return a;
|
|
1010
|
-
};
|
|
1011
|
-
var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
|
|
1012
|
-
var __objRest$k = (source, exclude) => {
|
|
1013
|
-
var target = {};
|
|
1014
|
-
for (var prop in source)
|
|
1015
|
-
if (__hasOwnProp$m.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1016
|
-
target[prop] = source[prop];
|
|
1017
|
-
if (source != null && __getOwnPropSymbols$m)
|
|
1018
|
-
for (var prop of __getOwnPropSymbols$m(source)) {
|
|
1019
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$m.call(source, prop))
|
|
1020
|
-
target[prop] = source[prop];
|
|
1021
|
-
}
|
|
1022
|
-
return target;
|
|
1023
|
-
};
|
|
1024
|
-
const HiddenFileInput = React__default["default"].forwardRef(function InputWrapper(props, ref) {
|
|
1025
|
-
return /* @__PURE__ */ React__default["default"].createElement("input", __spreadProps$l(__spreadValues$m({}, props), {
|
|
1026
|
-
ref,
|
|
1027
|
-
type: "file",
|
|
1028
|
-
style: { display: "none" }
|
|
1029
|
-
}));
|
|
741
|
+
const HiddenFileInput = React.forwardRef(function InputWrapper(props, ref) {
|
|
742
|
+
return /* @__PURE__ */ React.createElement("input", { ...props, ref, type: "file", style: { display: "none" } });
|
|
1030
743
|
});
|
|
1031
|
-
const FileTrigger =
|
|
1032
|
-
const
|
|
744
|
+
const FileTrigger = React.forwardRef(function FileTriggerWrapper(props, ref) {
|
|
745
|
+
const {
|
|
1033
746
|
acceptedFileTypes,
|
|
1034
747
|
allowsMultiple = false,
|
|
1035
748
|
onSelect = () => null,
|
|
1036
749
|
children,
|
|
1037
|
-
isDisabled = false
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
if (inputRef.current) {
|
|
1052
|
-
inputRef.current.value = "";
|
|
750
|
+
isDisabled = false,
|
|
751
|
+
...rest
|
|
752
|
+
} = props;
|
|
753
|
+
const inputRef = useObjectRef.useObjectRef(ref);
|
|
754
|
+
const domProps = filterDOMProps.filterDOMProps(rest, { global: true });
|
|
755
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
756
|
+
PressResponder.PressResponder,
|
|
757
|
+
{
|
|
758
|
+
isDisabled,
|
|
759
|
+
onPress: () => {
|
|
760
|
+
if (inputRef.current) {
|
|
761
|
+
inputRef.current.value = "";
|
|
762
|
+
}
|
|
763
|
+
inputRef.current?.click();
|
|
1053
764
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
765
|
+
},
|
|
766
|
+
children
|
|
767
|
+
), /* @__PURE__ */ React.createElement(
|
|
768
|
+
HiddenFileInput,
|
|
769
|
+
{
|
|
770
|
+
...domProps,
|
|
771
|
+
disabled: isDisabled,
|
|
772
|
+
ref: inputRef,
|
|
773
|
+
accept: acceptedFileTypes?.toString(),
|
|
774
|
+
onChange: (e) => onSelect?.(e.target.files),
|
|
775
|
+
multiple: allowsMultiple
|
|
776
|
+
}
|
|
777
|
+
));
|
|
1063
778
|
});
|
|
1064
779
|
|
|
1065
780
|
const convertFileListToFileDropItems = (fileList) => {
|
|
@@ -1132,39 +847,8 @@ var intlMessages$2 = {
|
|
|
1132
847
|
"sv-SE": se$2
|
|
1133
848
|
};
|
|
1134
849
|
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
|
|
1138
|
-
var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
|
|
1139
|
-
var __hasOwnProp$l = Object.prototype.hasOwnProperty;
|
|
1140
|
-
var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
|
|
1141
|
-
var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1142
|
-
var __spreadValues$l = (a, b) => {
|
|
1143
|
-
for (var prop in b || (b = {}))
|
|
1144
|
-
if (__hasOwnProp$l.call(b, prop))
|
|
1145
|
-
__defNormalProp$l(a, prop, b[prop]);
|
|
1146
|
-
if (__getOwnPropSymbols$l)
|
|
1147
|
-
for (var prop of __getOwnPropSymbols$l(b)) {
|
|
1148
|
-
if (__propIsEnum$l.call(b, prop))
|
|
1149
|
-
__defNormalProp$l(a, prop, b[prop]);
|
|
1150
|
-
}
|
|
1151
|
-
return a;
|
|
1152
|
-
};
|
|
1153
|
-
var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
|
|
1154
|
-
var __objRest$j = (source, exclude) => {
|
|
1155
|
-
var target = {};
|
|
1156
|
-
for (var prop in source)
|
|
1157
|
-
if (__hasOwnProp$l.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1158
|
-
target[prop] = source[prop];
|
|
1159
|
-
if (source != null && __getOwnPropSymbols$l)
|
|
1160
|
-
for (var prop of __getOwnPropSymbols$l(source)) {
|
|
1161
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$l.call(source, prop))
|
|
1162
|
-
target[prop] = source[prop];
|
|
1163
|
-
}
|
|
1164
|
-
return target;
|
|
1165
|
-
};
|
|
1166
|
-
const FileDropzone = React__default["default"].forwardRef(function DropzoneWrapper(props, forwardedRef) {
|
|
1167
|
-
const _a = props, {
|
|
850
|
+
const FileDropzone = React.forwardRef(function DropzoneWrapper(props, forwardedRef) {
|
|
851
|
+
const {
|
|
1168
852
|
isDisabled = false,
|
|
1169
853
|
hasError,
|
|
1170
854
|
renderInstruction,
|
|
@@ -1172,32 +856,28 @@ const FileDropzone = React__default["default"].forwardRef(function DropzoneWrapp
|
|
|
1172
856
|
acceptedFileTypes,
|
|
1173
857
|
allowsMultiple,
|
|
1174
858
|
onDrop = () => null,
|
|
1175
|
-
getDropOperation = () => "copy"
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
"renderInstruction",
|
|
1180
|
-
"onFileSelectOpen",
|
|
1181
|
-
"acceptedFileTypes",
|
|
1182
|
-
"allowsMultiple",
|
|
1183
|
-
"onDrop",
|
|
1184
|
-
"getDropOperation"
|
|
1185
|
-
]);
|
|
1186
|
-
const id = utils.useId();
|
|
859
|
+
getDropOperation = () => "copy",
|
|
860
|
+
...otherProps
|
|
861
|
+
} = props;
|
|
862
|
+
const id = useId.useId();
|
|
1187
863
|
const paragraphId = props["aria-label"] ? void 0 : id;
|
|
1188
864
|
const format = i18n.useMessageFormatter(intlMessages$2);
|
|
1189
|
-
const pressableRef =
|
|
1190
|
-
const { hoverProps, isHovered } =
|
|
865
|
+
const pressableRef = useObjectRef.useObjectRef(forwardedRef);
|
|
866
|
+
const { hoverProps, isHovered } = useHover.useHover({ isDisabled });
|
|
1191
867
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
1192
|
-
const { dropProps, isDropTarget: isDropping } =
|
|
868
|
+
const { dropProps, isDropTarget: isDropping } = useDrop.useDrop({
|
|
869
|
+
...props,
|
|
1193
870
|
ref: pressableRef,
|
|
1194
871
|
hasDropButton: true,
|
|
1195
872
|
isDisabled,
|
|
1196
873
|
getDropOperation
|
|
1197
|
-
})
|
|
1198
|
-
const { buttonProps, isPressed } = sapphireReact.useButton(
|
|
1199
|
-
|
|
1200
|
-
|
|
874
|
+
});
|
|
875
|
+
const { buttonProps, isPressed } = sapphireReact.useButton(
|
|
876
|
+
{ elementType: "div" },
|
|
877
|
+
pressableRef
|
|
878
|
+
);
|
|
879
|
+
const { focusProps, isFocusVisible } = useFocusRing.useFocusRing();
|
|
880
|
+
const { clipboardProps } = useClipboard.useClipboard({
|
|
1201
881
|
isDisabled,
|
|
1202
882
|
onPaste: (items) => onDrop({
|
|
1203
883
|
type: "drop",
|
|
@@ -1217,340 +897,241 @@ const FileDropzone = React__default["default"].forwardRef(function DropzoneWrapp
|
|
|
1217
897
|
dropOperation: "copy"
|
|
1218
898
|
});
|
|
1219
899
|
};
|
|
1220
|
-
return /* @__PURE__ */
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
900
|
+
return /* @__PURE__ */ React.createElement(
|
|
901
|
+
FileTrigger,
|
|
902
|
+
{
|
|
903
|
+
acceptedFileTypes,
|
|
904
|
+
allowsMultiple,
|
|
905
|
+
onSelect: onFileTriggerSelect,
|
|
906
|
+
isDisabled
|
|
907
|
+
},
|
|
908
|
+
/* @__PURE__ */ React.createElement(Pressable.Pressable, { ref: pressableRef, onPress: onFileSelectOpen }, /* @__PURE__ */ React.createElement(
|
|
909
|
+
"div",
|
|
910
|
+
{
|
|
911
|
+
...mergeProps.mergeProps(
|
|
912
|
+
dropProps,
|
|
913
|
+
hoverProps,
|
|
914
|
+
clipboardProps,
|
|
915
|
+
focusProps,
|
|
916
|
+
buttonProps
|
|
917
|
+
),
|
|
918
|
+
...filterDOMProps.filterDOMProps(otherProps, { global: true }),
|
|
919
|
+
style: { ...styleProps.style },
|
|
920
|
+
className: clsx(
|
|
921
|
+
styles$3["sapphire-dropzone"],
|
|
922
|
+
styles$3["js-focus"],
|
|
923
|
+
styles$3["js-hover"],
|
|
924
|
+
{
|
|
925
|
+
[styles$3["is-hover"]]: isHovered && !isDropping,
|
|
926
|
+
[styles$3["is-active"]]: isPressed,
|
|
927
|
+
[styles$3["is-disabled"]]: isDisabled,
|
|
928
|
+
[styles$3["is-focus"]]: isFocusVisible,
|
|
929
|
+
[styles$3["sapphire-dropzone--dropping"]]: isDropping,
|
|
930
|
+
[styles$3["sapphire-dropzone--error"]]: hasError
|
|
931
|
+
},
|
|
932
|
+
styleProps.className
|
|
933
|
+
),
|
|
934
|
+
"aria-label": ariaLabel,
|
|
935
|
+
"aria-invalid": hasError,
|
|
936
|
+
"aria-describedby": paragraphId
|
|
937
|
+
},
|
|
938
|
+
/* @__PURE__ */ React.createElement("div", { className: clsx(styles$3["sapphire-dropzone__content"]) }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$3["sapphire-dropzone__icon"]) }, /* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: "lg" }, /* @__PURE__ */ React.createElement(react.Upload, null))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles$3["sapphire-dropzone__heading"]) }, /* @__PURE__ */ React.createElement(sapphireReact.Typography.Heading, { level: 6 }, isDropping ? format("dropzone-heading-dropping") : allowsMultiple ? format("dropzone-heading-default") : format("dropzone-heading-default-single"))), /* @__PURE__ */ React.createElement(
|
|
939
|
+
"div",
|
|
940
|
+
{
|
|
941
|
+
id: paragraphId,
|
|
942
|
+
className: clsx(styles$3["sapphire-dropzone__paragraph"])
|
|
943
|
+
},
|
|
944
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Typography.Body, { size: "sm", color: "secondary" }, renderInstruction(isDropping))
|
|
945
|
+
))
|
|
946
|
+
))
|
|
947
|
+
);
|
|
1258
948
|
});
|
|
1259
949
|
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
var target = {};
|
|
1281
|
-
for (var prop in source)
|
|
1282
|
-
if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1283
|
-
target[prop] = source[prop];
|
|
1284
|
-
if (source != null && __getOwnPropSymbols$k)
|
|
1285
|
-
for (var prop of __getOwnPropSymbols$k(source)) {
|
|
1286
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
|
|
1287
|
-
target[prop] = source[prop];
|
|
1288
|
-
}
|
|
1289
|
-
return target;
|
|
1290
|
-
};
|
|
1291
|
-
function FilterDropdown(_a) {
|
|
1292
|
-
var _b = _a, {
|
|
1293
|
-
children,
|
|
1294
|
-
label,
|
|
1295
|
-
value,
|
|
1296
|
-
isDisabled = false,
|
|
1297
|
-
isApplyDisabled = false,
|
|
1298
|
-
isClearDisabled,
|
|
1299
|
-
isOpen: isOpenProp,
|
|
1300
|
-
applyButtonLabel = "Apply",
|
|
1301
|
-
clearButtonLabel = "Clear",
|
|
1302
|
-
hideClearButton = false,
|
|
1303
|
-
defaultOpen = false,
|
|
1304
|
-
hasApplyButton = false,
|
|
1305
|
-
noMaxWidth,
|
|
1306
|
-
onApply,
|
|
1307
|
-
onClear,
|
|
1308
|
-
onOpenChange,
|
|
1309
|
-
buttonSize = "md"
|
|
1310
|
-
} = _b, props = __objRest$i(_b, [
|
|
1311
|
-
"children",
|
|
1312
|
-
"label",
|
|
1313
|
-
"value",
|
|
1314
|
-
"isDisabled",
|
|
1315
|
-
"isApplyDisabled",
|
|
1316
|
-
"isClearDisabled",
|
|
1317
|
-
"isOpen",
|
|
1318
|
-
"applyButtonLabel",
|
|
1319
|
-
"clearButtonLabel",
|
|
1320
|
-
"hideClearButton",
|
|
1321
|
-
"defaultOpen",
|
|
1322
|
-
"hasApplyButton",
|
|
1323
|
-
"noMaxWidth",
|
|
1324
|
-
"onApply",
|
|
1325
|
-
"onClear",
|
|
1326
|
-
"onOpenChange",
|
|
1327
|
-
"buttonSize"
|
|
1328
|
-
]);
|
|
950
|
+
function FilterDropdown({
|
|
951
|
+
children,
|
|
952
|
+
label,
|
|
953
|
+
value,
|
|
954
|
+
isDisabled = false,
|
|
955
|
+
isApplyDisabled = false,
|
|
956
|
+
isClearDisabled,
|
|
957
|
+
isOpen: isOpenProp,
|
|
958
|
+
applyButtonLabel = "Apply",
|
|
959
|
+
clearButtonLabel = "Clear",
|
|
960
|
+
hideClearButton = false,
|
|
961
|
+
defaultOpen = false,
|
|
962
|
+
hasApplyButton = false,
|
|
963
|
+
noMaxWidth,
|
|
964
|
+
onApply,
|
|
965
|
+
onClear,
|
|
966
|
+
onOpenChange,
|
|
967
|
+
buttonSize = "md",
|
|
968
|
+
...props
|
|
969
|
+
}) {
|
|
1329
970
|
const triggerRef = React.useRef(null);
|
|
1330
971
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
1331
|
-
const [isOpen, setIsOpen] =
|
|
972
|
+
const [isOpen, setIsOpen] = useControlledState.useControlledState(
|
|
973
|
+
isOpenProp,
|
|
974
|
+
defaultOpen,
|
|
975
|
+
useEffectEvent.useEffectEvent(onOpenChange)
|
|
976
|
+
);
|
|
1332
977
|
const hasValue = value != null && value !== "";
|
|
1333
978
|
const close = () => setIsOpen(false);
|
|
1334
979
|
const onSubmit = (e) => {
|
|
1335
|
-
var _a2;
|
|
1336
980
|
e.preventDefault();
|
|
1337
|
-
onApply
|
|
981
|
+
onApply?.();
|
|
1338
982
|
close();
|
|
1339
|
-
(_a2 = triggerRef.current) == null ? void 0 : _a2.focus();
|
|
1340
983
|
};
|
|
1341
|
-
const applyButton = /* @__PURE__ */
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
isDisabled: isApplyDisabled
|
|
1346
|
-
}, applyButtonLabel);
|
|
1347
|
-
return /* @__PURE__ */ React__default["default"].createElement(sapphireReact.PopoverTrigger, {
|
|
1348
|
-
ref: triggerRef,
|
|
1349
|
-
placement: "bottom left",
|
|
1350
|
-
isOpen,
|
|
1351
|
-
onOpenChange: setIsOpen,
|
|
1352
|
-
noMaxWidth,
|
|
1353
|
-
noPadding: true,
|
|
1354
|
-
popoverContent: /* @__PURE__ */ React__default["default"].createElement("form", __spreadProps$j(__spreadValues$k({}, utils.filterDOMProps(props, { global: true })), {
|
|
1355
|
-
onSubmit,
|
|
1356
|
-
className: clsx__default["default"](styles__default$4["default"]["sapphire-filter-dropdown"], styleProps.className),
|
|
1357
|
-
style: __spreadValues$k({}, styleProps.style)
|
|
1358
|
-
}), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1359
|
-
className: styles__default$4["default"]["sapphire-filter-dropdown__body"]
|
|
1360
|
-
}, children), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1361
|
-
className: styles__default$4["default"]["sapphire-filter-dropdown__footer"]
|
|
1362
|
-
}, /* @__PURE__ */ React__default["default"].createElement(sapphireReact.ButtonGroup, {
|
|
1363
|
-
align: "right"
|
|
1364
|
-
}, !hideClearButton && /* @__PURE__ */ React__default["default"].createElement(sapphireReact.Button, {
|
|
984
|
+
const applyButton = /* @__PURE__ */ React.createElement(
|
|
985
|
+
sapphireReact.Button,
|
|
986
|
+
{
|
|
987
|
+
type: "submit",
|
|
1365
988
|
size: buttonSize,
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
989
|
+
excludeFromTabOrder: !hasApplyButton,
|
|
990
|
+
isDisabled: isApplyDisabled
|
|
991
|
+
},
|
|
992
|
+
applyButtonLabel
|
|
993
|
+
);
|
|
994
|
+
return /* @__PURE__ */ React.createElement(
|
|
995
|
+
sapphireReact.PopoverTrigger,
|
|
996
|
+
{
|
|
997
|
+
ref: triggerRef,
|
|
998
|
+
placement: "bottom left",
|
|
999
|
+
isOpen,
|
|
1000
|
+
onOpenChange: setIsOpen,
|
|
1001
|
+
noMaxWidth,
|
|
1002
|
+
noPadding: true,
|
|
1003
|
+
popoverContent: /* @__PURE__ */ React.createElement(
|
|
1004
|
+
"form",
|
|
1005
|
+
{
|
|
1006
|
+
...filterDOMProps.filterDOMProps(props, { global: true }),
|
|
1007
|
+
onSubmit,
|
|
1008
|
+
className: clsx(
|
|
1009
|
+
styles$4["sapphire-filter-dropdown"],
|
|
1010
|
+
styleProps.className
|
|
1011
|
+
),
|
|
1012
|
+
style: { ...styleProps.style }
|
|
1013
|
+
},
|
|
1014
|
+
/* @__PURE__ */ React.createElement("div", { className: styles$4["sapphire-filter-dropdown__body"] }, children),
|
|
1015
|
+
/* @__PURE__ */ React.createElement("div", { className: styles$4["sapphire-filter-dropdown__footer"] }, /* @__PURE__ */ React.createElement(sapphireReact.ButtonGroup, { align: "right" }, !hideClearButton && /* @__PURE__ */ React.createElement(
|
|
1016
|
+
sapphireReact.Button,
|
|
1017
|
+
{
|
|
1018
|
+
size: buttonSize,
|
|
1019
|
+
variant: "text",
|
|
1020
|
+
onPress: () => {
|
|
1021
|
+
close();
|
|
1022
|
+
onClear?.();
|
|
1023
|
+
},
|
|
1024
|
+
isDisabled: isClearDisabled ?? !hasValue
|
|
1025
|
+
},
|
|
1026
|
+
clearButtonLabel
|
|
1027
|
+
), hasApplyButton ? applyButton : (
|
|
1028
|
+
// The following is necessary to have the form submitted on "Enter", if there is more than one field
|
|
1029
|
+
/* @__PURE__ */ React.createElement(VisuallyHidden.VisuallyHidden, null, applyButton)
|
|
1030
|
+
)))
|
|
1031
|
+
)
|
|
1032
|
+
},
|
|
1033
|
+
/* @__PURE__ */ React.createElement(
|
|
1034
|
+
sapphireReact.ToggleButton,
|
|
1035
|
+
{
|
|
1036
|
+
icon: isOpen ? /* @__PURE__ */ React.createElement(react.ChevronUp, null) : /* @__PURE__ */ React.createElement(react.ChevronDown, null),
|
|
1037
|
+
iconAlign: "right",
|
|
1038
|
+
isSelected: hasValue,
|
|
1039
|
+
isDisabled,
|
|
1040
|
+
size: buttonSize
|
|
1370
1041
|
},
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
isSelected: hasValue,
|
|
1377
|
-
isDisabled,
|
|
1378
|
-
size: buttonSize
|
|
1379
|
-
}, label, value ? ": " : "", value));
|
|
1042
|
+
label,
|
|
1043
|
+
value ? ": " : "",
|
|
1044
|
+
value
|
|
1045
|
+
)
|
|
1046
|
+
);
|
|
1380
1047
|
}
|
|
1381
1048
|
|
|
1382
|
-
var __defProp$j = Object.defineProperty;
|
|
1383
|
-
var __defProps$i = Object.defineProperties;
|
|
1384
|
-
var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
|
|
1385
|
-
var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
|
|
1386
|
-
var __hasOwnProp$j = Object.prototype.hasOwnProperty;
|
|
1387
|
-
var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
|
|
1388
|
-
var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1389
|
-
var __spreadValues$j = (a, b) => {
|
|
1390
|
-
for (var prop in b || (b = {}))
|
|
1391
|
-
if (__hasOwnProp$j.call(b, prop))
|
|
1392
|
-
__defNormalProp$j(a, prop, b[prop]);
|
|
1393
|
-
if (__getOwnPropSymbols$j)
|
|
1394
|
-
for (var prop of __getOwnPropSymbols$j(b)) {
|
|
1395
|
-
if (__propIsEnum$j.call(b, prop))
|
|
1396
|
-
__defNormalProp$j(a, prop, b[prop]);
|
|
1397
|
-
}
|
|
1398
|
-
return a;
|
|
1399
|
-
};
|
|
1400
|
-
var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
|
|
1401
|
-
var __objRest$h = (source, exclude) => {
|
|
1402
|
-
var target = {};
|
|
1403
|
-
for (var prop in source)
|
|
1404
|
-
if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1405
|
-
target[prop] = source[prop];
|
|
1406
|
-
if (source != null && __getOwnPropSymbols$j)
|
|
1407
|
-
for (var prop of __getOwnPropSymbols$j(source)) {
|
|
1408
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
|
|
1409
|
-
target[prop] = source[prop];
|
|
1410
|
-
}
|
|
1411
|
-
return target;
|
|
1412
|
-
};
|
|
1413
1049
|
function SearchableSelectFilter(props) {
|
|
1414
|
-
|
|
1415
|
-
const _a = props, { searchField, listBox, size = "md" } = _a, otherProps = __objRest$h(_a, ["searchField", "listBox", "size"]);
|
|
1050
|
+
const { searchField, listBox, size = "md", ...otherProps } = props;
|
|
1416
1051
|
const searchFieldRef = React.useRef(null);
|
|
1417
1052
|
const searchFieldProps = searchField.props;
|
|
1418
1053
|
const listBoxProps = listBox.props;
|
|
1419
|
-
const [searchQuery, setSearchQuery] =
|
|
1420
|
-
|
|
1421
|
-
|
|
1054
|
+
const [searchQuery, setSearchQuery] = useControlledState.useControlledState(
|
|
1055
|
+
searchFieldProps?.value,
|
|
1056
|
+
"",
|
|
1057
|
+
searchFieldProps.onChange
|
|
1058
|
+
);
|
|
1059
|
+
if (listBoxProps.connectedInputRef && typeof process !== "undefined" && process.env?.NODE_ENV === "development") {
|
|
1060
|
+
console.warn(
|
|
1061
|
+
"The connectedInputRef prop on the ListBox in the SearchableSelectFilter component is not needed and will be ignored. The connectedInputRef is set automatically (to the passed SearchField) and should not be set manually."
|
|
1062
|
+
);
|
|
1422
1063
|
}
|
|
1423
1064
|
const hasSelection = listBoxProps.selectedKeys === "all" || Array.from(listBoxProps.selectedKeys || []).length > 0;
|
|
1424
|
-
return /* @__PURE__ */
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1065
|
+
return /* @__PURE__ */ React.createElement(
|
|
1066
|
+
FilterDropdown,
|
|
1067
|
+
{
|
|
1068
|
+
...otherProps,
|
|
1069
|
+
noMaxWidth: otherProps.noMaxWidth ?? true,
|
|
1070
|
+
buttonSize: size,
|
|
1071
|
+
hasApplyButton: Boolean(otherProps.onApply),
|
|
1072
|
+
isClearDisabled: otherProps.isClearDisabled || !hasSelection && !otherProps.value
|
|
1073
|
+
},
|
|
1074
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Flex, { flexDirection: "column", height: "100%" }, React.cloneElement(searchField, {
|
|
1075
|
+
size: "md",
|
|
1076
|
+
value: searchFieldProps.value || searchQuery,
|
|
1077
|
+
inputRef: mergeRefs.mergeRefs(searchFieldRef, searchFieldProps.inputRef),
|
|
1078
|
+
width: searchFieldProps.width || "100%",
|
|
1079
|
+
marginBottom: searchFieldProps.marginBottom || sapphireReact.tokens.size.spacingSm,
|
|
1080
|
+
onChange: setSearchQuery
|
|
1081
|
+
}), React.cloneElement(listBox, {
|
|
1082
|
+
connectedInputRef: searchFieldRef,
|
|
1083
|
+
selectionMode: listBoxProps.selectionMode || "multiple",
|
|
1084
|
+
marginX: `calc(${sapphireReact.tokens.size.spacingContainerHorizontalSm.value} * -1)`,
|
|
1085
|
+
hasScrollDividers: true,
|
|
1086
|
+
filter: (
|
|
1087
|
+
// This is a way to also allow opting out of the internal filter with filter={undefined}
|
|
1088
|
+
// without us having to allow for more values on the ListBox filter prop
|
|
1089
|
+
"filter" in listBoxProps ? listBoxProps.filter : (textValue) => textValue.toLowerCase().includes(searchQuery.toLowerCase())
|
|
1090
|
+
)
|
|
1091
|
+
}))
|
|
1092
|
+
);
|
|
1446
1093
|
}
|
|
1447
1094
|
|
|
1448
|
-
|
|
1449
|
-
var __defProps$h = Object.defineProperties;
|
|
1450
|
-
var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
|
|
1451
|
-
var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
|
|
1452
|
-
var __hasOwnProp$i = Object.prototype.hasOwnProperty;
|
|
1453
|
-
var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
|
|
1454
|
-
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1455
|
-
var __spreadValues$i = (a, b) => {
|
|
1456
|
-
for (var prop in b || (b = {}))
|
|
1457
|
-
if (__hasOwnProp$i.call(b, prop))
|
|
1458
|
-
__defNormalProp$i(a, prop, b[prop]);
|
|
1459
|
-
if (__getOwnPropSymbols$i)
|
|
1460
|
-
for (var prop of __getOwnPropSymbols$i(b)) {
|
|
1461
|
-
if (__propIsEnum$i.call(b, prop))
|
|
1462
|
-
__defNormalProp$i(a, prop, b[prop]);
|
|
1463
|
-
}
|
|
1464
|
-
return a;
|
|
1465
|
-
};
|
|
1466
|
-
var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
|
|
1467
|
-
var __objRest$g = (source, exclude) => {
|
|
1468
|
-
var target = {};
|
|
1469
|
-
for (var prop in source)
|
|
1470
|
-
if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1471
|
-
target[prop] = source[prop];
|
|
1472
|
-
if (source != null && __getOwnPropSymbols$i)
|
|
1473
|
-
for (var prop of __getOwnPropSymbols$i(source)) {
|
|
1474
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$i.call(source, prop))
|
|
1475
|
-
target[prop] = source[prop];
|
|
1476
|
-
}
|
|
1477
|
-
return target;
|
|
1478
|
-
};
|
|
1479
|
-
const Flag = React__default["default"].forwardRef(function Flag2(_a, ref) {
|
|
1480
|
-
var _b = _a, { size = "lg", rounded, "aria-label": ariaLabel } = _b, props = __objRest$g(_b, ["size", "rounded", "aria-label"]);
|
|
1095
|
+
const Flag = React.forwardRef(function Flag2({ size = "lg", rounded, "aria-label": ariaLabel, ...props }, ref) {
|
|
1481
1096
|
sapphireReact.useThemeCheck();
|
|
1482
1097
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
1483
|
-
return
|
|
1098
|
+
return React.cloneElement(utils.getWrappedElement(props.children), {
|
|
1484
1099
|
ref,
|
|
1485
|
-
role: "img"
|
|
1486
|
-
|
|
1487
|
-
className:
|
|
1488
|
-
[
|
|
1489
|
-
[
|
|
1490
|
-
[
|
|
1491
|
-
[
|
|
1492
|
-
[
|
|
1493
|
-
[
|
|
1100
|
+
role: "img",
|
|
1101
|
+
...ariaLabel ? { "aria-label": ariaLabel } : { "aria-hidden": true },
|
|
1102
|
+
className: clsx(styles$5["sapphire-flag"], styleProps.className, {
|
|
1103
|
+
[styles$5["sapphire-flag--xs"]]: size === "xs",
|
|
1104
|
+
[styles$5["sapphire-flag--sm"]]: size === "sm",
|
|
1105
|
+
[styles$5["sapphire-flag--md"]]: size === "md",
|
|
1106
|
+
[styles$5["sapphire-flag--lg"]]: size === "lg",
|
|
1107
|
+
[styles$5["sapphire-flag--xl"]]: size === "xl",
|
|
1108
|
+
[styles$5["sapphire-flag--rounded"]]: rounded
|
|
1494
1109
|
}),
|
|
1495
1110
|
style: styleProps.style
|
|
1496
|
-
})
|
|
1111
|
+
});
|
|
1497
1112
|
});
|
|
1498
1113
|
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
for (var prop in b || (b = {}))
|
|
1508
|
-
if (__hasOwnProp$h.call(b, prop))
|
|
1509
|
-
__defNormalProp$h(a, prop, b[prop]);
|
|
1510
|
-
if (__getOwnPropSymbols$h)
|
|
1511
|
-
for (var prop of __getOwnPropSymbols$h(b)) {
|
|
1512
|
-
if (__propIsEnum$h.call(b, prop))
|
|
1513
|
-
__defNormalProp$h(a, prop, b[prop]);
|
|
1514
|
-
}
|
|
1515
|
-
return a;
|
|
1516
|
-
};
|
|
1517
|
-
var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
|
|
1518
|
-
var __objRest$f = (source, exclude) => {
|
|
1519
|
-
var target = {};
|
|
1520
|
-
for (var prop in source)
|
|
1521
|
-
if (__hasOwnProp$h.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1522
|
-
target[prop] = source[prop];
|
|
1523
|
-
if (source != null && __getOwnPropSymbols$h)
|
|
1524
|
-
for (var prop of __getOwnPropSymbols$h(source)) {
|
|
1525
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$h.call(source, prop))
|
|
1526
|
-
target[prop] = source[prop];
|
|
1527
|
-
}
|
|
1528
|
-
return target;
|
|
1529
|
-
};
|
|
1530
|
-
function LabeledValue(_a) {
|
|
1531
|
-
var _b = _a, {
|
|
1532
|
-
children,
|
|
1533
|
-
contextualHelp,
|
|
1534
|
-
label: label$1,
|
|
1535
|
-
labelPlacement = "above",
|
|
1536
|
-
size = "lg"
|
|
1537
|
-
} = _b, otherProps = __objRest$f(_b, [
|
|
1538
|
-
"children",
|
|
1539
|
-
"contextualHelp",
|
|
1540
|
-
"label",
|
|
1541
|
-
"labelPlacement",
|
|
1542
|
-
"size"
|
|
1543
|
-
]);
|
|
1114
|
+
function LabeledValue({
|
|
1115
|
+
children,
|
|
1116
|
+
contextualHelp,
|
|
1117
|
+
label,
|
|
1118
|
+
labelPlacement = "above",
|
|
1119
|
+
size = "lg",
|
|
1120
|
+
...otherProps
|
|
1121
|
+
}) {
|
|
1544
1122
|
sapphireReact.useThemeCheck();
|
|
1545
|
-
const { fieldProps } =
|
|
1546
|
-
return /* @__PURE__ */
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1123
|
+
const { fieldProps } = useField.useField({ label });
|
|
1124
|
+
return /* @__PURE__ */ React.createElement(
|
|
1125
|
+
sapphireReact.Field,
|
|
1126
|
+
{
|
|
1127
|
+
...mergeProps.mergeProps(fieldProps, otherProps),
|
|
1128
|
+
labelPlacement,
|
|
1129
|
+
size,
|
|
1130
|
+
noDefaultWidth: true
|
|
1131
|
+
},
|
|
1132
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Field.Label, null, /* @__PURE__ */ React.createElement(sapphireReact.Label, { contextualHelp, size }, label)),
|
|
1133
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Field.Control, null, children)
|
|
1134
|
+
);
|
|
1554
1135
|
}
|
|
1555
1136
|
|
|
1556
1137
|
var increment$6 = "øge";
|
|
@@ -1612,60 +1193,38 @@ var intlMessages$1 = {
|
|
|
1612
1193
|
"sv-SE": se$1
|
|
1613
1194
|
};
|
|
1614
1195
|
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
|
|
1621
|
-
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1622
|
-
var __spreadValues$g = (a, b) => {
|
|
1623
|
-
for (var prop in b || (b = {}))
|
|
1624
|
-
if (__hasOwnProp$g.call(b, prop))
|
|
1625
|
-
__defNormalProp$g(a, prop, b[prop]);
|
|
1626
|
-
if (__getOwnPropSymbols$g)
|
|
1627
|
-
for (var prop of __getOwnPropSymbols$g(b)) {
|
|
1628
|
-
if (__propIsEnum$g.call(b, prop))
|
|
1629
|
-
__defNormalProp$g(a, prop, b[prop]);
|
|
1630
|
-
}
|
|
1631
|
-
return a;
|
|
1632
|
-
};
|
|
1633
|
-
var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
|
|
1634
|
-
var __objRest$e = (source, exclude) => {
|
|
1635
|
-
var target = {};
|
|
1636
|
-
for (var prop in source)
|
|
1637
|
-
if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1638
|
-
target[prop] = source[prop];
|
|
1639
|
-
if (source != null && __getOwnPropSymbols$g)
|
|
1640
|
-
for (var prop of __getOwnPropSymbols$g(source)) {
|
|
1641
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
|
|
1642
|
-
target[prop] = source[prop];
|
|
1643
|
-
}
|
|
1644
|
-
return target;
|
|
1645
|
-
};
|
|
1646
|
-
const StepperButton = (_a) => {
|
|
1647
|
-
var _b = _a, {
|
|
1648
|
-
variant,
|
|
1649
|
-
size
|
|
1650
|
-
} = _b, props = __objRest$e(_b, [
|
|
1651
|
-
"variant",
|
|
1652
|
-
"size"
|
|
1653
|
-
]);
|
|
1196
|
+
const StepperButton = ({
|
|
1197
|
+
variant,
|
|
1198
|
+
size,
|
|
1199
|
+
...props
|
|
1200
|
+
}) => {
|
|
1654
1201
|
const ref = React.useRef(null);
|
|
1655
1202
|
const { buttonProps, isPressed } = sapphireReact.useButton(props, ref);
|
|
1656
|
-
const { hoverProps, isHovered } =
|
|
1657
|
-
const { focusProps, isFocusVisible } =
|
|
1658
|
-
return /* @__PURE__ */
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1203
|
+
const { hoverProps, isHovered } = useHover.useHover({ isDisabled: props.isDisabled });
|
|
1204
|
+
const { focusProps, isFocusVisible } = useFocusRing.useFocusRing();
|
|
1205
|
+
return /* @__PURE__ */ React.createElement(
|
|
1206
|
+
"button",
|
|
1207
|
+
{
|
|
1208
|
+
...mergeProps.mergeProps(
|
|
1209
|
+
buttonProps,
|
|
1210
|
+
hoverProps,
|
|
1211
|
+
focusProps,
|
|
1212
|
+
filterDOMProps.filterDOMProps(props, { global: true })
|
|
1213
|
+
),
|
|
1214
|
+
tabIndex: 0,
|
|
1215
|
+
ref,
|
|
1216
|
+
className: clsx(
|
|
1217
|
+
textFieldStyles["sapphire-text-field__stepper-button"],
|
|
1218
|
+
textFieldStyles["js-hover"],
|
|
1219
|
+
{
|
|
1220
|
+
[textFieldStyles["is-active"]]: isPressed,
|
|
1221
|
+
[textFieldStyles["is-hover"]]: isHovered,
|
|
1222
|
+
[textFieldStyles["is-focus"]]: isFocusVisible
|
|
1223
|
+
}
|
|
1224
|
+
)
|
|
1225
|
+
},
|
|
1226
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: size === "lg" ? "md" : "sm" }, variant === "increment" ? /* @__PURE__ */ React.createElement(react.Add, null) : /* @__PURE__ */ React.createElement(react.Subtract, null))
|
|
1227
|
+
);
|
|
1669
1228
|
};
|
|
1670
1229
|
|
|
1671
1230
|
function useAutofillStyle(inputRef) {
|
|
@@ -1686,20 +1245,18 @@ function useAutofillStyle(inputRef) {
|
|
|
1686
1245
|
}
|
|
1687
1246
|
|
|
1688
1247
|
const getSeparators = (formatter) => {
|
|
1689
|
-
var _a, _b, _c, _d, _e;
|
|
1690
1248
|
const parts = formatter.formatToParts(1000.1);
|
|
1691
|
-
const groupSeparator =
|
|
1692
|
-
let decimalSeparator =
|
|
1249
|
+
const groupSeparator = parts.find((p) => p.type === "group")?.value ?? ",";
|
|
1250
|
+
let decimalSeparator = parts.find((p) => p.type === "decimal")?.value;
|
|
1693
1251
|
if (!decimalSeparator) {
|
|
1694
1252
|
const locale = formatter.resolvedOptions().locale;
|
|
1695
1253
|
const plainFormatter = new Intl.NumberFormat(locale);
|
|
1696
|
-
decimalSeparator =
|
|
1254
|
+
decimalSeparator = plainFormatter.formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
|
|
1697
1255
|
}
|
|
1698
1256
|
return { groupSeparator, decimalSeparator };
|
|
1699
1257
|
};
|
|
1700
1258
|
const trimSymbol = (value, symbol) => {
|
|
1701
|
-
if (!symbol)
|
|
1702
|
-
return value;
|
|
1259
|
+
if (!symbol) return value;
|
|
1703
1260
|
if (value.startsWith(symbol)) {
|
|
1704
1261
|
return value.slice(symbol.length).trimStart();
|
|
1705
1262
|
} else if (value.endsWith(symbol)) {
|
|
@@ -1708,20 +1265,20 @@ const trimSymbol = (value, symbol) => {
|
|
|
1708
1265
|
return value;
|
|
1709
1266
|
};
|
|
1710
1267
|
const parseNumericValue = (value, decimalSeparator, formatter) => {
|
|
1711
|
-
if (!value || value === "-")
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1268
|
+
if (!value || value === "-") return null;
|
|
1269
|
+
const cleaned = value.replace(
|
|
1270
|
+
new RegExp(`[^0-9${decimalSeparator}\\-]`, "g"),
|
|
1271
|
+
""
|
|
1272
|
+
);
|
|
1273
|
+
if (!cleaned) return null;
|
|
1716
1274
|
const hasLeadingMinus = cleaned.startsWith("-");
|
|
1717
1275
|
const withoutMinus = cleaned.replace(/-/g, "");
|
|
1718
1276
|
const normalized = hasLeadingMinus ? "-" + withoutMinus : withoutMinus;
|
|
1719
1277
|
const parts = normalized.split(decimalSeparator);
|
|
1720
1278
|
const withStandardDecimal = parts.length > 1 ? parts[0] + "." + parts.slice(1).join("") : normalized.replace(decimalSeparator, ".");
|
|
1721
1279
|
let parsed = parseFloat(withStandardDecimal);
|
|
1722
|
-
if (isNaN(parsed))
|
|
1723
|
-
|
|
1724
|
-
if ((formatter == null ? void 0 : formatter.resolvedOptions().style) === "percent") {
|
|
1280
|
+
if (isNaN(parsed)) return null;
|
|
1281
|
+
if (formatter?.resolvedOptions().style === "percent") {
|
|
1725
1282
|
parsed /= 100;
|
|
1726
1283
|
}
|
|
1727
1284
|
return parsed;
|
|
@@ -1746,13 +1303,12 @@ const formatNumberString = (value, formatter, decimalSeparator, shouldStripSymbo
|
|
|
1746
1303
|
const isSymbol = (type) => ["currency", "unit", "percentSign"].includes(type);
|
|
1747
1304
|
const hasSymbolAt = (parts, start) => {
|
|
1748
1305
|
const [first, second] = start ? [parts[0], parts[1]] : [parts[parts.length - 1], parts[parts.length - 2]];
|
|
1749
|
-
return isSymbol(first
|
|
1306
|
+
return isSymbol(first?.type) || first?.type === "literal" && isSymbol(second?.type);
|
|
1750
1307
|
};
|
|
1751
1308
|
const extractSymbol = (formatter, prefix, postfix) => {
|
|
1752
|
-
var _a, _b;
|
|
1753
1309
|
const parts = formatter.formatToParts(1000.1);
|
|
1754
|
-
const extractedPrefix = hasSymbolAt(parts, true) ?
|
|
1755
|
-
const extractedPostfix = hasSymbolAt(parts, false) ?
|
|
1310
|
+
const extractedPrefix = hasSymbolAt(parts, true) ? parts.find((part) => isSymbol(part.type))?.value || null : null;
|
|
1311
|
+
const extractedPostfix = hasSymbolAt(parts, false) ? [...parts].reverse().find((part) => isSymbol(part.type))?.value || null : null;
|
|
1756
1312
|
return prefix !== void 0 || postfix !== void 0 ? {
|
|
1757
1313
|
extractedPrefix: prefix,
|
|
1758
1314
|
extractedPostfix: postfix,
|
|
@@ -1768,8 +1324,7 @@ const isDeleteOperation = (inputType) => {
|
|
|
1768
1324
|
return inputType === "deleteContentBackward" || inputType === "deleteContentForward";
|
|
1769
1325
|
};
|
|
1770
1326
|
const calculateCursorPosition = (oldValue, newValue, oldCursor, inputType, decimalSeparator, numericValue) => {
|
|
1771
|
-
if (!newValue)
|
|
1772
|
-
return 0;
|
|
1327
|
+
if (!newValue) return 0;
|
|
1773
1328
|
const oldDecimalPos = oldValue.indexOf(decimalSeparator);
|
|
1774
1329
|
const newDecimalPos = newValue.indexOf(decimalSeparator);
|
|
1775
1330
|
if (numericValue === 0 && isDeleteOperation(inputType)) {
|
|
@@ -1778,8 +1333,7 @@ const calculateCursorPosition = (oldValue, newValue, oldCursor, inputType, decim
|
|
|
1778
1333
|
const countDigits = (str, start, end) => {
|
|
1779
1334
|
let count = 0;
|
|
1780
1335
|
for (let i = start; i < end; i++) {
|
|
1781
|
-
if (/[0-9]/.test(str[i]))
|
|
1782
|
-
count++;
|
|
1336
|
+
if (/[0-9]/.test(str[i])) count++;
|
|
1783
1337
|
}
|
|
1784
1338
|
return count;
|
|
1785
1339
|
};
|
|
@@ -1787,7 +1341,11 @@ const calculateCursorPosition = (oldValue, newValue, oldCursor, inputType, decim
|
|
|
1787
1341
|
return newDecimalPos;
|
|
1788
1342
|
}
|
|
1789
1343
|
if (oldDecimalPos >= 0 && oldCursor > oldDecimalPos && newDecimalPos >= 0) {
|
|
1790
|
-
const digitsBeforeCursor = countDigits(
|
|
1344
|
+
const digitsBeforeCursor = countDigits(
|
|
1345
|
+
oldValue,
|
|
1346
|
+
oldDecimalPos + 1,
|
|
1347
|
+
oldCursor
|
|
1348
|
+
);
|
|
1791
1349
|
let digitCount2 = 0;
|
|
1792
1350
|
for (let i = newDecimalPos + 1; i < newValue.length; i++) {
|
|
1793
1351
|
if (/[0-9]/.test(newValue[i]) && ++digitCount2 === digitsBeforeCursor) {
|
|
@@ -1798,12 +1356,15 @@ const calculateCursorPosition = (oldValue, newValue, oldCursor, inputType, decim
|
|
|
1798
1356
|
}
|
|
1799
1357
|
const oldEnd = oldDecimalPos >= 0 ? oldDecimalPos : oldValue.length;
|
|
1800
1358
|
const newEnd = newDecimalPos >= 0 ? newDecimalPos : newValue.length;
|
|
1801
|
-
const intDigitsBeforeCursor = countDigits(
|
|
1359
|
+
const intDigitsBeforeCursor = countDigits(
|
|
1360
|
+
oldValue,
|
|
1361
|
+
0,
|
|
1362
|
+
Math.min(oldCursor, oldEnd)
|
|
1363
|
+
);
|
|
1802
1364
|
if (intDigitsBeforeCursor === 0) {
|
|
1803
1365
|
if (isDeleteOperation(inputType)) {
|
|
1804
1366
|
for (let i = 0; i < newValue.length; i++) {
|
|
1805
|
-
if (/[0-9]/.test(newValue[i]))
|
|
1806
|
-
return i + 1;
|
|
1367
|
+
if (/[0-9]/.test(newValue[i])) return i + 1;
|
|
1807
1368
|
}
|
|
1808
1369
|
}
|
|
1809
1370
|
return 0;
|
|
@@ -1819,9 +1380,12 @@ const calculateCursorPosition = (oldValue, newValue, oldCursor, inputType, decim
|
|
|
1819
1380
|
|
|
1820
1381
|
const escapeRegExp = (str) => str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
1821
1382
|
const getSuffix = (value, groupSeparator, decimalSeparator) => {
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1383
|
+
const suffixReg = new RegExp(
|
|
1384
|
+
`\\d([^${escapeRegExp(groupSeparator)}${escapeRegExp(
|
|
1385
|
+
decimalSeparator
|
|
1386
|
+
)}0-9]+)`
|
|
1387
|
+
);
|
|
1388
|
+
return value.match(suffixReg)?.[1];
|
|
1825
1389
|
};
|
|
1826
1390
|
function handleNumberFieldKeyDown({
|
|
1827
1391
|
event,
|
|
@@ -1830,19 +1394,21 @@ function handleNumberFieldKeyDown({
|
|
|
1830
1394
|
decimalSeparator,
|
|
1831
1395
|
onOriginalKeyDown
|
|
1832
1396
|
}) {
|
|
1833
|
-
var _a;
|
|
1834
1397
|
const { key } = event;
|
|
1835
1398
|
const input = event.currentTarget;
|
|
1836
1399
|
const { selectionStart, value } = input;
|
|
1837
1400
|
if (selectionStart === null) {
|
|
1838
|
-
onOriginalKeyDown
|
|
1401
|
+
onOriginalKeyDown?.(event);
|
|
1839
1402
|
return;
|
|
1840
1403
|
}
|
|
1841
1404
|
if (/^[0-9]$/.test(key)) {
|
|
1842
1405
|
const decimalPos = value.indexOf(decimalSeparator);
|
|
1843
1406
|
if (selectionStart === 0) {
|
|
1844
1407
|
const integerPart = decimalPos >= 0 ? value.slice(0, decimalPos) : value;
|
|
1845
|
-
const cleanedInteger = integerPart.replace(
|
|
1408
|
+
const cleanedInteger = integerPart.replace(
|
|
1409
|
+
new RegExp(escapeRegExp(groupSeparator), "g"),
|
|
1410
|
+
""
|
|
1411
|
+
);
|
|
1846
1412
|
if (cleanedInteger === "0") {
|
|
1847
1413
|
event.preventDefault();
|
|
1848
1414
|
const newValue = key + (decimalPos >= 0 ? value.slice(decimalPos) : "");
|
|
@@ -1929,10 +1495,10 @@ function handleNumberFieldKeyDown({
|
|
|
1929
1495
|
const suffix = getSuffix(value, groupSeparator, decimalSeparator);
|
|
1930
1496
|
if (suffix && selectionStart > value.length - suffix.length) {
|
|
1931
1497
|
const suffixStartPos = value.length - suffix.length;
|
|
1932
|
-
|
|
1498
|
+
inputRef.current?.setSelectionRange(suffixStartPos, suffixStartPos);
|
|
1933
1499
|
}
|
|
1934
1500
|
}
|
|
1935
|
-
onOriginalKeyDown
|
|
1501
|
+
onOriginalKeyDown?.(event);
|
|
1936
1502
|
}
|
|
1937
1503
|
|
|
1938
1504
|
function useNumberFieldFormatting({
|
|
@@ -1945,19 +1511,28 @@ function useNumberFieldFormatting({
|
|
|
1945
1511
|
onChange,
|
|
1946
1512
|
autoFormat
|
|
1947
1513
|
}) {
|
|
1948
|
-
const { groupSeparator, decimalSeparator } = React.useMemo(
|
|
1514
|
+
const { groupSeparator, decimalSeparator } = React.useMemo(
|
|
1515
|
+
() => getSeparators(formatter),
|
|
1516
|
+
[formatter]
|
|
1517
|
+
);
|
|
1949
1518
|
const [formattedValue, setFormattedValue] = React.useState("");
|
|
1950
|
-
const symbolInfo = React.useMemo(
|
|
1519
|
+
const symbolInfo = React.useMemo(
|
|
1520
|
+
() => extractSymbol(formatter, prefix, postfix),
|
|
1521
|
+
[formatter, prefix, postfix]
|
|
1522
|
+
);
|
|
1951
1523
|
const { extractedPrefix, extractedPostfix, symbol } = symbolInfo;
|
|
1952
1524
|
const cursorPositionRef = React.useRef(null);
|
|
1953
1525
|
const displayValue = React.useMemo(() => {
|
|
1954
|
-
const numericValue = parseNumericValue(
|
|
1955
|
-
|
|
1956
|
-
|
|
1526
|
+
const numericValue = parseNumericValue(
|
|
1527
|
+
inputValue,
|
|
1528
|
+
decimalSeparator,
|
|
1529
|
+
formatter
|
|
1530
|
+
);
|
|
1531
|
+
if (numericValue === null) return inputValue;
|
|
1957
1532
|
try {
|
|
1958
1533
|
const trimmedValue = trimSymbol(inputValue, symbol) || inputValue;
|
|
1959
1534
|
return autoFormat ? formattedValue || trimmedValue : trimmedValue;
|
|
1960
|
-
} catch
|
|
1535
|
+
} catch {
|
|
1961
1536
|
return inputValue;
|
|
1962
1537
|
}
|
|
1963
1538
|
}, [
|
|
@@ -1970,49 +1545,74 @@ function useNumberFieldFormatting({
|
|
|
1970
1545
|
]);
|
|
1971
1546
|
React.useLayoutEffect(() => {
|
|
1972
1547
|
if (cursorPositionRef.current !== null && inputRef.current) {
|
|
1973
|
-
inputRef.current.setSelectionRange(
|
|
1548
|
+
inputRef.current.setSelectionRange(
|
|
1549
|
+
cursorPositionRef.current,
|
|
1550
|
+
cursorPositionRef.current
|
|
1551
|
+
);
|
|
1974
1552
|
cursorPositionRef.current = null;
|
|
1975
1553
|
}
|
|
1976
1554
|
}, [displayValue, inputRef]);
|
|
1977
|
-
const handleInput = React.useCallback(
|
|
1978
|
-
|
|
1979
|
-
return;
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1555
|
+
const handleInput = React.useCallback(
|
|
1556
|
+
(e) => {
|
|
1557
|
+
if (!autoFormat) return;
|
|
1558
|
+
const input = e.currentTarget;
|
|
1559
|
+
const { value, selectionStart } = input;
|
|
1560
|
+
const inputType = e.nativeEvent.inputType || "";
|
|
1561
|
+
const shouldStrip = !!symbol;
|
|
1562
|
+
const maxFractionDigits = formatter.resolvedOptions().maximumFractionDigits || 0;
|
|
1563
|
+
const decimalIndex = value.indexOf(decimalSeparator);
|
|
1564
|
+
if (decimalIndex !== -1 && selectionStart !== null) {
|
|
1565
|
+
const decimalPart = value.slice(decimalIndex + 1).replace(new RegExp(`[^0-9]`, "g"), "");
|
|
1566
|
+
const prevDecimalIndex = displayValue.indexOf(decimalSeparator);
|
|
1567
|
+
const prevDecimalLength = prevDecimalIndex !== -1 ? displayValue.slice(prevDecimalIndex + 1).length : 0;
|
|
1568
|
+
if (decimalPart.length > maxFractionDigits && selectionStart > decimalIndex + 1 + prevDecimalLength) {
|
|
1569
|
+
e.preventDefault();
|
|
1570
|
+
cursorPositionRef.current = decimalIndex + 1 + prevDecimalLength;
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1994
1573
|
}
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
1574
|
+
const formattedValue2 = formatNumberString(
|
|
1575
|
+
value,
|
|
1576
|
+
formatter,
|
|
1577
|
+
decimalSeparator,
|
|
1578
|
+
shouldStrip,
|
|
1579
|
+
symbol
|
|
1580
|
+
);
|
|
1581
|
+
setFormattedValue(formattedValue2);
|
|
1582
|
+
const numericValue = parseNumericValue(
|
|
1583
|
+
formattedValue2,
|
|
1584
|
+
decimalSeparator,
|
|
1585
|
+
formatter
|
|
1586
|
+
);
|
|
1587
|
+
if (formattedValue2 !== value && formattedValue2 !== "" && selectionStart !== null) {
|
|
1588
|
+
const newCursorPosition = calculateCursorPosition(
|
|
1589
|
+
value,
|
|
1590
|
+
formattedValue2,
|
|
1591
|
+
selectionStart,
|
|
1592
|
+
inputType,
|
|
1593
|
+
decimalSeparator,
|
|
1594
|
+
numericValue
|
|
1595
|
+
);
|
|
1596
|
+
cursorPositionRef.current = newCursorPosition;
|
|
1597
|
+
}
|
|
1598
|
+
if (numericValue !== null) {
|
|
1599
|
+
onChange?.(numericValue);
|
|
1600
|
+
}
|
|
1601
|
+
},
|
|
1602
|
+
[formatter, decimalSeparator, symbol, autoFormat, displayValue, onChange]
|
|
1603
|
+
);
|
|
1604
|
+
const handleKeyDown = React.useCallback(
|
|
1605
|
+
(e) => {
|
|
1606
|
+
handleNumberFieldKeyDown({
|
|
1607
|
+
event: e,
|
|
1608
|
+
inputRef,
|
|
1609
|
+
groupSeparator,
|
|
1610
|
+
decimalSeparator,
|
|
1611
|
+
onOriginalKeyDown
|
|
1612
|
+
});
|
|
1613
|
+
},
|
|
1614
|
+
[groupSeparator, decimalSeparator, inputRef, onOriginalKeyDown]
|
|
1615
|
+
);
|
|
2016
1616
|
return {
|
|
2017
1617
|
displayValue,
|
|
2018
1618
|
extractedPrefix,
|
|
@@ -2022,83 +1622,25 @@ function useNumberFieldFormatting({
|
|
|
2022
1622
|
};
|
|
2023
1623
|
}
|
|
2024
1624
|
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
var __hasOwnProp$f = Object.prototype.hasOwnProperty;
|
|
2030
|
-
var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
|
|
2031
|
-
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2032
|
-
var __spreadValues$f = (a, b) => {
|
|
2033
|
-
for (var prop in b || (b = {}))
|
|
2034
|
-
if (__hasOwnProp$f.call(b, prop))
|
|
2035
|
-
__defNormalProp$f(a, prop, b[prop]);
|
|
2036
|
-
if (__getOwnPropSymbols$f)
|
|
2037
|
-
for (var prop of __getOwnPropSymbols$f(b)) {
|
|
2038
|
-
if (__propIsEnum$f.call(b, prop))
|
|
2039
|
-
__defNormalProp$f(a, prop, b[prop]);
|
|
2040
|
-
}
|
|
2041
|
-
return a;
|
|
2042
|
-
};
|
|
2043
|
-
var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
|
|
2044
|
-
var __objRest$d = (source, exclude) => {
|
|
2045
|
-
var target = {};
|
|
2046
|
-
for (var prop in source)
|
|
2047
|
-
if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2048
|
-
target[prop] = source[prop];
|
|
2049
|
-
if (source != null && __getOwnPropSymbols$f)
|
|
2050
|
-
for (var prop of __getOwnPropSymbols$f(source)) {
|
|
2051
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
|
|
2052
|
-
target[prop] = source[prop];
|
|
2053
|
-
}
|
|
2054
|
-
return target;
|
|
2055
|
-
};
|
|
2056
|
-
const useSapphireNumberField = (_a, ref) => {
|
|
2057
|
-
var _b = _a, { error } = _b, numberFieldProps = __objRest$d(_b, ["error"]);
|
|
2058
|
-
const { locale } = i18n.useLocale();
|
|
2059
|
-
const numberFieldState = numberfield.useNumberFieldState(__spreadProps$e(__spreadValues$f({}, numberFieldProps), {
|
|
1625
|
+
const useSapphireNumberField = ({ error, ...numberFieldProps }, ref) => {
|
|
1626
|
+
const { locale } = I18nProvider.useLocale();
|
|
1627
|
+
const numberFieldState = useNumberFieldState.useNumberFieldState({
|
|
1628
|
+
...numberFieldProps,
|
|
2060
1629
|
locale
|
|
2061
|
-
})
|
|
2062
|
-
const numberFieldAria =
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
|
|
2072
|
-
var __hasOwnProp$e = Object.prototype.hasOwnProperty;
|
|
2073
|
-
var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
|
|
2074
|
-
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2075
|
-
var __spreadValues$e = (a, b) => {
|
|
2076
|
-
for (var prop in b || (b = {}))
|
|
2077
|
-
if (__hasOwnProp$e.call(b, prop))
|
|
2078
|
-
__defNormalProp$e(a, prop, b[prop]);
|
|
2079
|
-
if (__getOwnPropSymbols$e)
|
|
2080
|
-
for (var prop of __getOwnPropSymbols$e(b)) {
|
|
2081
|
-
if (__propIsEnum$e.call(b, prop))
|
|
2082
|
-
__defNormalProp$e(a, prop, b[prop]);
|
|
2083
|
-
}
|
|
2084
|
-
return a;
|
|
2085
|
-
};
|
|
2086
|
-
var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
|
|
2087
|
-
var __objRest$c = (source, exclude) => {
|
|
2088
|
-
var target = {};
|
|
2089
|
-
for (var prop in source)
|
|
2090
|
-
if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2091
|
-
target[prop] = source[prop];
|
|
2092
|
-
if (source != null && __getOwnPropSymbols$e)
|
|
2093
|
-
for (var prop of __getOwnPropSymbols$e(source)) {
|
|
2094
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
|
|
2095
|
-
target[prop] = source[prop];
|
|
2096
|
-
}
|
|
2097
|
-
return target;
|
|
1630
|
+
});
|
|
1631
|
+
const numberFieldAria = useNumberField.useNumberField(
|
|
1632
|
+
{
|
|
1633
|
+
...numberFieldProps,
|
|
1634
|
+
validationState: error === false || error === void 0 ? void 0 : "invalid"
|
|
1635
|
+
},
|
|
1636
|
+
numberFieldState,
|
|
1637
|
+
ref
|
|
1638
|
+
);
|
|
1639
|
+
return { ...numberFieldAria, state: numberFieldState };
|
|
2098
1640
|
};
|
|
1641
|
+
|
|
2099
1642
|
const NumberField = React.forwardRef(function NumberField2(props, ref) {
|
|
2100
|
-
|
|
2101
|
-
const _a = props, {
|
|
1643
|
+
const {
|
|
2102
1644
|
label,
|
|
2103
1645
|
isDisabled,
|
|
2104
1646
|
error,
|
|
@@ -2113,24 +1655,9 @@ const NumberField = React.forwardRef(function NumberField2(props, ref) {
|
|
|
2113
1655
|
showButtons = false,
|
|
2114
1656
|
incrementAriaLabel,
|
|
2115
1657
|
decrementAriaLabel,
|
|
2116
|
-
autoFormat = false
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
"isDisabled",
|
|
2120
|
-
"error",
|
|
2121
|
-
"note",
|
|
2122
|
-
"isRequired",
|
|
2123
|
-
"contextualHelp",
|
|
2124
|
-
"affix",
|
|
2125
|
-
"size",
|
|
2126
|
-
"labelPlacement",
|
|
2127
|
-
"necessityIndicator",
|
|
2128
|
-
"alignInputRight",
|
|
2129
|
-
"showButtons",
|
|
2130
|
-
"incrementAriaLabel",
|
|
2131
|
-
"decrementAriaLabel",
|
|
2132
|
-
"autoFormat"
|
|
2133
|
-
]);
|
|
1658
|
+
autoFormat = false,
|
|
1659
|
+
...otherProps
|
|
1660
|
+
} = props;
|
|
2134
1661
|
const { prefix, postfix } = React.useMemo(() => {
|
|
2135
1662
|
if (affix === "auto") {
|
|
2136
1663
|
return { prefix: void 0, postfix: void 0 };
|
|
@@ -2138,7 +1665,7 @@ const NumberField = React.forwardRef(function NumberField2(props, ref) {
|
|
|
2138
1665
|
return { prefix: affix.prefix, postfix: affix.postfix };
|
|
2139
1666
|
}, [affix]);
|
|
2140
1667
|
sapphireReact.useThemeCheck();
|
|
2141
|
-
const inputRef =
|
|
1668
|
+
const inputRef = useObjectRef.useObjectRef(props.inputRef);
|
|
2142
1669
|
const formatMessage = i18n.useMessageFormatter(intlMessages$1);
|
|
2143
1670
|
const {
|
|
2144
1671
|
inputProps,
|
|
@@ -2147,14 +1674,21 @@ const NumberField = React.forwardRef(function NumberField2(props, ref) {
|
|
|
2147
1674
|
decrementButtonProps,
|
|
2148
1675
|
descriptionProps,
|
|
2149
1676
|
errorMessageProps
|
|
2150
|
-
} = useSapphireNumberField(
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
1677
|
+
} = useSapphireNumberField(
|
|
1678
|
+
{
|
|
1679
|
+
...props,
|
|
1680
|
+
incrementAriaLabel: incrementAriaLabel ?? formatMessage("increment"),
|
|
1681
|
+
decrementAriaLabel: decrementAriaLabel ?? formatMessage("decrement")
|
|
1682
|
+
},
|
|
1683
|
+
inputRef
|
|
1684
|
+
);
|
|
1685
|
+
const { focusProps, isFocusVisible } = useFocusRing.useFocusRing();
|
|
2155
1686
|
const { autofillStyles, updateStyle } = useAutofillStyle(inputRef);
|
|
2156
|
-
const { locale } =
|
|
2157
|
-
const formatter = React.useMemo(
|
|
1687
|
+
const { locale } = I18nProvider.useLocale();
|
|
1688
|
+
const formatter = React.useMemo(
|
|
1689
|
+
() => new Intl.NumberFormat(locale, props.formatOptions),
|
|
1690
|
+
[locale, props.formatOptions]
|
|
1691
|
+
);
|
|
2158
1692
|
const formattingResult = useNumberFieldFormatting({
|
|
2159
1693
|
inputRef,
|
|
2160
1694
|
formatter,
|
|
@@ -2172,65 +1706,122 @@ const NumberField = React.forwardRef(function NumberField2(props, ref) {
|
|
|
2172
1706
|
handleKeyDown: inputProps.onKeyDown
|
|
2173
1707
|
};
|
|
2174
1708
|
const containerRef = React.useRef(null);
|
|
2175
|
-
React.useImperativeHandle(ref, () =>
|
|
1709
|
+
React.useImperativeHandle(ref, () => ({
|
|
1710
|
+
...utils.createFocusableRef(containerRef, inputRef),
|
|
1711
|
+
/**
|
|
1712
|
+
* (This function is deprecated. Use `inputRef` prop)
|
|
1713
|
+
* @deprecated
|
|
1714
|
+
*/
|
|
2176
1715
|
getInputElement() {
|
|
2177
1716
|
return inputRef.current;
|
|
2178
1717
|
}
|
|
2179
1718
|
}));
|
|
2180
|
-
return /* @__PURE__ */
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
1719
|
+
return /* @__PURE__ */ React.createElement(
|
|
1720
|
+
sapphireReact.Field,
|
|
1721
|
+
{
|
|
1722
|
+
...removeUniqueDOMProps(otherProps),
|
|
1723
|
+
ref: containerRef,
|
|
1724
|
+
size,
|
|
1725
|
+
labelPlacement
|
|
1726
|
+
},
|
|
1727
|
+
/* @__PURE__ */ React.createElement(
|
|
1728
|
+
sapphireReact.Field.Context,
|
|
1729
|
+
{
|
|
1730
|
+
descriptionProps: error ? errorMessageProps : descriptionProps
|
|
1731
|
+
},
|
|
1732
|
+
label && /* @__PURE__ */ React.createElement(sapphireReact.Field.Label, null, /* @__PURE__ */ React.createElement(
|
|
1733
|
+
sapphireReact.Label,
|
|
1734
|
+
{
|
|
1735
|
+
...labelProps,
|
|
1736
|
+
size,
|
|
1737
|
+
necessityIndicator: isRequired && necessityIndicator ? "required" : !isRequired && necessityIndicator ? "optional" : void 0,
|
|
1738
|
+
contextualHelp
|
|
1739
|
+
},
|
|
1740
|
+
label
|
|
1741
|
+
)),
|
|
1742
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Field.Control, null, /* @__PURE__ */ React.createElement(
|
|
1743
|
+
"div",
|
|
1744
|
+
{
|
|
1745
|
+
className: clsx(textFieldStyles["sapphire-text-field"], {
|
|
1746
|
+
[textFieldStyles["is-focus"]]: isFocusVisible,
|
|
1747
|
+
[textFieldStyles["sapphire-text-field--error"]]: error === true || typeof error === "string",
|
|
1748
|
+
[textFieldStyles["sapphire-text-field--md"]]: size === "md"
|
|
1749
|
+
})
|
|
1750
|
+
},
|
|
1751
|
+
extractedPrefix && /* @__PURE__ */ React.createElement(
|
|
1752
|
+
"span",
|
|
1753
|
+
{
|
|
1754
|
+
className: clsx(
|
|
1755
|
+
textFieldStyles["sapphire-text-field__prefix"],
|
|
1756
|
+
{
|
|
1757
|
+
[textFieldStyles["sapphire-text-field__prefix--icon"]]: typeof extractedPrefix !== "string"
|
|
1758
|
+
}
|
|
1759
|
+
)
|
|
1760
|
+
},
|
|
1761
|
+
extractedPrefix
|
|
1762
|
+
),
|
|
1763
|
+
/* @__PURE__ */ React.createElement(
|
|
1764
|
+
"input",
|
|
1765
|
+
{
|
|
1766
|
+
...mergeProps.mergeProps(
|
|
1767
|
+
inputProps,
|
|
1768
|
+
focusProps,
|
|
1769
|
+
{
|
|
1770
|
+
onChange: updateStyle,
|
|
1771
|
+
onBlur: updateStyle
|
|
1772
|
+
},
|
|
1773
|
+
autoFormat ? {
|
|
1774
|
+
onInput: handleInput,
|
|
1775
|
+
onKeyDown: handleKeyDown
|
|
1776
|
+
} : {}
|
|
1777
|
+
),
|
|
1778
|
+
value: formattingResult?.displayValue ?? inputProps.value,
|
|
1779
|
+
ref: inputRef,
|
|
1780
|
+
className: clsx(textFieldStyles["sapphire-text-field__input"], {
|
|
1781
|
+
[textFieldStyles["sapphire-text-field__input--align-right"]]: !!alignInputRight
|
|
1782
|
+
}),
|
|
1783
|
+
style: autofillStyles
|
|
1784
|
+
}
|
|
1785
|
+
),
|
|
1786
|
+
extractedPostfix && /* @__PURE__ */ React.createElement(
|
|
1787
|
+
"span",
|
|
1788
|
+
{
|
|
1789
|
+
className: clsx(
|
|
1790
|
+
textFieldStyles["sapphire-text-field__postfix"],
|
|
1791
|
+
{
|
|
1792
|
+
[textFieldStyles["sapphire-text-field__postfix--icon"]]: typeof extractedPostfix !== "string"
|
|
1793
|
+
}
|
|
1794
|
+
)
|
|
1795
|
+
},
|
|
1796
|
+
extractedPostfix
|
|
1797
|
+
),
|
|
1798
|
+
showButtons && /* @__PURE__ */ React.createElement("div", { className: textFieldStyles["sapphire-text-field__stepper"] }, /* @__PURE__ */ React.createElement(
|
|
1799
|
+
StepperButton,
|
|
1800
|
+
{
|
|
1801
|
+
variant: "decrement",
|
|
1802
|
+
size,
|
|
1803
|
+
...decrementButtonProps
|
|
1804
|
+
}
|
|
1805
|
+
), /* @__PURE__ */ React.createElement(sapphireReact.Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
|
|
1806
|
+
StepperButton,
|
|
1807
|
+
{
|
|
1808
|
+
variant: "increment",
|
|
1809
|
+
size,
|
|
1810
|
+
...incrementButtonProps
|
|
1811
|
+
}
|
|
1812
|
+
))
|
|
1813
|
+
)),
|
|
1814
|
+
(error && typeof error !== "boolean" || note) && /* @__PURE__ */ React.createElement(sapphireReact.Field.Footer, null, error && typeof error !== "boolean" ? /* @__PURE__ */ React.createElement(sapphireReact.Field.Note, { variant: "error" }, error) : note ? note : /* @__PURE__ */ React.createElement(React.Fragment, null))
|
|
1815
|
+
)
|
|
1816
|
+
);
|
|
2230
1817
|
});
|
|
2231
|
-
const removeUniqueDOMProps = (props) => Object.fromEntries(
|
|
1818
|
+
const removeUniqueDOMProps = (props) => Object.fromEntries(
|
|
1819
|
+
Object.entries(props).filter(
|
|
1820
|
+
([name]) => name !== "id" && !name.startsWith("data-")
|
|
1821
|
+
)
|
|
1822
|
+
);
|
|
2232
1823
|
|
|
2233
|
-
const SecondarySidebarContext =
|
|
1824
|
+
const SecondarySidebarContext = React.createContext(null);
|
|
2234
1825
|
const useSecondarySidebarContext = () => {
|
|
2235
1826
|
const context = React.useContext(SecondarySidebarContext);
|
|
2236
1827
|
if (context) {
|
|
@@ -2245,22 +1836,25 @@ const SecondarySidebarProvider = ({
|
|
|
2245
1836
|
themeVariant,
|
|
2246
1837
|
children
|
|
2247
1838
|
}) => {
|
|
2248
|
-
var _a, _b, _c, _d;
|
|
2249
1839
|
const context = React.useContext(SecondarySidebarContext);
|
|
2250
|
-
const [secondarySidebarId, setSecondarySidebarId] =
|
|
1840
|
+
const [secondarySidebarId, setSecondarySidebarId] = useControlledState.useControlledState(openedId, defaultOpenedId ?? null, onOpenedIdChange);
|
|
2251
1841
|
const [content, setContent] = React.useState(null);
|
|
2252
|
-
return /* @__PURE__ */
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
1842
|
+
return /* @__PURE__ */ React.createElement(
|
|
1843
|
+
SecondarySidebarContext.Provider,
|
|
1844
|
+
{
|
|
1845
|
+
value: {
|
|
1846
|
+
openedId: context?.openedId ?? secondarySidebarId,
|
|
1847
|
+
setOpenedId: context?.setOpenedId ?? setSecondarySidebarId,
|
|
1848
|
+
content: context?.content ?? content,
|
|
1849
|
+
setContent: context?.setContent ?? setContent,
|
|
1850
|
+
themeVariant: themeVariant ?? context?.themeVariant
|
|
1851
|
+
}
|
|
1852
|
+
},
|
|
1853
|
+
children
|
|
1854
|
+
);
|
|
2261
1855
|
};
|
|
2262
1856
|
|
|
2263
|
-
const ResponsiveSidebarContext =
|
|
1857
|
+
const ResponsiveSidebarContext = React.createContext(null);
|
|
2264
1858
|
function useResponsiveSidebarContext() {
|
|
2265
1859
|
return React.useContext(ResponsiveSidebarContext);
|
|
2266
1860
|
}
|
|
@@ -2286,59 +1880,35 @@ const ResponsiveSidebarProvider = ({
|
|
|
2286
1880
|
onPanelOpenChange,
|
|
2287
1881
|
children
|
|
2288
1882
|
}) => {
|
|
2289
|
-
const [isOpen, setOpen] =
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2306
|
-
var __spreadValues$d = (a, b) => {
|
|
2307
|
-
for (var prop in b || (b = {}))
|
|
2308
|
-
if (__hasOwnProp$d.call(b, prop))
|
|
2309
|
-
__defNormalProp$d(a, prop, b[prop]);
|
|
2310
|
-
if (__getOwnPropSymbols$d)
|
|
2311
|
-
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
2312
|
-
if (__propIsEnum$d.call(b, prop))
|
|
2313
|
-
__defNormalProp$d(a, prop, b[prop]);
|
|
2314
|
-
}
|
|
2315
|
-
return a;
|
|
2316
|
-
};
|
|
2317
|
-
var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
|
|
2318
|
-
var __objRest$b = (source, exclude) => {
|
|
2319
|
-
var target = {};
|
|
2320
|
-
for (var prop in source)
|
|
2321
|
-
if (__hasOwnProp$d.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2322
|
-
target[prop] = source[prop];
|
|
2323
|
-
if (source != null && __getOwnPropSymbols$d)
|
|
2324
|
-
for (var prop of __getOwnPropSymbols$d(source)) {
|
|
2325
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$d.call(source, prop))
|
|
2326
|
-
target[prop] = source[prop];
|
|
2327
|
-
}
|
|
2328
|
-
return target;
|
|
1883
|
+
const [isOpen, setOpen] = useControlledState.useControlledState(
|
|
1884
|
+
isPanelOpen,
|
|
1885
|
+
defaultIsPanelOpen ?? false,
|
|
1886
|
+
onPanelOpenChange
|
|
1887
|
+
);
|
|
1888
|
+
return /* @__PURE__ */ React.createElement(
|
|
1889
|
+
ResponsiveSidebarContext.Provider,
|
|
1890
|
+
{
|
|
1891
|
+
value: {
|
|
1892
|
+
isPanelOpen: isOpen,
|
|
1893
|
+
setPanelOpen: setOpen,
|
|
1894
|
+
collapsed
|
|
1895
|
+
}
|
|
1896
|
+
},
|
|
1897
|
+
children
|
|
1898
|
+
);
|
|
2329
1899
|
};
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
"header"
|
|
2337
|
-
]);
|
|
1900
|
+
|
|
1901
|
+
const SidebarPanel = ({
|
|
1902
|
+
children,
|
|
1903
|
+
header,
|
|
1904
|
+
...props
|
|
1905
|
+
}) => {
|
|
2338
1906
|
const { openedId, setOpenedId, content } = useSecondarySidebarContext();
|
|
2339
1907
|
const responsiveContext = useResponsiveSidebarContext();
|
|
2340
1908
|
if (!responsiveContext) {
|
|
2341
|
-
throw new Error(
|
|
1909
|
+
throw new Error(
|
|
1910
|
+
"<SidebarPanel> must be rendered inside a <Sidebar.ResponsiveProvider>"
|
|
1911
|
+
);
|
|
2342
1912
|
}
|
|
2343
1913
|
const { isPanelOpen, setPanelOpen } = responsiveContext;
|
|
2344
1914
|
const isCollapsed = useIsSidebarCollapsed();
|
|
@@ -2347,41 +1917,60 @@ const SidebarPanel = (_a) => {
|
|
|
2347
1917
|
setPanelOpen(false);
|
|
2348
1918
|
}
|
|
2349
1919
|
}, [isCollapsed]);
|
|
2350
|
-
return /* @__PURE__ */
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
1920
|
+
return /* @__PURE__ */ React.createElement(
|
|
1921
|
+
sapphireReact.Panel,
|
|
1922
|
+
{
|
|
1923
|
+
...props,
|
|
1924
|
+
isOpen: isPanelOpen,
|
|
1925
|
+
onClose: () => setPanelOpen(false),
|
|
1926
|
+
onCloseTransitionDone: () => setOpenedId(null),
|
|
1927
|
+
alignLeft: true,
|
|
1928
|
+
isDismissable: true,
|
|
1929
|
+
width: 320
|
|
1930
|
+
},
|
|
1931
|
+
/* @__PURE__ */ React.createElement(
|
|
1932
|
+
sapphireReact.ModalLayout,
|
|
1933
|
+
{
|
|
1934
|
+
header: /* @__PURE__ */ React.createElement(
|
|
1935
|
+
sapphireReact.ModalLayout.Header,
|
|
1936
|
+
{
|
|
1937
|
+
heading: openedId === null ? header : content?.header,
|
|
1938
|
+
backButton: openedId !== null && /* @__PURE__ */ React.createElement(
|
|
1939
|
+
sapphireReact.IconButton,
|
|
1940
|
+
{
|
|
1941
|
+
size: "md",
|
|
1942
|
+
"aria-label": "Back",
|
|
1943
|
+
variant: "tertiary",
|
|
1944
|
+
marginLeft: `calc(-1 * ${sapphireReact.tokens.size.spacingSm})`,
|
|
1945
|
+
onPress: () => setOpenedId(null)
|
|
1946
|
+
},
|
|
1947
|
+
/* @__PURE__ */ React.createElement(react.ChevronLeft, null)
|
|
1948
|
+
)
|
|
1949
|
+
}
|
|
1950
|
+
),
|
|
1951
|
+
body: /* @__PURE__ */ React.createElement(
|
|
1952
|
+
sapphireReact.ModalLayout.Body,
|
|
1953
|
+
{
|
|
1954
|
+
noPadding: true,
|
|
1955
|
+
UNSAFE_style: {
|
|
1956
|
+
paddingLeft: sapphireReact.tokens.size.spacingMd.value,
|
|
1957
|
+
paddingRight: sapphireReact.tokens.size.spacingMd.value
|
|
1958
|
+
}
|
|
1959
|
+
},
|
|
1960
|
+
/* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(sapphireReact.View, { isHidden: openedId !== null }, children), openedId && content?.body)
|
|
1961
|
+
)
|
|
2373
1962
|
}
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
}, children), openedId && (content == null ? void 0 : content.body)))
|
|
2377
|
-
}));
|
|
1963
|
+
)
|
|
1964
|
+
);
|
|
2378
1965
|
};
|
|
2379
1966
|
const SidebarPanelTrigger = ({
|
|
2380
1967
|
children
|
|
2381
1968
|
}) => {
|
|
2382
1969
|
const context = useResponsiveSidebarContext();
|
|
2383
1970
|
if (!context) {
|
|
2384
|
-
throw new Error(
|
|
1971
|
+
throw new Error(
|
|
1972
|
+
"<Sidebar.PanelTrigger> should be rendered inside a <Sidebar.ResponsiveProvider>"
|
|
1973
|
+
);
|
|
2385
1974
|
}
|
|
2386
1975
|
const isCollapsed = useIsSidebarCollapsed();
|
|
2387
1976
|
const panelTriggerProps = {
|
|
@@ -2416,271 +2005,163 @@ const useSidebar = () => {
|
|
|
2416
2005
|
};
|
|
2417
2006
|
};
|
|
2418
2007
|
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
if (__hasOwnProp$c.call(b, prop))
|
|
2429
|
-
__defNormalProp$c(a, prop, b[prop]);
|
|
2430
|
-
if (__getOwnPropSymbols$c)
|
|
2431
|
-
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
2432
|
-
if (__propIsEnum$c.call(b, prop))
|
|
2433
|
-
__defNormalProp$c(a, prop, b[prop]);
|
|
2434
|
-
}
|
|
2435
|
-
return a;
|
|
2436
|
-
};
|
|
2437
|
-
var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
|
|
2438
|
-
var __objRest$a = (source, exclude) => {
|
|
2439
|
-
var target = {};
|
|
2440
|
-
for (var prop in source)
|
|
2441
|
-
if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2442
|
-
target[prop] = source[prop];
|
|
2443
|
-
if (source != null && __getOwnPropSymbols$c)
|
|
2444
|
-
for (var prop of __getOwnPropSymbols$c(source)) {
|
|
2445
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
|
|
2446
|
-
target[prop] = source[prop];
|
|
2447
|
-
}
|
|
2448
|
-
return target;
|
|
2449
|
-
};
|
|
2450
|
-
const Sidebar = (_a) => {
|
|
2451
|
-
var _b = _a, {
|
|
2452
|
-
themeVariant,
|
|
2453
|
-
openedSecondarySidebar,
|
|
2454
|
-
defaultOpenedSecondarySidebar,
|
|
2455
|
-
onSecondarySidebarChange,
|
|
2456
|
-
secondarySidebarThemeVariant,
|
|
2457
|
-
children
|
|
2458
|
-
} = _b, props = __objRest$a(_b, [
|
|
2459
|
-
"themeVariant",
|
|
2460
|
-
"openedSecondarySidebar",
|
|
2461
|
-
"defaultOpenedSecondarySidebar",
|
|
2462
|
-
"onSecondarySidebarChange",
|
|
2463
|
-
"secondarySidebarThemeVariant",
|
|
2464
|
-
"children"
|
|
2465
|
-
]);
|
|
2008
|
+
const Sidebar = ({
|
|
2009
|
+
themeVariant,
|
|
2010
|
+
openedSecondarySidebar,
|
|
2011
|
+
defaultOpenedSecondarySidebar,
|
|
2012
|
+
onSecondarySidebarChange,
|
|
2013
|
+
secondarySidebarThemeVariant,
|
|
2014
|
+
children,
|
|
2015
|
+
...props
|
|
2016
|
+
}) => {
|
|
2466
2017
|
sapphireReact.useThemeCheck();
|
|
2467
|
-
return /* @__PURE__ */
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
}
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
"onFocusWithinChange",
|
|
2489
|
-
"closeOnBlurWithin",
|
|
2490
|
-
"header",
|
|
2491
|
-
"panelHeader",
|
|
2492
|
-
"children"
|
|
2493
|
-
]);
|
|
2018
|
+
return /* @__PURE__ */ React.createElement(
|
|
2019
|
+
SecondarySidebarProvider,
|
|
2020
|
+
{
|
|
2021
|
+
openedId: openedSecondarySidebar,
|
|
2022
|
+
defaultOpenedId: defaultOpenedSecondarySidebar,
|
|
2023
|
+
onOpenedIdChange: onSecondarySidebarChange,
|
|
2024
|
+
themeVariant: secondarySidebarThemeVariant
|
|
2025
|
+
},
|
|
2026
|
+
/* @__PURE__ */ React.createElement(WithThemeRoot, { themeVariant }, /* @__PURE__ */ React.createElement(SidebarContent, { ...props }, children))
|
|
2027
|
+
);
|
|
2028
|
+
};
|
|
2029
|
+
const SidebarContent = ({
|
|
2030
|
+
onBlurWithin,
|
|
2031
|
+
onFocusWithin,
|
|
2032
|
+
onFocusWithinChange,
|
|
2033
|
+
closeOnBlurWithin = true,
|
|
2034
|
+
header,
|
|
2035
|
+
panelHeader,
|
|
2036
|
+
children,
|
|
2037
|
+
...props
|
|
2038
|
+
}) => {
|
|
2494
2039
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
2495
2040
|
const { sidebarProps } = useSidebar();
|
|
2496
|
-
const { focusWithinProps } =
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2041
|
+
const { focusWithinProps } = useFocusWithin.useFocusWithin(
|
|
2042
|
+
mergeProps.mergeProps(
|
|
2043
|
+
{
|
|
2044
|
+
onBlurWithin,
|
|
2045
|
+
onFocusWithin,
|
|
2046
|
+
onFocusWithinChange
|
|
2047
|
+
},
|
|
2048
|
+
closeOnBlurWithin ? sidebarProps : {}
|
|
2049
|
+
)
|
|
2050
|
+
);
|
|
2501
2051
|
const responsiveSidebarContext = useResponsiveSidebarContext();
|
|
2502
2052
|
const isCollapsed = useIsSidebarCollapsed();
|
|
2503
|
-
return /* @__PURE__ */
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2053
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, !isCollapsed && /* @__PURE__ */ React.createElement(
|
|
2054
|
+
"div",
|
|
2055
|
+
{
|
|
2056
|
+
...styleProps,
|
|
2057
|
+
...filterDOMProps.filterDOMProps(props, { global: true }),
|
|
2058
|
+
...focusWithinProps,
|
|
2059
|
+
className: clsx(styles$6["sapphire-sidebar"]),
|
|
2060
|
+
tabIndex: -1
|
|
2061
|
+
},
|
|
2062
|
+
header,
|
|
2063
|
+
children
|
|
2064
|
+
), responsiveSidebarContext && /* @__PURE__ */ React.createElement(SidebarPanel, { header: panelHeader }, children));
|
|
2509
2065
|
};
|
|
2510
2066
|
const WithThemeRoot = ({
|
|
2511
2067
|
children,
|
|
2512
2068
|
themeVariant
|
|
2513
|
-
}) => themeVariant ? /* @__PURE__ */
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
}
|
|
2536
|
-
return a;
|
|
2537
|
-
};
|
|
2538
|
-
var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
|
|
2539
|
-
var __objRest$9 = (source, exclude) => {
|
|
2540
|
-
var target = {};
|
|
2541
|
-
for (var prop in source)
|
|
2542
|
-
if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2543
|
-
target[prop] = source[prop];
|
|
2544
|
-
if (source != null && __getOwnPropSymbols$b)
|
|
2545
|
-
for (var prop of __getOwnPropSymbols$b(source)) {
|
|
2546
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
|
|
2547
|
-
target[prop] = source[prop];
|
|
2548
|
-
}
|
|
2549
|
-
return target;
|
|
2550
|
-
};
|
|
2551
|
-
const SidebarHeader = (_a) => {
|
|
2552
|
-
var _b = _a, {
|
|
2069
|
+
}) => themeVariant ? /* @__PURE__ */ React.createElement(
|
|
2070
|
+
sapphireReact.ThemeRoot,
|
|
2071
|
+
{
|
|
2072
|
+
variant: themeVariant,
|
|
2073
|
+
noSurface: true,
|
|
2074
|
+
height: "100%",
|
|
2075
|
+
width: "min-content"
|
|
2076
|
+
},
|
|
2077
|
+
children
|
|
2078
|
+
) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
2079
|
+
|
|
2080
|
+
const SidebarHeader = ({
|
|
2081
|
+
children,
|
|
2082
|
+
closeButtonProps,
|
|
2083
|
+
...props
|
|
2084
|
+
}) => {
|
|
2085
|
+
return /* @__PURE__ */ React.createElement(
|
|
2086
|
+
"div",
|
|
2087
|
+
{
|
|
2088
|
+
...filterDOMProps.filterDOMProps(props),
|
|
2089
|
+
className: clsx(styles$6["sapphire-sidebar__header"])
|
|
2090
|
+
},
|
|
2553
2091
|
children,
|
|
2554
|
-
closeButtonProps
|
|
2555
|
-
|
|
2556
|
-
"children",
|
|
2557
|
-
"closeButtonProps"
|
|
2558
|
-
]);
|
|
2559
|
-
return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$a(__spreadValues$b({}, utils.filterDOMProps(props)), {
|
|
2560
|
-
className: clsx__default["default"](styles__default$6["default"]["sapphire-sidebar__header"])
|
|
2561
|
-
}), children, closeButtonProps && /* @__PURE__ */ React__default["default"].createElement(sapphireReact.IconButton, __spreadProps$a(__spreadValues$b({}, closeButtonProps), {
|
|
2562
|
-
"aria-label": "Close"
|
|
2563
|
-
}), /* @__PURE__ */ React__default["default"].createElement(react.CloseLarge, null)));
|
|
2564
|
-
};
|
|
2565
|
-
|
|
2566
|
-
var __defProp$a = Object.defineProperty;
|
|
2567
|
-
var __defProps$9 = Object.defineProperties;
|
|
2568
|
-
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
2569
|
-
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
2570
|
-
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
2571
|
-
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
2572
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2573
|
-
var __spreadValues$a = (a, b) => {
|
|
2574
|
-
for (var prop in b || (b = {}))
|
|
2575
|
-
if (__hasOwnProp$a.call(b, prop))
|
|
2576
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
2577
|
-
if (__getOwnPropSymbols$a)
|
|
2578
|
-
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
2579
|
-
if (__propIsEnum$a.call(b, prop))
|
|
2580
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
2581
|
-
}
|
|
2582
|
-
return a;
|
|
2583
|
-
};
|
|
2584
|
-
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
2585
|
-
var __objRest$8 = (source, exclude) => {
|
|
2586
|
-
var target = {};
|
|
2587
|
-
for (var prop in source)
|
|
2588
|
-
if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2589
|
-
target[prop] = source[prop];
|
|
2590
|
-
if (source != null && __getOwnPropSymbols$a)
|
|
2591
|
-
for (var prop of __getOwnPropSymbols$a(source)) {
|
|
2592
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
|
|
2593
|
-
target[prop] = source[prop];
|
|
2594
|
-
}
|
|
2595
|
-
return target;
|
|
2092
|
+
closeButtonProps && /* @__PURE__ */ React.createElement(sapphireReact.IconButton, { ...closeButtonProps, "aria-label": "Close" }, /* @__PURE__ */ React.createElement(react.CloseLarge, null))
|
|
2093
|
+
);
|
|
2596
2094
|
};
|
|
2597
|
-
|
|
2598
|
-
|
|
2095
|
+
|
|
2096
|
+
const SidebarItem = React.forwardRef(function SidebarItem2({ isActive, children, ...props }, ref) {
|
|
2599
2097
|
const { itemProps } = useSidebar();
|
|
2600
|
-
return /* @__PURE__ */
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2098
|
+
return /* @__PURE__ */ React.createElement("li", { className: clsx(styles$6["sapphire-sidebar__nav-item"]) }, /* @__PURE__ */ React.createElement(
|
|
2099
|
+
sapphireReact.Button,
|
|
2100
|
+
{
|
|
2101
|
+
ref,
|
|
2102
|
+
variant: "tertiary",
|
|
2103
|
+
elementType: "a",
|
|
2104
|
+
"aria-current": isActive ? "page" : void 0,
|
|
2105
|
+
...mergeProps.mergeProps(props, itemProps),
|
|
2106
|
+
UNSAFE_className: clsx(
|
|
2107
|
+
buttonStyles["sapphire-button--stretch-left-align"],
|
|
2108
|
+
{ [buttonStyles["sapphire-button--selected"]]: isActive }
|
|
2109
|
+
)
|
|
2110
|
+
},
|
|
2111
|
+
children
|
|
2112
|
+
));
|
|
2610
2113
|
});
|
|
2611
2114
|
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
2615
|
-
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
2616
|
-
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
2617
|
-
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
2618
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2619
|
-
var __spreadValues$9 = (a, b) => {
|
|
2620
|
-
for (var prop in b || (b = {}))
|
|
2621
|
-
if (__hasOwnProp$9.call(b, prop))
|
|
2622
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
2623
|
-
if (__getOwnPropSymbols$9)
|
|
2624
|
-
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
2625
|
-
if (__propIsEnum$9.call(b, prop))
|
|
2626
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
2627
|
-
}
|
|
2628
|
-
return a;
|
|
2629
|
-
};
|
|
2630
|
-
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
2631
|
-
var __objRest$7 = (source, exclude) => {
|
|
2632
|
-
var target = {};
|
|
2633
|
-
for (var prop in source)
|
|
2634
|
-
if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2635
|
-
target[prop] = source[prop];
|
|
2636
|
-
if (source != null && __getOwnPropSymbols$9)
|
|
2637
|
-
for (var prop of __getOwnPropSymbols$9(source)) {
|
|
2638
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
|
|
2639
|
-
target[prop] = source[prop];
|
|
2640
|
-
}
|
|
2641
|
-
return target;
|
|
2642
|
-
};
|
|
2643
|
-
const SidebarExpandableItem = React__default["default"].forwardRef(function SidebarExpandableItem2(_a, ref) {
|
|
2644
|
-
var _b = _a, {
|
|
2115
|
+
const SidebarExpandableItem = React.forwardRef(
|
|
2116
|
+
function SidebarExpandableItem2({
|
|
2645
2117
|
id,
|
|
2646
2118
|
isActive,
|
|
2647
2119
|
body,
|
|
2648
2120
|
header,
|
|
2649
|
-
children
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2121
|
+
children,
|
|
2122
|
+
...props
|
|
2123
|
+
}, ref) {
|
|
2124
|
+
const { openedId, setContent, themeVariant } = useSecondarySidebarContext();
|
|
2125
|
+
const isCollapsed = useIsSidebarCollapsed();
|
|
2126
|
+
const { getExpandableItemProps, secondarySidebarProps } = useSidebar();
|
|
2127
|
+
const itemId = useId.useId(id);
|
|
2128
|
+
const isOpen = openedId === itemId;
|
|
2129
|
+
React.useLayoutEffect(() => {
|
|
2130
|
+
if (isOpen) {
|
|
2131
|
+
setContent({ header, body });
|
|
2132
|
+
}
|
|
2133
|
+
}, [isOpen]);
|
|
2134
|
+
return /* @__PURE__ */ React.createElement("li", { className: clsx(styles$6["sapphire-sidebar__nav-item"]) }, /* @__PURE__ */ React.createElement(
|
|
2135
|
+
sapphireReact.Button,
|
|
2136
|
+
{
|
|
2137
|
+
variant: "tertiary",
|
|
2138
|
+
"aria-current": isActive || void 0,
|
|
2139
|
+
ref,
|
|
2140
|
+
...mergeProps.mergeProps(
|
|
2141
|
+
getExpandableItemProps(itemId),
|
|
2142
|
+
props
|
|
2143
|
+
),
|
|
2144
|
+
UNSAFE_className: clsx(
|
|
2145
|
+
buttonStyles["sapphire-button--stretch-left-align"],
|
|
2146
|
+
{
|
|
2147
|
+
[buttonStyles["sapphire-button--selected"]]: isActive && !isOpen,
|
|
2148
|
+
[buttonStyles["is-active"]]: isOpen
|
|
2149
|
+
}
|
|
2150
|
+
)
|
|
2151
|
+
},
|
|
2152
|
+
children
|
|
2153
|
+
), /* @__PURE__ */ React.createElement(
|
|
2154
|
+
SecondarySidebar,
|
|
2155
|
+
{
|
|
2156
|
+
isOpen: isOpen && !isCollapsed,
|
|
2157
|
+
header,
|
|
2158
|
+
themeVariant,
|
|
2159
|
+
...secondarySidebarProps
|
|
2160
|
+
},
|
|
2161
|
+
body
|
|
2162
|
+
));
|
|
2163
|
+
}
|
|
2164
|
+
);
|
|
2684
2165
|
const SecondarySidebar = ({
|
|
2685
2166
|
isOpen,
|
|
2686
2167
|
onClose,
|
|
@@ -2693,188 +2174,134 @@ const SecondarySidebar = ({
|
|
|
2693
2174
|
React.useEffect(() => {
|
|
2694
2175
|
const handleKeyDown = (e) => {
|
|
2695
2176
|
if (e.key === "Escape") {
|
|
2696
|
-
onClose
|
|
2177
|
+
onClose?.();
|
|
2697
2178
|
}
|
|
2698
2179
|
};
|
|
2699
2180
|
document.addEventListener("keydown", handleKeyDown);
|
|
2700
2181
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
2701
2182
|
}, [onClose]);
|
|
2702
|
-
return /* @__PURE__ */
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
var __objRest$6 = (source, exclude) => {
|
|
2750
|
-
var target = {};
|
|
2751
|
-
for (var prop in source)
|
|
2752
|
-
if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2753
|
-
target[prop] = source[prop];
|
|
2754
|
-
if (source != null && __getOwnPropSymbols$8)
|
|
2755
|
-
for (var prop of __getOwnPropSymbols$8(source)) {
|
|
2756
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
|
|
2757
|
-
target[prop] = source[prop];
|
|
2758
|
-
}
|
|
2759
|
-
return target;
|
|
2760
|
-
};
|
|
2761
|
-
const SidebarSection = (_a) => {
|
|
2762
|
-
var _b = _a, {
|
|
2763
|
-
title,
|
|
2764
|
-
"aria-label": label,
|
|
2765
|
-
children
|
|
2766
|
-
} = _b, props = __objRest$6(_b, [
|
|
2767
|
-
"title",
|
|
2768
|
-
"aria-label",
|
|
2769
|
-
"children"
|
|
2770
|
-
]);
|
|
2183
|
+
return /* @__PURE__ */ React.createElement(
|
|
2184
|
+
reactTransitionGroup.Transition,
|
|
2185
|
+
{
|
|
2186
|
+
in: isOpen,
|
|
2187
|
+
mountOnEnter: true,
|
|
2188
|
+
nodeRef: ref,
|
|
2189
|
+
unmountOnExit: true,
|
|
2190
|
+
onExited: onCloseTransitionDone,
|
|
2191
|
+
timeout: 200
|
|
2192
|
+
},
|
|
2193
|
+
(transitionState) => /* @__PURE__ */ React.createElement(
|
|
2194
|
+
"div",
|
|
2195
|
+
{
|
|
2196
|
+
ref,
|
|
2197
|
+
className: clsx(styles$6["sapphire-sidebar__secondary-container"], {
|
|
2198
|
+
[styles$6["sapphire-sidebar--slide-in"]]: true,
|
|
2199
|
+
[styles$6["sapphire-sidebar--slide-out"]]: transitionState === "exiting"
|
|
2200
|
+
})
|
|
2201
|
+
},
|
|
2202
|
+
/* @__PURE__ */ React.createElement(FocusScope.FocusScope, { restoreFocus: true, autoFocus: true }, /* @__PURE__ */ React.createElement(
|
|
2203
|
+
_Sidebar,
|
|
2204
|
+
{
|
|
2205
|
+
themeVariant,
|
|
2206
|
+
closeOnBlurWithin: false,
|
|
2207
|
+
header: /* @__PURE__ */ React.createElement(
|
|
2208
|
+
_Sidebar.Header,
|
|
2209
|
+
{
|
|
2210
|
+
closeButtonProps: {
|
|
2211
|
+
onPress: () => onClose?.()
|
|
2212
|
+
}
|
|
2213
|
+
},
|
|
2214
|
+
header
|
|
2215
|
+
),
|
|
2216
|
+
panelHeader: null
|
|
2217
|
+
},
|
|
2218
|
+
children
|
|
2219
|
+
))
|
|
2220
|
+
)
|
|
2221
|
+
);
|
|
2222
|
+
};
|
|
2223
|
+
|
|
2224
|
+
const SidebarSection = ({
|
|
2225
|
+
title,
|
|
2226
|
+
"aria-label": label,
|
|
2227
|
+
children,
|
|
2228
|
+
...props
|
|
2229
|
+
}) => {
|
|
2771
2230
|
sapphireReact.useThemeCheck();
|
|
2772
2231
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
2773
|
-
const { itemProps, headingProps, groupProps } =
|
|
2232
|
+
const { itemProps, headingProps, groupProps } = useListBox.useListBoxSection({
|
|
2774
2233
|
heading: title,
|
|
2775
2234
|
"aria-label": label
|
|
2776
2235
|
});
|
|
2777
|
-
return /* @__PURE__ */
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
target[prop] = source[prop];
|
|
2808
|
-
if (source != null && __getOwnPropSymbols$7)
|
|
2809
|
-
for (var prop of __getOwnPropSymbols$7(source)) {
|
|
2810
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
|
|
2811
|
-
target[prop] = source[prop];
|
|
2812
|
-
}
|
|
2813
|
-
return target;
|
|
2236
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2237
|
+
"li",
|
|
2238
|
+
{
|
|
2239
|
+
role: "separator",
|
|
2240
|
+
className: clsx(styles$6["sapphire-sidebar__separator"])
|
|
2241
|
+
}
|
|
2242
|
+
), /* @__PURE__ */ React.createElement(
|
|
2243
|
+
"li",
|
|
2244
|
+
{
|
|
2245
|
+
...itemProps,
|
|
2246
|
+
...styleProps,
|
|
2247
|
+
...filterDOMProps.filterDOMProps(props, { global: true })
|
|
2248
|
+
},
|
|
2249
|
+
title && /* @__PURE__ */ React.createElement(
|
|
2250
|
+
"div",
|
|
2251
|
+
{
|
|
2252
|
+
...headingProps,
|
|
2253
|
+
className: clsx(styles$6["sapphire-sidebar__section-header"])
|
|
2254
|
+
},
|
|
2255
|
+
title
|
|
2256
|
+
),
|
|
2257
|
+
/* @__PURE__ */ React.createElement(
|
|
2258
|
+
"ul",
|
|
2259
|
+
{
|
|
2260
|
+
...groupProps,
|
|
2261
|
+
className: clsx(styles$6["sapphire-sidebar__section"])
|
|
2262
|
+
},
|
|
2263
|
+
children
|
|
2264
|
+
)
|
|
2265
|
+
));
|
|
2814
2266
|
};
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
"children"
|
|
2822
|
-
]);
|
|
2267
|
+
|
|
2268
|
+
const SidebarBody = ({
|
|
2269
|
+
elementType = "nav",
|
|
2270
|
+
children,
|
|
2271
|
+
...props
|
|
2272
|
+
}) => {
|
|
2823
2273
|
const RootNode = elementType;
|
|
2824
2274
|
const sidebarBody = React.useRef(null);
|
|
2825
2275
|
const { isScrolled, scrollCheckProps } = sapphireReact.useScrollCheck(sidebarBody);
|
|
2826
|
-
return /* @__PURE__ */
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
}
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
2838
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
2839
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
2840
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
2841
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2842
|
-
var __spreadValues$6 = (a, b) => {
|
|
2843
|
-
for (var prop in b || (b = {}))
|
|
2844
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
2845
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
2846
|
-
if (__getOwnPropSymbols$6)
|
|
2847
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
2848
|
-
if (__propIsEnum$6.call(b, prop))
|
|
2849
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
2850
|
-
}
|
|
2851
|
-
return a;
|
|
2852
|
-
};
|
|
2853
|
-
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
2854
|
-
var __objRest$4 = (source, exclude) => {
|
|
2855
|
-
var target = {};
|
|
2856
|
-
for (var prop in source)
|
|
2857
|
-
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2858
|
-
target[prop] = source[prop];
|
|
2859
|
-
if (source != null && __getOwnPropSymbols$6)
|
|
2860
|
-
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
2861
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
2862
|
-
target[prop] = source[prop];
|
|
2863
|
-
}
|
|
2864
|
-
return target;
|
|
2865
|
-
};
|
|
2866
|
-
const SidebarList = (_a) => {
|
|
2867
|
-
var _b = _a, {
|
|
2868
|
-
elementType = "ul",
|
|
2276
|
+
return /* @__PURE__ */ React.createElement(
|
|
2277
|
+
RootNode,
|
|
2278
|
+
{
|
|
2279
|
+
ref: sidebarBody,
|
|
2280
|
+
tabIndex: -1,
|
|
2281
|
+
className: clsx(styles$6["sapphire-sidebar__body"], {
|
|
2282
|
+
[styles$6["sapphire-sidebar__body--scrolled"]]: isScrolled
|
|
2283
|
+
}),
|
|
2284
|
+
...filterDOMProps.filterDOMProps(props, { global: true }),
|
|
2285
|
+
...scrollCheckProps
|
|
2286
|
+
},
|
|
2869
2287
|
children
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2288
|
+
);
|
|
2289
|
+
};
|
|
2290
|
+
|
|
2291
|
+
const SidebarList = ({
|
|
2292
|
+
elementType = "ul",
|
|
2293
|
+
children,
|
|
2294
|
+
...props
|
|
2295
|
+
}) => {
|
|
2874
2296
|
const RootNode = elementType;
|
|
2875
|
-
return /* @__PURE__ */
|
|
2876
|
-
|
|
2877
|
-
|
|
2297
|
+
return /* @__PURE__ */ React.createElement(
|
|
2298
|
+
RootNode,
|
|
2299
|
+
{
|
|
2300
|
+
...filterDOMProps.filterDOMProps(props, { global: true }),
|
|
2301
|
+
className: clsx(styles$6["sapphire-sidebar__nav-list"])
|
|
2302
|
+
},
|
|
2303
|
+
children
|
|
2304
|
+
);
|
|
2878
2305
|
};
|
|
2879
2306
|
|
|
2880
2307
|
const _Sidebar = Object.assign(Sidebar, {
|
|
@@ -2888,25 +2315,6 @@ const _Sidebar = Object.assign(Sidebar, {
|
|
|
2888
2315
|
PanelTrigger: SidebarPanelTrigger
|
|
2889
2316
|
});
|
|
2890
2317
|
|
|
2891
|
-
var __defProp$5 = Object.defineProperty;
|
|
2892
|
-
var __defProps$5 = Object.defineProperties;
|
|
2893
|
-
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
2894
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
2895
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
2896
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
2897
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2898
|
-
var __spreadValues$5 = (a, b) => {
|
|
2899
|
-
for (var prop in b || (b = {}))
|
|
2900
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
2901
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
2902
|
-
if (__getOwnPropSymbols$5)
|
|
2903
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
2904
|
-
if (__propIsEnum$5.call(b, prop))
|
|
2905
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
2906
|
-
}
|
|
2907
|
-
return a;
|
|
2908
|
-
};
|
|
2909
|
-
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
2910
2318
|
const ProgressIndicator = (props) => {
|
|
2911
2319
|
const {
|
|
2912
2320
|
maxValue = 100,
|
|
@@ -2916,332 +2324,265 @@ const ProgressIndicator = (props) => {
|
|
|
2916
2324
|
} = props;
|
|
2917
2325
|
sapphireReact.useThemeCheck();
|
|
2918
2326
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
2919
|
-
const { progressBarProps } =
|
|
2327
|
+
const { progressBarProps } = useProgressBar.useProgressBar({
|
|
2328
|
+
...props,
|
|
2920
2329
|
minValue: 0,
|
|
2921
2330
|
valueLabel: ariaValueText
|
|
2922
|
-
})
|
|
2331
|
+
});
|
|
2923
2332
|
const minValue = 0;
|
|
2924
2333
|
const value = Math.min(Math.max(realValue, minValue), maxValue);
|
|
2925
2334
|
const widthPercentage = value / maxValue * 100;
|
|
2926
|
-
return /* @__PURE__ */
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
2945
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
2946
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2947
|
-
var __spreadValues$4 = (a, b) => {
|
|
2948
|
-
for (var prop in b || (b = {}))
|
|
2949
|
-
if (__hasOwnProp$4.call(b, prop))
|
|
2950
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
2951
|
-
if (__getOwnPropSymbols$4)
|
|
2952
|
-
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
2953
|
-
if (__propIsEnum$4.call(b, prop))
|
|
2954
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
2955
|
-
}
|
|
2956
|
-
return a;
|
|
2957
|
-
};
|
|
2958
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
2959
|
-
var __objRest$3 = (source, exclude) => {
|
|
2960
|
-
var target = {};
|
|
2961
|
-
for (var prop in source)
|
|
2962
|
-
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2963
|
-
target[prop] = source[prop];
|
|
2964
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
2965
|
-
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
2966
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
2967
|
-
target[prop] = source[prop];
|
|
2968
|
-
}
|
|
2969
|
-
return target;
|
|
2335
|
+
return /* @__PURE__ */ React.createElement(
|
|
2336
|
+
"div",
|
|
2337
|
+
{
|
|
2338
|
+
...filterDOMProps.filterDOMProps(props, { global: true }),
|
|
2339
|
+
className: clsx(styles$7["sapphire-progress"])
|
|
2340
|
+
},
|
|
2341
|
+
/* @__PURE__ */ React.createElement(
|
|
2342
|
+
"div",
|
|
2343
|
+
{
|
|
2344
|
+
...progressBarProps,
|
|
2345
|
+
className: styles$7["sapphire-progress--indicator"],
|
|
2346
|
+
style: { ...styleProps, width: `${widthPercentage}%` },
|
|
2347
|
+
"aria-label": "aria-label" in props ? props["aria-label"] : void 0,
|
|
2348
|
+
"aria-labelledby": "aria-labelledby" in props ? props["aria-labelledby"] : void 0
|
|
2349
|
+
}
|
|
2350
|
+
),
|
|
2351
|
+
segments > 1 && /* @__PURE__ */ React.createElement("div", { className: styles$7["sapphire-progress--segments"] }, Array.from({ length: segments }, (_, index) => /* @__PURE__ */ React.createElement("span", { key: index })))
|
|
2352
|
+
);
|
|
2970
2353
|
};
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
"labelPlacement",
|
|
2980
|
-
"note",
|
|
2981
|
-
"name"
|
|
2982
|
-
]);
|
|
2354
|
+
|
|
2355
|
+
const Slider = ({
|
|
2356
|
+
label,
|
|
2357
|
+
labelPlacement = "above",
|
|
2358
|
+
note,
|
|
2359
|
+
name,
|
|
2360
|
+
...props
|
|
2361
|
+
}) => {
|
|
2983
2362
|
sapphireReact.useThemeCheck();
|
|
2984
2363
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
2985
|
-
return /* @__PURE__ */
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
2364
|
+
return /* @__PURE__ */ React.createElement(sapphireReact.Field, { ...styleProps, labelPlacement }, /* @__PURE__ */ React.createElement(sapphireReact.Field.Context, null, label && /* @__PURE__ */ React.createElement(sapphireReact.Field.Label, null, /* @__PURE__ */ React.createElement(sapphireReact.Label, null, label)), /* @__PURE__ */ React.createElement(sapphireReact.Field.Control, null, /* @__PURE__ */ React.createElement(reactAriaComponents.Slider, { ...props, style: { height: "100%" } }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles$8["sapphire-slider"]), role: "slider" }, /* @__PURE__ */ React.createElement(
|
|
2365
|
+
reactAriaComponents.SliderTrack,
|
|
2366
|
+
{
|
|
2367
|
+
className: ({ isDisabled }) => clsx(styles$8["sapphire-slider__track"], {
|
|
2368
|
+
[styles$8["is-disabled"]]: isDisabled
|
|
2369
|
+
})
|
|
2370
|
+
},
|
|
2371
|
+
({ state }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2372
|
+
"div",
|
|
2373
|
+
{
|
|
2374
|
+
className: clsx(
|
|
2375
|
+
styles$8["sapphire-slider__track-remaining"]
|
|
2376
|
+
)
|
|
2377
|
+
}
|
|
2378
|
+
), /* @__PURE__ */ React.createElement(
|
|
2379
|
+
"div",
|
|
2380
|
+
{
|
|
2381
|
+
className: clsx(styles$8["sapphire-slider__track-fill"]),
|
|
2382
|
+
style: { width: state.getThumbPercent(0) * 100 + "%" }
|
|
2383
|
+
}
|
|
2384
|
+
), /* @__PURE__ */ React.createElement(
|
|
2385
|
+
reactAriaComponents.SliderThumb,
|
|
2386
|
+
{
|
|
2387
|
+
name,
|
|
2388
|
+
className: (state2) => clsx(styles$8["sapphire-slider__thumb"], {
|
|
2389
|
+
[styles$8["is-focus"]]: state2.isFocusVisible
|
|
2390
|
+
}),
|
|
2391
|
+
style: ({ state: state2 }) => {
|
|
2392
|
+
const percent = Math.min(
|
|
2393
|
+
3 + state2.getThumbPercent(0) * 94,
|
|
2394
|
+
100
|
|
2395
|
+
);
|
|
2396
|
+
return {
|
|
2397
|
+
left: `${percent}%`
|
|
2398
|
+
};
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
))
|
|
2402
|
+
)))), note && /* @__PURE__ */ React.createElement(sapphireReact.Field.Footer, null, note)));
|
|
3013
2403
|
};
|
|
3014
2404
|
|
|
3015
2405
|
const _Slider = Object.assign(Slider, {
|
|
3016
2406
|
Note: sapphireReact.Field.Note
|
|
3017
2407
|
});
|
|
3018
2408
|
|
|
3019
|
-
var __defProp$3 = Object.defineProperty;
|
|
3020
|
-
var __defProps$3 = Object.defineProperties;
|
|
3021
|
-
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
3022
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
3023
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
3024
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
3025
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3026
|
-
var __spreadValues$3 = (a, b) => {
|
|
3027
|
-
for (var prop in b || (b = {}))
|
|
3028
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
3029
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
3030
|
-
if (__getOwnPropSymbols$3)
|
|
3031
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
3032
|
-
if (__propIsEnum$3.call(b, prop))
|
|
3033
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
3034
|
-
}
|
|
3035
|
-
return a;
|
|
3036
|
-
};
|
|
3037
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
3038
|
-
var __objRest$2 = (source, exclude) => {
|
|
3039
|
-
var target = {};
|
|
3040
|
-
for (var prop in source)
|
|
3041
|
-
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
3042
|
-
target[prop] = source[prop];
|
|
3043
|
-
if (source != null && __getOwnPropSymbols$3)
|
|
3044
|
-
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
3045
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
3046
|
-
target[prop] = source[prop];
|
|
3047
|
-
}
|
|
3048
|
-
return target;
|
|
3049
|
-
};
|
|
3050
2409
|
function Tag(props) {
|
|
3051
2410
|
sapphireReact.useThemeCheck();
|
|
3052
2411
|
const { hasError = false, item, state } = props;
|
|
3053
2412
|
const ref = React.useRef(null);
|
|
3054
|
-
const
|
|
2413
|
+
const {
|
|
3055
2414
|
gridCellProps,
|
|
3056
2415
|
isDisabled,
|
|
3057
2416
|
isFocused,
|
|
3058
2417
|
isPressed,
|
|
3059
2418
|
removeButtonProps,
|
|
3060
|
-
rowProps:
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
"isFocused",
|
|
3065
|
-
"isPressed",
|
|
3066
|
-
"removeButtonProps",
|
|
3067
|
-
"rowProps"
|
|
3068
|
-
]);
|
|
3069
|
-
const { hoverProps, isHovered } = interactions.useHover({ isDisabled });
|
|
2419
|
+
rowProps: { onKeyDown, ...rowProps },
|
|
2420
|
+
...otherProps
|
|
2421
|
+
} = useTagGroup.useTag(props, state, ref);
|
|
2422
|
+
const { hoverProps, isHovered } = useHover.useHover({ isDisabled });
|
|
3070
2423
|
const hasAction = otherProps.hasAction;
|
|
3071
|
-
return /* @__PURE__ */
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
2424
|
+
return /* @__PURE__ */ React.createElement(sapphireReact.TooltipIfNeeded, { title: item.rendered }, (tooltipRef, tooltipProps) => {
|
|
2425
|
+
const { ref: tooltipTargetRef, ...restTooltipProps } = tooltipProps || {};
|
|
2426
|
+
return /* @__PURE__ */ React.createElement(FocusRing.FocusRing, { focusRingClass: styles$9["is-focus"] }, /* @__PURE__ */ React.createElement(
|
|
2427
|
+
"div",
|
|
2428
|
+
{
|
|
2429
|
+
ref: mergeRefs.mergeRefs(ref, tooltipTargetRef),
|
|
2430
|
+
...mergeProps.mergeProps(
|
|
2431
|
+
{
|
|
2432
|
+
onKeyDown: (e) => {
|
|
2433
|
+
if (e.key !== " ") {
|
|
2434
|
+
onKeyDown?.(e);
|
|
2435
|
+
} else {
|
|
2436
|
+
e.preventDefault();
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
},
|
|
2440
|
+
rowProps,
|
|
2441
|
+
hoverProps,
|
|
2442
|
+
restTooltipProps
|
|
2443
|
+
),
|
|
2444
|
+
className: clsx(
|
|
2445
|
+
styles$9["sapphire-tag"],
|
|
2446
|
+
styles$9["js-focus"],
|
|
2447
|
+
styles$9["js-hover"],
|
|
2448
|
+
{
|
|
2449
|
+
[styles$9["sapphire-tag--actionable"]]: hasAction,
|
|
2450
|
+
[styles$9["is-active"]]: hasAction && isPressed,
|
|
2451
|
+
[styles$9["is-hover"]]: hasAction && isHovered,
|
|
2452
|
+
[styles$9["is-disabled"]]: isDisabled
|
|
2453
|
+
}
|
|
2454
|
+
),
|
|
2455
|
+
...hasError ? { "aria-invalid": true } : {}
|
|
2456
|
+
},
|
|
2457
|
+
/* @__PURE__ */ React.createElement(
|
|
2458
|
+
"div",
|
|
2459
|
+
{
|
|
2460
|
+
...gridCellProps,
|
|
2461
|
+
className: styles$9["sapphire-tag__content"]
|
|
2462
|
+
},
|
|
2463
|
+
hasError && !isDisabled && /* @__PURE__ */ React.createElement(IconError, null),
|
|
2464
|
+
/* @__PURE__ */ React.createElement(
|
|
2465
|
+
"span",
|
|
2466
|
+
{
|
|
2467
|
+
ref: tooltipRef,
|
|
2468
|
+
className: styles$9["sapphire-tag__label"]
|
|
2469
|
+
},
|
|
2470
|
+
item.rendered
|
|
2471
|
+
),
|
|
2472
|
+
!isDisabled && props.allowsRemoving && /* @__PURE__ */ React.createElement(RemoveButton, { ...removeButtonProps })
|
|
2473
|
+
)
|
|
2474
|
+
));
|
|
3100
2475
|
});
|
|
3101
2476
|
}
|
|
3102
2477
|
function RemoveButton(removeButtonProps) {
|
|
3103
2478
|
const buttonRef = React.useRef(null);
|
|
3104
|
-
const { buttonProps } =
|
|
3105
|
-
return /* @__PURE__ */
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
2479
|
+
const { buttonProps } = useButton.useButton(removeButtonProps, buttonRef);
|
|
2480
|
+
return /* @__PURE__ */ React.createElement(
|
|
2481
|
+
"button",
|
|
2482
|
+
{
|
|
2483
|
+
...buttonProps,
|
|
2484
|
+
className: clsx(styles$9["sapphire-tag__button"], styles$9["js-focus"])
|
|
2485
|
+
},
|
|
2486
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: "sm" }, /* @__PURE__ */ React.createElement(react.Close, null))
|
|
2487
|
+
);
|
|
3110
2488
|
}
|
|
3111
2489
|
const IconError = () => {
|
|
3112
|
-
return /* @__PURE__ */
|
|
3113
|
-
className: clsx__default["default"](styles__default$9["default"]["sapphire-tag__error-icon"])
|
|
3114
|
-
}, /* @__PURE__ */ React__default["default"].createElement(sapphireReact.Icon, {
|
|
3115
|
-
size: "sm"
|
|
3116
|
-
}, /* @__PURE__ */ React__default["default"].createElement(react.Error, null)));
|
|
3117
|
-
};
|
|
3118
|
-
|
|
3119
|
-
var __defProp$2 = Object.defineProperty;
|
|
3120
|
-
var __defProps$2 = Object.defineProperties;
|
|
3121
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
3122
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
3123
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
3124
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
3125
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3126
|
-
var __spreadValues$2 = (a, b) => {
|
|
3127
|
-
for (var prop in b || (b = {}))
|
|
3128
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
3129
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
3130
|
-
if (__getOwnPropSymbols$2)
|
|
3131
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
3132
|
-
if (__propIsEnum$2.call(b, prop))
|
|
3133
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
3134
|
-
}
|
|
3135
|
-
return a;
|
|
3136
|
-
};
|
|
3137
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
3138
|
-
var __objRest$1 = (source, exclude) => {
|
|
3139
|
-
var target = {};
|
|
3140
|
-
for (var prop in source)
|
|
3141
|
-
if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
3142
|
-
target[prop] = source[prop];
|
|
3143
|
-
if (source != null && __getOwnPropSymbols$2)
|
|
3144
|
-
for (var prop of __getOwnPropSymbols$2(source)) {
|
|
3145
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
|
|
3146
|
-
target[prop] = source[prop];
|
|
3147
|
-
}
|
|
3148
|
-
return target;
|
|
2490
|
+
return /* @__PURE__ */ React.createElement("span", { className: clsx(styles$9["sapphire-tag__error-icon"]) }, /* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: "sm" }, /* @__PURE__ */ React.createElement(react.Error, null)));
|
|
3149
2491
|
};
|
|
2492
|
+
|
|
3150
2493
|
function TagGroup(props) {
|
|
3151
2494
|
sapphireReact.useThemeCheck();
|
|
3152
|
-
const
|
|
2495
|
+
const {
|
|
3153
2496
|
contextualHelp,
|
|
3154
2497
|
errorMessage,
|
|
3155
2498
|
label: labelText,
|
|
3156
2499
|
labelPlacement = "above",
|
|
3157
2500
|
note,
|
|
3158
|
-
onRemove: originalOnRemove
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
"errorMessage",
|
|
3162
|
-
"label",
|
|
3163
|
-
"labelPlacement",
|
|
3164
|
-
"note",
|
|
3165
|
-
"onRemove"
|
|
3166
|
-
]);
|
|
2501
|
+
onRemove: originalOnRemove,
|
|
2502
|
+
...otherProps
|
|
2503
|
+
} = props;
|
|
3167
2504
|
const ref = React.useRef(null);
|
|
3168
|
-
const state =
|
|
2505
|
+
const state = useListState.useListState(props);
|
|
3169
2506
|
const onRemove = originalOnRemove ? (keys) => {
|
|
3170
|
-
console.warn(
|
|
2507
|
+
console.warn(
|
|
2508
|
+
"The `onRemove` prop is deprecated and will be removed in future versions. Use the `onRemove` prop on the `TagItem` component instead."
|
|
2509
|
+
);
|
|
3171
2510
|
originalOnRemove(keys);
|
|
3172
2511
|
} : (keys) => {
|
|
3173
2512
|
Array.from(keys).forEach((key) => {
|
|
3174
|
-
var _a2, _b;
|
|
3175
2513
|
const item = state.collection.getItem(key);
|
|
3176
2514
|
if (item) {
|
|
3177
|
-
|
|
2515
|
+
item.props.onRemove?.();
|
|
3178
2516
|
}
|
|
3179
2517
|
});
|
|
3180
2518
|
};
|
|
3181
|
-
const { descriptionProps, gridProps, labelProps, errorMessageProps } =
|
|
3182
|
-
return /* @__PURE__ */
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
2519
|
+
const { descriptionProps, gridProps, labelProps, errorMessageProps } = useTagGroup.useTagGroup({ ...props, onRemove }, state, ref);
|
|
2520
|
+
return /* @__PURE__ */ React.createElement(
|
|
2521
|
+
sapphireReact.Field,
|
|
2522
|
+
{
|
|
2523
|
+
...otherProps,
|
|
2524
|
+
labelPlacement,
|
|
2525
|
+
labelVerticalAlignment: "top",
|
|
2526
|
+
noDefaultWidth: true
|
|
2527
|
+
},
|
|
2528
|
+
/* @__PURE__ */ React.createElement(
|
|
2529
|
+
sapphireReact.Field.Context,
|
|
2530
|
+
{
|
|
2531
|
+
descriptionProps: errorMessage ? errorMessageProps : descriptionProps
|
|
2532
|
+
},
|
|
2533
|
+
(labelText || contextualHelp) && /* @__PURE__ */ React.createElement(sapphireReact.Field.Label, null, /* @__PURE__ */ React.createElement(sapphireReact.Label, { ...labelProps, contextualHelp }, labelText)),
|
|
2534
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Field.Control, null, /* @__PURE__ */ React.createElement(
|
|
2535
|
+
"div",
|
|
2536
|
+
{
|
|
2537
|
+
...gridProps,
|
|
2538
|
+
ref,
|
|
2539
|
+
className: styles$9["sapphire-tag-group"]
|
|
2540
|
+
},
|
|
2541
|
+
Array.from(state.collection).map((item) => /* @__PURE__ */ React.createElement(
|
|
2542
|
+
Tag,
|
|
2543
|
+
{
|
|
2544
|
+
key: item.key,
|
|
2545
|
+
item,
|
|
2546
|
+
state,
|
|
2547
|
+
hasError: item.props.hasError,
|
|
2548
|
+
allowsRemoving: !!originalOnRemove || !!item.props.onRemove
|
|
2549
|
+
}
|
|
2550
|
+
))
|
|
2551
|
+
)),
|
|
2552
|
+
(note || errorMessage) && (errorMessage ? /* @__PURE__ */ React.createElement(sapphireReact.Field.Footer, null, /* @__PURE__ */ React.createElement(sapphireReact.Field.Note, { variant: "error" }, errorMessage)) : /* @__PURE__ */ React.createElement(sapphireReact.Field.Footer, null, note))
|
|
2553
|
+
)
|
|
2554
|
+
);
|
|
3202
2555
|
}
|
|
3203
2556
|
|
|
3204
|
-
const TagItem =
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
3219
|
-
if (__propIsEnum$1.call(b, prop))
|
|
3220
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
3221
|
-
}
|
|
3222
|
-
return a;
|
|
3223
|
-
};
|
|
3224
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
3225
|
-
const TimeSegment = ({ segment, state }) => segment.type === "hour" || segment.type === "minute" || segment.type === "dayPeriod" ? /* @__PURE__ */ React__default["default"].createElement(EditableSegment, {
|
|
3226
|
-
segment,
|
|
3227
|
-
state
|
|
3228
|
-
}) : /* @__PURE__ */ React__default["default"].createElement(SeparatorSegment, {
|
|
3229
|
-
segment
|
|
3230
|
-
});
|
|
3231
|
-
const SeparatorSegment = ({ segment }) => /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
3232
|
-
"aria-hidden": "true",
|
|
3233
|
-
className: clsx__default["default"](styles__default$a["default"]["sapphire-date-field__segment"], styles__default$a["default"]["sapphire-date-field__segment--separator"])
|
|
3234
|
-
}, segment.text);
|
|
2557
|
+
const TagItem = Item.Item;
|
|
2558
|
+
|
|
2559
|
+
const TimeSegment = ({ segment, state }) => segment.type === "hour" || segment.type === "minute" || segment.type === "dayPeriod" ? /* @__PURE__ */ React.createElement(EditableSegment, { segment, state }) : /* @__PURE__ */ React.createElement(SeparatorSegment, { segment });
|
|
2560
|
+
const SeparatorSegment = ({ segment }) => /* @__PURE__ */ React.createElement(
|
|
2561
|
+
"span",
|
|
2562
|
+
{
|
|
2563
|
+
"aria-hidden": "true",
|
|
2564
|
+
className: clsx(
|
|
2565
|
+
styles$a["sapphire-date-field__segment"],
|
|
2566
|
+
styles$a["sapphire-date-field__segment--separator"]
|
|
2567
|
+
)
|
|
2568
|
+
},
|
|
2569
|
+
segment.text
|
|
2570
|
+
);
|
|
3235
2571
|
const EditableSegment = ({ segment, state }) => {
|
|
3236
2572
|
const ref = React.useRef(null);
|
|
3237
|
-
const { segmentProps } =
|
|
3238
|
-
return /* @__PURE__ */
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
2573
|
+
const { segmentProps } = useDateField.useDateSegment(segment, state, ref);
|
|
2574
|
+
return /* @__PURE__ */ React.createElement(
|
|
2575
|
+
"div",
|
|
2576
|
+
{
|
|
2577
|
+
...segmentProps,
|
|
2578
|
+
style: segmentProps.style,
|
|
2579
|
+
ref,
|
|
2580
|
+
className: clsx(styles$a["sapphire-date-field__segment"], {
|
|
2581
|
+
[styles$a["sapphire-date-field__segment--filled"]]: !segment.isPlaceholder
|
|
2582
|
+
})
|
|
2583
|
+
},
|
|
2584
|
+
segment.text
|
|
2585
|
+
);
|
|
3245
2586
|
};
|
|
3246
2587
|
|
|
3247
2588
|
var clear$6 = "Nulstil";
|
|
@@ -3289,101 +2630,83 @@ var intlMessages = {
|
|
|
3289
2630
|
"sv-SE": se
|
|
3290
2631
|
};
|
|
3291
2632
|
|
|
3292
|
-
var __defProp = Object.defineProperty;
|
|
3293
|
-
var __defProps = Object.defineProperties;
|
|
3294
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
3295
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3296
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3297
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
3298
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3299
|
-
var __spreadValues = (a, b) => {
|
|
3300
|
-
for (var prop in b || (b = {}))
|
|
3301
|
-
if (__hasOwnProp.call(b, prop))
|
|
3302
|
-
__defNormalProp(a, prop, b[prop]);
|
|
3303
|
-
if (__getOwnPropSymbols)
|
|
3304
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
3305
|
-
if (__propIsEnum.call(b, prop))
|
|
3306
|
-
__defNormalProp(a, prop, b[prop]);
|
|
3307
|
-
}
|
|
3308
|
-
return a;
|
|
3309
|
-
};
|
|
3310
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
3311
|
-
var __objRest = (source, exclude) => {
|
|
3312
|
-
var target = {};
|
|
3313
|
-
for (var prop in source)
|
|
3314
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
3315
|
-
target[prop] = source[prop];
|
|
3316
|
-
if (source != null && __getOwnPropSymbols)
|
|
3317
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
3318
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
3319
|
-
target[prop] = source[prop];
|
|
3320
|
-
}
|
|
3321
|
-
return target;
|
|
3322
|
-
};
|
|
3323
2633
|
const isAnySegmentModified = (segments) => segments.map(({ type, isPlaceholder }) => {
|
|
3324
2634
|
return type !== "literal" && !isPlaceholder;
|
|
3325
2635
|
}).some((isModified) => isModified);
|
|
3326
|
-
function _TimeField(
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
"noClearButton",
|
|
3337
|
-
"error",
|
|
3338
|
-
"note",
|
|
3339
|
-
"contextualHelp",
|
|
3340
|
-
"necessityIndicator"
|
|
3341
|
-
]);
|
|
2636
|
+
function _TimeField({
|
|
2637
|
+
// TODO many other props
|
|
2638
|
+
size = "lg",
|
|
2639
|
+
noClearButton = false,
|
|
2640
|
+
error,
|
|
2641
|
+
note,
|
|
2642
|
+
contextualHelp,
|
|
2643
|
+
necessityIndicator = false,
|
|
2644
|
+
...otherProps
|
|
2645
|
+
}, ref) {
|
|
3342
2646
|
sapphireReact.useThemeCheck();
|
|
3343
|
-
const timeFieldRef =
|
|
3344
|
-
const { locale } =
|
|
2647
|
+
const timeFieldRef = useObjectRef.useObjectRef(ref);
|
|
2648
|
+
const { locale } = I18nProvider.useLocale();
|
|
3345
2649
|
const formatMessage = i18n.useMessageFormatter(intlMessages);
|
|
3346
|
-
const state =
|
|
2650
|
+
const state = useTimeFieldState.useTimeFieldState({
|
|
2651
|
+
...otherProps,
|
|
3347
2652
|
locale,
|
|
3348
2653
|
isInvalid: error ? true : void 0
|
|
3349
|
-
})
|
|
3350
|
-
const { fieldProps, labelProps } =
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
}
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
2654
|
+
});
|
|
2655
|
+
const { fieldProps, labelProps } = useTimeField.useTimeField(
|
|
2656
|
+
{ ...otherProps },
|
|
2657
|
+
state,
|
|
2658
|
+
timeFieldRef
|
|
2659
|
+
);
|
|
2660
|
+
return /* @__PURE__ */ React.createElement(sapphireReact.Field, { ...otherProps, ref, size, noShrink: true }, /* @__PURE__ */ React.createElement(sapphireReact.Field.Context, null, otherProps.label && /* @__PURE__ */ React.createElement(sapphireReact.Field.Label, null, /* @__PURE__ */ React.createElement(
|
|
2661
|
+
sapphireReact.Label,
|
|
2662
|
+
{
|
|
2663
|
+
...labelProps,
|
|
2664
|
+
size,
|
|
2665
|
+
necessityIndicator: otherProps.isRequired && necessityIndicator ? "required" : !otherProps.isRequired && necessityIndicator ? "optional" : void 0,
|
|
2666
|
+
contextualHelp
|
|
2667
|
+
},
|
|
2668
|
+
otherProps.label
|
|
2669
|
+
))), /* @__PURE__ */ React.createElement(sapphireReact.Field.Control, null, /* @__PURE__ */ React.createElement(
|
|
2670
|
+
"div",
|
|
2671
|
+
{
|
|
2672
|
+
className: clsx(styles$a["sapphire-date-field"], {
|
|
2673
|
+
[styles$a["sapphire-date-field--error"]]: state.isInvalid,
|
|
2674
|
+
[styles$a["sapphire-date-field--no-clear-button"]]: noClearButton,
|
|
2675
|
+
[styles$a["sapphire-date-field--no-calendar"]]: true,
|
|
2676
|
+
[styles$a["sapphire-date-field--md"]]: size === "md"
|
|
2677
|
+
})
|
|
2678
|
+
},
|
|
2679
|
+
/* @__PURE__ */ React.createElement(
|
|
2680
|
+
"div",
|
|
2681
|
+
{
|
|
2682
|
+
...fieldProps,
|
|
2683
|
+
className: styles$a["sapphire-date-field__input"],
|
|
2684
|
+
ref: timeFieldRef
|
|
2685
|
+
},
|
|
2686
|
+
state.segments.map((segment, i) => /* @__PURE__ */ React.createElement(TimeSegment, { key: i, segment, state }))
|
|
2687
|
+
),
|
|
2688
|
+
!noClearButton && !otherProps.isReadOnly && !otherProps.isDisabled && isAnySegmentModified(state.segments) && /* @__PURE__ */ React.createElement(
|
|
2689
|
+
sapphireReact.IconButton,
|
|
2690
|
+
{
|
|
2691
|
+
"aria-label": formatMessage("clear"),
|
|
2692
|
+
onPress: () => state.segments.forEach(
|
|
2693
|
+
(segment) => state.clearSegment(segment.type)
|
|
2694
|
+
),
|
|
2695
|
+
size: size === "md" ? "sm" : "md",
|
|
2696
|
+
UNSAFE_className: clsx(
|
|
2697
|
+
styles$a["sapphire-date-field__button"],
|
|
2698
|
+
styles$a["sapphire-date-field__button--clear"]
|
|
2699
|
+
)
|
|
2700
|
+
},
|
|
2701
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Icon, null, /* @__PURE__ */ React.createElement(react.CloseOutline, null))
|
|
2702
|
+
)
|
|
2703
|
+
)), !!error && typeof error !== "boolean" || note ? /* @__PURE__ */ React.createElement(sapphireReact.Field.Footer, null, !!error && typeof error !== "boolean" ? /* @__PURE__ */ React.createElement(sapphireReact.Field.Note, { variant: "error" }, error) : note ? note : null) : null);
|
|
3381
2704
|
}
|
|
3382
2705
|
const TimeField = React.forwardRef(_TimeField);
|
|
3383
2706
|
|
|
3384
|
-
Object.defineProperty(exports,
|
|
2707
|
+
Object.defineProperty(exports, "useLocale", {
|
|
3385
2708
|
enumerable: true,
|
|
3386
|
-
get: function () { return
|
|
2709
|
+
get: function () { return I18nProvider.useLocale; }
|
|
3387
2710
|
});
|
|
3388
2711
|
exports.Accordion = _Accordion;
|
|
3389
2712
|
exports.AccordionContext = AccordionContext;
|