@strapi/design-system 1.4.2 → 1.5.0-alpha.0
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 +17 -37
- package/dist/Accordion/AccordionToggle.cjs +6 -6
- package/dist/Accordion/AccordionToggle.js +75 -96
- package/dist/Alert/Alert.cjs +12 -12
- package/dist/Alert/Alert.js +83 -102
- package/dist/Badge/Badge.cjs +4 -4
- package/dist/Badge/Badge.js +29 -49
- package/dist/BaseButton/BaseButton.cjs +3 -3
- package/dist/BaseButton/BaseButton.js +20 -42
- package/dist/BaseCheckbox/BaseCheckbox.cjs +6 -6
- package/dist/BaseCheckbox/BaseCheckbox.js +35 -55
- package/dist/BaseLink/BaseLink.cjs +2 -2
- package/dist/BaseLink/BaseLink.js +21 -43
- package/dist/BaseRadio/BaseRadio.cjs +8 -8
- package/dist/BaseRadio/BaseRadio.js +31 -51
- package/dist/BaseRadio/RadioGroup.cjs +1 -1
- package/dist/BaseRadio/RadioGroup.js +24 -44
- package/dist/Box/BoxProps.cjs +1 -1
- package/dist/Box/BoxProps.js +10 -19
- package/dist/Breadcrumbs/Breadcrumbs.cjs +4 -4
- package/dist/Breadcrumbs/Breadcrumbs.js +29 -50
- package/dist/Button/Button.cjs +14 -14
- package/dist/Button/Button.js +53 -73
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.js +17 -37
- package/dist/Card/CardAsset.cjs +4 -4
- package/dist/Card/CardAsset.js +19 -42
- package/dist/Card/CardBadge.cjs +3 -3
- package/dist/Card/CardBadge.js +9 -18
- package/dist/Card/CardBody.cjs +1 -1
- package/dist/Card/CardBody.js +8 -19
- package/dist/Card/CardCheckbox.cjs +1 -1
- package/dist/Card/CardCheckbox.js +12 -22
- package/dist/Card/CardContent.cjs +2 -2
- package/dist/Card/CardContent.js +11 -32
- package/dist/Card/CardHeader.cjs +2 -2
- package/dist/Card/CardHeader.js +9 -19
- package/dist/Card/CardTimer.cjs +2 -2
- package/dist/Card/CardTimer.js +20 -42
- package/dist/Card/CardTitle.cjs +1 -1
- package/dist/Card/CardTitle.js +16 -27
- package/dist/CarouselInput/Carousel.cjs +6 -6
- package/dist/CarouselInput/Carousel.js +77 -107
- package/dist/CarouselInput/CarouselActions.cjs +1 -1
- package/dist/CarouselInput/CarouselActions.js +7 -17
- package/dist/CarouselInput/CarouselImage.cjs +3 -3
- package/dist/CarouselInput/CarouselImage.js +26 -38
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +49 -83
- package/dist/CarouselInput/CarouselSlide.cjs +2 -2
- package/dist/CarouselInput/CarouselSlide.js +20 -42
- package/dist/Checkbox/Checkbox.cjs +2 -2
- package/dist/Checkbox/Checkbox.js +44 -63
- package/dist/Combobox/Combobox.cjs +1 -1
- package/dist/Combobox/Combobox.js +196 -246
- package/dist/Combobox/ComboboxOption.cjs +1 -1
- package/dist/Combobox/ComboboxOption.js +25 -47
- package/dist/Combobox/utils.cjs +1 -1
- package/dist/Combobox/utils.js +21 -21
- package/dist/DatePicker/DatePicker.cjs +1 -1
- package/dist/DatePicker/DatePicker.js +85 -117
- 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 +23 -42
- package/dist/DatePicker/DatePickerTh.cjs +3 -3
- package/dist/DatePicker/DatePickerTh.js +23 -44
- package/dist/DatePicker/utils/getYears.cjs +1 -1
- package/dist/DatePicker/utils/getYears.js +6 -7
- package/dist/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/DateTimePicker/DateTimePicker.js +92 -126
- package/dist/DateTimePicker/DateTimePickerProps.cjs +1 -1
- package/dist/DateTimePicker/DateTimePickerProps.js +10 -19
- package/dist/Dialog/Dialog.cjs +5 -5
- package/dist/Dialog/Dialog.js +39 -58
- package/dist/Divider/Divider.cjs +4 -2
- package/dist/Divider/Divider.js +17 -38
- package/dist/Field/Field.cjs +1 -1
- package/dist/Field/Field.js +20 -39
- package/dist/Field/FieldAction.cjs +2 -2
- package/dist/Field/FieldAction.js +13 -35
- package/dist/Field/FieldInput.cjs +6 -6
- package/dist/Field/FieldInput.js +47 -67
- package/dist/Field/FieldLabel.cjs +3 -3
- package/dist/Field/FieldLabel.js +26 -46
- package/dist/Flex/FlexProps.cjs +1 -1
- package/dist/Flex/FlexProps.js +10 -19
- package/dist/FocusTrap/FocusTrap.cjs +1 -1
- package/dist/FocusTrap/FocusTrap.js +32 -52
- package/dist/Grid/Grid.cjs +3 -3
- package/dist/Grid/Grid.js +20 -42
- package/dist/Grid/GridItem.cjs +2 -2
- package/dist/Grid/GridItem.js +22 -41
- package/dist/Icon/Icon.cjs +2 -2
- package/dist/Icon/Icon.js +17 -27
- package/dist/IconButton/IconButton.cjs +4 -4
- package/dist/IconButton/IconButton.js +44 -64
- package/dist/KeyboardNavigable/KeyboardNavigable.cjs +1 -1
- package/dist/KeyboardNavigable/KeyboardNavigable.js +38 -58
- package/dist/Layout/HeaderLayout.cjs +2 -2
- package/dist/Layout/HeaderLayout.js +78 -96
- package/dist/Link/Link.cjs +6 -6
- package/dist/Link/Link.js +34 -54
- package/dist/LinkButton/LinkButton.cjs +10 -10
- package/dist/LinkButton/LinkButton.js +47 -69
- package/dist/Loader/Loader.cjs +4 -4
- package/dist/Loader/Loader.js +25 -47
- package/dist/Main/Main.cjs +2 -2
- package/dist/Main/Main.js +15 -35
- package/dist/MainNav/MainNav.cjs +2 -2
- package/dist/MainNav/MainNav.js +19 -40
- package/dist/MainNav/NavCondense.cjs +3 -3
- package/dist/MainNav/NavCondense.js +20 -40
- package/dist/MainNav/NavFooter.cjs +3 -0
- package/dist/MainNav/NavFooter.js +14 -0
- package/dist/MainNav/NavLink.cjs +13 -13
- package/dist/MainNav/NavLink.js +57 -76
- package/dist/MainNav/NavSection.cjs +1 -1
- package/dist/MainNav/NavSection.js +46 -67
- package/dist/MainNav/NavSections.cjs +4 -1
- package/dist/MainNav/NavSections.js +23 -40
- package/dist/MainNav/NavUser.cjs +2 -6
- package/dist/MainNav/NavUser.js +31 -55
- package/dist/MainNav/index.cjs +1 -1
- package/dist/MainNav/index.js +14 -12
- package/dist/ModalLayout/ModalBody.cjs +2 -2
- package/dist/ModalLayout/ModalBody.js +9 -19
- package/dist/ModalLayout/ModalLayout.cjs +3 -3
- package/dist/ModalLayout/ModalLayout.js +30 -52
- package/dist/NumberInput/NumberInput.cjs +6 -6
- package/dist/NumberInput/NumberInput.js +123 -157
- package/dist/Pagination/components.cjs +7 -7
- package/dist/Pagination/components.js +65 -88
- package/dist/Popover/Popover.cjs +3 -3
- package/dist/Popover/Popover.js +65 -91
- package/dist/Portal/Portal.cjs +1 -1
- package/dist/Portal/Portal.js +11 -12
- package/dist/ProgressBar/ProgressBar.cjs +2 -2
- package/dist/ProgressBar/ProgressBar.js +27 -49
- package/dist/Radio/Radio.cjs +2 -2
- package/dist/Radio/Radio.js +19 -40
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +69 -89
- package/dist/RawTable/RawTable.cjs +1 -1
- package/dist/RawTable/RawTable.js +46 -66
- package/dist/RawTable/RawTbody.cjs +1 -1
- package/dist/RawTable/RawTbody.js +11 -30
- package/dist/RawTable/RawThead.cjs +1 -1
- package/dist/RawTable/RawThead.js +10 -29
- package/dist/RawTable/RawTr.cjs +1 -1
- package/dist/RawTable/RawTr.js +14 -34
- package/dist/Searchbar/SearchForm.cjs +1 -1
- package/dist/Searchbar/SearchForm.js +5 -16
- package/dist/Searchbar/Searchbar.cjs +7 -7
- package/dist/Searchbar/Searchbar.js +45 -65
- package/dist/Select/MultiSelectNested.cjs +1 -1
- package/dist/Select/MultiSelectNested.js +23 -45
- package/dist/Select/OptGroup.cjs +1 -1
- package/dist/Select/OptGroup.js +15 -35
- package/dist/Select/Option.cjs +7 -7
- package/dist/Select/Option.js +37 -57
- package/dist/Select/Select.cjs +2 -2
- package/dist/Select/Select.js +145 -186
- package/dist/Select/SelectButton.cjs +2 -2
- package/dist/Select/SelectButton.js +33 -53
- package/dist/SimpleMenu/SimpleMenu.cjs +9 -9
- package/dist/SimpleMenu/SimpleMenu.js +137 -163
- package/dist/Stack/Stack.cjs +3 -3
- package/dist/Stack/Stack.js +29 -50
- package/dist/Status/Status.cjs +4 -4
- package/dist/Status/Status.js +30 -50
- package/dist/SubNav/SubNav.cjs +3 -3
- package/dist/SubNav/SubNav.js +15 -37
- package/dist/SubNav/SubNavHeader.cjs +2 -2
- package/dist/SubNav/SubNavHeader.js +38 -39
- package/dist/SubNav/SubNavLink.cjs +6 -6
- package/dist/SubNav/SubNavLink.js +39 -61
- package/dist/SubNav/SubNavSections.cjs +1 -1
- package/dist/SubNav/SubNavSections.js +17 -39
- package/dist/Switch/Switch.cjs +5 -5
- package/dist/Switch/Switch.js +35 -57
- package/dist/Table/Cell.cjs +3 -3
- package/dist/Table/Cell.js +20 -40
- package/dist/Table/TFooter.cjs +3 -3
- package/dist/Table/TFooter.js +28 -50
- package/dist/Table/Table.cjs +5 -5
- package/dist/Table/Table.js +35 -55
- package/dist/Table/Tbody.cjs +2 -2
- package/dist/Table/Tbody.js +8 -17
- package/dist/Table/Thead.cjs +2 -2
- package/dist/Table/Thead.js +8 -17
- package/dist/Table/Tr.cjs +2 -2
- package/dist/Table/Tr.js +8 -17
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +26 -45
- package/dist/Tabs/TabPanels.cjs +1 -1
- package/dist/Tabs/TabPanels.js +24 -43
- package/dist/Tabs/Tabs.cjs +2 -2
- package/dist/Tabs/Tabs.js +94 -112
- package/dist/Tag/Tag.cjs +4 -4
- package/dist/Tag/Tag.js +27 -50
- package/dist/TextButton/TextButton.cjs +6 -6
- package/dist/TextButton/TextButton.js +39 -59
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +49 -69
- package/dist/Textarea/Textarea.cjs +3 -3
- package/dist/Textarea/Textarea.js +43 -63
- package/dist/Textarea/TextareaInput.cjs +4 -4
- package/dist/Textarea/TextareaInput.js +30 -50
- package/dist/TimePicker/TimePicker.cjs +3 -3
- package/dist/TimePicker/TimePicker.js +62 -95
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +8 -8
- package/dist/ToggleCheckbox/ToggleCheckbox.js +56 -78
- package/dist/ToggleInput/ToggleInput.cjs +3 -3
- package/dist/ToggleInput/ToggleInput.js +65 -97
- package/dist/Tooltip/Tooltip.cjs +2 -2
- package/dist/Tooltip/Tooltip.js +38 -57
- package/dist/Typography/TypographyProps.cjs +1 -1
- package/dist/Typography/TypographyProps.js +13 -22
- 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/index.cjs +1 -1
- package/dist/index.js +150 -148
- package/dist/themes/darkTheme/index.cjs +1 -1
- package/dist/themes/darkTheme/index.js +8 -18
- package/dist/themes/extendTheme.cjs +4 -4
- package/dist/themes/extendTheme.js +18 -29
- package/dist/themes/lightTheme/index.cjs +1 -1
- package/dist/themes/lightTheme/index.js +8 -18
- package/dist/v2/Breadcrumbs/Breadcrumbs.cjs +2 -2
- package/dist/v2/Breadcrumbs/Breadcrumbs.js +23 -43
- package/dist/v2/Breadcrumbs/Crumb.cjs +1 -1
- package/dist/v2/Breadcrumbs/Crumb.js +22 -44
- package/dist/v2/Breadcrumbs/CrumbLink.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbLink.js +14 -35
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +2 -2
- package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +19 -41
- package/dist/v2/Link/Link.cjs +5 -5
- package/dist/v2/Link/Link.js +42 -64
- package/dist/v2/LinkButton/LinkButton.cjs +10 -10
- package/dist/v2/LinkButton/LinkButton.js +51 -75
- package/dist/v2/MainNav/MainNav.cjs +2 -2
- package/dist/v2/MainNav/MainNav.js +19 -40
- package/dist/v2/MainNav/NavBrand.cjs +3 -3
- package/dist/v2/MainNav/NavBrand.js +57 -78
- package/dist/v2/MainNav/NavCondense.cjs +3 -3
- package/dist/v2/MainNav/NavCondense.js +20 -40
- package/dist/v2/MainNav/NavFooter.cjs +3 -0
- package/dist/v2/MainNav/NavFooter.js +14 -0
- package/dist/v2/MainNav/NavLink.cjs +13 -13
- package/dist/v2/MainNav/NavLink.js +60 -81
- package/dist/v2/MainNav/NavSection.cjs +1 -1
- package/dist/v2/MainNav/NavSection.js +46 -67
- package/dist/v2/MainNav/NavSections.cjs +4 -1
- package/dist/v2/MainNav/NavSections.js +23 -40
- package/dist/v2/MainNav/NavUser.cjs +2 -6
- package/dist/v2/MainNav/NavUser.js +31 -55
- package/dist/v2/MainNav/index.cjs +1 -1
- package/dist/v2/MainNav/index.js +14 -12
- package/dist/v2/Pagination/components.cjs +7 -7
- package/dist/v2/Pagination/components.js +65 -89
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +9 -9
- package/dist/v2/SimpleMenu/SimpleMenu.js +131 -156
- package/dist/v2/SubNav/SubNav.cjs +3 -3
- package/dist/v2/SubNav/SubNav.js +15 -37
- package/dist/v2/SubNav/SubNavHeader.cjs +2 -2
- package/dist/v2/SubNav/SubNavHeader.js +38 -39
- package/dist/v2/SubNav/SubNavLink.cjs +6 -6
- package/dist/v2/SubNav/SubNavLink.js +42 -64
- package/dist/v2/SubNav/SubNavSections.cjs +1 -1
- package/dist/v2/SubNav/SubNavSections.js +17 -39
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.js +37 -35
- package/package.json +3 -3
|
@@ -1,49 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return e;
|
|
11
|
-
};
|
|
12
|
-
var y = (e, r) => {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var o in e)
|
|
15
|
-
c.call(e, o) && r.indexOf(o) < 0 && (t[o] = e[o]);
|
|
16
|
-
if (e != null && i)
|
|
17
|
-
for (var o of i(e))
|
|
18
|
-
r.indexOf(o) < 0 && u.call(e, o) && (t[o] = e[o]);
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
import a from "react";
|
|
22
|
-
import n from "prop-types";
|
|
23
|
-
import v, { keyframes as k } from "styled-components";
|
|
24
|
-
import $ from "@strapi/icons/Loader";
|
|
25
|
-
import { Box as b } from "../Box/Box.js";
|
|
26
|
-
import { Typography as B } from "../Typography/Typography.js";
|
|
27
|
-
import { Flex as C } from "../Flex/Flex.js";
|
|
28
|
-
import { buttonFocusStyle as R } from "../themes/utils.js";
|
|
29
|
-
const L = k`
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import m, { keyframes as g } from "styled-components";
|
|
4
|
+
import y from "@strapi/icons/Loader";
|
|
5
|
+
import { Box as p } from "../Box/Box.js";
|
|
6
|
+
import { Typography as b } from "../Typography/Typography.js";
|
|
7
|
+
import { Flex as v } from "../Flex/Flex.js";
|
|
8
|
+
import { buttonFocusStyle as h } from "../themes/utils.js";
|
|
9
|
+
const x = g`
|
|
30
10
|
from {
|
|
31
11
|
transform: rotate(0deg);
|
|
32
12
|
}
|
|
33
13
|
to {
|
|
34
14
|
transform: rotate(359deg);
|
|
35
15
|
}
|
|
36
|
-
`,
|
|
37
|
-
animation: ${
|
|
16
|
+
`, E = m.div`
|
|
17
|
+
animation: ${x} 2s infinite linear;
|
|
38
18
|
will-change: transform;
|
|
39
|
-
`,
|
|
19
|
+
`, T = m(v)`
|
|
40
20
|
background: transparent;
|
|
41
21
|
border: none;
|
|
42
22
|
|
|
43
23
|
&[aria-disabled='true'] {
|
|
44
24
|
pointer-events: none;
|
|
45
25
|
svg path {
|
|
46
|
-
fill: ${({ theme:
|
|
26
|
+
fill: ${({ theme: r }) => r.colors.neutral600};
|
|
47
27
|
}
|
|
48
28
|
}
|
|
49
29
|
|
|
@@ -53,50 +33,50 @@ const L = k`
|
|
|
53
33
|
}
|
|
54
34
|
|
|
55
35
|
svg path {
|
|
56
|
-
fill: ${({ theme:
|
|
36
|
+
fill: ${({ theme: r }) => r.colors.primary600};
|
|
57
37
|
}
|
|
58
38
|
|
|
59
|
-
${
|
|
60
|
-
`,
|
|
61
|
-
(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
onClick: E,
|
|
39
|
+
${h}
|
|
40
|
+
`, a = e.forwardRef(
|
|
41
|
+
({ children: r, startIcon: n, endIcon: i, onClick: l, disabled: s, loading: o, ...f }, c) => {
|
|
42
|
+
const u = l && !s ? l : void 0, d = s || o;
|
|
43
|
+
return /* @__PURE__ */ e.createElement(T, {
|
|
44
|
+
ref: c,
|
|
45
|
+
"aria-disabled": d,
|
|
46
|
+
onClick: u,
|
|
68
47
|
as: "button",
|
|
69
|
-
type: "button"
|
|
70
|
-
|
|
48
|
+
type: "button",
|
|
49
|
+
...f
|
|
50
|
+
}, (n || o) && /* @__PURE__ */ e.createElement(p, {
|
|
71
51
|
as: "span",
|
|
72
52
|
paddingRight: 2,
|
|
73
53
|
"aria-hidden": !0
|
|
74
|
-
},
|
|
54
|
+
}, o ? /* @__PURE__ */ e.createElement(E, null, /* @__PURE__ */ e.createElement(y, null)) : n), /* @__PURE__ */ e.createElement(b, {
|
|
75
55
|
variant: "pi",
|
|
76
|
-
textColor:
|
|
77
|
-
},
|
|
56
|
+
textColor: d ? "neutral600" : "primary600"
|
|
57
|
+
}, r), i && /* @__PURE__ */ e.createElement(p, {
|
|
78
58
|
as: "span",
|
|
79
59
|
paddingLeft: 2,
|
|
80
60
|
"aria-hidden": !0
|
|
81
|
-
},
|
|
61
|
+
}, i));
|
|
82
62
|
}
|
|
83
63
|
);
|
|
84
|
-
|
|
85
|
-
|
|
64
|
+
a.displayName = "TextButton";
|
|
65
|
+
a.defaultProps = {
|
|
86
66
|
disabled: !1,
|
|
87
67
|
startIcon: void 0,
|
|
88
68
|
endIcon: void 0,
|
|
89
69
|
loading: !1,
|
|
90
70
|
onClick: void 0
|
|
91
71
|
};
|
|
92
|
-
|
|
93
|
-
children:
|
|
94
|
-
disabled:
|
|
95
|
-
endIcon:
|
|
96
|
-
loading:
|
|
97
|
-
onClick:
|
|
98
|
-
startIcon:
|
|
72
|
+
a.propTypes = {
|
|
73
|
+
children: t.node.isRequired,
|
|
74
|
+
disabled: t.bool,
|
|
75
|
+
endIcon: t.element,
|
|
76
|
+
loading: t.bool,
|
|
77
|
+
onClick: t.func,
|
|
78
|
+
startIcon: t.element
|
|
99
79
|
};
|
|
100
80
|
export {
|
|
101
|
-
|
|
81
|
+
a as TextButton
|
|
102
82
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react"),v=require("prop-types"),y=require("../Field/Field.cjs"),I=require("../Field/FieldLabel.cjs"),g=require("../Field/FieldInput.cjs"),E=require("../Field/FieldHint.cjs"),T=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const A=require("../Stack/Stack.cjs"),_=require("../themes/sizes.cjs"),h=require("../helpers/useId.cjs"),o=l=>l&&typeof l=="object"&&"default"in l?l:{default:l},t=o(d),e=o(v),i=t.default.forwardRef(({size:l,startAction:s,endAction:c,name:f,hint:p,error:F,label:r,labelAction:b,id:m,required:q,...a},n)=>{const j=h.useId("textinput",m),u=d.useRef(null);if(!r&&!a["aria-label"])throw new Error('The TextInput component needs a "label" or an "aria-label" props');return d.useImperativeHandle(n,()=>({inputWrapperRef:u})),t.default.createElement("div",{ref:u},t.default.createElement(y.Field,{name:f,hint:p,error:F,id:j,required:q},t.default.createElement(A.Stack,{spacing:1},r&&t.default.createElement(I.FieldLabel,{action:b},r),t.default.createElement(g.FieldInput,{size:l,ref:n,startAction:s,endAction:c,...a}),t.default.createElement(E.FieldHint,null),t.default.createElement(T.FieldError,null))))});i.displayName="TextInput";i.defaultProps={"aria-label":void 0,label:void 0,labelAction:void 0,error:void 0,hint:void 0,id:void 0,startAction:void 0,size:"M",endAction:void 0,required:!1};i.propTypes={"aria-label":e.default.string,endAction:e.default.element,error:e.default.oneOfType([e.default.string,e.default.bool]),hint:e.default.oneOfType([e.default.string,e.default.node,e.default.arrayOf(e.default.node)]),id:e.default.string,label:e.default.string,labelAction:e.default.element,name:e.default.string.isRequired,required:e.default.bool,size:e.default.oneOf(Object.keys(_.sizes.input)),startAction:e.default.element};exports.TextInput=i;
|
|
@@ -1,65 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
for (var r of a(i))
|
|
9
|
-
b.call(i, r) && f(e, r, i[r]);
|
|
10
|
-
return e;
|
|
11
|
-
};
|
|
12
|
-
var E = (e, i) => {
|
|
13
|
-
var r = {};
|
|
14
|
-
for (var o in e)
|
|
15
|
-
u.call(e, o) && i.indexOf(o) < 0 && (r[o] = e[o]);
|
|
16
|
-
if (e != null && a)
|
|
17
|
-
for (var o of a(e))
|
|
18
|
-
i.indexOf(o) < 0 && b.call(e, o) && (r[o] = e[o]);
|
|
19
|
-
return r;
|
|
20
|
-
};
|
|
21
|
-
import n, { useRef as O, useImperativeHandle as R } from "react";
|
|
22
|
-
import t from "prop-types";
|
|
23
|
-
import { Field as h } from "../Field/Field.js";
|
|
24
|
-
import { FieldLabel as q } from "../Field/FieldLabel.js";
|
|
25
|
-
import { FieldInput as w } from "../Field/FieldInput.js";
|
|
26
|
-
import { FieldHint as z } from "../Field/FieldHint.js";
|
|
27
|
-
import { FieldError as k } from "../Field/FieldError.js";
|
|
1
|
+
import t, { useRef as E, useImperativeHandle as g } from "react";
|
|
2
|
+
import e from "prop-types";
|
|
3
|
+
import { Field as T } from "../Field/Field.js";
|
|
4
|
+
import { FieldLabel as y } from "../Field/FieldLabel.js";
|
|
5
|
+
import { FieldInput as I } from "../Field/FieldInput.js";
|
|
6
|
+
import { FieldHint as A } from "../Field/FieldHint.js";
|
|
7
|
+
import { FieldError as x } from "../Field/FieldError.js";
|
|
28
8
|
import "../Field/FieldContext.js";
|
|
29
9
|
import "../Field/FieldAction.js";
|
|
30
|
-
import { Stack as
|
|
31
|
-
import { sizes as
|
|
32
|
-
import { useId as
|
|
33
|
-
const
|
|
34
|
-
(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!l && !p["aria-label"])
|
|
10
|
+
import { Stack as F } from "../Stack/Stack.js";
|
|
11
|
+
import { sizes as O } from "../themes/sizes.js";
|
|
12
|
+
import { useId as R } from "../helpers/useId.js";
|
|
13
|
+
const i = t.forwardRef(
|
|
14
|
+
({ size: l, startAction: m, endAction: p, name: d, hint: s, error: c, label: r, labelAction: f, id: u, required: b, ...o }, n) => {
|
|
15
|
+
const v = R("textinput", u), a = E(null);
|
|
16
|
+
if (!r && !o["aria-label"])
|
|
38
17
|
throw new Error('The TextInput component needs a "label" or an "aria-label" props');
|
|
39
|
-
return
|
|
40
|
-
inputWrapperRef:
|
|
41
|
-
})), /* @__PURE__ */
|
|
42
|
-
ref:
|
|
43
|
-
}, /* @__PURE__ */
|
|
44
|
-
name:
|
|
45
|
-
hint:
|
|
46
|
-
error:
|
|
47
|
-
id:
|
|
48
|
-
required:
|
|
49
|
-
}, /* @__PURE__ */
|
|
18
|
+
return g(n, () => ({
|
|
19
|
+
inputWrapperRef: a
|
|
20
|
+
})), /* @__PURE__ */ t.createElement("div", {
|
|
21
|
+
ref: a
|
|
22
|
+
}, /* @__PURE__ */ t.createElement(T, {
|
|
23
|
+
name: d,
|
|
24
|
+
hint: s,
|
|
25
|
+
error: c,
|
|
26
|
+
id: v,
|
|
27
|
+
required: b
|
|
28
|
+
}, /* @__PURE__ */ t.createElement(F, {
|
|
50
29
|
spacing: 1
|
|
51
|
-
},
|
|
52
|
-
action:
|
|
53
|
-
},
|
|
54
|
-
size:
|
|
55
|
-
ref:
|
|
56
|
-
startAction:
|
|
57
|
-
endAction:
|
|
58
|
-
|
|
30
|
+
}, r && /* @__PURE__ */ t.createElement(y, {
|
|
31
|
+
action: f
|
|
32
|
+
}, r), /* @__PURE__ */ t.createElement(I, {
|
|
33
|
+
size: l,
|
|
34
|
+
ref: n,
|
|
35
|
+
startAction: m,
|
|
36
|
+
endAction: p,
|
|
37
|
+
...o
|
|
38
|
+
}), /* @__PURE__ */ t.createElement(A, null), /* @__PURE__ */ t.createElement(x, null))));
|
|
59
39
|
}
|
|
60
40
|
);
|
|
61
|
-
|
|
62
|
-
|
|
41
|
+
i.displayName = "TextInput";
|
|
42
|
+
i.defaultProps = {
|
|
63
43
|
"aria-label": void 0,
|
|
64
44
|
label: void 0,
|
|
65
45
|
labelAction: void 0,
|
|
@@ -71,19 +51,19 @@ m.defaultProps = {
|
|
|
71
51
|
endAction: void 0,
|
|
72
52
|
required: !1
|
|
73
53
|
};
|
|
74
|
-
|
|
75
|
-
"aria-label":
|
|
76
|
-
endAction:
|
|
77
|
-
error:
|
|
78
|
-
hint:
|
|
79
|
-
id:
|
|
80
|
-
label:
|
|
81
|
-
labelAction:
|
|
82
|
-
name:
|
|
83
|
-
required:
|
|
84
|
-
size:
|
|
85
|
-
startAction:
|
|
54
|
+
i.propTypes = {
|
|
55
|
+
"aria-label": e.string,
|
|
56
|
+
endAction: e.element,
|
|
57
|
+
error: e.oneOfType([e.string, e.bool]),
|
|
58
|
+
hint: e.oneOfType([e.string, e.node, e.arrayOf(e.node)]),
|
|
59
|
+
id: e.string,
|
|
60
|
+
label: e.string,
|
|
61
|
+
labelAction: e.element,
|
|
62
|
+
name: e.string.isRequired,
|
|
63
|
+
required: e.bool,
|
|
64
|
+
size: e.oneOf(Object.keys(O.input)),
|
|
65
|
+
startAction: e.element
|
|
86
66
|
};
|
|
87
67
|
export {
|
|
88
|
-
|
|
68
|
+
i as TextInput
|
|
89
69
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("react"),h=require("prop-types"),q=require("styled-components"),g=require("../Field/Field.cjs"),x=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const y=require("../Field/FieldHint.cjs"),j=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const T=require("./TextareaInput.cjs"),b=require("../Stack/Stack.cjs"),v=require("../Flex/Flex.cjs"),E=require("../helpers/useId.cjs"),a=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},l=a(m),e=a(h),_=a(q),I=_.default.div`
|
|
2
2
|
& textarea {
|
|
3
3
|
// TODO: remove when we'll have fonts in the theme
|
|
4
4
|
height: ${80/16}rem;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
font-weight: 400;
|
|
10
10
|
font-size: ${14/16}rem;
|
|
11
11
|
line-height: 1.43;
|
|
12
|
-
color: ${({theme:
|
|
12
|
+
color: ${({theme:t})=>t.colors.neutral500};
|
|
13
13
|
opacity: 1;
|
|
14
14
|
}
|
|
15
|
-
`,
|
|
15
|
+
`,r=l.default.forwardRef(({name:t,hint:d,error:n,label:i,children:u,labelAction:o,id:s,required:c,...f},p)=>{const F=E.useId("textarea",s);return l.default.createElement(I,null,l.default.createElement(g.Field,{name:t,hint:d,error:n,id:F,required:c},l.default.createElement(b.Stack,{spacing:1},i&&l.default.createElement(v.Flex,null,l.default.createElement(x.FieldLabel,{action:o},i)),l.default.createElement(T.TextareaInput,{ref:p,as:"textarea",value:u,...f}),l.default.createElement(y.FieldHint,null),l.default.createElement(j.FieldError,null))))});r.displayName="Textarea";r.defaultProps={"aria-label":void 0,label:void 0,labelAction:void 0,error:void 0,hint:void 0,id:void 0,children:"",required:!1};r.propTypes={"aria-label":e.default.string,children:e.default.string,error:e.default.string,hint:e.default.oneOfType([e.default.string,e.default.node,e.default.arrayOf(e.default.node)]),id:e.default.string,label:e.default.string,labelAction:e.default.element,name:e.default.string.isRequired,required:e.default.bool};exports.Textarea=r;
|
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
p.call(t, r) && d(e, r, t[r]);
|
|
7
|
-
if (l)
|
|
8
|
-
for (var r of l(t))
|
|
9
|
-
c.call(t, r) && d(e, r, t[r]);
|
|
10
|
-
return e;
|
|
11
|
-
};
|
|
12
|
-
var f = (e, t) => {
|
|
13
|
-
var r = {};
|
|
14
|
-
for (var o in e)
|
|
15
|
-
p.call(e, o) && t.indexOf(o) < 0 && (r[o] = e[o]);
|
|
16
|
-
if (e != null && l)
|
|
17
|
-
for (var o of l(e))
|
|
18
|
-
t.indexOf(o) < 0 && c.call(e, o) && (r[o] = e[o]);
|
|
19
|
-
return r;
|
|
20
|
-
};
|
|
21
|
-
import a from "react";
|
|
22
|
-
import i from "prop-types";
|
|
23
|
-
import y from "styled-components";
|
|
24
|
-
import { Field as F } from "../Field/Field.js";
|
|
25
|
-
import { FieldLabel as w } from "../Field/FieldLabel.js";
|
|
1
|
+
import r from "react";
|
|
2
|
+
import e from "prop-types";
|
|
3
|
+
import h from "styled-components";
|
|
4
|
+
import { Field as u } from "../Field/Field.js";
|
|
5
|
+
import { FieldLabel as g } from "../Field/FieldLabel.js";
|
|
26
6
|
import "../Field/FieldInput.js";
|
|
27
|
-
import { FieldHint as
|
|
28
|
-
import { FieldError as
|
|
7
|
+
import { FieldHint as v } from "../Field/FieldHint.js";
|
|
8
|
+
import { FieldError as x } from "../Field/FieldError.js";
|
|
29
9
|
import "../Field/FieldContext.js";
|
|
30
10
|
import "../Field/FieldAction.js";
|
|
31
|
-
import { TextareaInput as
|
|
32
|
-
import { Stack as
|
|
33
|
-
import { Flex as
|
|
34
|
-
import { useId as
|
|
35
|
-
const
|
|
11
|
+
import { TextareaInput as E } from "./TextareaInput.js";
|
|
12
|
+
import { Stack as T } from "../Stack/Stack.js";
|
|
13
|
+
import { Flex as b } from "../Flex/Flex.js";
|
|
14
|
+
import { useId as y } from "../helpers/useId.js";
|
|
15
|
+
const F = h.div`
|
|
36
16
|
& textarea {
|
|
37
17
|
// TODO: remove when we'll have fonts in the theme
|
|
38
18
|
height: ${80 / 16}rem;
|
|
@@ -43,32 +23,32 @@ const P = y.div`
|
|
|
43
23
|
font-weight: 400;
|
|
44
24
|
font-size: ${14 / 16}rem;
|
|
45
25
|
line-height: 1.43;
|
|
46
|
-
color: ${({ theme:
|
|
26
|
+
color: ${({ theme: t }) => t.colors.neutral500};
|
|
47
27
|
opacity: 1;
|
|
48
28
|
}
|
|
49
|
-
`,
|
|
50
|
-
(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}, /* @__PURE__ */ a.createElement(I, {
|
|
29
|
+
`, i = r.forwardRef(
|
|
30
|
+
({ name: t, hint: a, error: l, label: o, children: n, labelAction: m, id: d, required: p, ...c }, s) => {
|
|
31
|
+
const f = y("textarea", d);
|
|
32
|
+
return /* @__PURE__ */ r.createElement(F, null, /* @__PURE__ */ r.createElement(u, {
|
|
33
|
+
name: t,
|
|
34
|
+
hint: a,
|
|
35
|
+
error: l,
|
|
36
|
+
id: f,
|
|
37
|
+
required: p
|
|
38
|
+
}, /* @__PURE__ */ r.createElement(T, {
|
|
60
39
|
spacing: 1
|
|
61
|
-
}, o && /* @__PURE__ */
|
|
62
|
-
action:
|
|
63
|
-
}, o)), /* @__PURE__ */
|
|
64
|
-
ref:
|
|
40
|
+
}, o && /* @__PURE__ */ r.createElement(b, null, /* @__PURE__ */ r.createElement(g, {
|
|
41
|
+
action: m
|
|
42
|
+
}, o)), /* @__PURE__ */ r.createElement(E, {
|
|
43
|
+
ref: s,
|
|
65
44
|
as: "textarea",
|
|
66
|
-
value:
|
|
67
|
-
|
|
45
|
+
value: n,
|
|
46
|
+
...c
|
|
47
|
+
}), /* @__PURE__ */ r.createElement(v, null), /* @__PURE__ */ r.createElement(x, null))));
|
|
68
48
|
}
|
|
69
49
|
);
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
i.displayName = "Textarea";
|
|
51
|
+
i.defaultProps = {
|
|
72
52
|
"aria-label": void 0,
|
|
73
53
|
label: void 0,
|
|
74
54
|
labelAction: void 0,
|
|
@@ -78,17 +58,17 @@ n.defaultProps = {
|
|
|
78
58
|
children: "",
|
|
79
59
|
required: !1
|
|
80
60
|
};
|
|
81
|
-
|
|
82
|
-
"aria-label":
|
|
83
|
-
children:
|
|
84
|
-
error:
|
|
85
|
-
hint:
|
|
86
|
-
id:
|
|
87
|
-
label:
|
|
88
|
-
labelAction:
|
|
89
|
-
name:
|
|
90
|
-
required:
|
|
61
|
+
i.propTypes = {
|
|
62
|
+
"aria-label": e.string,
|
|
63
|
+
children: e.string,
|
|
64
|
+
error: e.string,
|
|
65
|
+
hint: e.oneOfType([e.string, e.node, e.arrayOf(e.node)]),
|
|
66
|
+
id: e.string,
|
|
67
|
+
label: e.string,
|
|
68
|
+
labelAction: e.element,
|
|
69
|
+
name: e.string.isRequired,
|
|
70
|
+
required: e.bool
|
|
91
71
|
};
|
|
92
72
|
export {
|
|
93
|
-
|
|
73
|
+
i as Textarea
|
|
94
74
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react"),b=require("styled-components"),$=require("prop-types");require("../Field/Field.cjs");require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const g=require("../Field/FieldContext.cjs");require("../Typography/Typography.cjs");require("../Field/FieldAction.cjs");const F=require("../themes/utils.cjs"),l=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},d=l(n),c=l(b),q=l($),T=c.default.div`
|
|
2
2
|
border: 1px solid ${({theme:e,hasError:r})=>r?e.colors.danger600:e.colors.neutral200};
|
|
3
3
|
border-radius: ${({theme:e})=>e.borderRadius};
|
|
4
4
|
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
padding-bottom: ${({theme:e})=>`${e.spaces[3]}`};
|
|
9
9
|
|
|
10
10
|
background: ${({theme:e,disabled:r})=>r?e.colors.neutral150:e.colors.neutral0};
|
|
11
|
-
${
|
|
12
|
-
`,
|
|
11
|
+
${F.inputFocusStyle()}
|
|
12
|
+
`,h=c.default.textarea`
|
|
13
13
|
display: block;
|
|
14
14
|
width: 100%;
|
|
15
15
|
font-weight: 400;
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
&:focus-within {
|
|
28
28
|
outline: none;
|
|
29
29
|
}
|
|
30
|
-
`,
|
|
30
|
+
`,t=n.forwardRef(({disabled:e,...r},u)=>{const{id:o,error:s,hint:p,name:f,required:y}=g.useField();let a;s?a=`${o}-error`:p&&(a=`${o}-hint`);const i=Boolean(s);return d.default.createElement(T,{hasError:i,disabled:e},d.default.createElement(h,{id:o,name:f,ref:u,"aria-describedby":a,"aria-invalid":i,disabled:e,hasError:i,"aria-required":y,...r}))});t.displayName="TextareaInput";t.defaultProps={disabled:!1};t.propTypes={disabled:q.default.bool};exports.TextareaInput=t;
|
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var c = (r, o, e) => o in r ? T(r, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[o] = e, f = (r, o) => {
|
|
5
|
-
for (var e in o || (o = {}))
|
|
6
|
-
u.call(o, e) && c(r, e, o[e]);
|
|
7
|
-
if (t)
|
|
8
|
-
for (var e of t(o))
|
|
9
|
-
m.call(o, e) && c(r, e, o[e]);
|
|
10
|
-
return r;
|
|
11
|
-
};
|
|
12
|
-
var $ = (r, o) => {
|
|
13
|
-
var e = {};
|
|
14
|
-
for (var a in r)
|
|
15
|
-
u.call(r, a) && o.indexOf(a) < 0 && (e[a] = r[a]);
|
|
16
|
-
if (r != null && t)
|
|
17
|
-
for (var a of t(r))
|
|
18
|
-
o.indexOf(a) < 0 && m.call(r, a) && (e[a] = r[a]);
|
|
19
|
-
return e;
|
|
20
|
-
};
|
|
21
|
-
import b, { forwardRef as w } from "react";
|
|
22
|
-
import g from "styled-components";
|
|
23
|
-
import k from "prop-types";
|
|
1
|
+
import s, { forwardRef as m } from "react";
|
|
2
|
+
import l from "styled-components";
|
|
3
|
+
import f from "prop-types";
|
|
24
4
|
import "../Field/Field.js";
|
|
25
5
|
import "../Field/FieldLabel.js";
|
|
26
6
|
import "../Field/FieldInput.js";
|
|
27
|
-
import { useField as
|
|
7
|
+
import { useField as $ } from "../Field/FieldContext.js";
|
|
28
8
|
import "../Typography/Typography.js";
|
|
29
9
|
import "../Field/FieldAction.js";
|
|
30
|
-
import { inputFocusStyle as
|
|
31
|
-
const
|
|
10
|
+
import { inputFocusStyle as b } from "../themes/utils.js";
|
|
11
|
+
const g = l.div`
|
|
32
12
|
border: 1px solid ${({ theme: r, hasError: o }) => o ? r.colors.danger600 : r.colors.neutral200};
|
|
33
13
|
border-radius: ${({ theme: r }) => r.borderRadius};
|
|
34
14
|
|
|
@@ -38,8 +18,8 @@ const q = g.div`
|
|
|
38
18
|
padding-bottom: ${({ theme: r }) => `${r.spaces[3]}`};
|
|
39
19
|
|
|
40
20
|
background: ${({ theme: r, disabled: o }) => o ? r.colors.neutral150 : r.colors.neutral0};
|
|
41
|
-
${
|
|
42
|
-
`,
|
|
21
|
+
${b()}
|
|
22
|
+
`, y = l.textarea`
|
|
43
23
|
display: block;
|
|
44
24
|
width: 100%;
|
|
45
25
|
font-weight: 400;
|
|
@@ -57,33 +37,33 @@ const q = g.div`
|
|
|
57
37
|
&:focus-within {
|
|
58
38
|
outline: none;
|
|
59
39
|
}
|
|
60
|
-
`,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
hasError: s,
|
|
40
|
+
`, i = m(({ disabled: r, ...o }, p) => {
|
|
41
|
+
const { id: e, error: n, hint: d, name: c, required: u } = $();
|
|
42
|
+
let a;
|
|
43
|
+
n ? a = `${e}-error` : d && (a = `${e}-hint`);
|
|
44
|
+
const t = Boolean(n);
|
|
45
|
+
return /* @__PURE__ */ s.createElement(g, {
|
|
46
|
+
hasError: t,
|
|
68
47
|
disabled: r
|
|
69
|
-
}, /* @__PURE__ */
|
|
70
|
-
id:
|
|
71
|
-
name:
|
|
72
|
-
ref:
|
|
73
|
-
"aria-describedby":
|
|
74
|
-
"aria-invalid":
|
|
48
|
+
}, /* @__PURE__ */ s.createElement(y, {
|
|
49
|
+
id: e,
|
|
50
|
+
name: c,
|
|
51
|
+
ref: p,
|
|
52
|
+
"aria-describedby": a,
|
|
53
|
+
"aria-invalid": t,
|
|
75
54
|
disabled: r,
|
|
76
|
-
hasError:
|
|
77
|
-
"aria-required":
|
|
78
|
-
|
|
55
|
+
hasError: t,
|
|
56
|
+
"aria-required": u,
|
|
57
|
+
...o
|
|
58
|
+
}));
|
|
79
59
|
});
|
|
80
|
-
|
|
81
|
-
|
|
60
|
+
i.displayName = "TextareaInput";
|
|
61
|
+
i.defaultProps = {
|
|
82
62
|
disabled: !1
|
|
83
63
|
};
|
|
84
|
-
|
|
85
|
-
disabled:
|
|
64
|
+
i.propTypes = {
|
|
65
|
+
disabled: f.bool
|
|
86
66
|
};
|
|
87
67
|
export {
|
|
88
|
-
|
|
68
|
+
i as TextareaInput
|
|
89
69
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("react"),P=require("prop-types"),z=require("@strapi/icons/Clock"),E=require("styled-components"),R=require("../themes/sizes.cjs"),L=require("../Select/Select.cjs"),w=require("../Select/Option.cjs");require("../Select/OptGroup.cjs");require("../Select/MultiSelectNested.cjs");require("../Select/SelectList.cjs");const B=require("../helpers/useId.cjs"),o=l=>l&&typeof l=="object"&&"default"in l?l:{default:l},n=o(I),e=o(P),x=o(z),D=o(E),G=D.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
svg {
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
svg path {
|
|
10
|
-
fill: ${({theme:
|
|
10
|
+
fill: ${({theme:l})=>l.colors.neutral500};
|
|
11
11
|
}
|
|
12
|
-
`,
|
|
12
|
+
`,c=({disabled:l,error:p,hint:m,id:b,onClear:y,onChange:h,value:i,clearLabel:g,label:q,required:v,selectButtonTitle:O,step:T,size:S,..._})=>{const j=B.useId("timepicker",b),M=24,s=[];let u=0;for(let t=0;t<M;t++)for(u=0;u<60;)s.push(`${t<10?`0${t}`:t}:${u<10?`0${u}`:u}`),u+=T;const k=()=>{const t=i.split(":")[0],f=i.split(":")[1],C=s.reduce((r,d)=>{const a=d.split(":")[0];return Math.abs(a-t)<Math.abs(r-t)?a:r},s[0].split(":")[0]),$=s.reduce((r,d)=>{const a=d.split(":")[1];return Math.abs(a-f)<Math.abs(r-f)?a:r},s[0].split(":")[1]);return`${C}:${$}`};return n.default.createElement(L.Select,{id:j,label:q,placeholder:"--:--",hint:m,onClear:y,clearLabel:g,error:p,value:i?k():null,size:S,onChange:h,disabled:l,required:v,selectButtonTitle:O,startIcon:n.default.createElement(G,null,n.default.createElement(x.default,null)),..._},s.map(t=>n.default.createElement(w.Option,{value:t,key:t},t)))};c.defaultProps={disabled:!1,error:void 0,hint:void 0,id:void 0,label:void 0,onClear:void 0,required:!1,size:"M",selectButtonTitle:void 0,step:15,value:void 0};c.propTypes={clearLabel:e.default.string.isRequired,disabled:e.default.bool,error:e.default.oneOfType([e.default.string,e.default.bool]),hint:e.default.oneOfType([e.default.string,e.default.node,e.default.arrayOf(e.default.node)]),id:e.default.oneOfType([e.default.string,e.default.number]),label:e.default.string,onChange:e.default.func.isRequired,onClear:e.default.func,required:e.default.bool,selectButtonTitle:e.default.string,size:e.default.oneOf(Object.keys(R.sizes.input)),step:e.default.number,value:e.default.oneOfType([e.default.arrayOf(e.default.oneOfType([e.default.string,e.default.number])),e.default.string,e.default.number])};exports.TimePicker=c;
|