@danske/sapphire-react-lab 0.105.1 → 0.106.1
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 +1528 -2227
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Accordion/index.js.map +1 -1
- package/build/esm/Accordion/src/Accordion.js +41 -73
- 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 +22 -54
- package/build/esm/Accordion/src/AccordionHeading.js.map +1 -1
- package/build/esm/Accordion/src/AccordionItem.js +15 -42
- package/build/esm/Accordion/src/AccordionItem.js.map +1 -1
- package/build/esm/Accordion/src/AccordionPanel.js +27 -44
- 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 +26 -64
- package/build/esm/Alert/src/Alert.js.map +1 -1
- package/build/esm/Amount/src/Amount.js +40 -62
- 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 +49 -74
- package/build/esm/Autocomplete/src/Autocomplete.js.map +1 -1
- package/build/esm/Breadcrumbs/src/BreadcrumbItem.js +44 -51
- package/build/esm/Breadcrumbs/src/BreadcrumbItem.js.map +1 -1
- package/build/esm/Breadcrumbs/src/BreadcrumbItemLink.js +18 -46
- package/build/esm/Breadcrumbs/src/BreadcrumbItemLink.js.map +1 -1
- package/build/esm/Breadcrumbs/src/BreadcrumbItemStatic.js +24 -45
- 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 +42 -61
- 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 +5 -5
- 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 +59 -84
- package/build/esm/FileDropzone/src/FileDropzone.js.map +1 -1
- package/build/esm/FileDropzone/src/FileTrigger.js +26 -59
- 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 +88 -110
- package/build/esm/Filtering/src/FilterDropdown.js.map +1 -1
- package/build/esm/Filtering/src/SearchableSelectFilter.js +38 -58
- 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 +19 -53
- 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 +125 -108
- package/build/esm/NumberField/src/NumberField.js.map +1 -1
- package/build/esm/NumberField/src/StepperButton.js +28 -50
- 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 +13 -39
- package/build/esm/NumberField/src/useSapphireNumberField.js.map +1 -1
- package/build/esm/ProgressIndicator/src/ProgressIndicator.js +21 -33
- 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 +18 -43
- package/build/esm/Sidebar/src/Body.js.map +1 -1
- package/build/esm/Sidebar/src/ExpandableItem.js +86 -95
- package/build/esm/Sidebar/src/ExpandableItem.js.map +1 -1
- package/build/esm/Sidebar/src/Header.js +13 -43
- package/build/esm/Sidebar/src/Header.js.map +1 -1
- package/build/esm/Sidebar/src/Item.js +16 -43
- package/build/esm/Sidebar/src/Item.js.map +1 -1
- package/build/esm/Sidebar/src/List.js +13 -42
- 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 +16 -8
- package/build/esm/Sidebar/src/ResponsiveSidebarContext.js.map +1 -1
- package/build/esm/Sidebar/src/SecondarySidebarContext.js +14 -11
- package/build/esm/Sidebar/src/SecondarySidebarContext.js.map +1 -1
- package/build/esm/Sidebar/src/Section.js +36 -49
- package/build/esm/Sidebar/src/Section.js.map +1 -1
- package/build/esm/Sidebar/src/Sidebar.js +62 -91
- 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 +66 -82
- package/build/esm/TagGroup/src/Tag.js.map +1 -1
- package/build/esm/TagGroup/src/TagGroup.js +44 -65
- package/build/esm/TagGroup/src/TagGroup.js.map +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 +62 -80
- package/build/esm/TimeField/src/TimeField.js.map +1 -1
- package/build/esm/TimeField/src/TimeFieldSegment.js +24 -36
- package/build/esm/TimeField/src/TimeFieldSegment.js.map +1 -1
- package/build/index.d.ts +13 -12
- package/package.json +6 -6
- 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,7 +1,5 @@
|
|
|
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
5
|
var utils = require('@react-aria/utils');
|
|
@@ -45,26 +43,7 @@ var styles$a = require('@danske/sapphire-css/components/dateField/dateField.modu
|
|
|
45
43
|
var datepicker = require('@react-aria/datepicker');
|
|
46
44
|
var datepicker$1 = require('@react-stately/datepicker');
|
|
47
45
|
|
|
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({
|
|
46
|
+
const AccordionContext = React.createContext({
|
|
68
47
|
sidePadding: void 0,
|
|
69
48
|
headerLevel: 5
|
|
70
49
|
});
|
|
@@ -73,85 +52,55 @@ function useAccordionContext() {
|
|
|
73
52
|
if (context) {
|
|
74
53
|
return context;
|
|
75
54
|
}
|
|
76
|
-
throw new Error(
|
|
55
|
+
throw new Error(
|
|
56
|
+
"Accordion context can only be used within Accordion component."
|
|
57
|
+
);
|
|
77
58
|
}
|
|
78
59
|
|
|
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
|
-
]);
|
|
60
|
+
const Accordion = React.forwardRef(function Accordion2({
|
|
61
|
+
allowsMultipleExpanded = true,
|
|
62
|
+
headerLevel = 5,
|
|
63
|
+
hideLastDivider = false,
|
|
64
|
+
hasNegativeSideMargin = false,
|
|
65
|
+
sidePadding,
|
|
66
|
+
children,
|
|
67
|
+
expandedKeys,
|
|
68
|
+
defaultExpandedKeys,
|
|
69
|
+
onExpandedChange,
|
|
70
|
+
isDisabled,
|
|
71
|
+
...props
|
|
72
|
+
}, ref) {
|
|
134
73
|
sapphireReact.useThemeCheck();
|
|
135
74
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
136
75
|
const forwardedRef = utils.useObjectRef(ref);
|
|
137
|
-
return /* @__PURE__ */
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
76
|
+
return /* @__PURE__ */ React.createElement(focus.FocusScope, null, /* @__PURE__ */ React.createElement(AccordionContext.Provider, { value: { sidePadding, headerLevel } }, /* @__PURE__ */ React.createElement(
|
|
77
|
+
reactAriaComponents.DisclosureGroup,
|
|
78
|
+
{
|
|
79
|
+
...utils.filterDOMProps(props, { global: true, labelable: true }),
|
|
80
|
+
allowsMultipleExpanded,
|
|
81
|
+
expandedKeys,
|
|
82
|
+
defaultExpandedKeys,
|
|
83
|
+
onExpandedChange,
|
|
84
|
+
isDisabled,
|
|
85
|
+
ref: forwardedRef,
|
|
86
|
+
className: clsx(
|
|
87
|
+
styles["sapphire-accordion"],
|
|
88
|
+
{
|
|
89
|
+
[styles["sapphire-accordion--without-last-divider"]]: hideLastDivider,
|
|
90
|
+
[styles["sapphire-accordion--negative-margin-self"]]: !sapphireReact.withTruthyZero(sidePadding) && hasNegativeSideMargin
|
|
91
|
+
},
|
|
92
|
+
styleProps.className
|
|
93
|
+
),
|
|
94
|
+
style: {
|
|
95
|
+
...sapphireReact.withTruthyZero(sidePadding) && hasNegativeSideMargin ? {
|
|
96
|
+
marginLeft: typeof sidePadding === "string" ? `calc(${sidePadding} * -1)` : `-${sidePadding}px`,
|
|
97
|
+
width: `calc(100% + calc(${sidePadding} * 2${typeof sidePadding === "string" ? "" : "px"}))`
|
|
98
|
+
} : {},
|
|
99
|
+
...styleProps.style
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
children
|
|
103
|
+
)));
|
|
155
104
|
});
|
|
156
105
|
|
|
157
106
|
const customPaddingStyleProps = (sidePadding) => ({
|
|
@@ -159,98 +108,36 @@ const customPaddingStyleProps = (sidePadding) => ({
|
|
|
159
108
|
paddingRight: typeof sidePadding === "string" ? sidePadding : `${sidePadding}px`
|
|
160
109
|
});
|
|
161
110
|
|
|
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"]);
|
|
111
|
+
const AccordionHeading = React.forwardRef(function AccordionHeading2({ children, headerLevel, ...props }, ref) {
|
|
195
112
|
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
|
-
|
|
113
|
+
return /* @__PURE__ */ React.createElement(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
role: "heading",
|
|
117
|
+
"aria-level": headerLevel ?? contextHeaderLevel,
|
|
118
|
+
...utils.filterDOMProps(props, { global: true }),
|
|
119
|
+
ref
|
|
120
|
+
},
|
|
121
|
+
/* @__PURE__ */ React.createElement(
|
|
122
|
+
reactAriaComponents.Button,
|
|
123
|
+
{
|
|
124
|
+
slot: "trigger",
|
|
125
|
+
className: ({ isFocusVisible }) => clsx(styles["sapphire-accordion__item-header"], styles["js-focus"], {
|
|
126
|
+
[styles["is-focus"]]: isFocusVisible
|
|
127
|
+
}),
|
|
128
|
+
style: sapphireReact.withTruthyZero(sidePadding) ? customPaddingStyleProps(sidePadding) : {}
|
|
129
|
+
},
|
|
130
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Typography.Heading, { level: 6, elementType: "span" }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles["sapphire-accordion__item-heading"]) }, children)),
|
|
131
|
+
/* @__PURE__ */ React.createElement("div", { className: clsx(styles["sapphire-accordion__item-arrow"]) }, /* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: "lg" }, /* @__PURE__ */ React.createElement(react.ChevronDown, null)))
|
|
132
|
+
)
|
|
133
|
+
);
|
|
217
134
|
});
|
|
218
135
|
|
|
219
|
-
|
|
220
|
-
var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
|
|
221
|
-
var __hasOwnProp$v = Object.prototype.hasOwnProperty;
|
|
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"]);
|
|
136
|
+
const AccordionItem = React.forwardRef(function AccordionItem2({ children, id, ...props }, forwardedRef) {
|
|
249
137
|
const ref = utils.useObjectRef(forwardedRef);
|
|
250
138
|
const focusManager = focus.useFocusManager();
|
|
251
139
|
const onKeyDown = (e) => {
|
|
252
|
-
if (!focusManager)
|
|
253
|
-
return;
|
|
140
|
+
if (!focusManager) return;
|
|
254
141
|
if (!(e.target instanceof Element) || e.target.getAttribute("slot") !== "trigger")
|
|
255
142
|
return;
|
|
256
143
|
switch (e.key) {
|
|
@@ -275,63 +162,49 @@ const AccordionItem = React.forwardRef(function AccordionItem2(_a, forwardedRef)
|
|
|
275
162
|
}
|
|
276
163
|
};
|
|
277
164
|
utils.useEvent(ref, "keydown", onKeyDown);
|
|
278
|
-
return /* @__PURE__ */
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
[
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
165
|
+
return /* @__PURE__ */ React.createElement(
|
|
166
|
+
reactAriaComponents.Disclosure,
|
|
167
|
+
{
|
|
168
|
+
ref,
|
|
169
|
+
id,
|
|
170
|
+
className: ({ isExpanded, isDisabled }) => clsx(styles["sapphire-accordion__item"], {
|
|
171
|
+
[styles["sapphire-accordion__item--open"]]: isExpanded,
|
|
172
|
+
[styles["is-disabled"]]: isDisabled
|
|
173
|
+
}),
|
|
174
|
+
...props
|
|
175
|
+
},
|
|
176
|
+
/* @__PURE__ */ React.createElement("div", { className: clsx(styles["sapphire-accordion__item-content-wrapper"]) }, children)
|
|
177
|
+
);
|
|
288
178
|
});
|
|
289
179
|
|
|
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"]);
|
|
180
|
+
const AccordionPanel = React.forwardRef(function AccordionPanel2({ children, ...props }, ref) {
|
|
323
181
|
const { sidePadding } = useAccordionContext();
|
|
324
|
-
return /* @__PURE__ */
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
182
|
+
return /* @__PURE__ */ React.createElement(
|
|
183
|
+
reactAriaComponents.DisclosurePanel,
|
|
184
|
+
{
|
|
185
|
+
ref,
|
|
186
|
+
...utils.filterDOMProps(props, { global: true }),
|
|
187
|
+
className: clsx(styles["sapphire-accordion__item-content"]),
|
|
188
|
+
style: {
|
|
189
|
+
/**
|
|
190
|
+
* useDisclosure hook from react-aria uses css variable --disclosure-panel-height to
|
|
191
|
+
* animate the height of the panel.
|
|
192
|
+
*/
|
|
193
|
+
height: "var(--disclosure-panel-height)"
|
|
194
|
+
},
|
|
195
|
+
...props
|
|
196
|
+
},
|
|
197
|
+
/* @__PURE__ */ React.createElement(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
style: {
|
|
201
|
+
...sapphireReact.withTruthyZero(sidePadding) ? customPaddingStyleProps(sidePadding) : {}
|
|
202
|
+
},
|
|
203
|
+
className: styles["sapphire-accordion__item-content-inner"]
|
|
204
|
+
},
|
|
205
|
+
children
|
|
206
|
+
)
|
|
207
|
+
);
|
|
335
208
|
});
|
|
336
209
|
|
|
337
210
|
const _Accordion = Object.assign(Accordion, {
|
|
@@ -340,47 +213,12 @@ const _Accordion = Object.assign(Accordion, {
|
|
|
340
213
|
Panel: AccordionPanel
|
|
341
214
|
});
|
|
342
215
|
|
|
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
|
-
]);
|
|
216
|
+
function Alert({
|
|
217
|
+
children,
|
|
218
|
+
title,
|
|
219
|
+
variant = "info",
|
|
220
|
+
...props
|
|
221
|
+
}) {
|
|
384
222
|
sapphireReact.useThemeCheck();
|
|
385
223
|
const {
|
|
386
224
|
styleProps: { style, className }
|
|
@@ -388,38 +226,35 @@ function Alert(_a) {
|
|
|
388
226
|
const getIcon = (variant2) => {
|
|
389
227
|
switch (variant2) {
|
|
390
228
|
case "warning":
|
|
391
|
-
return /* @__PURE__ */
|
|
229
|
+
return /* @__PURE__ */ React.createElement(react.Warning, null);
|
|
392
230
|
case "positive":
|
|
393
|
-
return /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ React.createElement(react.CheckmarkOutline, null);
|
|
394
232
|
case "negative":
|
|
395
|
-
return /* @__PURE__ */
|
|
233
|
+
return /* @__PURE__ */ React.createElement(react.Error, null);
|
|
396
234
|
default:
|
|
397
|
-
return /* @__PURE__ */
|
|
235
|
+
return /* @__PURE__ */ React.createElement(react.Information, null);
|
|
398
236
|
}
|
|
399
237
|
};
|
|
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)));
|
|
238
|
+
return /* @__PURE__ */ React.createElement(
|
|
239
|
+
"div",
|
|
240
|
+
{
|
|
241
|
+
...utils.filterDOMProps(props, { global: true }),
|
|
242
|
+
className: clsx.clsx(
|
|
243
|
+
alertStyles["sapphire-alert"],
|
|
244
|
+
{
|
|
245
|
+
[alertStyles["sapphire-alert--positive"]]: variant === "positive",
|
|
246
|
+
[alertStyles["sapphire-alert--negative"]]: variant === "negative",
|
|
247
|
+
[alertStyles["sapphire-alert--warning"]]: variant === "warning"
|
|
248
|
+
},
|
|
249
|
+
className
|
|
250
|
+
),
|
|
251
|
+
style,
|
|
252
|
+
role: "alert"
|
|
253
|
+
},
|
|
254
|
+
/* @__PURE__ */ React.createElement("span", { className: alertStyles["sapphire-alert__icon"] }, /* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: "sm" }, getIcon(variant))),
|
|
255
|
+
/* @__PURE__ */ React.createElement("div", { className: alertStyles["sapphire-alert__title"] }, /* @__PURE__ */ React.createElement(sapphireReact.Typography.Body, { size: "sm", isSemibold: true }, title)),
|
|
256
|
+
/* @__PURE__ */ React.createElement("div", { className: alertStyles["sapphire-alert__content"] }, /* @__PURE__ */ React.createElement(sapphireReact.Typography.Body, { elementType: "section", size: "md" }, children))
|
|
257
|
+
);
|
|
423
258
|
}
|
|
424
259
|
|
|
425
260
|
const useGroupAmount = (value, formatter) => {
|
|
@@ -449,76 +284,57 @@ const useGroupAmount = (value, formatter) => {
|
|
|
449
284
|
}
|
|
450
285
|
return result;
|
|
451
286
|
}, [numberValue, formatter]);
|
|
452
|
-
const formattedValue = React.useMemo(
|
|
287
|
+
const formattedValue = React.useMemo(
|
|
288
|
+
() => groupedParts.map((part) => part.value).join(""),
|
|
289
|
+
[groupedParts]
|
|
290
|
+
);
|
|
453
291
|
return { formattedValue, groupedParts };
|
|
454
292
|
};
|
|
455
293
|
|
|
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
|
-
]);
|
|
294
|
+
const Amount = ({
|
|
295
|
+
emphasis = "regular",
|
|
296
|
+
variant,
|
|
297
|
+
formatOptions,
|
|
298
|
+
value,
|
|
299
|
+
size,
|
|
300
|
+
...props
|
|
301
|
+
}) => {
|
|
501
302
|
sapphireReact.useThemeCheck();
|
|
502
303
|
const { styleProps, filteredProps } = sapphireReact.useSapphireStyleProps(props);
|
|
503
304
|
const { locale } = i18n.useLocale();
|
|
504
|
-
const formatter = React.useMemo(
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
305
|
+
const formatter = React.useMemo(
|
|
306
|
+
() => new Intl.NumberFormat(locale, {
|
|
307
|
+
style: formatOptions?.currency ? "currency" : void 0,
|
|
308
|
+
/**
|
|
309
|
+
* Always show the sign if the value starts with '+' or '-'.
|
|
310
|
+
*/
|
|
311
|
+
signDisplay: formatOptions?.signDisplay || String(value).startsWith("+") ? "always" : "auto",
|
|
312
|
+
minimumFractionDigits: 2,
|
|
313
|
+
...formatOptions
|
|
314
|
+
}),
|
|
315
|
+
[locale, formatOptions, value]
|
|
316
|
+
);
|
|
509
317
|
const { formattedValue, groupedParts } = useGroupAmount(value, formatter);
|
|
510
|
-
return /* @__PURE__ */
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
318
|
+
return /* @__PURE__ */ React.createElement(
|
|
319
|
+
"span",
|
|
320
|
+
{
|
|
321
|
+
style: styleProps.style,
|
|
322
|
+
className: styles$1["sapphire-amount"],
|
|
323
|
+
...filteredProps,
|
|
324
|
+
"aria-label": formattedValue
|
|
325
|
+
},
|
|
326
|
+
groupedParts.map((part, index) => /* @__PURE__ */ React.createElement(
|
|
327
|
+
sapphireReact.Typography.Body,
|
|
328
|
+
{
|
|
329
|
+
elementType: "span",
|
|
330
|
+
key: index,
|
|
331
|
+
color: variant === "positive" ? "positive" : "primary",
|
|
332
|
+
isSemibold: emphasis === "primary" ? true : false,
|
|
333
|
+
size
|
|
334
|
+
},
|
|
335
|
+
part.value
|
|
336
|
+
))
|
|
337
|
+
);
|
|
522
338
|
};
|
|
523
339
|
|
|
524
340
|
var da$3 = {
|
|
@@ -559,58 +375,19 @@ var intlMessages$3 = {
|
|
|
559
375
|
"sv-SE": se$3
|
|
560
376
|
};
|
|
561
377
|
|
|
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
378
|
function Autocomplete(props) {
|
|
594
|
-
var _b;
|
|
595
379
|
sapphireReact.useThemeCheck();
|
|
596
380
|
const formatMessage = i18n.useMessageFormatter(intlMessages$3);
|
|
597
|
-
const
|
|
381
|
+
const {
|
|
598
382
|
inputValue,
|
|
599
383
|
renderInput,
|
|
600
384
|
loadingState,
|
|
601
385
|
loadingSkeletonRowsCount,
|
|
602
386
|
listboxAriaLabel,
|
|
603
387
|
onSuggestionSelected,
|
|
604
|
-
onSelectionChange
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
"renderInput",
|
|
608
|
-
"loadingState",
|
|
609
|
-
"loadingSkeletonRowsCount",
|
|
610
|
-
"listboxAriaLabel",
|
|
611
|
-
"onSuggestionSelected",
|
|
612
|
-
"onSelectionChange"
|
|
613
|
-
]);
|
|
388
|
+
onSelectionChange,
|
|
389
|
+
...otherProps
|
|
390
|
+
} = props;
|
|
614
391
|
const {
|
|
615
392
|
styleProps: { style, className }
|
|
616
393
|
} = sapphireReact.useSapphireStyleProps(props);
|
|
@@ -618,54 +395,68 @@ function Autocomplete(props) {
|
|
|
618
395
|
const listBoxRef = utils$1.useFocusableRef(null);
|
|
619
396
|
const popoverRef = React.useRef(null);
|
|
620
397
|
const triggerRef = utils$1.useFocusableRef(null);
|
|
621
|
-
const state = sapphireReact.useComboBoxState(
|
|
398
|
+
const state = sapphireReact.useComboBoxState({
|
|
399
|
+
...props,
|
|
622
400
|
inputValue,
|
|
623
401
|
allowsEmptyCollection: loadingState === "loading",
|
|
624
402
|
allowsCustomValue: true,
|
|
625
403
|
shouldCloseOnBlur: true,
|
|
626
404
|
onSelectionChange: (key) => {
|
|
627
405
|
if (key !== null) {
|
|
628
|
-
onSelectionChange
|
|
629
|
-
onSuggestionSelected
|
|
406
|
+
onSelectionChange?.(key);
|
|
407
|
+
onSuggestionSelected?.(key);
|
|
630
408
|
}
|
|
631
409
|
}
|
|
632
|
-
})
|
|
633
|
-
const { inputProps, listBoxProps } = combobox.useComboBox(
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
410
|
+
});
|
|
411
|
+
const { inputProps, listBoxProps } = combobox.useComboBox(
|
|
412
|
+
{
|
|
413
|
+
...props,
|
|
414
|
+
"aria-label": listboxAriaLabel || formatMessage("listbox-suggestions"),
|
|
415
|
+
inputRef,
|
|
416
|
+
listBoxRef,
|
|
417
|
+
popoverRef
|
|
418
|
+
},
|
|
419
|
+
state
|
|
420
|
+
);
|
|
421
|
+
const inputElement = renderInput({
|
|
422
|
+
...inputProps,
|
|
640
423
|
isDisabled: props.isDisabled,
|
|
641
424
|
inputRef,
|
|
642
425
|
"aria-haspopup": "listbox",
|
|
643
426
|
"aria-expanded": state.isOpen,
|
|
644
427
|
onChange: (value) => {
|
|
645
|
-
|
|
646
|
-
(_a2 = inputProps.onChange) == null ? void 0 : _a2.call(inputProps, {
|
|
428
|
+
inputProps.onChange?.({
|
|
647
429
|
target: { value },
|
|
648
430
|
currentTarget: { value }
|
|
649
431
|
});
|
|
650
432
|
}
|
|
651
|
-
})
|
|
652
|
-
return /* @__PURE__ */
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
433
|
+
});
|
|
434
|
+
return /* @__PURE__ */ React.createElement(
|
|
435
|
+
"div",
|
|
436
|
+
{
|
|
437
|
+
ref: triggerRef,
|
|
438
|
+
...utils.filterDOMProps(otherProps, { global: true }),
|
|
439
|
+
style: { display: "inline-flex", ...style },
|
|
440
|
+
className
|
|
441
|
+
},
|
|
442
|
+
inputElement,
|
|
443
|
+
state.isOpen && /* @__PURE__ */ React.createElement(
|
|
444
|
+
sapphireReact.ListBoxPopover,
|
|
445
|
+
{
|
|
446
|
+
state,
|
|
447
|
+
triggerRef,
|
|
448
|
+
popoverRef,
|
|
449
|
+
listBoxRef,
|
|
450
|
+
listBoxProps,
|
|
451
|
+
loadingState,
|
|
452
|
+
loadingSkeletonRowsCount,
|
|
453
|
+
selectWidth: triggerRef.current?.offsetWidth,
|
|
454
|
+
disableSelectedStyles: true,
|
|
455
|
+
isNonModal: true
|
|
456
|
+
},
|
|
457
|
+
props.children || []
|
|
458
|
+
)
|
|
459
|
+
);
|
|
669
460
|
}
|
|
670
461
|
|
|
671
462
|
const useBreadcrumbThreshold = (childrenCount, containerRef, breadcrumbRef) => {
|
|
@@ -698,9 +489,10 @@ const useBreadcrumbThreshold = (childrenCount, containerRef, breadcrumbRef) => {
|
|
|
698
489
|
};
|
|
699
490
|
}, [itemWidths, containerWidth, childrenCount]);
|
|
700
491
|
const computeItemWidths = () => {
|
|
701
|
-
if (!breadcrumbRef.current)
|
|
702
|
-
|
|
703
|
-
|
|
492
|
+
if (!breadcrumbRef.current) return;
|
|
493
|
+
const breadcrumbItems = Array.from(
|
|
494
|
+
breadcrumbRef.current.children
|
|
495
|
+
);
|
|
704
496
|
const widths = breadcrumbItems.map((item) => item.offsetWidth).filter(Boolean);
|
|
705
497
|
if (widths.length === breadcrumbItems.length) {
|
|
706
498
|
setItemWidths(widths);
|
|
@@ -714,8 +506,7 @@ const useBreadcrumbThreshold = (childrenCount, containerRef, breadcrumbRef) => {
|
|
|
714
506
|
utils.useResizeObserver({
|
|
715
507
|
ref: containerRef,
|
|
716
508
|
onResize: () => {
|
|
717
|
-
if (!containerRef.current)
|
|
718
|
-
return;
|
|
509
|
+
if (!containerRef.current) return;
|
|
719
510
|
setContainerWidth(containerRef.current.offsetWidth);
|
|
720
511
|
}
|
|
721
512
|
});
|
|
@@ -734,332 +525,233 @@ const useBreadcrumbThreshold = (childrenCount, containerRef, breadcrumbRef) => {
|
|
|
734
525
|
};
|
|
735
526
|
};
|
|
736
527
|
|
|
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
528
|
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"]);
|
|
529
|
+
const Breadcrumbs = React.forwardRef(function Breadcrumbs2({ maxWidth, size = "md", ...props }, fwdRef) {
|
|
771
530
|
const [RACprops, ref] = reactAriaComponents.useContextProps(props, fwdRef, reactAriaComponents.BreadcrumbsContext);
|
|
772
531
|
const { styleProps } = sapphireReact.useSapphireStyleProps(RACprops);
|
|
773
532
|
const containerRef = React.useRef(null);
|
|
774
533
|
const { CollectionRoot } = React.useContext(reactAriaComponents.CollectionRendererContext);
|
|
775
534
|
const { navProps } = breadcrumbs.useBreadcrumbs(RACprops);
|
|
776
535
|
const DOMProps = utils.filterDOMProps(RACprops, { global: true });
|
|
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({
|
|
536
|
+
return /* @__PURE__ */ React.createElement(collections.CollectionBuilder, { content: /* @__PURE__ */ React.createElement(collections.Collection, { ...RACprops }) }, (collection) => {
|
|
537
|
+
const { overflowNodes } = useBreadcrumbThreshold(
|
|
538
|
+
collection.size,
|
|
539
|
+
containerRef,
|
|
789
540
|
ref
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
541
|
+
);
|
|
542
|
+
const keys = Array.from(collection.getKeys());
|
|
543
|
+
return /* @__PURE__ */ React.createElement(
|
|
544
|
+
"div",
|
|
545
|
+
{
|
|
546
|
+
ref: containerRef,
|
|
547
|
+
style: {
|
|
548
|
+
...styleProps.style,
|
|
549
|
+
maxWidth,
|
|
550
|
+
display: "flex"
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
/* @__PURE__ */ React.createElement(
|
|
554
|
+
"ol",
|
|
555
|
+
{
|
|
556
|
+
ref,
|
|
557
|
+
...utils.mergeProps(DOMProps, navProps),
|
|
558
|
+
className: clsx(styles$2["sapphire-breadcrumbs"], {
|
|
559
|
+
[styles$2["sapphire-breadcrumbs--sm"]]: size === "sm",
|
|
560
|
+
[styles$2["sapphire-breadcrumbs--lg"]]: size === "lg"
|
|
561
|
+
})
|
|
562
|
+
},
|
|
563
|
+
/* @__PURE__ */ React.createElement(
|
|
564
|
+
BreadcrumbsContext.Provider,
|
|
565
|
+
{
|
|
566
|
+
value: {
|
|
567
|
+
size,
|
|
568
|
+
overflowNodes: overflowNodes.map(
|
|
569
|
+
(index) => collection.getItem(keys[index])
|
|
570
|
+
),
|
|
571
|
+
isDisabled: RACprops.isDisabled
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
/* @__PURE__ */ React.createElement(reactAriaComponents.BreadcrumbsContext.Provider, { value: RACprops }, /* @__PURE__ */ React.createElement(CollectionRoot, { collection }))
|
|
575
|
+
)
|
|
576
|
+
)
|
|
577
|
+
);
|
|
806
578
|
});
|
|
807
579
|
});
|
|
808
580
|
|
|
809
581
|
const BreadcrumbsSeparator = () => {
|
|
810
582
|
const { size } = React.useContext(BreadcrumbsContext);
|
|
811
583
|
const iconSize = size === "lg" ? "md" : "sm";
|
|
812
|
-
return /* @__PURE__ */
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
584
|
+
return /* @__PURE__ */ React.createElement(
|
|
585
|
+
"span",
|
|
586
|
+
{
|
|
587
|
+
className: clsx(styles$2["sapphire-breadcrumbs__separator"]),
|
|
588
|
+
"aria-hidden": "true"
|
|
589
|
+
},
|
|
590
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: iconSize }, /* @__PURE__ */ React.createElement(react.ChevronRight, null))
|
|
591
|
+
);
|
|
818
592
|
};
|
|
819
593
|
|
|
820
594
|
const BreadcrumbOverflowMenu = () => {
|
|
821
595
|
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"]);
|
|
596
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
597
|
+
sapphireReact.Menu,
|
|
598
|
+
{
|
|
599
|
+
triggerElement: /* @__PURE__ */ React.createElement(sapphireReact.IconButton, { "aria-label": "Show more breadcrumbs", size }, /* @__PURE__ */ React.createElement(react.OverflowMenuHorizontal, null))
|
|
600
|
+
},
|
|
601
|
+
overflowNodes.map(
|
|
602
|
+
(item) => !item ? null : /* @__PURE__ */ React.createElement(
|
|
603
|
+
sapphireReact.MenuItem,
|
|
604
|
+
{
|
|
605
|
+
key: item.key,
|
|
606
|
+
id: item.key,
|
|
607
|
+
href: item.href,
|
|
608
|
+
isDisabled: !item.href
|
|
609
|
+
},
|
|
610
|
+
item.rendered
|
|
611
|
+
)
|
|
612
|
+
)
|
|
613
|
+
), /* @__PURE__ */ React.createElement(BreadcrumbsSeparator, null));
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
const BreadcrumbItemStatic = React.forwardRef(function BreadcrumbItemStatic2({ size, ...props }, ref) {
|
|
868
617
|
sapphireReact.useThemeCheck();
|
|
869
618
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
870
|
-
return /* @__PURE__ */
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
619
|
+
return /* @__PURE__ */ React.createElement(sapphireReact.TooltipIfNeeded, { title: props.children }, (tooltipContentRef, tooltipProps) => {
|
|
620
|
+
const positioningRef = tooltipProps?.ref;
|
|
621
|
+
return /* @__PURE__ */ React.createElement(
|
|
622
|
+
"span",
|
|
623
|
+
{
|
|
624
|
+
...tooltipProps,
|
|
625
|
+
ref: utils.mergeRefs(
|
|
626
|
+
ref,
|
|
627
|
+
tooltipContentRef,
|
|
628
|
+
positioningRef
|
|
629
|
+
),
|
|
630
|
+
className: clsx(
|
|
631
|
+
styles$2["sapphire-breadcrumbs__item--static"],
|
|
632
|
+
{
|
|
633
|
+
[styles$2["sapphire-breadcrumbs__item--static--sm"]]: size === "sm",
|
|
634
|
+
[styles$2["sapphire-breadcrumbs__item--static--lg"]]: size === "lg"
|
|
635
|
+
},
|
|
636
|
+
styleProps.className
|
|
637
|
+
),
|
|
638
|
+
style: styleProps.style
|
|
639
|
+
},
|
|
640
|
+
props.children
|
|
641
|
+
);
|
|
882
642
|
});
|
|
883
643
|
});
|
|
884
644
|
|
|
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"]);
|
|
645
|
+
const BreadcrumbItemLink = React.forwardRef(function BreadcrumbItemLink2({ children, ...props }, ref) {
|
|
918
646
|
sapphireReact.useThemeCheck();
|
|
919
647
|
const { styleProps: sapphireStyleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
920
|
-
const
|
|
648
|
+
const { style, className, ...styleProps } = sapphireStyleProps;
|
|
921
649
|
const { size } = React.useContext(BreadcrumbsContext);
|
|
922
|
-
if (!props.href) {
|
|
923
|
-
return /* @__PURE__ */
|
|
924
|
-
size
|
|
925
|
-
}), children);
|
|
650
|
+
if (!props.href && !props.UNSAFE_onClick) {
|
|
651
|
+
return /* @__PURE__ */ React.createElement(BreadcrumbItemStatic, { ...props, size }, children);
|
|
926
652
|
}
|
|
927
|
-
return /* @__PURE__ */
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
653
|
+
return /* @__PURE__ */ React.createElement(
|
|
654
|
+
sapphireReact.Button,
|
|
655
|
+
{
|
|
656
|
+
...props,
|
|
657
|
+
...styleProps,
|
|
658
|
+
UNSAFE_className: className,
|
|
659
|
+
UNSAFE_style: { ...style },
|
|
660
|
+
ref,
|
|
661
|
+
size,
|
|
662
|
+
variant: "tertiary",
|
|
663
|
+
isDisabled: props.isDisabled
|
|
664
|
+
},
|
|
665
|
+
children
|
|
666
|
+
);
|
|
935
667
|
});
|
|
936
668
|
BreadcrumbItemLink.displayName = "BreadcrumbItemLink";
|
|
937
669
|
|
|
938
|
-
var __defProp$n = Object.defineProperty;
|
|
939
|
-
var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
|
|
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
670
|
class BreadcrumbItemCollectionNode extends collections.CollectionNode {
|
|
671
|
+
static type = "item";
|
|
955
672
|
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
673
|
+
const BreadcrumbItem = collections.createLeafComponent(
|
|
674
|
+
BreadcrumbItemCollectionNode,
|
|
675
|
+
function BreadcrumbItem2(props, ref, node) {
|
|
676
|
+
sapphireReact.useThemeCheck();
|
|
677
|
+
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
678
|
+
const {
|
|
679
|
+
size,
|
|
680
|
+
overflowNodes,
|
|
681
|
+
isDisabled: breadcrumbsDisabled
|
|
682
|
+
} = React.useContext(BreadcrumbsContext);
|
|
683
|
+
const { isDisabled: individualDisabled = false } = props;
|
|
684
|
+
const isCurrent = node.nextKey == null;
|
|
685
|
+
const isDisabled = individualDisabled || breadcrumbsDisabled;
|
|
686
|
+
const shouldRender = !overflowNodes.some((item) => item?.key === node.key);
|
|
687
|
+
const showOverflowMenu = overflowNodes[0]?.key === node.key;
|
|
688
|
+
if (!shouldRender && !showOverflowMenu) {
|
|
689
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
690
|
+
}
|
|
691
|
+
if (!shouldRender && showOverflowMenu) {
|
|
692
|
+
return /* @__PURE__ */ React.createElement(BreadcrumbOverflowMenu, null);
|
|
693
|
+
}
|
|
694
|
+
node.href = props.href;
|
|
695
|
+
return /* @__PURE__ */ React.createElement(
|
|
696
|
+
"li",
|
|
697
|
+
{
|
|
698
|
+
ref,
|
|
699
|
+
className: clsx(styles$2["sapphire-breadcrumbs__item"]),
|
|
700
|
+
style: { ...styleProps.style },
|
|
701
|
+
"data-disabled": isDisabled || void 0,
|
|
702
|
+
"data-current": isCurrent || void 0
|
|
703
|
+
},
|
|
704
|
+
isCurrent ? /* @__PURE__ */ React.createElement(
|
|
705
|
+
sapphireReact.Typography.Body,
|
|
706
|
+
{
|
|
707
|
+
elementType: "span",
|
|
708
|
+
isSemibold: true,
|
|
709
|
+
size: size === "lg" ? "md" : size === "md" ? "sm" : "xs"
|
|
710
|
+
},
|
|
711
|
+
node.rendered
|
|
712
|
+
) : /* @__PURE__ */ React.createElement(BreadcrumbItemLink, { isDisabled, ...props }, node.rendered),
|
|
713
|
+
!isCurrent && /* @__PURE__ */ React.createElement(BreadcrumbsSeparator, null)
|
|
714
|
+
);
|
|
976
715
|
}
|
|
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
|
-
});
|
|
716
|
+
);
|
|
992
717
|
|
|
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
|
-
}));
|
|
718
|
+
const HiddenFileInput = React.forwardRef(function InputWrapper(props, ref) {
|
|
719
|
+
return /* @__PURE__ */ React.createElement("input", { ...props, ref, type: "file", style: { display: "none" } });
|
|
1030
720
|
});
|
|
1031
|
-
const FileTrigger =
|
|
1032
|
-
const
|
|
721
|
+
const FileTrigger = React.forwardRef(function FileTriggerWrapper(props, ref) {
|
|
722
|
+
const {
|
|
1033
723
|
acceptedFileTypes,
|
|
1034
724
|
allowsMultiple = false,
|
|
1035
725
|
onSelect = () => null,
|
|
1036
726
|
children,
|
|
1037
|
-
isDisabled = false
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
"allowsMultiple",
|
|
1041
|
-
"onSelect",
|
|
1042
|
-
"children",
|
|
1043
|
-
"isDisabled"
|
|
1044
|
-
]);
|
|
727
|
+
isDisabled = false,
|
|
728
|
+
...rest
|
|
729
|
+
} = props;
|
|
1045
730
|
const inputRef = utils.useObjectRef(ref);
|
|
1046
731
|
const domProps = utils.filterDOMProps(rest, { global: true });
|
|
1047
|
-
return /* @__PURE__ */
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
inputRef.current
|
|
732
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
733
|
+
interactions.PressResponder,
|
|
734
|
+
{
|
|
735
|
+
isDisabled,
|
|
736
|
+
onPress: () => {
|
|
737
|
+
if (inputRef.current) {
|
|
738
|
+
inputRef.current.value = "";
|
|
739
|
+
}
|
|
740
|
+
inputRef.current?.click();
|
|
1053
741
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
742
|
+
},
|
|
743
|
+
children
|
|
744
|
+
), /* @__PURE__ */ React.createElement(
|
|
745
|
+
HiddenFileInput,
|
|
746
|
+
{
|
|
747
|
+
...domProps,
|
|
748
|
+
disabled: isDisabled,
|
|
749
|
+
ref: inputRef,
|
|
750
|
+
accept: acceptedFileTypes?.toString(),
|
|
751
|
+
onChange: (e) => onSelect?.(e.target.files),
|
|
752
|
+
multiple: allowsMultiple
|
|
753
|
+
}
|
|
754
|
+
));
|
|
1063
755
|
});
|
|
1064
756
|
|
|
1065
757
|
const convertFileListToFileDropItems = (fileList) => {
|
|
@@ -1132,39 +824,8 @@ var intlMessages$2 = {
|
|
|
1132
824
|
"sv-SE": se$2
|
|
1133
825
|
};
|
|
1134
826
|
|
|
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, {
|
|
827
|
+
const FileDropzone = React.forwardRef(function DropzoneWrapper(props, forwardedRef) {
|
|
828
|
+
const {
|
|
1168
829
|
isDisabled = false,
|
|
1169
830
|
hasError,
|
|
1170
831
|
renderInstruction,
|
|
@@ -1172,30 +833,26 @@ const FileDropzone = React__default["default"].forwardRef(function DropzoneWrapp
|
|
|
1172
833
|
acceptedFileTypes,
|
|
1173
834
|
allowsMultiple,
|
|
1174
835
|
onDrop = () => null,
|
|
1175
|
-
getDropOperation = () => "copy"
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
"hasError",
|
|
1179
|
-
"renderInstruction",
|
|
1180
|
-
"onFileSelectOpen",
|
|
1181
|
-
"acceptedFileTypes",
|
|
1182
|
-
"allowsMultiple",
|
|
1183
|
-
"onDrop",
|
|
1184
|
-
"getDropOperation"
|
|
1185
|
-
]);
|
|
836
|
+
getDropOperation = () => "copy",
|
|
837
|
+
...otherProps
|
|
838
|
+
} = props;
|
|
1186
839
|
const id = utils.useId();
|
|
1187
840
|
const paragraphId = props["aria-label"] ? void 0 : id;
|
|
1188
841
|
const format = i18n.useMessageFormatter(intlMessages$2);
|
|
1189
842
|
const pressableRef = utils.useObjectRef(forwardedRef);
|
|
1190
843
|
const { hoverProps, isHovered } = interactions.useHover({ isDisabled });
|
|
1191
844
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
1192
|
-
const { dropProps, isDropTarget: isDropping } = dnd.useDrop(
|
|
845
|
+
const { dropProps, isDropTarget: isDropping } = dnd.useDrop({
|
|
846
|
+
...props,
|
|
1193
847
|
ref: pressableRef,
|
|
1194
848
|
hasDropButton: true,
|
|
1195
849
|
isDisabled,
|
|
1196
850
|
getDropOperation
|
|
1197
|
-
})
|
|
1198
|
-
const { buttonProps, isPressed } = sapphireReact.useButton(
|
|
851
|
+
});
|
|
852
|
+
const { buttonProps, isPressed } = sapphireReact.useButton(
|
|
853
|
+
{ elementType: "div" },
|
|
854
|
+
pressableRef
|
|
855
|
+
);
|
|
1199
856
|
const { focusProps, isFocusVisible } = focus.useFocusRing();
|
|
1200
857
|
const { clipboardProps } = dnd.useClipboard({
|
|
1201
858
|
isDisabled,
|
|
@@ -1217,340 +874,242 @@ const FileDropzone = React__default["default"].forwardRef(function DropzoneWrapp
|
|
|
1217
874
|
dropOperation: "copy"
|
|
1218
875
|
});
|
|
1219
876
|
};
|
|
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
|
-
|
|
877
|
+
return /* @__PURE__ */ React.createElement(
|
|
878
|
+
FileTrigger,
|
|
879
|
+
{
|
|
880
|
+
acceptedFileTypes,
|
|
881
|
+
allowsMultiple,
|
|
882
|
+
onSelect: onFileTriggerSelect,
|
|
883
|
+
isDisabled
|
|
884
|
+
},
|
|
885
|
+
/* @__PURE__ */ React.createElement(interactions.Pressable, { ref: pressableRef, onPress: onFileSelectOpen }, /* @__PURE__ */ React.createElement(
|
|
886
|
+
"div",
|
|
887
|
+
{
|
|
888
|
+
...utils.mergeProps(
|
|
889
|
+
dropProps,
|
|
890
|
+
hoverProps,
|
|
891
|
+
clipboardProps,
|
|
892
|
+
focusProps,
|
|
893
|
+
buttonProps
|
|
894
|
+
),
|
|
895
|
+
...utils.filterDOMProps(otherProps, { global: true }),
|
|
896
|
+
style: { ...styleProps.style },
|
|
897
|
+
className: clsx(
|
|
898
|
+
styles$3["sapphire-dropzone"],
|
|
899
|
+
styles$3["js-focus"],
|
|
900
|
+
styles$3["js-hover"],
|
|
901
|
+
{
|
|
902
|
+
[styles$3["is-hover"]]: isHovered && !isDropping,
|
|
903
|
+
[styles$3["is-active"]]: isPressed,
|
|
904
|
+
[styles$3["is-disabled"]]: isDisabled,
|
|
905
|
+
[styles$3["is-focus"]]: isFocusVisible,
|
|
906
|
+
[styles$3["sapphire-dropzone--dropping"]]: isDropping,
|
|
907
|
+
[styles$3["sapphire-dropzone--error"]]: hasError
|
|
908
|
+
},
|
|
909
|
+
styleProps.className
|
|
910
|
+
),
|
|
911
|
+
"aria-label": ariaLabel,
|
|
912
|
+
"aria-invalid": hasError,
|
|
913
|
+
"aria-describedby": paragraphId
|
|
914
|
+
},
|
|
915
|
+
/* @__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(
|
|
916
|
+
"div",
|
|
917
|
+
{
|
|
918
|
+
id: paragraphId,
|
|
919
|
+
className: clsx(styles$3["sapphire-dropzone__paragraph"])
|
|
920
|
+
},
|
|
921
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Typography.Body, { size: "sm", color: "secondary" }, renderInstruction(isDropping))
|
|
922
|
+
))
|
|
923
|
+
))
|
|
924
|
+
);
|
|
1258
925
|
});
|
|
1259
926
|
|
|
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
|
-
]);
|
|
927
|
+
function FilterDropdown({
|
|
928
|
+
children,
|
|
929
|
+
label,
|
|
930
|
+
value,
|
|
931
|
+
isDisabled = false,
|
|
932
|
+
isApplyDisabled = false,
|
|
933
|
+
isClearDisabled,
|
|
934
|
+
isOpen: isOpenProp,
|
|
935
|
+
applyButtonLabel = "Apply",
|
|
936
|
+
clearButtonLabel = "Clear",
|
|
937
|
+
hideClearButton = false,
|
|
938
|
+
defaultOpen = false,
|
|
939
|
+
hasApplyButton = false,
|
|
940
|
+
noMaxWidth,
|
|
941
|
+
onApply,
|
|
942
|
+
onClear,
|
|
943
|
+
onOpenChange,
|
|
944
|
+
buttonSize = "md",
|
|
945
|
+
...props
|
|
946
|
+
}) {
|
|
1329
947
|
const triggerRef = React.useRef(null);
|
|
1330
948
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
1331
|
-
const [isOpen, setIsOpen] = utils$2.useControlledState(
|
|
949
|
+
const [isOpen, setIsOpen] = utils$2.useControlledState(
|
|
950
|
+
isOpenProp,
|
|
951
|
+
defaultOpen,
|
|
952
|
+
utils.useEffectEvent(onOpenChange)
|
|
953
|
+
);
|
|
1332
954
|
const hasValue = value != null && value !== "";
|
|
1333
955
|
const close = () => setIsOpen(false);
|
|
1334
956
|
const onSubmit = (e) => {
|
|
1335
|
-
var _a2;
|
|
1336
957
|
e.preventDefault();
|
|
1337
|
-
onApply
|
|
958
|
+
onApply?.();
|
|
1338
959
|
close();
|
|
1339
|
-
|
|
960
|
+
triggerRef.current?.focus();
|
|
1340
961
|
};
|
|
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, {
|
|
962
|
+
const applyButton = /* @__PURE__ */ React.createElement(
|
|
963
|
+
sapphireReact.Button,
|
|
964
|
+
{
|
|
965
|
+
type: "submit",
|
|
1365
966
|
size: buttonSize,
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
967
|
+
excludeFromTabOrder: !hasApplyButton,
|
|
968
|
+
isDisabled: isApplyDisabled
|
|
969
|
+
},
|
|
970
|
+
applyButtonLabel
|
|
971
|
+
);
|
|
972
|
+
return /* @__PURE__ */ React.createElement(
|
|
973
|
+
sapphireReact.PopoverTrigger,
|
|
974
|
+
{
|
|
975
|
+
ref: triggerRef,
|
|
976
|
+
placement: "bottom left",
|
|
977
|
+
isOpen,
|
|
978
|
+
onOpenChange: setIsOpen,
|
|
979
|
+
noMaxWidth,
|
|
980
|
+
noPadding: true,
|
|
981
|
+
popoverContent: /* @__PURE__ */ React.createElement(
|
|
982
|
+
"form",
|
|
983
|
+
{
|
|
984
|
+
...utils.filterDOMProps(props, { global: true }),
|
|
985
|
+
onSubmit,
|
|
986
|
+
className: clsx(
|
|
987
|
+
styles$4["sapphire-filter-dropdown"],
|
|
988
|
+
styleProps.className
|
|
989
|
+
),
|
|
990
|
+
style: { ...styleProps.style }
|
|
991
|
+
},
|
|
992
|
+
/* @__PURE__ */ React.createElement("div", { className: styles$4["sapphire-filter-dropdown__body"] }, children),
|
|
993
|
+
/* @__PURE__ */ React.createElement("div", { className: styles$4["sapphire-filter-dropdown__footer"] }, /* @__PURE__ */ React.createElement(sapphireReact.ButtonGroup, { align: "right" }, !hideClearButton && /* @__PURE__ */ React.createElement(
|
|
994
|
+
sapphireReact.Button,
|
|
995
|
+
{
|
|
996
|
+
size: buttonSize,
|
|
997
|
+
variant: "text",
|
|
998
|
+
onPress: () => {
|
|
999
|
+
close();
|
|
1000
|
+
onClear?.();
|
|
1001
|
+
},
|
|
1002
|
+
isDisabled: isClearDisabled ?? !hasValue
|
|
1003
|
+
},
|
|
1004
|
+
clearButtonLabel
|
|
1005
|
+
), hasApplyButton ? applyButton : (
|
|
1006
|
+
// The following is necessary to have the form submitted on "Enter", if there is more than one field
|
|
1007
|
+
/* @__PURE__ */ React.createElement(visuallyHidden.VisuallyHidden, null, applyButton)
|
|
1008
|
+
)))
|
|
1009
|
+
)
|
|
1010
|
+
},
|
|
1011
|
+
/* @__PURE__ */ React.createElement(
|
|
1012
|
+
sapphireReact.ToggleButton,
|
|
1013
|
+
{
|
|
1014
|
+
icon: isOpen ? /* @__PURE__ */ React.createElement(react.ChevronUp, null) : /* @__PURE__ */ React.createElement(react.ChevronDown, null),
|
|
1015
|
+
iconAlign: "right",
|
|
1016
|
+
isSelected: hasValue,
|
|
1017
|
+
isDisabled,
|
|
1018
|
+
size: buttonSize
|
|
1370
1019
|
},
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
isSelected: hasValue,
|
|
1377
|
-
isDisabled,
|
|
1378
|
-
size: buttonSize
|
|
1379
|
-
}, label, value ? ": " : "", value));
|
|
1020
|
+
label,
|
|
1021
|
+
value ? ": " : "",
|
|
1022
|
+
value
|
|
1023
|
+
)
|
|
1024
|
+
);
|
|
1380
1025
|
}
|
|
1381
1026
|
|
|
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
1027
|
function SearchableSelectFilter(props) {
|
|
1414
|
-
|
|
1415
|
-
const _a = props, { searchField, listBox, size = "md" } = _a, otherProps = __objRest$h(_a, ["searchField", "listBox", "size"]);
|
|
1028
|
+
const { searchField, listBox, size = "md", ...otherProps } = props;
|
|
1416
1029
|
const searchFieldRef = React.useRef(null);
|
|
1417
1030
|
const searchFieldProps = searchField.props;
|
|
1418
1031
|
const listBoxProps = listBox.props;
|
|
1419
|
-
const [searchQuery, setSearchQuery] = utils$2.useControlledState(
|
|
1420
|
-
|
|
1421
|
-
|
|
1032
|
+
const [searchQuery, setSearchQuery] = utils$2.useControlledState(
|
|
1033
|
+
searchFieldProps?.value,
|
|
1034
|
+
"",
|
|
1035
|
+
searchFieldProps.onChange
|
|
1036
|
+
);
|
|
1037
|
+
if (listBoxProps.connectedInputRef && typeof process !== "undefined" && process.env?.NODE_ENV === "development") {
|
|
1038
|
+
console.warn(
|
|
1039
|
+
"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."
|
|
1040
|
+
);
|
|
1422
1041
|
}
|
|
1423
1042
|
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
|
-
|
|
1043
|
+
return /* @__PURE__ */ React.createElement(
|
|
1044
|
+
FilterDropdown,
|
|
1045
|
+
{
|
|
1046
|
+
...otherProps,
|
|
1047
|
+
noMaxWidth: otherProps.noMaxWidth ?? true,
|
|
1048
|
+
buttonSize: size,
|
|
1049
|
+
hasApplyButton: Boolean(otherProps.onApply),
|
|
1050
|
+
isClearDisabled: otherProps.isClearDisabled || !hasSelection && !otherProps.value
|
|
1051
|
+
},
|
|
1052
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Flex, { flexDirection: "column", height: "100%" }, React.cloneElement(searchField, {
|
|
1053
|
+
size: "md",
|
|
1054
|
+
value: searchFieldProps.value || searchQuery,
|
|
1055
|
+
inputRef: utils.mergeRefs(searchFieldRef, searchFieldProps.inputRef),
|
|
1056
|
+
width: searchFieldProps.width || "100%",
|
|
1057
|
+
marginBottom: searchFieldProps.marginBottom || sapphireReact.tokens.size.spacingSm,
|
|
1058
|
+
onChange: setSearchQuery
|
|
1059
|
+
}), React.cloneElement(listBox, {
|
|
1060
|
+
connectedInputRef: searchFieldRef,
|
|
1061
|
+
selectionMode: listBoxProps.selectionMode || "multiple",
|
|
1062
|
+
marginX: `calc(${sapphireReact.tokens.size.spacingContainerHorizontalSm.value} * -1)`,
|
|
1063
|
+
hasScrollDividers: true,
|
|
1064
|
+
filter: (
|
|
1065
|
+
// This is a way to also allow opting out of the internal filter with filter={undefined}
|
|
1066
|
+
// without us having to allow for more values on the ListBox filter prop
|
|
1067
|
+
"filter" in listBoxProps ? listBoxProps.filter : (textValue) => textValue.toLowerCase().includes(searchQuery.toLowerCase())
|
|
1068
|
+
)
|
|
1069
|
+
}))
|
|
1070
|
+
);
|
|
1446
1071
|
}
|
|
1447
1072
|
|
|
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"]);
|
|
1073
|
+
const Flag = React.forwardRef(function Flag2({ size = "lg", rounded, "aria-label": ariaLabel, ...props }, ref) {
|
|
1481
1074
|
sapphireReact.useThemeCheck();
|
|
1482
1075
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
1483
|
-
return
|
|
1076
|
+
return React.cloneElement(utils$1.getWrappedElement(props.children), {
|
|
1484
1077
|
ref,
|
|
1485
|
-
role: "img"
|
|
1486
|
-
|
|
1487
|
-
className:
|
|
1488
|
-
[
|
|
1489
|
-
[
|
|
1490
|
-
[
|
|
1491
|
-
[
|
|
1492
|
-
[
|
|
1493
|
-
[
|
|
1078
|
+
role: "img",
|
|
1079
|
+
...ariaLabel ? { "aria-label": ariaLabel } : { "aria-hidden": true },
|
|
1080
|
+
className: clsx(styles$5["sapphire-flag"], styleProps.className, {
|
|
1081
|
+
[styles$5["sapphire-flag--xs"]]: size === "xs",
|
|
1082
|
+
[styles$5["sapphire-flag--sm"]]: size === "sm",
|
|
1083
|
+
[styles$5["sapphire-flag--md"]]: size === "md",
|
|
1084
|
+
[styles$5["sapphire-flag--lg"]]: size === "lg",
|
|
1085
|
+
[styles$5["sapphire-flag--xl"]]: size === "xl",
|
|
1086
|
+
[styles$5["sapphire-flag--rounded"]]: rounded
|
|
1494
1087
|
}),
|
|
1495
1088
|
style: styleProps.style
|
|
1496
|
-
})
|
|
1089
|
+
});
|
|
1497
1090
|
});
|
|
1498
1091
|
|
|
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
|
-
]);
|
|
1092
|
+
function LabeledValue({
|
|
1093
|
+
children,
|
|
1094
|
+
contextualHelp,
|
|
1095
|
+
label: label$1,
|
|
1096
|
+
labelPlacement = "above",
|
|
1097
|
+
size = "lg",
|
|
1098
|
+
...otherProps
|
|
1099
|
+
}) {
|
|
1544
1100
|
sapphireReact.useThemeCheck();
|
|
1545
1101
|
const { fieldProps } = label.useField({ label: label$1 });
|
|
1546
|
-
return /* @__PURE__ */
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1102
|
+
return /* @__PURE__ */ React.createElement(
|
|
1103
|
+
sapphireReact.Field,
|
|
1104
|
+
{
|
|
1105
|
+
...utils.mergeProps(fieldProps, otherProps),
|
|
1106
|
+
labelPlacement,
|
|
1107
|
+
size,
|
|
1108
|
+
noDefaultWidth: true
|
|
1109
|
+
},
|
|
1110
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Field.Label, null, /* @__PURE__ */ React.createElement(sapphireReact.Label, { contextualHelp, size }, label$1)),
|
|
1111
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Field.Control, null, children)
|
|
1112
|
+
);
|
|
1554
1113
|
}
|
|
1555
1114
|
|
|
1556
1115
|
var increment$6 = "øge";
|
|
@@ -1612,60 +1171,38 @@ var intlMessages$1 = {
|
|
|
1612
1171
|
"sv-SE": se$1
|
|
1613
1172
|
};
|
|
1614
1173
|
|
|
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
|
-
]);
|
|
1174
|
+
const StepperButton = ({
|
|
1175
|
+
variant,
|
|
1176
|
+
size,
|
|
1177
|
+
...props
|
|
1178
|
+
}) => {
|
|
1654
1179
|
const ref = React.useRef(null);
|
|
1655
1180
|
const { buttonProps, isPressed } = sapphireReact.useButton(props, ref);
|
|
1656
1181
|
const { hoverProps, isHovered } = interactions.useHover({ isDisabled: props.isDisabled });
|
|
1657
1182
|
const { focusProps, isFocusVisible } = focus.useFocusRing();
|
|
1658
|
-
return /* @__PURE__ */
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1183
|
+
return /* @__PURE__ */ React.createElement(
|
|
1184
|
+
"button",
|
|
1185
|
+
{
|
|
1186
|
+
...utils.mergeProps(
|
|
1187
|
+
buttonProps,
|
|
1188
|
+
hoverProps,
|
|
1189
|
+
focusProps,
|
|
1190
|
+
utils.filterDOMProps(props, { global: true })
|
|
1191
|
+
),
|
|
1192
|
+
tabIndex: 0,
|
|
1193
|
+
ref,
|
|
1194
|
+
className: clsx(
|
|
1195
|
+
textFieldStyles["sapphire-text-field__stepper-button"],
|
|
1196
|
+
textFieldStyles["js-hover"],
|
|
1197
|
+
{
|
|
1198
|
+
[textFieldStyles["is-active"]]: isPressed,
|
|
1199
|
+
[textFieldStyles["is-hover"]]: isHovered,
|
|
1200
|
+
[textFieldStyles["is-focus"]]: isFocusVisible
|
|
1201
|
+
}
|
|
1202
|
+
)
|
|
1203
|
+
},
|
|
1204
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: size === "lg" ? "md" : "sm" }, variant === "increment" ? /* @__PURE__ */ React.createElement(react.Add, null) : /* @__PURE__ */ React.createElement(react.Subtract, null))
|
|
1205
|
+
);
|
|
1669
1206
|
};
|
|
1670
1207
|
|
|
1671
1208
|
function useAutofillStyle(inputRef) {
|
|
@@ -1686,20 +1223,18 @@ function useAutofillStyle(inputRef) {
|
|
|
1686
1223
|
}
|
|
1687
1224
|
|
|
1688
1225
|
const getSeparators = (formatter) => {
|
|
1689
|
-
var _a, _b, _c, _d, _e;
|
|
1690
1226
|
const parts = formatter.formatToParts(1000.1);
|
|
1691
|
-
const groupSeparator =
|
|
1692
|
-
let decimalSeparator =
|
|
1227
|
+
const groupSeparator = parts.find((p) => p.type === "group")?.value ?? ",";
|
|
1228
|
+
let decimalSeparator = parts.find((p) => p.type === "decimal")?.value;
|
|
1693
1229
|
if (!decimalSeparator) {
|
|
1694
1230
|
const locale = formatter.resolvedOptions().locale;
|
|
1695
1231
|
const plainFormatter = new Intl.NumberFormat(locale);
|
|
1696
|
-
decimalSeparator =
|
|
1232
|
+
decimalSeparator = plainFormatter.formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
|
|
1697
1233
|
}
|
|
1698
1234
|
return { groupSeparator, decimalSeparator };
|
|
1699
1235
|
};
|
|
1700
1236
|
const trimSymbol = (value, symbol) => {
|
|
1701
|
-
if (!symbol)
|
|
1702
|
-
return value;
|
|
1237
|
+
if (!symbol) return value;
|
|
1703
1238
|
if (value.startsWith(symbol)) {
|
|
1704
1239
|
return value.slice(symbol.length).trimStart();
|
|
1705
1240
|
} else if (value.endsWith(symbol)) {
|
|
@@ -1708,20 +1243,20 @@ const trimSymbol = (value, symbol) => {
|
|
|
1708
1243
|
return value;
|
|
1709
1244
|
};
|
|
1710
1245
|
const parseNumericValue = (value, decimalSeparator, formatter) => {
|
|
1711
|
-
if (!value || value === "-")
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1246
|
+
if (!value || value === "-") return null;
|
|
1247
|
+
const cleaned = value.replace(
|
|
1248
|
+
new RegExp(`[^0-9${decimalSeparator}\\-]`, "g"),
|
|
1249
|
+
""
|
|
1250
|
+
);
|
|
1251
|
+
if (!cleaned) return null;
|
|
1716
1252
|
const hasLeadingMinus = cleaned.startsWith("-");
|
|
1717
1253
|
const withoutMinus = cleaned.replace(/-/g, "");
|
|
1718
1254
|
const normalized = hasLeadingMinus ? "-" + withoutMinus : withoutMinus;
|
|
1719
1255
|
const parts = normalized.split(decimalSeparator);
|
|
1720
1256
|
const withStandardDecimal = parts.length > 1 ? parts[0] + "." + parts.slice(1).join("") : normalized.replace(decimalSeparator, ".");
|
|
1721
1257
|
let parsed = parseFloat(withStandardDecimal);
|
|
1722
|
-
if (isNaN(parsed))
|
|
1723
|
-
|
|
1724
|
-
if ((formatter == null ? void 0 : formatter.resolvedOptions().style) === "percent") {
|
|
1258
|
+
if (isNaN(parsed)) return null;
|
|
1259
|
+
if (formatter?.resolvedOptions().style === "percent") {
|
|
1725
1260
|
parsed /= 100;
|
|
1726
1261
|
}
|
|
1727
1262
|
return parsed;
|
|
@@ -1746,13 +1281,12 @@ const formatNumberString = (value, formatter, decimalSeparator, shouldStripSymbo
|
|
|
1746
1281
|
const isSymbol = (type) => ["currency", "unit", "percentSign"].includes(type);
|
|
1747
1282
|
const hasSymbolAt = (parts, start) => {
|
|
1748
1283
|
const [first, second] = start ? [parts[0], parts[1]] : [parts[parts.length - 1], parts[parts.length - 2]];
|
|
1749
|
-
return isSymbol(first
|
|
1284
|
+
return isSymbol(first?.type) || first?.type === "literal" && isSymbol(second?.type);
|
|
1750
1285
|
};
|
|
1751
1286
|
const extractSymbol = (formatter, prefix, postfix) => {
|
|
1752
|
-
var _a, _b;
|
|
1753
1287
|
const parts = formatter.formatToParts(1000.1);
|
|
1754
|
-
const extractedPrefix = hasSymbolAt(parts, true) ?
|
|
1755
|
-
const extractedPostfix = hasSymbolAt(parts, false) ?
|
|
1288
|
+
const extractedPrefix = hasSymbolAt(parts, true) ? parts.find((part) => isSymbol(part.type))?.value || null : null;
|
|
1289
|
+
const extractedPostfix = hasSymbolAt(parts, false) ? [...parts].reverse().find((part) => isSymbol(part.type))?.value || null : null;
|
|
1756
1290
|
return prefix !== void 0 || postfix !== void 0 ? {
|
|
1757
1291
|
extractedPrefix: prefix,
|
|
1758
1292
|
extractedPostfix: postfix,
|
|
@@ -1768,8 +1302,7 @@ const isDeleteOperation = (inputType) => {
|
|
|
1768
1302
|
return inputType === "deleteContentBackward" || inputType === "deleteContentForward";
|
|
1769
1303
|
};
|
|
1770
1304
|
const calculateCursorPosition = (oldValue, newValue, oldCursor, inputType, decimalSeparator, numericValue) => {
|
|
1771
|
-
if (!newValue)
|
|
1772
|
-
return 0;
|
|
1305
|
+
if (!newValue) return 0;
|
|
1773
1306
|
const oldDecimalPos = oldValue.indexOf(decimalSeparator);
|
|
1774
1307
|
const newDecimalPos = newValue.indexOf(decimalSeparator);
|
|
1775
1308
|
if (numericValue === 0 && isDeleteOperation(inputType)) {
|
|
@@ -1778,8 +1311,7 @@ const calculateCursorPosition = (oldValue, newValue, oldCursor, inputType, decim
|
|
|
1778
1311
|
const countDigits = (str, start, end) => {
|
|
1779
1312
|
let count = 0;
|
|
1780
1313
|
for (let i = start; i < end; i++) {
|
|
1781
|
-
if (/[0-9]/.test(str[i]))
|
|
1782
|
-
count++;
|
|
1314
|
+
if (/[0-9]/.test(str[i])) count++;
|
|
1783
1315
|
}
|
|
1784
1316
|
return count;
|
|
1785
1317
|
};
|
|
@@ -1787,7 +1319,11 @@ const calculateCursorPosition = (oldValue, newValue, oldCursor, inputType, decim
|
|
|
1787
1319
|
return newDecimalPos;
|
|
1788
1320
|
}
|
|
1789
1321
|
if (oldDecimalPos >= 0 && oldCursor > oldDecimalPos && newDecimalPos >= 0) {
|
|
1790
|
-
const digitsBeforeCursor = countDigits(
|
|
1322
|
+
const digitsBeforeCursor = countDigits(
|
|
1323
|
+
oldValue,
|
|
1324
|
+
oldDecimalPos + 1,
|
|
1325
|
+
oldCursor
|
|
1326
|
+
);
|
|
1791
1327
|
let digitCount2 = 0;
|
|
1792
1328
|
for (let i = newDecimalPos + 1; i < newValue.length; i++) {
|
|
1793
1329
|
if (/[0-9]/.test(newValue[i]) && ++digitCount2 === digitsBeforeCursor) {
|
|
@@ -1798,12 +1334,15 @@ const calculateCursorPosition = (oldValue, newValue, oldCursor, inputType, decim
|
|
|
1798
1334
|
}
|
|
1799
1335
|
const oldEnd = oldDecimalPos >= 0 ? oldDecimalPos : oldValue.length;
|
|
1800
1336
|
const newEnd = newDecimalPos >= 0 ? newDecimalPos : newValue.length;
|
|
1801
|
-
const intDigitsBeforeCursor = countDigits(
|
|
1337
|
+
const intDigitsBeforeCursor = countDigits(
|
|
1338
|
+
oldValue,
|
|
1339
|
+
0,
|
|
1340
|
+
Math.min(oldCursor, oldEnd)
|
|
1341
|
+
);
|
|
1802
1342
|
if (intDigitsBeforeCursor === 0) {
|
|
1803
1343
|
if (isDeleteOperation(inputType)) {
|
|
1804
1344
|
for (let i = 0; i < newValue.length; i++) {
|
|
1805
|
-
if (/[0-9]/.test(newValue[i]))
|
|
1806
|
-
return i + 1;
|
|
1345
|
+
if (/[0-9]/.test(newValue[i])) return i + 1;
|
|
1807
1346
|
}
|
|
1808
1347
|
}
|
|
1809
1348
|
return 0;
|
|
@@ -1819,9 +1358,12 @@ const calculateCursorPosition = (oldValue, newValue, oldCursor, inputType, decim
|
|
|
1819
1358
|
|
|
1820
1359
|
const escapeRegExp = (str) => str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
1821
1360
|
const getSuffix = (value, groupSeparator, decimalSeparator) => {
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1361
|
+
const suffixReg = new RegExp(
|
|
1362
|
+
`\\d([^${escapeRegExp(groupSeparator)}${escapeRegExp(
|
|
1363
|
+
decimalSeparator
|
|
1364
|
+
)}0-9]+)`
|
|
1365
|
+
);
|
|
1366
|
+
return value.match(suffixReg)?.[1];
|
|
1825
1367
|
};
|
|
1826
1368
|
function handleNumberFieldKeyDown({
|
|
1827
1369
|
event,
|
|
@@ -1830,19 +1372,21 @@ function handleNumberFieldKeyDown({
|
|
|
1830
1372
|
decimalSeparator,
|
|
1831
1373
|
onOriginalKeyDown
|
|
1832
1374
|
}) {
|
|
1833
|
-
var _a;
|
|
1834
1375
|
const { key } = event;
|
|
1835
1376
|
const input = event.currentTarget;
|
|
1836
1377
|
const { selectionStart, value } = input;
|
|
1837
1378
|
if (selectionStart === null) {
|
|
1838
|
-
onOriginalKeyDown
|
|
1379
|
+
onOriginalKeyDown?.(event);
|
|
1839
1380
|
return;
|
|
1840
1381
|
}
|
|
1841
1382
|
if (/^[0-9]$/.test(key)) {
|
|
1842
1383
|
const decimalPos = value.indexOf(decimalSeparator);
|
|
1843
1384
|
if (selectionStart === 0) {
|
|
1844
1385
|
const integerPart = decimalPos >= 0 ? value.slice(0, decimalPos) : value;
|
|
1845
|
-
const cleanedInteger = integerPart.replace(
|
|
1386
|
+
const cleanedInteger = integerPart.replace(
|
|
1387
|
+
new RegExp(escapeRegExp(groupSeparator), "g"),
|
|
1388
|
+
""
|
|
1389
|
+
);
|
|
1846
1390
|
if (cleanedInteger === "0") {
|
|
1847
1391
|
event.preventDefault();
|
|
1848
1392
|
const newValue = key + (decimalPos >= 0 ? value.slice(decimalPos) : "");
|
|
@@ -1929,10 +1473,10 @@ function handleNumberFieldKeyDown({
|
|
|
1929
1473
|
const suffix = getSuffix(value, groupSeparator, decimalSeparator);
|
|
1930
1474
|
if (suffix && selectionStart > value.length - suffix.length) {
|
|
1931
1475
|
const suffixStartPos = value.length - suffix.length;
|
|
1932
|
-
|
|
1476
|
+
inputRef.current?.setSelectionRange(suffixStartPos, suffixStartPos);
|
|
1933
1477
|
}
|
|
1934
1478
|
}
|
|
1935
|
-
onOriginalKeyDown
|
|
1479
|
+
onOriginalKeyDown?.(event);
|
|
1936
1480
|
}
|
|
1937
1481
|
|
|
1938
1482
|
function useNumberFieldFormatting({
|
|
@@ -1945,19 +1489,28 @@ function useNumberFieldFormatting({
|
|
|
1945
1489
|
onChange,
|
|
1946
1490
|
autoFormat
|
|
1947
1491
|
}) {
|
|
1948
|
-
const { groupSeparator, decimalSeparator } = React.useMemo(
|
|
1492
|
+
const { groupSeparator, decimalSeparator } = React.useMemo(
|
|
1493
|
+
() => getSeparators(formatter),
|
|
1494
|
+
[formatter]
|
|
1495
|
+
);
|
|
1949
1496
|
const [formattedValue, setFormattedValue] = React.useState("");
|
|
1950
|
-
const symbolInfo = React.useMemo(
|
|
1497
|
+
const symbolInfo = React.useMemo(
|
|
1498
|
+
() => extractSymbol(formatter, prefix, postfix),
|
|
1499
|
+
[formatter, prefix, postfix]
|
|
1500
|
+
);
|
|
1951
1501
|
const { extractedPrefix, extractedPostfix, symbol } = symbolInfo;
|
|
1952
1502
|
const cursorPositionRef = React.useRef(null);
|
|
1953
1503
|
const displayValue = React.useMemo(() => {
|
|
1954
|
-
const numericValue = parseNumericValue(
|
|
1955
|
-
|
|
1956
|
-
|
|
1504
|
+
const numericValue = parseNumericValue(
|
|
1505
|
+
inputValue,
|
|
1506
|
+
decimalSeparator,
|
|
1507
|
+
formatter
|
|
1508
|
+
);
|
|
1509
|
+
if (numericValue === null) return inputValue;
|
|
1957
1510
|
try {
|
|
1958
1511
|
const trimmedValue = trimSymbol(inputValue, symbol) || inputValue;
|
|
1959
1512
|
return autoFormat ? formattedValue || trimmedValue : trimmedValue;
|
|
1960
|
-
} catch
|
|
1513
|
+
} catch {
|
|
1961
1514
|
return inputValue;
|
|
1962
1515
|
}
|
|
1963
1516
|
}, [
|
|
@@ -1970,49 +1523,74 @@ function useNumberFieldFormatting({
|
|
|
1970
1523
|
]);
|
|
1971
1524
|
React.useLayoutEffect(() => {
|
|
1972
1525
|
if (cursorPositionRef.current !== null && inputRef.current) {
|
|
1973
|
-
inputRef.current.setSelectionRange(
|
|
1526
|
+
inputRef.current.setSelectionRange(
|
|
1527
|
+
cursorPositionRef.current,
|
|
1528
|
+
cursorPositionRef.current
|
|
1529
|
+
);
|
|
1974
1530
|
cursorPositionRef.current = null;
|
|
1975
1531
|
}
|
|
1976
1532
|
}, [displayValue, inputRef]);
|
|
1977
|
-
const handleInput = React.useCallback(
|
|
1978
|
-
|
|
1979
|
-
return;
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1533
|
+
const handleInput = React.useCallback(
|
|
1534
|
+
(e) => {
|
|
1535
|
+
if (!autoFormat) return;
|
|
1536
|
+
const input = e.currentTarget;
|
|
1537
|
+
const { value, selectionStart } = input;
|
|
1538
|
+
const inputType = e.nativeEvent.inputType || "";
|
|
1539
|
+
const shouldStrip = !!symbol;
|
|
1540
|
+
const maxFractionDigits = formatter.resolvedOptions().maximumFractionDigits || 0;
|
|
1541
|
+
const decimalIndex = value.indexOf(decimalSeparator);
|
|
1542
|
+
if (decimalIndex !== -1 && selectionStart !== null) {
|
|
1543
|
+
const decimalPart = value.slice(decimalIndex + 1).replace(new RegExp(`[^0-9]`, "g"), "");
|
|
1544
|
+
const prevDecimalIndex = displayValue.indexOf(decimalSeparator);
|
|
1545
|
+
const prevDecimalLength = prevDecimalIndex !== -1 ? displayValue.slice(prevDecimalIndex + 1).length : 0;
|
|
1546
|
+
if (decimalPart.length > maxFractionDigits && selectionStart > decimalIndex + 1 + prevDecimalLength) {
|
|
1547
|
+
e.preventDefault();
|
|
1548
|
+
cursorPositionRef.current = decimalIndex + 1 + prevDecimalLength;
|
|
1549
|
+
return;
|
|
1550
|
+
}
|
|
1994
1551
|
}
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
1552
|
+
const formattedValue2 = formatNumberString(
|
|
1553
|
+
value,
|
|
1554
|
+
formatter,
|
|
1555
|
+
decimalSeparator,
|
|
1556
|
+
shouldStrip,
|
|
1557
|
+
symbol
|
|
1558
|
+
);
|
|
1559
|
+
setFormattedValue(formattedValue2);
|
|
1560
|
+
const numericValue = parseNumericValue(
|
|
1561
|
+
formattedValue2,
|
|
1562
|
+
decimalSeparator,
|
|
1563
|
+
formatter
|
|
1564
|
+
);
|
|
1565
|
+
if (formattedValue2 !== value && formattedValue2 !== "" && selectionStart !== null) {
|
|
1566
|
+
const newCursorPosition = calculateCursorPosition(
|
|
1567
|
+
value,
|
|
1568
|
+
formattedValue2,
|
|
1569
|
+
selectionStart,
|
|
1570
|
+
inputType,
|
|
1571
|
+
decimalSeparator,
|
|
1572
|
+
numericValue
|
|
1573
|
+
);
|
|
1574
|
+
cursorPositionRef.current = newCursorPosition;
|
|
1575
|
+
}
|
|
1576
|
+
if (numericValue !== null) {
|
|
1577
|
+
onChange?.(numericValue);
|
|
1578
|
+
}
|
|
1579
|
+
},
|
|
1580
|
+
[formatter, decimalSeparator, symbol, autoFormat, displayValue, onChange]
|
|
1581
|
+
);
|
|
1582
|
+
const handleKeyDown = React.useCallback(
|
|
1583
|
+
(e) => {
|
|
1584
|
+
handleNumberFieldKeyDown({
|
|
1585
|
+
event: e,
|
|
1586
|
+
inputRef,
|
|
1587
|
+
groupSeparator,
|
|
1588
|
+
decimalSeparator,
|
|
1589
|
+
onOriginalKeyDown
|
|
1590
|
+
});
|
|
1591
|
+
},
|
|
1592
|
+
[groupSeparator, decimalSeparator, inputRef, onOriginalKeyDown]
|
|
1593
|
+
);
|
|
2016
1594
|
return {
|
|
2017
1595
|
displayValue,
|
|
2018
1596
|
extractedPrefix,
|
|
@@ -2022,83 +1600,25 @@ function useNumberFieldFormatting({
|
|
|
2022
1600
|
};
|
|
2023
1601
|
}
|
|
2024
1602
|
|
|
2025
|
-
|
|
2026
|
-
var __defProps$e = Object.defineProperties;
|
|
2027
|
-
var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
|
|
2028
|
-
var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
|
|
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"]);
|
|
1603
|
+
const useSapphireNumberField = ({ error, ...numberFieldProps }, ref) => {
|
|
2058
1604
|
const { locale } = i18n.useLocale();
|
|
2059
|
-
const numberFieldState = numberfield.useNumberFieldState(
|
|
1605
|
+
const numberFieldState = numberfield.useNumberFieldState({
|
|
1606
|
+
...numberFieldProps,
|
|
2060
1607
|
locale
|
|
2061
|
-
})
|
|
2062
|
-
const numberFieldAria = numberfield$1.useNumberField(
|
|
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;
|
|
1608
|
+
});
|
|
1609
|
+
const numberFieldAria = numberfield$1.useNumberField(
|
|
1610
|
+
{
|
|
1611
|
+
...numberFieldProps,
|
|
1612
|
+
validationState: error === false || error === void 0 ? void 0 : "invalid"
|
|
1613
|
+
},
|
|
1614
|
+
numberFieldState,
|
|
1615
|
+
ref
|
|
1616
|
+
);
|
|
1617
|
+
return { ...numberFieldAria, state: numberFieldState };
|
|
2098
1618
|
};
|
|
1619
|
+
|
|
2099
1620
|
const NumberField = React.forwardRef(function NumberField2(props, ref) {
|
|
2100
|
-
|
|
2101
|
-
const _a = props, {
|
|
1621
|
+
const {
|
|
2102
1622
|
label,
|
|
2103
1623
|
isDisabled,
|
|
2104
1624
|
error,
|
|
@@ -2113,24 +1633,9 @@ const NumberField = React.forwardRef(function NumberField2(props, ref) {
|
|
|
2113
1633
|
showButtons = false,
|
|
2114
1634
|
incrementAriaLabel,
|
|
2115
1635
|
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
|
-
]);
|
|
1636
|
+
autoFormat = false,
|
|
1637
|
+
...otherProps
|
|
1638
|
+
} = props;
|
|
2134
1639
|
const { prefix, postfix } = React.useMemo(() => {
|
|
2135
1640
|
if (affix === "auto") {
|
|
2136
1641
|
return { prefix: void 0, postfix: void 0 };
|
|
@@ -2147,14 +1652,21 @@ const NumberField = React.forwardRef(function NumberField2(props, ref) {
|
|
|
2147
1652
|
decrementButtonProps,
|
|
2148
1653
|
descriptionProps,
|
|
2149
1654
|
errorMessageProps
|
|
2150
|
-
} = useSapphireNumberField(
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
1655
|
+
} = useSapphireNumberField(
|
|
1656
|
+
{
|
|
1657
|
+
...props,
|
|
1658
|
+
incrementAriaLabel: incrementAriaLabel ?? formatMessage("increment"),
|
|
1659
|
+
decrementAriaLabel: decrementAriaLabel ?? formatMessage("decrement")
|
|
1660
|
+
},
|
|
1661
|
+
inputRef
|
|
1662
|
+
);
|
|
2154
1663
|
const { focusProps, isFocusVisible } = focus.useFocusRing();
|
|
2155
1664
|
const { autofillStyles, updateStyle } = useAutofillStyle(inputRef);
|
|
2156
1665
|
const { locale } = i18n.useLocale();
|
|
2157
|
-
const formatter = React.useMemo(
|
|
1666
|
+
const formatter = React.useMemo(
|
|
1667
|
+
() => new Intl.NumberFormat(locale, props.formatOptions),
|
|
1668
|
+
[locale, props.formatOptions]
|
|
1669
|
+
);
|
|
2158
1670
|
const formattingResult = useNumberFieldFormatting({
|
|
2159
1671
|
inputRef,
|
|
2160
1672
|
formatter,
|
|
@@ -2172,65 +1684,122 @@ const NumberField = React.forwardRef(function NumberField2(props, ref) {
|
|
|
2172
1684
|
handleKeyDown: inputProps.onKeyDown
|
|
2173
1685
|
};
|
|
2174
1686
|
const containerRef = React.useRef(null);
|
|
2175
|
-
React.useImperativeHandle(ref, () =>
|
|
1687
|
+
React.useImperativeHandle(ref, () => ({
|
|
1688
|
+
...utils$1.createFocusableRef(containerRef, inputRef),
|
|
1689
|
+
/**
|
|
1690
|
+
* (This function is deprecated. Use `inputRef` prop)
|
|
1691
|
+
* @deprecated
|
|
1692
|
+
*/
|
|
2176
1693
|
getInputElement() {
|
|
2177
1694
|
return inputRef.current;
|
|
2178
1695
|
}
|
|
2179
1696
|
}));
|
|
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
|
-
|
|
1697
|
+
return /* @__PURE__ */ React.createElement(
|
|
1698
|
+
sapphireReact.Field,
|
|
1699
|
+
{
|
|
1700
|
+
...removeUniqueDOMProps(otherProps),
|
|
1701
|
+
ref: containerRef,
|
|
1702
|
+
size,
|
|
1703
|
+
labelPlacement
|
|
1704
|
+
},
|
|
1705
|
+
/* @__PURE__ */ React.createElement(
|
|
1706
|
+
sapphireReact.Field.Context,
|
|
1707
|
+
{
|
|
1708
|
+
descriptionProps: error ? errorMessageProps : descriptionProps
|
|
1709
|
+
},
|
|
1710
|
+
label && /* @__PURE__ */ React.createElement(sapphireReact.Field.Label, null, /* @__PURE__ */ React.createElement(
|
|
1711
|
+
sapphireReact.Label,
|
|
1712
|
+
{
|
|
1713
|
+
...labelProps,
|
|
1714
|
+
size,
|
|
1715
|
+
necessityIndicator: isRequired && necessityIndicator ? "required" : !isRequired && necessityIndicator ? "optional" : void 0,
|
|
1716
|
+
contextualHelp
|
|
1717
|
+
},
|
|
1718
|
+
label
|
|
1719
|
+
)),
|
|
1720
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Field.Control, null, /* @__PURE__ */ React.createElement(
|
|
1721
|
+
"div",
|
|
1722
|
+
{
|
|
1723
|
+
className: clsx(textFieldStyles["sapphire-text-field"], {
|
|
1724
|
+
[textFieldStyles["is-focus"]]: isFocusVisible,
|
|
1725
|
+
[textFieldStyles["sapphire-text-field--error"]]: error === true || typeof error === "string",
|
|
1726
|
+
[textFieldStyles["sapphire-text-field--md"]]: size === "md"
|
|
1727
|
+
})
|
|
1728
|
+
},
|
|
1729
|
+
extractedPrefix && /* @__PURE__ */ React.createElement(
|
|
1730
|
+
"span",
|
|
1731
|
+
{
|
|
1732
|
+
className: clsx(
|
|
1733
|
+
textFieldStyles["sapphire-text-field__prefix"],
|
|
1734
|
+
{
|
|
1735
|
+
[textFieldStyles["sapphire-text-field__prefix--icon"]]: typeof extractedPrefix !== "string"
|
|
1736
|
+
}
|
|
1737
|
+
)
|
|
1738
|
+
},
|
|
1739
|
+
extractedPrefix
|
|
1740
|
+
),
|
|
1741
|
+
/* @__PURE__ */ React.createElement(
|
|
1742
|
+
"input",
|
|
1743
|
+
{
|
|
1744
|
+
...utils.mergeProps(
|
|
1745
|
+
inputProps,
|
|
1746
|
+
focusProps,
|
|
1747
|
+
{
|
|
1748
|
+
onChange: updateStyle,
|
|
1749
|
+
onBlur: updateStyle
|
|
1750
|
+
},
|
|
1751
|
+
autoFormat ? {
|
|
1752
|
+
onInput: handleInput,
|
|
1753
|
+
onKeyDown: handleKeyDown
|
|
1754
|
+
} : {}
|
|
1755
|
+
),
|
|
1756
|
+
value: formattingResult?.displayValue ?? inputProps.value,
|
|
1757
|
+
ref: inputRef,
|
|
1758
|
+
className: clsx(textFieldStyles["sapphire-text-field__input"], {
|
|
1759
|
+
[textFieldStyles["sapphire-text-field__input--align-right"]]: !!alignInputRight
|
|
1760
|
+
}),
|
|
1761
|
+
style: autofillStyles
|
|
1762
|
+
}
|
|
1763
|
+
),
|
|
1764
|
+
extractedPostfix && /* @__PURE__ */ React.createElement(
|
|
1765
|
+
"span",
|
|
1766
|
+
{
|
|
1767
|
+
className: clsx(
|
|
1768
|
+
textFieldStyles["sapphire-text-field__postfix"],
|
|
1769
|
+
{
|
|
1770
|
+
[textFieldStyles["sapphire-text-field__postfix--icon"]]: typeof extractedPostfix !== "string"
|
|
1771
|
+
}
|
|
1772
|
+
)
|
|
1773
|
+
},
|
|
1774
|
+
extractedPostfix
|
|
1775
|
+
),
|
|
1776
|
+
showButtons && /* @__PURE__ */ React.createElement("div", { className: textFieldStyles["sapphire-text-field__stepper"] }, /* @__PURE__ */ React.createElement(
|
|
1777
|
+
StepperButton,
|
|
1778
|
+
{
|
|
1779
|
+
variant: "decrement",
|
|
1780
|
+
size,
|
|
1781
|
+
...decrementButtonProps
|
|
1782
|
+
}
|
|
1783
|
+
), /* @__PURE__ */ React.createElement(sapphireReact.Separator, { orientation: "vertical" }), /* @__PURE__ */ React.createElement(
|
|
1784
|
+
StepperButton,
|
|
1785
|
+
{
|
|
1786
|
+
variant: "increment",
|
|
1787
|
+
size,
|
|
1788
|
+
...incrementButtonProps
|
|
1789
|
+
}
|
|
1790
|
+
))
|
|
1791
|
+
)),
|
|
1792
|
+
(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))
|
|
1793
|
+
)
|
|
1794
|
+
);
|
|
2230
1795
|
});
|
|
2231
|
-
const removeUniqueDOMProps = (props) => Object.fromEntries(
|
|
1796
|
+
const removeUniqueDOMProps = (props) => Object.fromEntries(
|
|
1797
|
+
Object.entries(props).filter(
|
|
1798
|
+
([name]) => name !== "id" && !name.startsWith("data-")
|
|
1799
|
+
)
|
|
1800
|
+
);
|
|
2232
1801
|
|
|
2233
|
-
const SecondarySidebarContext =
|
|
1802
|
+
const SecondarySidebarContext = React.createContext(null);
|
|
2234
1803
|
const useSecondarySidebarContext = () => {
|
|
2235
1804
|
const context = React.useContext(SecondarySidebarContext);
|
|
2236
1805
|
if (context) {
|
|
@@ -2245,22 +1814,25 @@ const SecondarySidebarProvider = ({
|
|
|
2245
1814
|
themeVariant,
|
|
2246
1815
|
children
|
|
2247
1816
|
}) => {
|
|
2248
|
-
var _a, _b, _c, _d;
|
|
2249
1817
|
const context = React.useContext(SecondarySidebarContext);
|
|
2250
|
-
const [secondarySidebarId, setSecondarySidebarId] = utils$2.useControlledState(openedId, defaultOpenedId
|
|
1818
|
+
const [secondarySidebarId, setSecondarySidebarId] = utils$2.useControlledState(openedId, defaultOpenedId ?? null, onOpenedIdChange);
|
|
2251
1819
|
const [content, setContent] = React.useState(null);
|
|
2252
|
-
return /* @__PURE__ */
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
1820
|
+
return /* @__PURE__ */ React.createElement(
|
|
1821
|
+
SecondarySidebarContext.Provider,
|
|
1822
|
+
{
|
|
1823
|
+
value: {
|
|
1824
|
+
openedId: context?.openedId ?? secondarySidebarId,
|
|
1825
|
+
setOpenedId: context?.setOpenedId ?? setSecondarySidebarId,
|
|
1826
|
+
content: context?.content ?? content,
|
|
1827
|
+
setContent: context?.setContent ?? setContent,
|
|
1828
|
+
themeVariant: themeVariant ?? context?.themeVariant
|
|
1829
|
+
}
|
|
1830
|
+
},
|
|
1831
|
+
children
|
|
1832
|
+
);
|
|
2261
1833
|
};
|
|
2262
1834
|
|
|
2263
|
-
const ResponsiveSidebarContext =
|
|
1835
|
+
const ResponsiveSidebarContext = React.createContext(null);
|
|
2264
1836
|
function useResponsiveSidebarContext() {
|
|
2265
1837
|
return React.useContext(ResponsiveSidebarContext);
|
|
2266
1838
|
}
|
|
@@ -2286,59 +1858,35 @@ const ResponsiveSidebarProvider = ({
|
|
|
2286
1858
|
onPanelOpenChange,
|
|
2287
1859
|
children
|
|
2288
1860
|
}) => {
|
|
2289
|
-
const [isOpen, setOpen] = utils$2.useControlledState(
|
|
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;
|
|
1861
|
+
const [isOpen, setOpen] = utils$2.useControlledState(
|
|
1862
|
+
isPanelOpen,
|
|
1863
|
+
defaultIsPanelOpen ?? false,
|
|
1864
|
+
onPanelOpenChange
|
|
1865
|
+
);
|
|
1866
|
+
return /* @__PURE__ */ React.createElement(
|
|
1867
|
+
ResponsiveSidebarContext.Provider,
|
|
1868
|
+
{
|
|
1869
|
+
value: {
|
|
1870
|
+
isPanelOpen: isOpen,
|
|
1871
|
+
setPanelOpen: setOpen,
|
|
1872
|
+
collapsed
|
|
1873
|
+
}
|
|
1874
|
+
},
|
|
1875
|
+
children
|
|
1876
|
+
);
|
|
2329
1877
|
};
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
"header"
|
|
2337
|
-
]);
|
|
1878
|
+
|
|
1879
|
+
const SidebarPanel = ({
|
|
1880
|
+
children,
|
|
1881
|
+
header,
|
|
1882
|
+
...props
|
|
1883
|
+
}) => {
|
|
2338
1884
|
const { openedId, setOpenedId, content } = useSecondarySidebarContext();
|
|
2339
1885
|
const responsiveContext = useResponsiveSidebarContext();
|
|
2340
1886
|
if (!responsiveContext) {
|
|
2341
|
-
throw new Error(
|
|
1887
|
+
throw new Error(
|
|
1888
|
+
"<SidebarPanel> must be rendered inside a <Sidebar.ResponsiveProvider>"
|
|
1889
|
+
);
|
|
2342
1890
|
}
|
|
2343
1891
|
const { isPanelOpen, setPanelOpen } = responsiveContext;
|
|
2344
1892
|
const isCollapsed = useIsSidebarCollapsed();
|
|
@@ -2347,41 +1895,60 @@ const SidebarPanel = (_a) => {
|
|
|
2347
1895
|
setPanelOpen(false);
|
|
2348
1896
|
}
|
|
2349
1897
|
}, [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
|
-
|
|
1898
|
+
return /* @__PURE__ */ React.createElement(
|
|
1899
|
+
sapphireReact.Panel,
|
|
1900
|
+
{
|
|
1901
|
+
...props,
|
|
1902
|
+
isOpen: isPanelOpen,
|
|
1903
|
+
onClose: () => setPanelOpen(false),
|
|
1904
|
+
onCloseTransitionDone: () => setOpenedId(null),
|
|
1905
|
+
alignLeft: true,
|
|
1906
|
+
isDismissable: true,
|
|
1907
|
+
width: 320
|
|
1908
|
+
},
|
|
1909
|
+
/* @__PURE__ */ React.createElement(
|
|
1910
|
+
sapphireReact.ModalLayout,
|
|
1911
|
+
{
|
|
1912
|
+
header: /* @__PURE__ */ React.createElement(
|
|
1913
|
+
sapphireReact.ModalLayout.Header,
|
|
1914
|
+
{
|
|
1915
|
+
heading: openedId === null ? header : content?.header,
|
|
1916
|
+
backButton: openedId !== null && /* @__PURE__ */ React.createElement(
|
|
1917
|
+
sapphireReact.IconButton,
|
|
1918
|
+
{
|
|
1919
|
+
size: "md",
|
|
1920
|
+
"aria-label": "Back",
|
|
1921
|
+
variant: "tertiary",
|
|
1922
|
+
marginLeft: `calc(-1 * ${sapphireReact.tokens.size.spacingSm})`,
|
|
1923
|
+
onPress: () => setOpenedId(null)
|
|
1924
|
+
},
|
|
1925
|
+
/* @__PURE__ */ React.createElement(react.ChevronLeft, null)
|
|
1926
|
+
)
|
|
1927
|
+
}
|
|
1928
|
+
),
|
|
1929
|
+
body: /* @__PURE__ */ React.createElement(
|
|
1930
|
+
sapphireReact.ModalLayout.Body,
|
|
1931
|
+
{
|
|
1932
|
+
noPadding: true,
|
|
1933
|
+
UNSAFE_style: {
|
|
1934
|
+
paddingLeft: sapphireReact.tokens.size.spacingMd.value,
|
|
1935
|
+
paddingRight: sapphireReact.tokens.size.spacingMd.value
|
|
1936
|
+
}
|
|
1937
|
+
},
|
|
1938
|
+
/* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(sapphireReact.View, { isHidden: openedId !== null }, children), openedId && content?.body)
|
|
1939
|
+
)
|
|
2373
1940
|
}
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
}, children), openedId && (content == null ? void 0 : content.body)))
|
|
2377
|
-
}));
|
|
1941
|
+
)
|
|
1942
|
+
);
|
|
2378
1943
|
};
|
|
2379
1944
|
const SidebarPanelTrigger = ({
|
|
2380
1945
|
children
|
|
2381
1946
|
}) => {
|
|
2382
1947
|
const context = useResponsiveSidebarContext();
|
|
2383
1948
|
if (!context) {
|
|
2384
|
-
throw new Error(
|
|
1949
|
+
throw new Error(
|
|
1950
|
+
"<Sidebar.PanelTrigger> should be rendered inside a <Sidebar.ResponsiveProvider>"
|
|
1951
|
+
);
|
|
2385
1952
|
}
|
|
2386
1953
|
const isCollapsed = useIsSidebarCollapsed();
|
|
2387
1954
|
const panelTriggerProps = {
|
|
@@ -2416,271 +1983,163 @@ const useSidebar = () => {
|
|
|
2416
1983
|
};
|
|
2417
1984
|
};
|
|
2418
1985
|
|
|
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
|
-
]);
|
|
1986
|
+
const Sidebar = ({
|
|
1987
|
+
themeVariant,
|
|
1988
|
+
openedSecondarySidebar,
|
|
1989
|
+
defaultOpenedSecondarySidebar,
|
|
1990
|
+
onSecondarySidebarChange,
|
|
1991
|
+
secondarySidebarThemeVariant,
|
|
1992
|
+
children,
|
|
1993
|
+
...props
|
|
1994
|
+
}) => {
|
|
2466
1995
|
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
|
-
]);
|
|
1996
|
+
return /* @__PURE__ */ React.createElement(
|
|
1997
|
+
SecondarySidebarProvider,
|
|
1998
|
+
{
|
|
1999
|
+
openedId: openedSecondarySidebar,
|
|
2000
|
+
defaultOpenedId: defaultOpenedSecondarySidebar,
|
|
2001
|
+
onOpenedIdChange: onSecondarySidebarChange,
|
|
2002
|
+
themeVariant: secondarySidebarThemeVariant
|
|
2003
|
+
},
|
|
2004
|
+
/* @__PURE__ */ React.createElement(WithThemeRoot, { themeVariant }, /* @__PURE__ */ React.createElement(SidebarContent, { ...props }, children))
|
|
2005
|
+
);
|
|
2006
|
+
};
|
|
2007
|
+
const SidebarContent = ({
|
|
2008
|
+
onBlurWithin,
|
|
2009
|
+
onFocusWithin,
|
|
2010
|
+
onFocusWithinChange,
|
|
2011
|
+
closeOnBlurWithin = true,
|
|
2012
|
+
header,
|
|
2013
|
+
panelHeader,
|
|
2014
|
+
children,
|
|
2015
|
+
...props
|
|
2016
|
+
}) => {
|
|
2494
2017
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
2495
2018
|
const { sidebarProps } = useSidebar();
|
|
2496
|
-
const { focusWithinProps } = interactions.useFocusWithin(
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2019
|
+
const { focusWithinProps } = interactions.useFocusWithin(
|
|
2020
|
+
utils.mergeProps(
|
|
2021
|
+
{
|
|
2022
|
+
onBlurWithin,
|
|
2023
|
+
onFocusWithin,
|
|
2024
|
+
onFocusWithinChange
|
|
2025
|
+
},
|
|
2026
|
+
closeOnBlurWithin ? sidebarProps : {}
|
|
2027
|
+
)
|
|
2028
|
+
);
|
|
2501
2029
|
const responsiveSidebarContext = useResponsiveSidebarContext();
|
|
2502
2030
|
const isCollapsed = useIsSidebarCollapsed();
|
|
2503
|
-
return /* @__PURE__ */
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2031
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, !isCollapsed && /* @__PURE__ */ React.createElement(
|
|
2032
|
+
"div",
|
|
2033
|
+
{
|
|
2034
|
+
...styleProps,
|
|
2035
|
+
...utils.filterDOMProps(props, { global: true }),
|
|
2036
|
+
...focusWithinProps,
|
|
2037
|
+
className: clsx(styles$6["sapphire-sidebar"]),
|
|
2038
|
+
tabIndex: -1
|
|
2039
|
+
},
|
|
2040
|
+
header,
|
|
2041
|
+
children
|
|
2042
|
+
), responsiveSidebarContext && /* @__PURE__ */ React.createElement(SidebarPanel, { header: panelHeader }, children));
|
|
2509
2043
|
};
|
|
2510
2044
|
const WithThemeRoot = ({
|
|
2511
2045
|
children,
|
|
2512
2046
|
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, {
|
|
2047
|
+
}) => themeVariant ? /* @__PURE__ */ React.createElement(
|
|
2048
|
+
sapphireReact.ThemeRoot,
|
|
2049
|
+
{
|
|
2050
|
+
variant: themeVariant,
|
|
2051
|
+
noSurface: true,
|
|
2052
|
+
height: "100%",
|
|
2053
|
+
width: "min-content"
|
|
2054
|
+
},
|
|
2055
|
+
children
|
|
2056
|
+
) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
2057
|
+
|
|
2058
|
+
const SidebarHeader = ({
|
|
2059
|
+
children,
|
|
2060
|
+
closeButtonProps,
|
|
2061
|
+
...props
|
|
2062
|
+
}) => {
|
|
2063
|
+
return /* @__PURE__ */ React.createElement(
|
|
2064
|
+
"div",
|
|
2065
|
+
{
|
|
2066
|
+
...utils.filterDOMProps(props),
|
|
2067
|
+
className: clsx(styles$6["sapphire-sidebar__header"])
|
|
2068
|
+
},
|
|
2553
2069
|
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;
|
|
2070
|
+
closeButtonProps && /* @__PURE__ */ React.createElement(sapphireReact.IconButton, { ...closeButtonProps, "aria-label": "Close" }, /* @__PURE__ */ React.createElement(react.CloseLarge, null))
|
|
2071
|
+
);
|
|
2596
2072
|
};
|
|
2597
|
-
|
|
2598
|
-
|
|
2073
|
+
|
|
2074
|
+
const SidebarItem = React.forwardRef(function SidebarItem2({ isActive, children, ...props }, ref) {
|
|
2599
2075
|
const { itemProps } = useSidebar();
|
|
2600
|
-
return /* @__PURE__ */
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2076
|
+
return /* @__PURE__ */ React.createElement("li", { className: clsx(styles$6["sapphire-sidebar__nav-item"]) }, /* @__PURE__ */ React.createElement(
|
|
2077
|
+
sapphireReact.Button,
|
|
2078
|
+
{
|
|
2079
|
+
ref,
|
|
2080
|
+
variant: "tertiary",
|
|
2081
|
+
elementType: "a",
|
|
2082
|
+
"aria-current": isActive ? "page" : void 0,
|
|
2083
|
+
...utils.mergeProps(props, itemProps),
|
|
2084
|
+
UNSAFE_className: clsx(
|
|
2085
|
+
buttonStyles["sapphire-button--stretch-left-align"],
|
|
2086
|
+
{ [buttonStyles["sapphire-button--selected"]]: isActive }
|
|
2087
|
+
)
|
|
2088
|
+
},
|
|
2089
|
+
children
|
|
2090
|
+
));
|
|
2610
2091
|
});
|
|
2611
2092
|
|
|
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, {
|
|
2093
|
+
const SidebarExpandableItem = React.forwardRef(
|
|
2094
|
+
function SidebarExpandableItem2({
|
|
2645
2095
|
id,
|
|
2646
2096
|
isActive,
|
|
2647
2097
|
body,
|
|
2648
2098
|
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
|
-
|
|
2099
|
+
children,
|
|
2100
|
+
...props
|
|
2101
|
+
}, ref) {
|
|
2102
|
+
const { openedId, setContent, themeVariant } = useSecondarySidebarContext();
|
|
2103
|
+
const isCollapsed = useIsSidebarCollapsed();
|
|
2104
|
+
const { getExpandableItemProps, secondarySidebarProps } = useSidebar();
|
|
2105
|
+
const itemId = utils.useId(id);
|
|
2106
|
+
const isOpen = openedId === itemId;
|
|
2107
|
+
React.useLayoutEffect(() => {
|
|
2108
|
+
if (isOpen) {
|
|
2109
|
+
setContent({ header, body });
|
|
2110
|
+
}
|
|
2111
|
+
}, [isOpen]);
|
|
2112
|
+
return /* @__PURE__ */ React.createElement("li", { className: clsx(styles$6["sapphire-sidebar__nav-item"]) }, /* @__PURE__ */ React.createElement(
|
|
2113
|
+
sapphireReact.Button,
|
|
2114
|
+
{
|
|
2115
|
+
variant: "tertiary",
|
|
2116
|
+
"aria-current": isActive || void 0,
|
|
2117
|
+
ref,
|
|
2118
|
+
...utils.mergeProps(
|
|
2119
|
+
getExpandableItemProps(itemId),
|
|
2120
|
+
props
|
|
2121
|
+
),
|
|
2122
|
+
UNSAFE_className: clsx(
|
|
2123
|
+
buttonStyles["sapphire-button--stretch-left-align"],
|
|
2124
|
+
{
|
|
2125
|
+
[buttonStyles["sapphire-button--selected"]]: isActive && !isOpen,
|
|
2126
|
+
[buttonStyles["is-active"]]: isOpen
|
|
2127
|
+
}
|
|
2128
|
+
)
|
|
2129
|
+
},
|
|
2130
|
+
children
|
|
2131
|
+
), /* @__PURE__ */ React.createElement(
|
|
2132
|
+
SecondarySidebar,
|
|
2133
|
+
{
|
|
2134
|
+
isOpen: isOpen && !isCollapsed,
|
|
2135
|
+
header,
|
|
2136
|
+
themeVariant,
|
|
2137
|
+
...secondarySidebarProps
|
|
2138
|
+
},
|
|
2139
|
+
body
|
|
2140
|
+
));
|
|
2141
|
+
}
|
|
2142
|
+
);
|
|
2684
2143
|
const SecondarySidebar = ({
|
|
2685
2144
|
isOpen,
|
|
2686
2145
|
onClose,
|
|
@@ -2693,188 +2152,134 @@ const SecondarySidebar = ({
|
|
|
2693
2152
|
React.useEffect(() => {
|
|
2694
2153
|
const handleKeyDown = (e) => {
|
|
2695
2154
|
if (e.key === "Escape") {
|
|
2696
|
-
onClose
|
|
2155
|
+
onClose?.();
|
|
2697
2156
|
}
|
|
2698
2157
|
};
|
|
2699
2158
|
document.addEventListener("keydown", handleKeyDown);
|
|
2700
2159
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
2701
2160
|
}, [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
|
-
]);
|
|
2161
|
+
return /* @__PURE__ */ React.createElement(
|
|
2162
|
+
reactTransitionGroup.Transition,
|
|
2163
|
+
{
|
|
2164
|
+
in: isOpen,
|
|
2165
|
+
mountOnEnter: true,
|
|
2166
|
+
nodeRef: ref,
|
|
2167
|
+
unmountOnExit: true,
|
|
2168
|
+
onExited: onCloseTransitionDone,
|
|
2169
|
+
timeout: 200
|
|
2170
|
+
},
|
|
2171
|
+
(transitionState) => /* @__PURE__ */ React.createElement(
|
|
2172
|
+
"div",
|
|
2173
|
+
{
|
|
2174
|
+
ref,
|
|
2175
|
+
className: clsx(styles$6["sapphire-sidebar__secondary-container"], {
|
|
2176
|
+
[styles$6["sapphire-sidebar--slide-in"]]: true,
|
|
2177
|
+
[styles$6["sapphire-sidebar--slide-out"]]: transitionState === "exiting"
|
|
2178
|
+
})
|
|
2179
|
+
},
|
|
2180
|
+
/* @__PURE__ */ React.createElement(focus.FocusScope, { restoreFocus: true, autoFocus: true }, /* @__PURE__ */ React.createElement(
|
|
2181
|
+
_Sidebar,
|
|
2182
|
+
{
|
|
2183
|
+
themeVariant,
|
|
2184
|
+
closeOnBlurWithin: false,
|
|
2185
|
+
header: /* @__PURE__ */ React.createElement(
|
|
2186
|
+
_Sidebar.Header,
|
|
2187
|
+
{
|
|
2188
|
+
closeButtonProps: {
|
|
2189
|
+
onPress: () => onClose?.()
|
|
2190
|
+
}
|
|
2191
|
+
},
|
|
2192
|
+
header
|
|
2193
|
+
),
|
|
2194
|
+
panelHeader: null
|
|
2195
|
+
},
|
|
2196
|
+
children
|
|
2197
|
+
))
|
|
2198
|
+
)
|
|
2199
|
+
);
|
|
2200
|
+
};
|
|
2201
|
+
|
|
2202
|
+
const SidebarSection = ({
|
|
2203
|
+
title,
|
|
2204
|
+
"aria-label": label,
|
|
2205
|
+
children,
|
|
2206
|
+
...props
|
|
2207
|
+
}) => {
|
|
2771
2208
|
sapphireReact.useThemeCheck();
|
|
2772
2209
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
2773
2210
|
const { itemProps, headingProps, groupProps } = listbox.useListBoxSection({
|
|
2774
2211
|
heading: title,
|
|
2775
2212
|
"aria-label": label
|
|
2776
2213
|
});
|
|
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;
|
|
2214
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2215
|
+
"li",
|
|
2216
|
+
{
|
|
2217
|
+
role: "separator",
|
|
2218
|
+
className: clsx(styles$6["sapphire-sidebar__separator"])
|
|
2219
|
+
}
|
|
2220
|
+
), /* @__PURE__ */ React.createElement(
|
|
2221
|
+
"li",
|
|
2222
|
+
{
|
|
2223
|
+
...itemProps,
|
|
2224
|
+
...styleProps,
|
|
2225
|
+
...utils.filterDOMProps(props, { global: true })
|
|
2226
|
+
},
|
|
2227
|
+
title && /* @__PURE__ */ React.createElement(
|
|
2228
|
+
"div",
|
|
2229
|
+
{
|
|
2230
|
+
...headingProps,
|
|
2231
|
+
className: clsx(styles$6["sapphire-sidebar__section-header"])
|
|
2232
|
+
},
|
|
2233
|
+
title
|
|
2234
|
+
),
|
|
2235
|
+
/* @__PURE__ */ React.createElement(
|
|
2236
|
+
"ul",
|
|
2237
|
+
{
|
|
2238
|
+
...groupProps,
|
|
2239
|
+
className: clsx(styles$6["sapphire-sidebar__section"])
|
|
2240
|
+
},
|
|
2241
|
+
children
|
|
2242
|
+
)
|
|
2243
|
+
));
|
|
2814
2244
|
};
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
"children"
|
|
2822
|
-
]);
|
|
2245
|
+
|
|
2246
|
+
const SidebarBody = ({
|
|
2247
|
+
elementType = "nav",
|
|
2248
|
+
children,
|
|
2249
|
+
...props
|
|
2250
|
+
}) => {
|
|
2823
2251
|
const RootNode = elementType;
|
|
2824
2252
|
const sidebarBody = React.useRef(null);
|
|
2825
2253
|
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",
|
|
2254
|
+
return /* @__PURE__ */ React.createElement(
|
|
2255
|
+
RootNode,
|
|
2256
|
+
{
|
|
2257
|
+
ref: sidebarBody,
|
|
2258
|
+
tabIndex: -1,
|
|
2259
|
+
className: clsx(styles$6["sapphire-sidebar__body"], {
|
|
2260
|
+
[styles$6["sapphire-sidebar__body--scrolled"]]: isScrolled
|
|
2261
|
+
}),
|
|
2262
|
+
...utils.filterDOMProps(props, { global: true }),
|
|
2263
|
+
...scrollCheckProps
|
|
2264
|
+
},
|
|
2869
2265
|
children
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2266
|
+
);
|
|
2267
|
+
};
|
|
2268
|
+
|
|
2269
|
+
const SidebarList = ({
|
|
2270
|
+
elementType = "ul",
|
|
2271
|
+
children,
|
|
2272
|
+
...props
|
|
2273
|
+
}) => {
|
|
2874
2274
|
const RootNode = elementType;
|
|
2875
|
-
return /* @__PURE__ */
|
|
2876
|
-
|
|
2877
|
-
|
|
2275
|
+
return /* @__PURE__ */ React.createElement(
|
|
2276
|
+
RootNode,
|
|
2277
|
+
{
|
|
2278
|
+
...utils.filterDOMProps(props, { global: true }),
|
|
2279
|
+
className: clsx(styles$6["sapphire-sidebar__nav-list"])
|
|
2280
|
+
},
|
|
2281
|
+
children
|
|
2282
|
+
);
|
|
2878
2283
|
};
|
|
2879
2284
|
|
|
2880
2285
|
const _Sidebar = Object.assign(Sidebar, {
|
|
@@ -2888,25 +2293,6 @@ const _Sidebar = Object.assign(Sidebar, {
|
|
|
2888
2293
|
PanelTrigger: SidebarPanelTrigger
|
|
2889
2294
|
});
|
|
2890
2295
|
|
|
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
2296
|
const ProgressIndicator = (props) => {
|
|
2911
2297
|
const {
|
|
2912
2298
|
maxValue = 100,
|
|
@@ -2916,332 +2302,265 @@ const ProgressIndicator = (props) => {
|
|
|
2916
2302
|
} = props;
|
|
2917
2303
|
sapphireReact.useThemeCheck();
|
|
2918
2304
|
const { styleProps } = sapphireReact.useSapphireStyleProps(props);
|
|
2919
|
-
const { progressBarProps } = progress.useProgressBar(
|
|
2305
|
+
const { progressBarProps } = progress.useProgressBar({
|
|
2306
|
+
...props,
|
|
2920
2307
|
minValue: 0,
|
|
2921
2308
|
valueLabel: ariaValueText
|
|
2922
|
-
})
|
|
2309
|
+
});
|
|
2923
2310
|
const minValue = 0;
|
|
2924
2311
|
const value = Math.min(Math.max(realValue, minValue), maxValue);
|
|
2925
2312
|
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;
|
|
2313
|
+
return /* @__PURE__ */ React.createElement(
|
|
2314
|
+
"div",
|
|
2315
|
+
{
|
|
2316
|
+
...utils.filterDOMProps(props, { global: true }),
|
|
2317
|
+
className: clsx(styles$7["sapphire-progress"])
|
|
2318
|
+
},
|
|
2319
|
+
/* @__PURE__ */ React.createElement(
|
|
2320
|
+
"div",
|
|
2321
|
+
{
|
|
2322
|
+
...progressBarProps,
|
|
2323
|
+
className: styles$7["sapphire-progress--indicator"],
|
|
2324
|
+
style: { ...styleProps, width: `${widthPercentage}%` },
|
|
2325
|
+
"aria-label": "aria-label" in props ? props["aria-label"] : void 0,
|
|
2326
|
+
"aria-labelledby": "aria-labelledby" in props ? props["aria-labelledby"] : void 0
|
|
2327
|
+
}
|
|
2328
|
+
),
|
|
2329
|
+
segments > 1 && /* @__PURE__ */ React.createElement("div", { className: styles$7["sapphire-progress--segments"] }, Array.from({ length: segments }, (_, index) => /* @__PURE__ */ React.createElement("span", { key: index })))
|
|
2330
|
+
);
|
|
2970
2331
|
};
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
"labelPlacement",
|
|
2980
|
-
"note",
|
|
2981
|
-
"name"
|
|
2982
|
-
]);
|
|
2332
|
+
|
|
2333
|
+
const Slider = ({
|
|
2334
|
+
label,
|
|
2335
|
+
labelPlacement = "above",
|
|
2336
|
+
note,
|
|
2337
|
+
name,
|
|
2338
|
+
...props
|
|
2339
|
+
}) => {
|
|
2983
2340
|
sapphireReact.useThemeCheck();
|
|
2984
2341
|
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
|
-
|
|
2342
|
+
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(
|
|
2343
|
+
reactAriaComponents.SliderTrack,
|
|
2344
|
+
{
|
|
2345
|
+
className: ({ isDisabled }) => clsx(styles$8["sapphire-slider__track"], {
|
|
2346
|
+
[styles$8["is-disabled"]]: isDisabled
|
|
2347
|
+
})
|
|
2348
|
+
},
|
|
2349
|
+
({ state }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2350
|
+
"div",
|
|
2351
|
+
{
|
|
2352
|
+
className: clsx(
|
|
2353
|
+
styles$8["sapphire-slider__track-remaining"]
|
|
2354
|
+
)
|
|
2355
|
+
}
|
|
2356
|
+
), /* @__PURE__ */ React.createElement(
|
|
2357
|
+
"div",
|
|
2358
|
+
{
|
|
2359
|
+
className: clsx(styles$8["sapphire-slider__track-fill"]),
|
|
2360
|
+
style: { width: state.getThumbPercent(0) * 100 + "%" }
|
|
2361
|
+
}
|
|
2362
|
+
), /* @__PURE__ */ React.createElement(
|
|
2363
|
+
reactAriaComponents.SliderThumb,
|
|
2364
|
+
{
|
|
2365
|
+
name,
|
|
2366
|
+
className: (state2) => clsx(styles$8["sapphire-slider__thumb"], {
|
|
2367
|
+
[styles$8["is-focus"]]: state2.isFocusVisible
|
|
2368
|
+
}),
|
|
2369
|
+
style: ({ state: state2 }) => {
|
|
2370
|
+
const percent = Math.min(
|
|
2371
|
+
3 + state2.getThumbPercent(0) * 94,
|
|
2372
|
+
100
|
|
2373
|
+
);
|
|
2374
|
+
return {
|
|
2375
|
+
left: `${percent}%`
|
|
2376
|
+
};
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
))
|
|
2380
|
+
)))), note && /* @__PURE__ */ React.createElement(sapphireReact.Field.Footer, null, note)));
|
|
3013
2381
|
};
|
|
3014
2382
|
|
|
3015
2383
|
const _Slider = Object.assign(Slider, {
|
|
3016
2384
|
Note: sapphireReact.Field.Note
|
|
3017
2385
|
});
|
|
3018
2386
|
|
|
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
2387
|
function Tag(props) {
|
|
3051
2388
|
sapphireReact.useThemeCheck();
|
|
3052
2389
|
const { hasError = false, item, state } = props;
|
|
3053
2390
|
const ref = React.useRef(null);
|
|
3054
|
-
const
|
|
2391
|
+
const {
|
|
3055
2392
|
gridCellProps,
|
|
3056
2393
|
isDisabled,
|
|
3057
2394
|
isFocused,
|
|
3058
2395
|
isPressed,
|
|
3059
2396
|
removeButtonProps,
|
|
3060
|
-
rowProps:
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
"isDisabled",
|
|
3064
|
-
"isFocused",
|
|
3065
|
-
"isPressed",
|
|
3066
|
-
"removeButtonProps",
|
|
3067
|
-
"rowProps"
|
|
3068
|
-
]);
|
|
2397
|
+
rowProps: { onKeyDown, ...rowProps },
|
|
2398
|
+
...otherProps
|
|
2399
|
+
} = tag.useTag(props, state, ref);
|
|
3069
2400
|
const { hoverProps, isHovered } = interactions.useHover({ isDisabled });
|
|
3070
2401
|
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
|
-
|
|
2402
|
+
return /* @__PURE__ */ React.createElement(sapphireReact.TooltipIfNeeded, { title: item.rendered }, (tooltipRef, tooltipProps) => {
|
|
2403
|
+
const { ref: tooltipTargetRef, ...restTooltipProps } = tooltipProps || {};
|
|
2404
|
+
return /* @__PURE__ */ React.createElement(focus.FocusRing, { focusRingClass: styles$9["is-focus"] }, /* @__PURE__ */ React.createElement(
|
|
2405
|
+
"div",
|
|
2406
|
+
{
|
|
2407
|
+
ref: utils.mergeRefs(ref, tooltipTargetRef),
|
|
2408
|
+
...utils.mergeProps(
|
|
2409
|
+
{
|
|
2410
|
+
onKeyDown: (e) => {
|
|
2411
|
+
if (e.key !== " ") {
|
|
2412
|
+
onKeyDown?.(e);
|
|
2413
|
+
} else {
|
|
2414
|
+
e.preventDefault();
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
},
|
|
2418
|
+
rowProps,
|
|
2419
|
+
hoverProps,
|
|
2420
|
+
restTooltipProps
|
|
2421
|
+
),
|
|
2422
|
+
className: clsx(
|
|
2423
|
+
styles$9["sapphire-tag"],
|
|
2424
|
+
styles$9["js-focus"],
|
|
2425
|
+
styles$9["js-hover"],
|
|
2426
|
+
{
|
|
2427
|
+
[styles$9["sapphire-tag--actionable"]]: hasAction,
|
|
2428
|
+
[styles$9["is-active"]]: hasAction && isPressed,
|
|
2429
|
+
[styles$9["is-hover"]]: hasAction && isHovered,
|
|
2430
|
+
[styles$9["is-disabled"]]: isDisabled
|
|
2431
|
+
}
|
|
2432
|
+
),
|
|
2433
|
+
...hasError ? { "aria-invalid": true } : {}
|
|
2434
|
+
},
|
|
2435
|
+
/* @__PURE__ */ React.createElement(
|
|
2436
|
+
"div",
|
|
2437
|
+
{
|
|
2438
|
+
...gridCellProps,
|
|
2439
|
+
className: styles$9["sapphire-tag__content"]
|
|
2440
|
+
},
|
|
2441
|
+
hasError && !isDisabled && /* @__PURE__ */ React.createElement(IconError, null),
|
|
2442
|
+
/* @__PURE__ */ React.createElement(
|
|
2443
|
+
"span",
|
|
2444
|
+
{
|
|
2445
|
+
ref: tooltipRef,
|
|
2446
|
+
className: styles$9["sapphire-tag__label"]
|
|
2447
|
+
},
|
|
2448
|
+
item.rendered
|
|
2449
|
+
),
|
|
2450
|
+
!isDisabled && props.allowsRemoving && /* @__PURE__ */ React.createElement(RemoveButton, { ...removeButtonProps })
|
|
2451
|
+
)
|
|
2452
|
+
));
|
|
3100
2453
|
});
|
|
3101
2454
|
}
|
|
3102
2455
|
function RemoveButton(removeButtonProps) {
|
|
3103
2456
|
const buttonRef = React.useRef(null);
|
|
3104
2457
|
const { buttonProps } = button.useButton(removeButtonProps, buttonRef);
|
|
3105
|
-
return /* @__PURE__ */
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
2458
|
+
return /* @__PURE__ */ React.createElement(
|
|
2459
|
+
"button",
|
|
2460
|
+
{
|
|
2461
|
+
...buttonProps,
|
|
2462
|
+
className: clsx(styles$9["sapphire-tag__button"], styles$9["js-focus"])
|
|
2463
|
+
},
|
|
2464
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Icon, { size: "sm" }, /* @__PURE__ */ React.createElement(react.Close, null))
|
|
2465
|
+
);
|
|
3110
2466
|
}
|
|
3111
2467
|
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;
|
|
2468
|
+
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
2469
|
};
|
|
2470
|
+
|
|
3150
2471
|
function TagGroup(props) {
|
|
3151
2472
|
sapphireReact.useThemeCheck();
|
|
3152
|
-
const
|
|
2473
|
+
const {
|
|
3153
2474
|
contextualHelp,
|
|
3154
2475
|
errorMessage,
|
|
3155
2476
|
label: labelText,
|
|
3156
2477
|
labelPlacement = "above",
|
|
3157
2478
|
note,
|
|
3158
|
-
onRemove: originalOnRemove
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
"errorMessage",
|
|
3162
|
-
"label",
|
|
3163
|
-
"labelPlacement",
|
|
3164
|
-
"note",
|
|
3165
|
-
"onRemove"
|
|
3166
|
-
]);
|
|
2479
|
+
onRemove: originalOnRemove,
|
|
2480
|
+
...otherProps
|
|
2481
|
+
} = props;
|
|
3167
2482
|
const ref = React.useRef(null);
|
|
3168
2483
|
const state = list.useListState(props);
|
|
3169
2484
|
const onRemove = originalOnRemove ? (keys) => {
|
|
3170
|
-
console.warn(
|
|
2485
|
+
console.warn(
|
|
2486
|
+
"The `onRemove` prop is deprecated and will be removed in future versions. Use the `onRemove` prop on the `TagItem` component instead."
|
|
2487
|
+
);
|
|
3171
2488
|
originalOnRemove(keys);
|
|
3172
2489
|
} : (keys) => {
|
|
3173
2490
|
Array.from(keys).forEach((key) => {
|
|
3174
|
-
var _a2, _b;
|
|
3175
2491
|
const item = state.collection.getItem(key);
|
|
3176
2492
|
if (item) {
|
|
3177
|
-
|
|
2493
|
+
item.props.onRemove?.();
|
|
3178
2494
|
}
|
|
3179
2495
|
});
|
|
3180
2496
|
};
|
|
3181
|
-
const { descriptionProps, gridProps, labelProps, errorMessageProps } = tag.useTagGroup(
|
|
3182
|
-
return /* @__PURE__ */
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
2497
|
+
const { descriptionProps, gridProps, labelProps, errorMessageProps } = tag.useTagGroup({ ...props, onRemove }, state, ref);
|
|
2498
|
+
return /* @__PURE__ */ React.createElement(
|
|
2499
|
+
sapphireReact.Field,
|
|
2500
|
+
{
|
|
2501
|
+
...otherProps,
|
|
2502
|
+
labelPlacement,
|
|
2503
|
+
labelVerticalAlignment: "top",
|
|
2504
|
+
noDefaultWidth: true
|
|
2505
|
+
},
|
|
2506
|
+
/* @__PURE__ */ React.createElement(
|
|
2507
|
+
sapphireReact.Field.Context,
|
|
2508
|
+
{
|
|
2509
|
+
descriptionProps: errorMessage ? errorMessageProps : descriptionProps
|
|
2510
|
+
},
|
|
2511
|
+
(labelText || contextualHelp) && /* @__PURE__ */ React.createElement(sapphireReact.Field.Label, null, /* @__PURE__ */ React.createElement(sapphireReact.Label, { ...labelProps, contextualHelp }, labelText)),
|
|
2512
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Field.Control, null, /* @__PURE__ */ React.createElement(
|
|
2513
|
+
"div",
|
|
2514
|
+
{
|
|
2515
|
+
...gridProps,
|
|
2516
|
+
ref,
|
|
2517
|
+
className: styles$9["sapphire-tag-group"]
|
|
2518
|
+
},
|
|
2519
|
+
Array.from(state.collection).map((item) => /* @__PURE__ */ React.createElement(
|
|
2520
|
+
Tag,
|
|
2521
|
+
{
|
|
2522
|
+
key: item.key,
|
|
2523
|
+
item,
|
|
2524
|
+
state,
|
|
2525
|
+
hasError: item.props.hasError,
|
|
2526
|
+
allowsRemoving: !!originalOnRemove || !!item.props.onRemove
|
|
2527
|
+
}
|
|
2528
|
+
))
|
|
2529
|
+
)),
|
|
2530
|
+
(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))
|
|
2531
|
+
)
|
|
2532
|
+
);
|
|
3202
2533
|
}
|
|
3203
2534
|
|
|
3204
2535
|
const TagItem = collections$1.Item;
|
|
3205
2536
|
|
|
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);
|
|
2537
|
+
const TimeSegment = ({ segment, state }) => segment.type === "hour" || segment.type === "minute" || segment.type === "dayPeriod" ? /* @__PURE__ */ React.createElement(EditableSegment, { segment, state }) : /* @__PURE__ */ React.createElement(SeparatorSegment, { segment });
|
|
2538
|
+
const SeparatorSegment = ({ segment }) => /* @__PURE__ */ React.createElement(
|
|
2539
|
+
"span",
|
|
2540
|
+
{
|
|
2541
|
+
"aria-hidden": "true",
|
|
2542
|
+
className: clsx(
|
|
2543
|
+
styles$a["sapphire-date-field__segment"],
|
|
2544
|
+
styles$a["sapphire-date-field__segment--separator"]
|
|
2545
|
+
)
|
|
2546
|
+
},
|
|
2547
|
+
segment.text
|
|
2548
|
+
);
|
|
3235
2549
|
const EditableSegment = ({ segment, state }) => {
|
|
3236
2550
|
const ref = React.useRef(null);
|
|
3237
2551
|
const { segmentProps } = datepicker.useDateSegment(segment, state, ref);
|
|
3238
|
-
return /* @__PURE__ */
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
2552
|
+
return /* @__PURE__ */ React.createElement(
|
|
2553
|
+
"div",
|
|
2554
|
+
{
|
|
2555
|
+
...segmentProps,
|
|
2556
|
+
style: segmentProps.style,
|
|
2557
|
+
ref,
|
|
2558
|
+
className: clsx(styles$a["sapphire-date-field__segment"], {
|
|
2559
|
+
[styles$a["sapphire-date-field__segment--filled"]]: !segment.isPlaceholder
|
|
2560
|
+
})
|
|
2561
|
+
},
|
|
2562
|
+
segment.text
|
|
2563
|
+
);
|
|
3245
2564
|
};
|
|
3246
2565
|
|
|
3247
2566
|
var clear$6 = "Nulstil";
|
|
@@ -3289,99 +2608,81 @@ var intlMessages = {
|
|
|
3289
2608
|
"sv-SE": se
|
|
3290
2609
|
};
|
|
3291
2610
|
|
|
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
2611
|
const isAnySegmentModified = (segments) => segments.map(({ type, isPlaceholder }) => {
|
|
3324
2612
|
return type !== "literal" && !isPlaceholder;
|
|
3325
2613
|
}).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
|
-
]);
|
|
2614
|
+
function _TimeField({
|
|
2615
|
+
// TODO many other props
|
|
2616
|
+
size = "lg",
|
|
2617
|
+
noClearButton = false,
|
|
2618
|
+
error,
|
|
2619
|
+
note,
|
|
2620
|
+
contextualHelp,
|
|
2621
|
+
necessityIndicator = false,
|
|
2622
|
+
...otherProps
|
|
2623
|
+
}, ref) {
|
|
3342
2624
|
sapphireReact.useThemeCheck();
|
|
3343
2625
|
const timeFieldRef = utils.useObjectRef(ref);
|
|
3344
2626
|
const { locale } = i18n.useLocale();
|
|
3345
2627
|
const formatMessage = i18n.useMessageFormatter(intlMessages);
|
|
3346
|
-
const state = datepicker$1.useTimeFieldState(
|
|
2628
|
+
const state = datepicker$1.useTimeFieldState({
|
|
2629
|
+
...otherProps,
|
|
3347
2630
|
locale,
|
|
3348
2631
|
isInvalid: error ? true : void 0
|
|
3349
|
-
})
|
|
3350
|
-
const { fieldProps, labelProps } = datepicker.useTimeField(
|
|
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
|
-
|
|
2632
|
+
});
|
|
2633
|
+
const { fieldProps, labelProps } = datepicker.useTimeField(
|
|
2634
|
+
{ ...otherProps },
|
|
2635
|
+
state,
|
|
2636
|
+
timeFieldRef
|
|
2637
|
+
);
|
|
2638
|
+
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(
|
|
2639
|
+
sapphireReact.Label,
|
|
2640
|
+
{
|
|
2641
|
+
...labelProps,
|
|
2642
|
+
size,
|
|
2643
|
+
necessityIndicator: otherProps.isRequired && necessityIndicator ? "required" : !otherProps.isRequired && necessityIndicator ? "optional" : void 0,
|
|
2644
|
+
contextualHelp
|
|
2645
|
+
},
|
|
2646
|
+
otherProps.label
|
|
2647
|
+
))), /* @__PURE__ */ React.createElement(sapphireReact.Field.Control, null, /* @__PURE__ */ React.createElement(
|
|
2648
|
+
"div",
|
|
2649
|
+
{
|
|
2650
|
+
className: clsx(styles$a["sapphire-date-field"], {
|
|
2651
|
+
[styles$a["sapphire-date-field--error"]]: state.isInvalid,
|
|
2652
|
+
[styles$a["sapphire-date-field--no-clear-button"]]: noClearButton,
|
|
2653
|
+
[styles$a["sapphire-date-field--no-calendar"]]: true,
|
|
2654
|
+
[styles$a["sapphire-date-field--md"]]: size === "md"
|
|
2655
|
+
})
|
|
2656
|
+
},
|
|
2657
|
+
/* @__PURE__ */ React.createElement(
|
|
2658
|
+
"div",
|
|
2659
|
+
{
|
|
2660
|
+
...fieldProps,
|
|
2661
|
+
className: styles$a["sapphire-date-field__input"],
|
|
2662
|
+
ref: timeFieldRef
|
|
2663
|
+
},
|
|
2664
|
+
state.segments.map((segment, i) => /* @__PURE__ */ React.createElement(TimeSegment, { key: i, segment, state }))
|
|
2665
|
+
),
|
|
2666
|
+
!noClearButton && !otherProps.isReadOnly && !otherProps.isDisabled && isAnySegmentModified(state.segments) && /* @__PURE__ */ React.createElement(
|
|
2667
|
+
sapphireReact.IconButton,
|
|
2668
|
+
{
|
|
2669
|
+
"aria-label": formatMessage("clear"),
|
|
2670
|
+
onPress: () => state.segments.forEach(
|
|
2671
|
+
(segment) => state.clearSegment(segment.type)
|
|
2672
|
+
),
|
|
2673
|
+
size: size === "md" ? "sm" : "md",
|
|
2674
|
+
UNSAFE_className: clsx(
|
|
2675
|
+
styles$a["sapphire-date-field__button"],
|
|
2676
|
+
styles$a["sapphire-date-field__button--clear"]
|
|
2677
|
+
)
|
|
2678
|
+
},
|
|
2679
|
+
/* @__PURE__ */ React.createElement(sapphireReact.Icon, null, /* @__PURE__ */ React.createElement(react.CloseOutline, null))
|
|
2680
|
+
)
|
|
2681
|
+
)), !!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
2682
|
}
|
|
3382
2683
|
const TimeField = React.forwardRef(_TimeField);
|
|
3383
2684
|
|
|
3384
|
-
Object.defineProperty(exports,
|
|
2685
|
+
Object.defineProperty(exports, "useLocale", {
|
|
3385
2686
|
enumerable: true,
|
|
3386
2687
|
get: function () { return i18n.useLocale; }
|
|
3387
2688
|
});
|