@strapi/design-system 1.3.1-alpha.0 → 1.3.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/dist/Accordion/AccordionContent.cjs +1 -1
- package/dist/Accordion/AccordionContent.js +37 -17
- package/dist/Accordion/AccordionToggle.cjs +6 -6
- package/dist/Accordion/AccordionToggle.js +96 -75
- package/dist/Alert/Alert.cjs +12 -12
- package/dist/Alert/Alert.js +102 -83
- package/dist/Badge/Badge.cjs +1 -1
- package/dist/Badge/Badge.js +47 -25
- package/dist/BaseButton/BaseButton.cjs +3 -3
- package/dist/BaseButton/BaseButton.js +42 -20
- package/dist/BaseCheckbox/BaseCheckbox.cjs +6 -6
- package/dist/BaseCheckbox/BaseCheckbox.js +55 -35
- package/dist/BaseLink/BaseLink.cjs +2 -2
- package/dist/BaseLink/BaseLink.js +43 -21
- package/dist/BaseRadio/BaseRadio.cjs +8 -8
- package/dist/BaseRadio/BaseRadio.js +51 -31
- package/dist/BaseRadio/RadioGroup.cjs +1 -1
- package/dist/BaseRadio/RadioGroup.js +44 -24
- package/dist/Box/BoxProps.cjs +1 -1
- package/dist/Box/BoxProps.js +19 -10
- package/dist/Breadcrumbs/Breadcrumbs.cjs +4 -4
- package/dist/Breadcrumbs/Breadcrumbs.js +50 -29
- package/dist/Button/Button.cjs +14 -14
- package/dist/Button/Button.js +73 -53
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.js +37 -17
- package/dist/Card/CardAsset.cjs +4 -4
- package/dist/Card/CardAsset.js +42 -19
- package/dist/Card/CardBadge.cjs +3 -3
- package/dist/Card/CardBadge.js +18 -9
- package/dist/Card/CardBody.cjs +1 -1
- package/dist/Card/CardBody.js +19 -8
- package/dist/Card/CardCheckbox.cjs +1 -1
- package/dist/Card/CardCheckbox.js +22 -12
- package/dist/Card/CardContent.cjs +2 -2
- package/dist/Card/CardContent.js +32 -11
- package/dist/Card/CardHeader.cjs +2 -2
- package/dist/Card/CardHeader.js +19 -9
- package/dist/Card/CardTimer.cjs +2 -2
- package/dist/Card/CardTimer.js +42 -20
- package/dist/Card/CardTitle.cjs +1 -1
- package/dist/Card/CardTitle.js +27 -16
- package/dist/CarouselInput/Carousel.cjs +6 -6
- package/dist/CarouselInput/Carousel.js +107 -77
- package/dist/CarouselInput/CarouselActions.cjs +1 -1
- package/dist/CarouselInput/CarouselActions.js +17 -7
- package/dist/CarouselInput/CarouselImage.cjs +3 -3
- package/dist/CarouselInput/CarouselImage.js +38 -26
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +83 -49
- package/dist/CarouselInput/CarouselSlide.cjs +2 -2
- package/dist/CarouselInput/CarouselSlide.js +42 -20
- package/dist/Checkbox/Checkbox.cjs +2 -2
- package/dist/Checkbox/Checkbox.js +63 -44
- package/dist/Combobox/Combobox.cjs +1 -1
- package/dist/Combobox/Combobox.js +240 -190
- package/dist/Combobox/ComboboxOption.cjs +1 -1
- package/dist/Combobox/ComboboxOption.js +47 -25
- package/dist/Combobox/utils.cjs +1 -1
- package/dist/Combobox/utils.js +18 -18
- package/dist/DatePicker/DatePicker.cjs +1 -1
- package/dist/DatePicker/DatePicker.js +111 -80
- package/dist/DatePicker/DatePickerCalendar.cjs +1 -1
- package/dist/DatePicker/DatePickerCalendar.js +1 -1
- package/dist/DatePicker/DatePickerTd.cjs +4 -4
- package/dist/DatePicker/DatePickerTd.js +42 -23
- package/dist/DatePicker/DatePickerTh.cjs +3 -3
- package/dist/DatePicker/DatePickerTh.js +44 -23
- package/dist/DatePicker/utils/getYears.cjs +1 -1
- package/dist/DatePicker/utils/getYears.js +7 -6
- package/dist/Dialog/Dialog.cjs +5 -5
- package/dist/Dialog/Dialog.js +58 -39
- package/dist/DismissibleLayer/DismissibleLayer.cjs +1 -1
- package/dist/DismissibleLayer/DismissibleLayer.js +29 -26
- package/dist/Divider/Divider.cjs +2 -2
- package/dist/Divider/Divider.js +38 -15
- package/dist/Field/Field.cjs +1 -1
- package/dist/Field/Field.js +38 -19
- package/dist/Field/FieldAction.cjs +2 -2
- package/dist/Field/FieldAction.js +35 -13
- package/dist/Field/FieldInput.cjs +6 -6
- package/dist/Field/FieldInput.js +66 -46
- package/dist/Field/FieldLabel.cjs +3 -3
- package/dist/Field/FieldLabel.js +45 -25
- package/dist/Flex/FlexProps.cjs +1 -1
- package/dist/Flex/FlexProps.js +19 -10
- package/dist/FocusTrap/FocusTrap.cjs +1 -1
- package/dist/FocusTrap/FocusTrap.js +52 -32
- package/dist/Grid/Grid.cjs +3 -3
- package/dist/Grid/Grid.js +42 -20
- package/dist/Grid/GridItem.cjs +2 -2
- package/dist/Grid/GridItem.js +41 -22
- package/dist/Icon/Icon.cjs +2 -2
- package/dist/Icon/Icon.js +27 -17
- package/dist/IconButton/IconButton.cjs +4 -4
- package/dist/IconButton/IconButton.js +67 -47
- package/dist/KeyboardNavigable/KeyboardNavigable.cjs +1 -1
- package/dist/KeyboardNavigable/KeyboardNavigable.js +58 -38
- package/dist/Layout/HeaderLayout.cjs +2 -2
- package/dist/Layout/HeaderLayout.js +96 -78
- package/dist/Link/Link.cjs +6 -6
- package/dist/Link/Link.js +54 -34
- package/dist/LinkButton/LinkButton.cjs +10 -10
- package/dist/LinkButton/LinkButton.js +69 -47
- package/dist/Loader/Loader.cjs +4 -4
- package/dist/Loader/Loader.js +47 -25
- package/dist/Main/Main.cjs +2 -2
- package/dist/Main/Main.js +35 -15
- package/dist/MainNav/MainNav.cjs +2 -2
- package/dist/MainNav/MainNav.js +39 -17
- package/dist/MainNav/NavCondense.cjs +3 -3
- package/dist/MainNav/NavCondense.js +40 -20
- package/dist/MainNav/NavLink.cjs +9 -9
- package/dist/MainNav/NavLink.js +72 -53
- package/dist/MainNav/NavSection.cjs +1 -1
- package/dist/MainNav/NavSection.js +67 -46
- package/dist/MainNav/NavSections.cjs +1 -1
- package/dist/MainNav/NavSections.js +40 -18
- package/dist/MainNav/NavUser.cjs +2 -2
- package/dist/MainNav/NavUser.js +51 -31
- package/dist/ModalLayout/ModalBody.cjs +2 -2
- package/dist/ModalLayout/ModalBody.js +19 -9
- package/dist/ModalLayout/ModalLayout.cjs +3 -3
- package/dist/ModalLayout/ModalLayout.js +52 -30
- package/dist/NumberInput/NumberInput.cjs +6 -6
- package/dist/NumberInput/NumberInput.js +154 -120
- package/dist/Pagination/components.cjs +7 -7
- package/dist/Pagination/components.js +88 -65
- package/dist/Popover/Popover.cjs +3 -3
- package/dist/Popover/Popover.js +91 -65
- package/dist/Portal/Portal.cjs +1 -1
- package/dist/Portal/Portal.js +12 -11
- package/dist/ProgressBar/ProgressBar.cjs +2 -2
- package/dist/ProgressBar/ProgressBar.js +49 -27
- package/dist/Radio/Radio.cjs +2 -2
- package/dist/Radio/Radio.js +40 -19
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +79 -59
- package/dist/RawTable/RawTable.cjs +1 -1
- package/dist/RawTable/RawTable.js +66 -46
- package/dist/RawTable/RawTbody.cjs +1 -1
- package/dist/RawTable/RawTbody.js +30 -11
- package/dist/RawTable/RawThead.cjs +1 -1
- package/dist/RawTable/RawThead.js +29 -10
- package/dist/RawTable/RawTr.cjs +1 -1
- package/dist/RawTable/RawTr.js +34 -14
- package/dist/Searchbar/SearchForm.cjs +1 -1
- package/dist/Searchbar/SearchForm.js +16 -5
- package/dist/Searchbar/Searchbar.cjs +7 -7
- package/dist/Searchbar/Searchbar.js +65 -45
- package/dist/Select/MultiSelectNested.cjs +1 -1
- package/dist/Select/MultiSelectNested.js +45 -23
- package/dist/Select/OptGroup.cjs +1 -1
- package/dist/Select/OptGroup.js +35 -15
- package/dist/Select/Option.cjs +7 -7
- package/dist/Select/Option.js +57 -37
- package/dist/Select/Select.cjs +2 -2
- package/dist/Select/Select.js +183 -144
- package/dist/Select/SelectButton.cjs +2 -2
- package/dist/Select/SelectButton.js +53 -33
- package/dist/SimpleMenu/SimpleMenu.cjs +7 -7
- package/dist/SimpleMenu/SimpleMenu.js +145 -119
- package/dist/Stack/Stack.cjs +3 -3
- package/dist/Stack/Stack.js +50 -29
- package/dist/Status/Status.cjs +4 -4
- package/dist/Status/Status.js +50 -30
- package/dist/SubNav/SubNav.cjs +3 -3
- package/dist/SubNav/SubNav.js +37 -15
- package/dist/SubNav/SubNavHeader.cjs +2 -2
- package/dist/SubNav/SubNavHeader.js +40 -39
- package/dist/SubNav/SubNavLink.cjs +6 -6
- package/dist/SubNav/SubNavLink.js +62 -40
- package/dist/SubNav/SubNavSections.cjs +1 -1
- package/dist/SubNav/SubNavSections.js +39 -17
- package/dist/Switch/Switch.cjs +5 -5
- package/dist/Switch/Switch.js +57 -35
- package/dist/Table/Cell.cjs +3 -3
- package/dist/Table/Cell.js +40 -20
- package/dist/Table/TFooter.cjs +3 -3
- package/dist/Table/TFooter.js +50 -28
- package/dist/Table/Table.cjs +5 -5
- package/dist/Table/Table.js +56 -36
- package/dist/Table/Tbody.cjs +2 -2
- package/dist/Table/Tbody.js +17 -8
- package/dist/Table/Thead.cjs +2 -2
- package/dist/Table/Thead.js +17 -8
- package/dist/Table/Tr.cjs +2 -2
- package/dist/Table/Tr.js +17 -8
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +45 -26
- package/dist/Tabs/TabPanels.cjs +1 -1
- package/dist/Tabs/TabPanels.js +43 -24
- package/dist/Tabs/Tabs.cjs +2 -2
- package/dist/Tabs/Tabs.js +112 -94
- package/dist/Tag/Tag.cjs +4 -4
- package/dist/Tag/Tag.js +50 -27
- package/dist/TextButton/TextButton.cjs +6 -6
- package/dist/TextButton/TextButton.js +59 -39
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +69 -49
- package/dist/Textarea/Textarea.cjs +3 -3
- package/dist/Textarea/Textarea.js +63 -43
- package/dist/Textarea/TextareaInput.cjs +4 -4
- package/dist/Textarea/TextareaInput.js +49 -29
- package/dist/TimePicker/TimePicker.cjs +3 -3
- package/dist/TimePicker/TimePicker.js +89 -58
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +8 -8
- package/dist/ToggleCheckbox/ToggleCheckbox.js +75 -53
- package/dist/ToggleInput/ToggleInput.cjs +3 -3
- package/dist/ToggleInput/ToggleInput.js +98 -66
- package/dist/Tooltip/Tooltip.cjs +2 -2
- package/dist/Tooltip/Tooltip.js +57 -38
- package/dist/Typography/TypographyProps.cjs +1 -1
- package/dist/Typography/TypographyProps.js +22 -13
- package/dist/helpers/getDefaultLocale.cjs +1 -1
- package/dist/helpers/getDefaultLocale.js +1 -1
- package/dist/helpers/handleResponsiveValues.cjs +5 -5
- package/dist/helpers/handleResponsiveValues.js +14 -14
- package/dist/themes/darkTheme/index.cjs +1 -1
- package/dist/themes/darkTheme/index.js +18 -8
- package/dist/themes/extendTheme.cjs +4 -4
- package/dist/themes/extendTheme.js +29 -18
- package/dist/themes/lightTheme/index.cjs +1 -1
- package/dist/themes/lightTheme/index.js +18 -8
- package/dist/v2/Breadcrumbs/Breadcrumbs.cjs +2 -2
- package/dist/v2/Breadcrumbs/Breadcrumbs.js +43 -23
- package/dist/v2/Breadcrumbs/Crumb.cjs +1 -1
- package/dist/v2/Breadcrumbs/Crumb.js +44 -22
- package/dist/v2/Breadcrumbs/CrumbLink.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbLink.js +35 -14
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +41 -19
- package/dist/v2/Link/Link.cjs +5 -5
- package/dist/v2/Link/Link.js +64 -42
- package/dist/v2/LinkButton/LinkButton.cjs +10 -10
- package/dist/v2/LinkButton/LinkButton.js +75 -51
- package/dist/v2/MainNav/MainNav.cjs +2 -2
- package/dist/v2/MainNav/MainNav.js +39 -17
- package/dist/v2/MainNav/NavBrand.cjs +3 -3
- package/dist/v2/MainNav/NavBrand.js +78 -57
- package/dist/v2/MainNav/NavCondense.cjs +3 -3
- package/dist/v2/MainNav/NavCondense.js +40 -20
- package/dist/v2/MainNav/NavLink.cjs +9 -9
- package/dist/v2/MainNav/NavLink.js +77 -56
- package/dist/v2/MainNav/NavSection.cjs +1 -1
- package/dist/v2/MainNav/NavSection.js +67 -46
- package/dist/v2/MainNav/NavSections.cjs +1 -1
- package/dist/v2/MainNav/NavSections.js +40 -18
- package/dist/v2/MainNav/NavUser.cjs +2 -2
- package/dist/v2/MainNav/NavUser.js +51 -31
- package/dist/v2/Pagination/components.cjs +7 -7
- package/dist/v2/Pagination/components.js +89 -65
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +7 -7
- package/dist/v2/SimpleMenu/SimpleMenu.js +145 -119
- package/dist/v2/SubNav/SubNav.cjs +3 -3
- package/dist/v2/SubNav/SubNav.js +37 -15
- package/dist/v2/SubNav/SubNavHeader.cjs +2 -2
- package/dist/v2/SubNav/SubNavHeader.js +40 -39
- package/dist/v2/SubNav/SubNavLink.cjs +6 -6
- package/dist/v2/SubNav/SubNavLink.js +65 -43
- package/dist/v2/SubNav/SubNavSections.cjs +1 -1
- package/dist/v2/SubNav/SubNavSections.js +39 -17
- package/package.json +5 -4
package/dist/Popover/Popover.js
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var i = Object.getOwnPropertySymbols;
|
|
3
|
+
var b = Object.prototype.hasOwnProperty, g = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var h = (e, o, t) => o in e ? L(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t, p = (e, o) => {
|
|
5
|
+
for (var t in o || (o = {}))
|
|
6
|
+
b.call(o, t) && h(e, t, o[t]);
|
|
7
|
+
if (i)
|
|
8
|
+
for (var t of i(o))
|
|
9
|
+
g.call(o, t) && h(e, t, o[t]);
|
|
10
|
+
return e;
|
|
11
|
+
};
|
|
12
|
+
var w = (e, o) => {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var r in e)
|
|
15
|
+
b.call(e, r) && o.indexOf(r) < 0 && (t[r] = e[r]);
|
|
16
|
+
if (e != null && i)
|
|
17
|
+
for (var r of i(e))
|
|
18
|
+
o.indexOf(r) < 0 && g.call(e, r) && (t[r] = e[r]);
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import * as s from "react";
|
|
22
|
+
import n from "prop-types";
|
|
23
|
+
import v from "styled-components";
|
|
24
|
+
import { useFloating as z, offset as A, shift as C, flip as M, autoUpdate as B } from "@floating-ui/react-dom";
|
|
25
|
+
import { Box as d } from "../Box/Box.js";
|
|
26
|
+
import { Portal as D } from "../Portal/Portal.js";
|
|
27
|
+
import { useIntersection as F } from "../helpers/useIntersection.js";
|
|
28
|
+
const N = [
|
|
9
29
|
"top",
|
|
10
30
|
"top-start",
|
|
11
31
|
"top-end",
|
|
@@ -18,12 +38,12 @@ const L = [
|
|
|
18
38
|
"left",
|
|
19
39
|
"left-start",
|
|
20
40
|
"left-end"
|
|
21
|
-
],
|
|
41
|
+
], U = v(d)`
|
|
22
42
|
box-shadow: ${({ theme: e }) => e.shadows.filterShadow};
|
|
23
43
|
z-index: 4;
|
|
24
44
|
border: 1px solid ${({ theme: e }) => e.colors.neutral150};
|
|
25
45
|
background: ${({ theme: e }) => e.colors.neutral0};
|
|
26
|
-
`,
|
|
46
|
+
`, V = v(d)`
|
|
27
47
|
// 16 is base base size, 3 is the factor to get closer to 40px and 5 is the number of elements visible in the list
|
|
28
48
|
max-height: ${3 * 5}rem;
|
|
29
49
|
overflow-y: auto;
|
|
@@ -43,80 +63,86 @@ const L = [
|
|
|
43
63
|
border-radius: ${({ theme: e }) => e.borderRadius};
|
|
44
64
|
margin-right: 10px;
|
|
45
65
|
}
|
|
46
|
-
`,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
66
|
+
`, c = (_) => {
|
|
67
|
+
var f = _, {
|
|
68
|
+
source: e,
|
|
69
|
+
children: o,
|
|
70
|
+
spacing: t,
|
|
71
|
+
fullWidth: r,
|
|
72
|
+
placement: P,
|
|
73
|
+
onReachEnd: l,
|
|
74
|
+
intersectionId: a,
|
|
75
|
+
centered: k
|
|
76
|
+
} = f, R = w(f, [
|
|
77
|
+
"source",
|
|
78
|
+
"children",
|
|
79
|
+
"spacing",
|
|
80
|
+
"fullWidth",
|
|
81
|
+
"placement",
|
|
82
|
+
"onReachEnd",
|
|
83
|
+
"intersectionId",
|
|
84
|
+
"centered"
|
|
85
|
+
]);
|
|
86
|
+
const u = s.useRef(null), [m, $] = s.useState(void 0), { x: W, y: T, reference: O, floating: S, strategy: q } = z({
|
|
58
87
|
strategy: "fixed",
|
|
59
|
-
placement:
|
|
88
|
+
placement: k ? "bottom" : P,
|
|
60
89
|
middleware: [
|
|
61
|
-
|
|
62
|
-
mainAxis:
|
|
90
|
+
A({
|
|
91
|
+
mainAxis: t
|
|
63
92
|
}),
|
|
64
|
-
|
|
65
|
-
|
|
93
|
+
C(),
|
|
94
|
+
M()
|
|
66
95
|
],
|
|
67
|
-
whileElementsMounted:
|
|
96
|
+
whileElementsMounted: B
|
|
68
97
|
});
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
}, [e]),
|
|
72
|
-
|
|
73
|
-
}, [
|
|
74
|
-
selectorToWatch: `#${
|
|
75
|
-
skipWhen: !
|
|
76
|
-
}), /* @__PURE__ */
|
|
77
|
-
ref:
|
|
98
|
+
return s.useLayoutEffect(() => {
|
|
99
|
+
O(e.current);
|
|
100
|
+
}, [e]), s.useLayoutEffect(() => {
|
|
101
|
+
r && $(e.current.offsetWidth);
|
|
102
|
+
}, [r]), F(u, l, {
|
|
103
|
+
selectorToWatch: `#${a}`,
|
|
104
|
+
skipWhen: !a || !l
|
|
105
|
+
}), /* @__PURE__ */ s.createElement(U, {
|
|
106
|
+
ref: S,
|
|
78
107
|
style: {
|
|
79
|
-
left:
|
|
80
|
-
top:
|
|
81
|
-
position:
|
|
82
|
-
width:
|
|
108
|
+
left: W,
|
|
109
|
+
top: T,
|
|
110
|
+
position: q,
|
|
111
|
+
width: m || void 0
|
|
83
112
|
},
|
|
84
113
|
hasRadius: !0,
|
|
85
114
|
background: "neutral0",
|
|
86
115
|
padding: 1
|
|
87
|
-
}, /* @__PURE__ */
|
|
88
|
-
ref:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
id: r,
|
|
116
|
+
}, /* @__PURE__ */ s.createElement(V, p({
|
|
117
|
+
ref: u
|
|
118
|
+
}, R), o, a && l && /* @__PURE__ */ s.createElement(d, {
|
|
119
|
+
id: a,
|
|
92
120
|
width: "100%",
|
|
93
121
|
height: "1px"
|
|
94
122
|
})));
|
|
95
|
-
},
|
|
96
|
-
...e
|
|
97
|
-
})), f = {
|
|
123
|
+
}, x = (e) => /* @__PURE__ */ s.createElement(D, null, /* @__PURE__ */ s.createElement(c, p({}, e))), y = {
|
|
98
124
|
fullWidth: !1,
|
|
99
125
|
intersectionId: void 0,
|
|
100
126
|
onReachEnd: void 0,
|
|
101
127
|
centered: !1,
|
|
102
128
|
placement: "bottom-start"
|
|
103
|
-
},
|
|
104
|
-
centered:
|
|
105
|
-
children:
|
|
106
|
-
fullWidth:
|
|
107
|
-
intersectionId:
|
|
108
|
-
onReachEnd:
|
|
109
|
-
placement:
|
|
110
|
-
source:
|
|
111
|
-
current: (typeof Element
|
|
129
|
+
}, E = {
|
|
130
|
+
centered: n.bool,
|
|
131
|
+
children: n.node.isRequired,
|
|
132
|
+
fullWidth: n.bool,
|
|
133
|
+
intersectionId: n.string,
|
|
134
|
+
onReachEnd: n.func,
|
|
135
|
+
placement: n.oneOf(N),
|
|
136
|
+
source: n.shape({
|
|
137
|
+
current: (typeof Element == "undefined" ? n.any : n.instanceOf(Element)).isRequired
|
|
112
138
|
}).isRequired,
|
|
113
|
-
spacing:
|
|
139
|
+
spacing: n.number
|
|
114
140
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
141
|
+
c.propTypes = E;
|
|
142
|
+
c.defaultProps = y;
|
|
143
|
+
x.propTypes = E;
|
|
144
|
+
x.defaultProps = y;
|
|
119
145
|
export {
|
|
120
|
-
|
|
121
|
-
|
|
146
|
+
N as POPOVER_PLACEMENTS,
|
|
147
|
+
x as Popover
|
|
122
148
|
};
|
package/dist/Portal/Portal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),a=require("react-dom"),s=require("prop-types"),l=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},d=l(s),o=({children:e})=>{const t=r.useRef(null),[n,c]=r.useState(!1);return r.useLayoutEffect(()=>(t.current=document.createElement("div"),t.current.setAttribute("data-react-portal","true"),document.body.appendChild(t.current),c(!0),()=>{var u;(u=t.current)==null||u.remove()}),[]),!n||!t.current?null:a.createPortal(e,t.current)};o.propTypes={children:d.default.node.isRequired};exports.Portal=o;
|
package/dist/Portal/Portal.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { createPortal as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
const e =
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useRef as n, useState as c, useLayoutEffect as a } from "react";
|
|
2
|
+
import { createPortal as d } from "react-dom";
|
|
3
|
+
import p from "prop-types";
|
|
4
|
+
const s = ({ children: t }) => {
|
|
5
|
+
const e = n(null), [o, u] = c(!1);
|
|
6
|
+
return a(() => (e.current = document.createElement("div"), e.current.setAttribute("data-react-portal", "true"), document.body.appendChild(e.current), u(!0), () => {
|
|
7
|
+
var r;
|
|
8
|
+
(r = e.current) == null || r.remove();
|
|
9
|
+
}), []), !o || !e.current ? null : d(t, e.current);
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
children:
|
|
11
|
+
s.propTypes = {
|
|
12
|
+
children: p.node.isRequired
|
|
12
13
|
};
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
+
s as Portal
|
|
15
16
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";var g=Object.defineProperty;var s=Object.getOwnPropertySymbols;var c=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;var d=(e,r,t)=>r in e?g(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,f=(e,r)=>{for(var t in r||(r={}))c.call(r,t)&&d(e,t,r[t]);if(s)for(var t of s(r))p.call(r,t)&&d(e,t,r[t]);return e};var b=(e,r)=>{var t={};for(var o in e)c.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&s)for(var o of s(e))r.indexOf(o)<0&&p.call(e,o)&&(t[o]=e[o]);return t};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("react"),x=require("prop-types"),_=require("styled-components"),v=require("../Box/Box.cjs"),u=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},B=u(y),a=u(x),P=u(_),h=P.default(v.Box)`
|
|
2
2
|
&:before {
|
|
3
3
|
background-color: ${({theme:e})=>e.colors.neutral0};
|
|
4
4
|
border-radius: ${({theme:e})=>e.borderRadius};
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
top: 0;
|
|
9
9
|
width: ${({value:e})=>`${e}%`};
|
|
10
10
|
}
|
|
11
|
-
`,
|
|
11
|
+
`,l=q=>{var i=q,{min:e,max:r,value:t,children:o,size:n}=i,m=b(i,["min","max","value","children","size"]);return B.default.createElement(h,f({background:"neutral600",hasRadius:!0,"aria-label":o,"aria-valuemax":r,"aria-valuemin":e,"aria-valuenow":t,height:n==="S"?1:2,position:"relative",role:"progressbar",value:t,width:n==="S"?"78px":"102px"},m))};l.defaultProps={min:0,max:100,value:0,size:"M"};l.propTypes={children:a.default.node.isRequired,max:a.default.number,min:a.default.number,size:a.default.oneOf(["S","M"]),value:a.default.number};exports.ProgressBar=l;
|
|
@@ -1,8 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var i = Object.getOwnPropertySymbols;
|
|
3
|
+
var m = Object.prototype.hasOwnProperty, l = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var u = (r, o, e) => o in r ? f(r, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[o] = e, p = (r, o) => {
|
|
5
|
+
for (var e in o || (o = {}))
|
|
6
|
+
m.call(o, e) && u(r, e, o[e]);
|
|
7
|
+
if (i)
|
|
8
|
+
for (var e of i(o))
|
|
9
|
+
l.call(o, e) && u(r, e, o[e]);
|
|
10
|
+
return r;
|
|
11
|
+
};
|
|
12
|
+
var d = (r, o) => {
|
|
13
|
+
var e = {};
|
|
14
|
+
for (var a in r)
|
|
15
|
+
m.call(r, a) && o.indexOf(a) < 0 && (e[a] = r[a]);
|
|
16
|
+
if (r != null && i)
|
|
17
|
+
for (var a of i(r))
|
|
18
|
+
o.indexOf(a) < 0 && l.call(r, a) && (e[a] = r[a]);
|
|
19
|
+
return e;
|
|
20
|
+
};
|
|
21
|
+
import x from "react";
|
|
22
|
+
import t from "prop-types";
|
|
23
|
+
import g from "styled-components";
|
|
24
|
+
import { Box as h } from "../Box/Box.js";
|
|
25
|
+
const v = g(h)`
|
|
6
26
|
&:before {
|
|
7
27
|
background-color: ${({ theme: r }) => r.colors.neutral0};
|
|
8
28
|
border-radius: ${({ theme: r }) => r.borderRadius};
|
|
@@ -12,33 +32,35 @@ const p = m(l)`
|
|
|
12
32
|
top: 0;
|
|
13
33
|
width: ${({ value: r }) => `${r}%`};
|
|
14
34
|
}
|
|
15
|
-
`,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
`, b = (P) => {
|
|
36
|
+
var n = P, { min: r, max: o, value: e, children: a, size: s } = n, c = d(n, ["min", "max", "value", "children", "size"]);
|
|
37
|
+
return /* @__PURE__ */ x.createElement(v, p({
|
|
38
|
+
background: "neutral600",
|
|
39
|
+
hasRadius: !0,
|
|
40
|
+
"aria-label": a,
|
|
41
|
+
"aria-valuemax": o,
|
|
42
|
+
"aria-valuemin": r,
|
|
43
|
+
"aria-valuenow": e,
|
|
44
|
+
height: s === "S" ? 1 : 2,
|
|
45
|
+
position: "relative",
|
|
46
|
+
role: "progressbar",
|
|
47
|
+
value: e,
|
|
48
|
+
width: s === "S" ? "78px" : "102px"
|
|
49
|
+
}, c));
|
|
50
|
+
};
|
|
51
|
+
b.defaultProps = {
|
|
30
52
|
min: 0,
|
|
31
53
|
max: 100,
|
|
32
54
|
value: 0,
|
|
33
55
|
size: "M"
|
|
34
56
|
};
|
|
35
|
-
|
|
36
|
-
children:
|
|
37
|
-
max:
|
|
38
|
-
min:
|
|
39
|
-
size:
|
|
40
|
-
value:
|
|
57
|
+
b.propTypes = {
|
|
58
|
+
children: t.node.isRequired,
|
|
59
|
+
max: t.number,
|
|
60
|
+
min: t.number,
|
|
61
|
+
size: t.oneOf(["S", "M"]),
|
|
62
|
+
value: t.number
|
|
41
63
|
};
|
|
42
64
|
export {
|
|
43
|
-
|
|
65
|
+
b as ProgressBar
|
|
44
66
|
};
|
package/dist/Radio/Radio.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";var f=Object.defineProperty;var r=Object.getOwnPropertySymbols;var n=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var d=(e,t,a)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,c=(e,t)=>{for(var a in t||(t={}))n.call(t,a)&&d(e,a,t[a]);if(r)for(var a of r(t))u.call(t,a)&&d(e,a,t[a]);return e};var i=(e,t)=>{var a={};for(var o in e)n.call(e,o)&&t.indexOf(o)<0&&(a[o]=e[o]);if(e!=null&&r)for(var o of r(e))t.indexOf(o)<0&&u.call(e,o)&&(a[o]=e[o]);return a};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("react"),g=require("prop-types"),T=require("styled-components"),_=require("../BaseRadio/BaseRadio.cjs"),q=require("../Typography/Typography.cjs"),B=require("../Box/Box.cjs"),l=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},s=l(R),p=l(g),x=l(T),m=x.default(q.Typography)`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
`,
|
|
4
|
+
`,y=a=>{var o=a,{children:e}=o,t=i(o,["children"]);return s.default.createElement(m,{as:"label",textColor:"neutral800"},s.default.createElement(_.BaseRadio,c({},t)),s.default.createElement(B.Box,{paddingLeft:2},e))};y.propTypes={children:p.default.node.isRequired,value:p.default.any.isRequired};exports.Radio=y;
|
package/dist/Radio/Radio.js
CHANGED
|
@@ -1,24 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var a = Object.getOwnPropertySymbols;
|
|
3
|
+
var p = Object.prototype.hasOwnProperty, l = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var m = (e, r, t) => r in e ? f(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, n = (e, r) => {
|
|
5
|
+
for (var t in r || (r = {}))
|
|
6
|
+
p.call(r, t) && m(e, t, r[t]);
|
|
7
|
+
if (a)
|
|
8
|
+
for (var t of a(r))
|
|
9
|
+
l.call(r, t) && m(e, t, r[t]);
|
|
10
|
+
return e;
|
|
11
|
+
};
|
|
12
|
+
var d = (e, r) => {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var o in e)
|
|
15
|
+
p.call(e, o) && r.indexOf(o) < 0 && (t[o] = e[o]);
|
|
16
|
+
if (e != null && a)
|
|
17
|
+
for (var o of a(e))
|
|
18
|
+
r.indexOf(o) < 0 && l.call(e, o) && (t[o] = e[o]);
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import i from "react";
|
|
22
|
+
import s from "prop-types";
|
|
23
|
+
import c from "styled-components";
|
|
24
|
+
import { BaseRadio as y } from "../BaseRadio/BaseRadio.js";
|
|
25
|
+
import { Typography as u } from "../Typography/Typography.js";
|
|
26
|
+
import { Box as x } from "../Box/Box.js";
|
|
27
|
+
const R = c(u)`
|
|
8
28
|
display: flex;
|
|
9
29
|
align-items: center;
|
|
10
|
-
`,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}), /* @__PURE__ */
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
`, T = (t) => {
|
|
31
|
+
var o = t, { children: e } = o, r = d(o, ["children"]);
|
|
32
|
+
return /* @__PURE__ */ i.createElement(R, {
|
|
33
|
+
as: "label",
|
|
34
|
+
textColor: "neutral800"
|
|
35
|
+
}, /* @__PURE__ */ i.createElement(y, n({}, r)), /* @__PURE__ */ i.createElement(x, {
|
|
36
|
+
paddingLeft: 2
|
|
37
|
+
}, e));
|
|
38
|
+
};
|
|
39
|
+
T.propTypes = {
|
|
40
|
+
children: s.node.isRequired,
|
|
41
|
+
value: s.any.isRequired
|
|
21
42
|
};
|
|
22
43
|
export {
|
|
23
|
-
|
|
44
|
+
T as Radio
|
|
24
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";var k=Object.defineProperty,_=Object.defineProperties;var j=Object.getOwnPropertyDescriptors;var y=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable;var E=(e,o,a)=>o in e?k(e,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[o]=a,N=(e,o)=>{for(var a in o||(o={}))K.call(o,a)&&E(e,a,o[a]);if(y)for(var a of y(o))m.call(o,a)&&E(e,a,o[a]);return e},R=(e,o)=>_(e,j(o));var w=(e,o)=>{var a={};for(var u in e)K.call(e,u)&&o.indexOf(u)<0&&(a[u]=e[u]);if(e!=null&&y)for(var u of y(e))o.indexOf(u)<0&&m.call(e,u)&&(a[u]=e[u]);return a};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("react"),A=require("prop-types"),L=require("../Box/Box.cjs"),f=require("../helpers/getFocusableNodes.cjs"),i=require("../helpers/keyboardKeys.cjs"),O=require("./RawTableContext.cjs"),F=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},v=F(b),n=F(A),T=e=>v.default.createElement(h,R(N({},e),{as:"th"})),h=u=>{var x=u,{coords:e,as:o}=x,a=w(x,["coords","as"]);const l=b.useRef(null),{rowIndex:B,colIndex:I,setTableValues:P}=O.useTable(),[d,p]=b.useState(!1),q=t=>{const s=f.getFocusableNodes(l.current,!0);if(!(s.length===0||s.length===1&&f.getFocusableNodesWithKeyboardNav(s).length===0)){if(s.length>1&&!Boolean(s.find(r=>r.tagName!=="BUTTON"))){t.preventDefault();const r=s.findIndex(c=>c===document.activeElement);if(t.key===i.KeyboardKeys.RIGHT){const c=s[r+1];c&&(t.stopPropagation(),c.focus())}else if(t.key===i.KeyboardKeys.LEFT){const c=s[r-1];c&&(t.stopPropagation(),c.focus())}return}t.key===i.KeyboardKeys.ENTER&&!d?p(!0):(t.key===i.KeyboardKeys.ESCAPE||t.key===i.KeyboardKeys.ENTER)&&d?(p(!1),l.current.focus()):d&&t.stopPropagation()}},g=B===e.row-1&&I===e.col-1;return b.useLayoutEffect(()=>{const t=f.getFocusableNodes(l.current,!0);t.length===0||t.length===1&&f.getFocusableNodesWithKeyboardNav(t).length!==0||t.length>1&&Boolean(t.find(s=>s.tagName!=="BUTTON"))?(l.current.setAttribute("tabIndex",!d&&g?0:-1),t.forEach((s,r)=>{s.setAttribute("tabIndex",d?0:-1),d&&r===0&&s.focus()})):t.forEach(s=>{s.setAttribute("tabIndex",g?0:-1)})},[d,g]),b.useLayoutEffect(()=>{const t=f.getFocusableNodes(l.current,!0),s=()=>{t.length>=1&&(f.getFocusableNodesWithKeyboardNav(t).length!==0||!Boolean(t.find(r=>r.tagName!=="BUTTON")))&&p(!0),P({rowIndex:e.row-1,colIndex:e.col-1})};return t.forEach(r=>{r.addEventListener("focus",s)}),()=>{f.getFocusableNodes(l.current,!0).forEach(c=>{c.removeEventListener("focus",s)})}},[]),v.default.createElement(L.Box,N({as:o||"td",ref:l,onKeyDown:q},a))};T.defaultProps={coords:{}};T.propTypes={["aria-colindex"]:n.default.number.isRequired,children:n.default.node,coords:n.default.shape({col:n.default.number,row:n.default.number})};h.defaultProps={coords:{}};h.propTypes={["aria-colindex"]:n.default.number.isRequired,as:n.default.oneOf(["td","th"]),children:n.default.node,coords:n.default.shape({col:n.default.number,row:n.default.number})};exports.RawTd=h;exports.RawTh=T;
|
package/dist/RawTable/RawCell.js
CHANGED
|
@@ -1,80 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var K = Object.defineProperty, L = Object.defineProperties;
|
|
2
|
+
var O = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var i = Object.getOwnPropertySymbols;
|
|
4
|
+
var x = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var T = (e, o, r) => o in e ? K(e, o, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[o] = r, h = (e, o) => {
|
|
6
|
+
for (var r in o || (o = {}))
|
|
7
|
+
x.call(o, r) && T(e, r, o[r]);
|
|
8
|
+
if (i)
|
|
9
|
+
for (var r of i(o))
|
|
10
|
+
y.call(o, r) && T(e, r, o[r]);
|
|
11
|
+
return e;
|
|
12
|
+
}, I = (e, o) => L(e, O(o));
|
|
13
|
+
var w = (e, o) => {
|
|
14
|
+
var r = {};
|
|
15
|
+
for (var c in e)
|
|
16
|
+
x.call(e, c) && o.indexOf(c) < 0 && (r[c] = e[c]);
|
|
17
|
+
if (e != null && i)
|
|
18
|
+
for (var c of i(e))
|
|
19
|
+
o.indexOf(c) < 0 && y.call(e, c) && (r[c] = e[c]);
|
|
20
|
+
return r;
|
|
21
|
+
};
|
|
22
|
+
import v, { useRef as D, useState as U, useLayoutEffect as R } from "react";
|
|
23
|
+
import a from "prop-types";
|
|
24
|
+
import { Box as q } from "../Box/Box.js";
|
|
25
|
+
import { getFocusableNodes as m, getFocusableNodesWithKeyboardNav as N } from "../helpers/getFocusableNodes.js";
|
|
26
|
+
import { KeyboardKeys as d } from "../helpers/keyboardKeys.js";
|
|
27
|
+
import { useTable as S } from "./RawTableContext.js";
|
|
28
|
+
const B = (e) => /* @__PURE__ */ v.createElement(g, I(h({}, e), {
|
|
9
29
|
as: "th"
|
|
10
|
-
}),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
})), g = (c) => {
|
|
31
|
+
var E = c, { coords: e, as: o } = E, r = w(E, ["coords", "as"]);
|
|
32
|
+
const l = D(null), { rowIndex: P, colIndex: A, setTableValues: F } = S(), [f, p] = U(!1), k = (t) => {
|
|
33
|
+
const n = m(l.current, !0);
|
|
34
|
+
if (!(n.length === 0 || n.length === 1 && N(n).length === 0)) {
|
|
35
|
+
if (n.length > 1 && !Boolean(n.find((s) => s.tagName !== "BUTTON"))) {
|
|
36
|
+
t.preventDefault();
|
|
37
|
+
const s = n.findIndex((u) => u === document.activeElement);
|
|
38
|
+
if (t.key === d.RIGHT) {
|
|
39
|
+
const u = n[s + 1];
|
|
40
|
+
u && (t.stopPropagation(), u.focus());
|
|
41
|
+
} else if (t.key === d.LEFT) {
|
|
42
|
+
const u = n[s - 1];
|
|
43
|
+
u && (t.stopPropagation(), u.focus());
|
|
23
44
|
}
|
|
24
45
|
return;
|
|
25
46
|
}
|
|
26
|
-
|
|
47
|
+
t.key === d.ENTER && !f ? p(!0) : (t.key === d.ESCAPE || t.key === d.ENTER) && f ? (p(!1), l.current.focus()) : f && t.stopPropagation();
|
|
27
48
|
}
|
|
28
|
-
},
|
|
29
|
-
return
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})) :
|
|
34
|
-
|
|
49
|
+
}, b = P === e.row - 1 && A === e.col - 1;
|
|
50
|
+
return R(() => {
|
|
51
|
+
const t = m(l.current, !0);
|
|
52
|
+
t.length === 0 || t.length === 1 && N(t).length !== 0 || t.length > 1 && Boolean(t.find((n) => n.tagName !== "BUTTON")) ? (l.current.setAttribute("tabIndex", !f && b ? 0 : -1), t.forEach((n, s) => {
|
|
53
|
+
n.setAttribute("tabIndex", f ? 0 : -1), f && s === 0 && n.focus();
|
|
54
|
+
})) : t.forEach((n) => {
|
|
55
|
+
n.setAttribute("tabIndex", b ? 0 : -1);
|
|
35
56
|
});
|
|
36
|
-
}, [
|
|
37
|
-
const
|
|
38
|
-
|
|
57
|
+
}, [f, b]), R(() => {
|
|
58
|
+
const t = m(l.current, !0), n = () => {
|
|
59
|
+
t.length >= 1 && (N(t).length !== 0 || !Boolean(t.find((s) => s.tagName !== "BUTTON"))) && p(!0), F({ rowIndex: e.row - 1, colIndex: e.col - 1 });
|
|
39
60
|
};
|
|
40
|
-
return
|
|
41
|
-
|
|
61
|
+
return t.forEach((s) => {
|
|
62
|
+
s.addEventListener("focus", n);
|
|
42
63
|
}), () => {
|
|
43
|
-
l
|
|
44
|
-
|
|
64
|
+
m(l.current, !0).forEach((u) => {
|
|
65
|
+
u.removeEventListener("focus", n);
|
|
45
66
|
});
|
|
46
67
|
};
|
|
47
|
-
}, []), /* @__PURE__ */
|
|
48
|
-
as:
|
|
49
|
-
ref:
|
|
50
|
-
onKeyDown:
|
|
51
|
-
|
|
52
|
-
});
|
|
68
|
+
}, []), /* @__PURE__ */ v.createElement(q, h({
|
|
69
|
+
as: o || "td",
|
|
70
|
+
ref: l,
|
|
71
|
+
onKeyDown: k
|
|
72
|
+
}, r));
|
|
53
73
|
};
|
|
54
|
-
|
|
74
|
+
B.defaultProps = {
|
|
55
75
|
coords: {}
|
|
56
76
|
};
|
|
57
|
-
|
|
58
|
-
["aria-colindex"]:
|
|
59
|
-
children:
|
|
60
|
-
coords:
|
|
61
|
-
col:
|
|
62
|
-
row:
|
|
77
|
+
B.propTypes = {
|
|
78
|
+
["aria-colindex"]: a.number.isRequired,
|
|
79
|
+
children: a.node,
|
|
80
|
+
coords: a.shape({
|
|
81
|
+
col: a.number,
|
|
82
|
+
row: a.number
|
|
63
83
|
})
|
|
64
84
|
};
|
|
65
|
-
|
|
85
|
+
g.defaultProps = {
|
|
66
86
|
coords: {}
|
|
67
87
|
};
|
|
68
|
-
|
|
69
|
-
["aria-colindex"]:
|
|
70
|
-
as:
|
|
71
|
-
children:
|
|
72
|
-
coords:
|
|
73
|
-
col:
|
|
74
|
-
row:
|
|
88
|
+
g.propTypes = {
|
|
89
|
+
["aria-colindex"]: a.number.isRequired,
|
|
90
|
+
as: a.oneOf(["td", "th"]),
|
|
91
|
+
children: a.node,
|
|
92
|
+
coords: a.shape({
|
|
93
|
+
col: a.number,
|
|
94
|
+
row: a.number
|
|
75
95
|
})
|
|
76
96
|
};
|
|
77
97
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
98
|
+
g as RawTd,
|
|
99
|
+
B as RawTh
|
|
80
100
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";var O=Object.defineProperty;var f=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var T=(e,a,r)=>a in e?O(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r,P=(e,a)=>{for(var r in a||(a={}))p.call(a,r)&&T(e,r,a[r]);if(f)for(var r of f(a))R.call(a,r)&&T(e,r,a[r]);return e};var _=(e,a)=>{var r={};for(var u in e)p.call(e,u)&&a.indexOf(u)<0&&(r[u]=e[u]);if(e!=null&&f)for(var u of f(e))a.indexOf(u)<0&&R.call(e,u)&&(r[u]=e[u]);return r};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),g=require("prop-types"),h=require("./RawTableContext.cjs"),l=require("../helpers/keyboardKeys.cjs"),G=require("./focusFocusable.cjs"),E=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},m=E(o),b=E(g),y=M=>{var d=M,{colCount:e,rowCount:a,jumpStep:r,initialCol:u,initialRow:q}=d,w=_(d,["colCount","rowCount","jumpStep","initialCol","initialRow"]);const K=o.useRef(null),i=o.useRef(!1),[D,c]=o.useState(q),[k,n]=o.useState(u),j=o.useCallback(({colIndex:s,rowIndex:t})=>{n(s),c(t)},[]);o.useEffect(()=>{i.current&&G.focusFocusable(K.current),i.current||(i.current=!0)},[k,D]);const F=s=>{switch(s.key){case l.KeyboardKeys.RIGHT:{s.preventDefault(),n(t=>t<e-1?t+1:t);break}case l.KeyboardKeys.LEFT:{s.preventDefault(),n(t=>t>0?t-1:t);break}case l.KeyboardKeys.UP:{s.preventDefault(),c(t=>t>0?t-1:t);break}case l.KeyboardKeys.DOWN:{s.preventDefault(),c(t=>t<a-1?t+1:t);break}case l.KeyboardKeys.HOME:{s.preventDefault(),s.ctrlKey&&c(0),n(0);break}case l.KeyboardKeys.END:{s.preventDefault(),s.ctrlKey&&c(a-1),n(e-1);break}case l.KeyboardKeys.PAGE_DOWN:{s.preventDefault(),c(t=>t+r<a?t+r:a-1);break}case l.KeyboardKeys.PAGE_UP:{s.preventDefault(),c(t=>t-r>0?t-r:0);break}}};return m.default.createElement(h.RawTableContext.Provider,{value:{rowIndex:D,colIndex:k,setTableValues:j}},m.default.createElement("table",P({ref:K,"aria-rowcount":a,"aria-colcount":e,onKeyDown:F},w)))};y.defaultProps={jumpStep:3,initialCol:0,initialRow:0};y.propTypes={colCount:b.default.number.isRequired,initialCol:b.default.number,initialRow:b.default.number,jumpStep:b.default.number,rowCount:b.default.number.isRequired};exports.RawTable=y;
|