@strapi/design-system 1.6.5 → 1.7.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/README.md +55 -0
- package/dist/BaseButton/BaseButton.cjs +4 -4
- package/dist/BaseButton/BaseButton.js +18 -17
- package/dist/BaseLink/BaseLink.cjs +1 -3
- package/dist/BaseLink/BaseLink.js +14 -14
- package/dist/Combobox/Combobox.cjs +104 -1
- package/dist/Combobox/Combobox.js +348 -278
- package/dist/Combobox/ComboboxList.cjs +1 -1
- package/dist/Combobox/ComboboxList.js +7 -6
- package/dist/Combobox/ComboboxOption.cjs +1 -1
- package/dist/Combobox/ComboboxOption.js +3 -29
- package/dist/DatePicker/DatePicker.cjs +12 -1
- package/dist/DatePicker/DatePicker.js +79 -100
- package/dist/DatePicker/DatePickerCalendar.cjs +1 -1
- package/dist/DatePicker/DatePickerCalendar.js +124 -57
- package/dist/DatePicker/DatePickerTd.cjs +4 -4
- package/dist/DatePicker/DatePickerTd.js +42 -24
- package/dist/DatePicker/DatePickerTh.cjs +3 -3
- package/dist/DatePicker/DatePickerTh.js +29 -12
- package/dist/DatePicker/components.cjs +8 -6
- package/dist/DatePicker/components.js +15 -13
- package/dist/DatePicker/utils/getDayOfWeek.js +8 -8
- package/dist/DatePicker/utils/getMonths.cjs +1 -1
- package/dist/DatePicker/utils/getMonths.js +3 -3
- package/dist/DatePicker/utils/getYears.cjs +1 -1
- package/dist/DatePicker/utils/getYears.js +1 -1
- package/dist/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/DateTimePicker/DateTimePicker.js +97 -104
- package/dist/DateTimePicker/parseDate.cjs +1 -1
- package/dist/DateTimePicker/parseDate.js +2 -1
- package/dist/Field/FieldHint.cjs +1 -1
- package/dist/Field/FieldHint.js +3 -3
- package/dist/Field/FieldLabel.cjs +5 -2
- package/dist/Field/FieldLabel.js +27 -27
- package/dist/IconButton/IconButton.cjs +4 -4
- package/dist/IconButton/IconButton.js +32 -30
- package/dist/NumberInput/NumberInput.cjs +2 -2
- package/dist/NumberInput/NumberInput.js +31 -31
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +4 -1
- package/dist/Select/MultiSelect.cjs +30 -0
- package/dist/Select/MultiSelect.js +239 -0
- package/dist/Select/MultiSelectNested.cjs +3 -1
- package/dist/Select/MultiSelectNested.js +25 -12
- package/dist/Select/OptGroup.cjs +1 -1
- package/dist/Select/OptGroup.js +3 -22
- package/dist/Select/Option.cjs +1 -45
- package/dist/Select/Option.js +12 -100
- package/dist/Select/Select.cjs +1 -3
- package/dist/Select/Select.js +9 -205
- package/dist/Select/SelectList.cjs +1 -1
- package/dist/Select/SelectList.js +98 -80
- package/dist/Select/SelectParts.cjs +79 -0
- package/dist/Select/SelectParts.js +221 -0
- package/dist/Select/SingleSelect.cjs +1 -0
- package/dist/Select/SingleSelect.js +129 -0
- package/dist/Select/index.cjs +1 -1
- package/dist/Select/index.js +15 -10
- package/dist/TextButton/TextButton.cjs +6 -12
- package/dist/TextButton/TextButton.js +32 -46
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +47 -46
- package/dist/TimePicker/TimePicker.cjs +5 -7
- package/dist/TimePicker/TimePicker.js +53 -103
- package/dist/helpers/objects.cjs +1 -1
- package/dist/helpers/objects.js +6 -22
- package/dist/hooks/useComposeRefs.cjs +1 -0
- package/dist/hooks/useComposeRefs.js +14 -0
- package/dist/hooks/useIntersection.cjs +1 -1
- package/dist/hooks/useIntersection.js +7 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +143 -138
- package/dist/themes/extendTheme.cjs +4 -4
- package/dist/themes/extendTheme.js +21 -13
- package/dist/themes/utils.cjs +6 -6
- package/dist/themes/utils.js +7 -6
- package/dist/v2/Link/Link.cjs +13 -11
- package/dist/v2/Link/Link.js +52 -37
- package/dist/v2/SimpleMenu/Menu.cjs +65 -0
- package/dist/v2/SimpleMenu/Menu.js +229 -0
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +1 -33
- package/dist/v2/SimpleMenu/SimpleMenu.js +37 -176
- package/dist/v2/SimpleMenu/index.cjs +1 -1
- package/dist/v2/SimpleMenu/index.js +5 -3
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.js +53 -51
- package/package.json +7 -19
- package/dist/Combobox/components.cjs +0 -53
- package/dist/Combobox/components.js +0 -64
- package/dist/Combobox/utils.cjs +0 -1
- package/dist/Combobox/utils.js +0 -78
- package/dist/DateTimePicker/DateTimePickerProps.cjs +0 -1
- package/dist/DateTimePicker/DateTimePickerProps.js +0 -40
- package/dist/DateTimePicker/__tests__/parseDate.test.cjs +0 -1
- package/dist/DateTimePicker/__tests__/parseDate.test.js +0 -8
- package/dist/Select/SelectButton.cjs +0 -19
- package/dist/Select/SelectButton.js +0 -67
- package/dist/Select/SelectTags.cjs +0 -6
- package/dist/Select/SelectTags.js +0 -38
- package/dist/Select/components.cjs +0 -39
- package/dist/Select/components.js +0 -48
- package/dist/Select/constants.cjs +0 -1
- package/dist/Select/constants.js +0 -8
- package/dist/Select/hooks/useButtonRef.cjs +0 -1
- package/dist/Select/hooks/useButtonRef.js +0 -13
- package/dist/Select/hooks/useListRef.cjs +0 -1
- package/dist/Select/hooks/useListRef.js +0 -18
- package/dist/Select/utils.cjs +0 -1
- package/dist/Select/utils.js +0 -17
- package/dist/helpers/arrays.cjs +0 -1
- package/dist/helpers/arrays.js +0 -6
- package/dist/v2/SimpleMenu/utils.cjs +0 -12
- package/dist/v2/SimpleMenu/utils.js +0 -15
|
@@ -1,25 +1,42 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import
|
|
3
|
-
import r from "styled-components";
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import t from "styled-components";
|
|
4
3
|
import { Flex as n } from "../Flex/Flex.js";
|
|
5
|
-
import "react
|
|
4
|
+
import "react";
|
|
6
5
|
import "../RawTable/RawTableContext.js";
|
|
7
6
|
import { RawTh as a } from "../RawTable/RawCell.js";
|
|
8
7
|
import "../Box/Box.js";
|
|
9
8
|
import { Typography as m } from "../Typography/Typography.js";
|
|
10
9
|
import { VisuallyHidden as p } from "../VisuallyHidden/VisuallyHidden.js";
|
|
11
|
-
const
|
|
10
|
+
const s = t(a)`
|
|
12
11
|
// Trick to prevent the outline from overflowing because of the general outline-offset
|
|
13
12
|
outline-offset: -2px;
|
|
14
|
-
border-radius: ${({
|
|
13
|
+
border-radius: ${({
|
|
14
|
+
theme: r
|
|
15
|
+
}) => r.borderRadius};
|
|
15
16
|
text-transform: capitalize;
|
|
16
|
-
`,
|
|
17
|
+
`, l = t(n)`
|
|
17
18
|
height: ${24 / 16}rem;
|
|
18
19
|
width: ${32 / 16}rem;
|
|
19
|
-
`,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
20
|
+
`, y = ({
|
|
21
|
+
children: r,
|
|
22
|
+
...o
|
|
23
|
+
}) => e(s, {
|
|
24
|
+
...o,
|
|
25
|
+
children: i(l, {
|
|
26
|
+
justifyContent: "center",
|
|
27
|
+
children: [e(m, {
|
|
28
|
+
variant: "pi",
|
|
29
|
+
fontWeight: "bold",
|
|
30
|
+
color: "neutral800",
|
|
31
|
+
"aria-hidden": !0,
|
|
32
|
+
children: r.substr(0, 2)
|
|
33
|
+
}), e(p, {
|
|
34
|
+
children: e("span", {
|
|
35
|
+
children: r
|
|
36
|
+
})
|
|
37
|
+
})]
|
|
38
|
+
})
|
|
39
|
+
});
|
|
23
40
|
export {
|
|
24
|
-
|
|
41
|
+
y as DatePickerTh
|
|
25
42
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("styled-components"),n=require("../Box/Box.cjs"),a=require("../Field/FieldInput.cjs"),i=require("../Popover/Popover.cjs"),s=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},o=s(r),d=o.default(i.Popover)`
|
|
2
2
|
max-height: ${3*6}rem;
|
|
3
3
|
overflow: hidden;
|
|
4
4
|
`,l=o.default.button`
|
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
fill: ${({theme:e})=>e.colors.neutral500};
|
|
12
12
|
}
|
|
13
13
|
`,c=o.default.div`
|
|
14
|
-
${({bold:e,theme:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
${({bold:e,theme:t})=>e?r.css`
|
|
15
|
+
& ${a.InputWrapper} {
|
|
16
|
+
border: 1px solid ${t.colors.primary600};
|
|
17
|
+
}
|
|
18
|
+
`:""}
|
|
19
|
+
`,u=o.default(n.Box)`
|
|
18
20
|
background: transparent;
|
|
19
21
|
border: none;
|
|
20
22
|
position: relative;
|
|
@@ -28,4 +30,4 @@
|
|
|
28
30
|
svg path {
|
|
29
31
|
fill: ${({theme:e})=>e.colors.neutral600};
|
|
30
32
|
}
|
|
31
|
-
`;exports.DatePickerButton=l;exports.DatePickerPopover=
|
|
33
|
+
`;exports.DatePickerButton=l;exports.DatePickerPopover=d;exports.DatePickerWrapper=c;exports.IconBox=u;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import o from "styled-components";
|
|
2
|
-
import { Box as
|
|
1
|
+
import o, { css as t } from "styled-components";
|
|
2
|
+
import { Box as n } from "../Box/Box.js";
|
|
3
3
|
import { InputWrapper as i } from "../Field/FieldInput.js";
|
|
4
4
|
import { Popover as a } from "../Popover/Popover.js";
|
|
5
|
-
const
|
|
5
|
+
const c = o(a)`
|
|
6
6
|
max-height: ${3 * 6}rem;
|
|
7
7
|
overflow: hidden;
|
|
8
|
-
`,
|
|
8
|
+
`, m = o.button`
|
|
9
9
|
border: none;
|
|
10
10
|
background: transparent;
|
|
11
11
|
border-radius: ${({ theme: r }) => r.borderRadius};
|
|
@@ -14,11 +14,13 @@ const l = o(a)`
|
|
|
14
14
|
& svg path {
|
|
15
15
|
fill: ${({ theme: r }) => r.colors.neutral500};
|
|
16
16
|
}
|
|
17
|
-
`,
|
|
18
|
-
${({ bold: r, theme: e }) => r ?
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
`, u = o.div`
|
|
18
|
+
${({ bold: r, theme: e }) => r ? t`
|
|
19
|
+
& ${i} {
|
|
20
|
+
border: 1px solid ${e.colors.primary600};
|
|
21
|
+
}
|
|
22
|
+
` : ""}
|
|
23
|
+
`, $ = o(n)`
|
|
22
24
|
background: transparent;
|
|
23
25
|
border: none;
|
|
24
26
|
position: relative;
|
|
@@ -34,8 +36,8 @@ const l = o(a)`
|
|
|
34
36
|
}
|
|
35
37
|
`;
|
|
36
38
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
m as DatePickerButton,
|
|
40
|
+
c as DatePickerPopover,
|
|
41
|
+
u as DatePickerWrapper,
|
|
42
|
+
$ as IconBox
|
|
41
43
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const D = () => {
|
|
2
|
-
const
|
|
2
|
+
const e = new Intl.DateTimeFormat(void 0, { weekday: "long" }).format, t = new Date(1970, 0, 1), n = new Date(1970, 0, 2), o = new Date(1970, 0, 3), a = new Date(1970, 0, 4), s = new Date(1970, 0, 5), w = new Date(1970, 0, 6), c = new Date(1970, 0, 7);
|
|
3
3
|
return {
|
|
4
|
-
sun:
|
|
5
|
-
mon:
|
|
6
|
-
tue:
|
|
7
|
-
wed:
|
|
8
|
-
thu: t
|
|
9
|
-
fri:
|
|
10
|
-
sat:
|
|
4
|
+
sun: e(a),
|
|
5
|
+
mon: e(s),
|
|
6
|
+
tue: e(w),
|
|
7
|
+
wed: e(c),
|
|
8
|
+
thu: e(t),
|
|
9
|
+
fri: e(n),
|
|
10
|
+
sat: e(o)
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=()=>{const e=new Intl.DateTimeFormat(void 0,{month:"long"}).format;return Array(12).fill(null).map((o,t)=>e(new Date(1970,t,1)))};exports.getMonths=n;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o = () => {
|
|
2
2
|
const t = new Intl.DateTimeFormat(void 0, { month: "long" }).format;
|
|
3
|
-
return Array(12).fill(null).map((
|
|
3
|
+
return Array(12).fill(null).map((e, n) => t(new Date(1970, n, 1)));
|
|
4
4
|
};
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
o as getMonths
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=200,u=15,c=(s,a)=>{const t=new Date().getFullYear(),n=s?.getFullYear()??
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=200,u=15,c=(s,a)=>{const t=new Date().getFullYear(),n=s?.getFullYear()??t-l,o=a?.getFullYear()??t+u,r=[];for(let e=n;e<=o;e++)r.push(e);return r};exports.getYears=c;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const E = (n, s) => {
|
|
2
|
-
const t = new Date().getFullYear(), a = n?.getFullYear() ??
|
|
2
|
+
const t = new Date().getFullYear(), a = n?.getFullYear() ?? t - 200, A = s?.getFullYear() ?? t + 15, r = [];
|
|
3
3
|
for (let e = a; e <= A; e++)
|
|
4
4
|
r.push(e);
|
|
5
5
|
return r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),$=require("../DatePicker/DatePicker.cjs"),w=require("../Field/Field.cjs"),L=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const v=require("../Field/FieldHint.cjs"),E=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const g=require("../Flex/Flex.cjs"),N=require("../hooks/useControllableState.cjs"),V=require("../hooks/useId.cjs"),_=require("../TimePicker/TimePicker.cjs"),z=({ariaLabel:l,clearLabel:s="clear",disabled:p=!1,error:c,hint:d,id:h,label:u,labelAction:x,onChange:f,onClear:m,name:q,required:F=!1,selectButtonTitle:b="select",size:D="M",step:k=1,value:T,...C})=>{const P=A(T),[t,a]=N.useControllableState({prop:P,onChange:f}),r=t?`${t.getHours()}:${t.getMinutes()}:${t.getSeconds()}`:void 0,I=e=>{if(r){const[n,j]=r.split(":");e.setHours(parseInt(n,10)),e.setMinutes(parseInt(j,10))}a(e)},S=e=>{const n=t?new Date(t):new Date,[j,y]=e.split(":");n.setHours(parseInt(j,10)),n.setMinutes(parseInt(y,10)),a(n)},H=()=>{a(void 0),m&&m()},M=()=>{let e=t?new Date(t):new Date;e.setHours(0),e.setMinutes(0),a(e)},o=V.useId(h);return i.jsx(w.Field,{name:q,role:"group",id:o,"aria-labelledby":o,hint:d,error:c,required:F,children:i.jsxs(g.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[i.jsx(L.FieldLabel,{action:x,children:u}),i.jsxs(g.Flex,{gap:2,children:[i.jsx($.DatePicker,{ariaLabel:u||l,selectedDate:t,selectedDateLabel:e=>`Date picker, current is ${e}`,onChange:I,error:typeof c=="string",hint:typeof d=="string",required:F,size:D,onClear:H,clearLabel:`${s} date`,disabled:p,id:o,...C}),i.jsx(_.TimePicker,{size:D,"aria-label":u||l,error:typeof c=="string",hint:typeof d=="string",value:r,onChange:S,onClear:r!==void 0&&r!=="0:0:0"?M:void 0,clearLabel:`${s} time`,required:F,selectButtonTitle:b,disabled:p,step:k,id:o})]}),i.jsx(v.FieldHint,{}),i.jsx(E.FieldError,{})]})})},A=l=>{const s=Date.parse(l);if(!Number.isNaN(s))return new Date(s)};exports.DateTimePicker=z;
|
|
@@ -1,114 +1,107 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { DatePicker as R } from "../DatePicker/DatePicker.js";
|
|
5
|
-
import { Field as b } from "../Field/Field.js";
|
|
1
|
+
import { jsx as r, jsxs as D } from "react/jsx-runtime";
|
|
2
|
+
import { DatePicker as P } from "../DatePicker/DatePicker.js";
|
|
3
|
+
import { Field as V } from "../Field/Field.js";
|
|
6
4
|
import { FieldLabel as j } from "../Field/FieldLabel.js";
|
|
7
5
|
import "../Field/FieldInput.js";
|
|
8
|
-
import { FieldHint as
|
|
9
|
-
import { FieldError as
|
|
6
|
+
import { FieldHint as q } from "../Field/FieldHint.js";
|
|
7
|
+
import { FieldError as v } from "../Field/FieldError.js";
|
|
10
8
|
import "../Field/FieldContext.js";
|
|
11
9
|
import "../Field/FieldAction.js";
|
|
12
|
-
import { Flex as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
import { Flex as C } from "../Flex/Flex.js";
|
|
11
|
+
import { useControllableState as z } from "../hooks/useControllableState.js";
|
|
12
|
+
import { useId as B } from "../hooks/useId.js";
|
|
13
|
+
import { TimePicker as E } from "../TimePicker/TimePicker.js";
|
|
14
|
+
const te = ({
|
|
15
|
+
ariaLabel: s,
|
|
16
|
+
clearLabel: n = "clear",
|
|
17
|
+
disabled: f = !1,
|
|
19
18
|
error: d,
|
|
20
|
-
hint:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
hint: m,
|
|
20
|
+
id: b,
|
|
21
|
+
label: c,
|
|
22
|
+
labelAction: I,
|
|
23
|
+
onChange: T,
|
|
24
|
+
onClear: g,
|
|
25
25
|
name: $,
|
|
26
|
-
required:
|
|
27
|
-
selectButtonTitle:
|
|
28
|
-
size:
|
|
29
|
-
step:
|
|
30
|
-
value:
|
|
31
|
-
...
|
|
26
|
+
required: p = !1,
|
|
27
|
+
selectButtonTitle: w = "select",
|
|
28
|
+
size: h = "M",
|
|
29
|
+
step: y = 1,
|
|
30
|
+
value: F,
|
|
31
|
+
...H
|
|
32
32
|
}) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
disabled: E,
|
|
105
|
-
step: h
|
|
106
|
-
}
|
|
107
|
-
)), /* @__PURE__ */ r.createElement(A, null), /* @__PURE__ */ r.createElement(B, null))
|
|
108
|
-
);
|
|
33
|
+
const M = A(F), [t, a] = z({
|
|
34
|
+
prop: M,
|
|
35
|
+
onChange: T
|
|
36
|
+
}), i = t ? `${t.getHours()}:${t.getMinutes()}:${t.getSeconds()}` : void 0, k = (e) => {
|
|
37
|
+
if (i) {
|
|
38
|
+
const [o, u] = i.split(":");
|
|
39
|
+
e.setHours(parseInt(o, 10)), e.setMinutes(parseInt(u, 10));
|
|
40
|
+
}
|
|
41
|
+
a(e);
|
|
42
|
+
}, x = (e) => {
|
|
43
|
+
const o = t ? new Date(t) : new Date(), [u, N] = e.split(":");
|
|
44
|
+
o.setHours(parseInt(u, 10)), o.setMinutes(parseInt(N, 10)), a(o);
|
|
45
|
+
}, S = () => {
|
|
46
|
+
a(void 0), g && g();
|
|
47
|
+
}, L = () => {
|
|
48
|
+
let e = t ? new Date(t) : new Date();
|
|
49
|
+
e.setHours(0), e.setMinutes(0), a(e);
|
|
50
|
+
}, l = B(b);
|
|
51
|
+
return r(V, {
|
|
52
|
+
name: $,
|
|
53
|
+
role: "group",
|
|
54
|
+
id: l,
|
|
55
|
+
"aria-labelledby": l,
|
|
56
|
+
hint: m,
|
|
57
|
+
error: d,
|
|
58
|
+
required: p,
|
|
59
|
+
children: D(C, {
|
|
60
|
+
direction: "column",
|
|
61
|
+
alignItems: "stretch",
|
|
62
|
+
gap: 1,
|
|
63
|
+
children: [r(j, {
|
|
64
|
+
action: I,
|
|
65
|
+
children: c
|
|
66
|
+
}), D(C, {
|
|
67
|
+
gap: 2,
|
|
68
|
+
children: [r(P, {
|
|
69
|
+
ariaLabel: c || s,
|
|
70
|
+
selectedDate: t,
|
|
71
|
+
selectedDateLabel: (e) => `Date picker, current is ${e}`,
|
|
72
|
+
onChange: k,
|
|
73
|
+
error: typeof d == "string",
|
|
74
|
+
hint: typeof m == "string",
|
|
75
|
+
required: p,
|
|
76
|
+
size: h,
|
|
77
|
+
onClear: S,
|
|
78
|
+
clearLabel: `${n} date`,
|
|
79
|
+
disabled: f,
|
|
80
|
+
id: l,
|
|
81
|
+
...H
|
|
82
|
+
}), r(E, {
|
|
83
|
+
size: h,
|
|
84
|
+
"aria-label": c || s,
|
|
85
|
+
error: typeof d == "string",
|
|
86
|
+
hint: typeof m == "string",
|
|
87
|
+
value: i,
|
|
88
|
+
onChange: x,
|
|
89
|
+
onClear: i !== void 0 && i !== "0:0:0" ? L : void 0,
|
|
90
|
+
clearLabel: `${n} time`,
|
|
91
|
+
required: p,
|
|
92
|
+
selectButtonTitle: w,
|
|
93
|
+
disabled: f,
|
|
94
|
+
step: y,
|
|
95
|
+
id: l
|
|
96
|
+
})]
|
|
97
|
+
}), r(q, {}), r(v, {})]
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}, A = (s) => {
|
|
101
|
+
const n = Date.parse(s);
|
|
102
|
+
if (!Number.isNaN(n))
|
|
103
|
+
return new Date(n);
|
|
109
104
|
};
|
|
110
|
-
M.defaultProps = C;
|
|
111
|
-
M.propTypes = L;
|
|
112
105
|
export {
|
|
113
|
-
|
|
106
|
+
te as DateTimePicker
|
|
114
107
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=t=>{const e=Date.parse(t);
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=t=>{const e=Date.parse(t);if(!Number.isNaN(e))return new Date(e)};exports.parseDate=r;
|
package/dist/Field/FieldHint.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),n=require("./FieldContext.cjs"),o=require("../Typography/Typography.cjs"),s=()=>{const{id:t,hint:e,error:r}=n.useField();return!e||
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),n=require("./FieldContext.cjs"),o=require("../Typography/Typography.cjs"),s=()=>{const{id:t,hint:e,error:r}=n.useField();return!e||r?null:i.jsx(o.Typography,{variant:"pi",as:"p",id:`${t}-hint`,textColor:"neutral600",children:e})};exports.FieldHint=s;
|
package/dist/Field/FieldHint.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useField as n } from "./FieldContext.js";
|
|
3
3
|
import { Typography as e } from "../Typography/Typography.js";
|
|
4
|
-
const
|
|
4
|
+
const a = () => {
|
|
5
5
|
const {
|
|
6
6
|
id: t,
|
|
7
7
|
hint: r,
|
|
8
8
|
error: i
|
|
9
9
|
} = n();
|
|
10
|
-
return !r ||
|
|
10
|
+
return !r || i ? null : o(e, {
|
|
11
11
|
variant: "pi",
|
|
12
12
|
as: "p",
|
|
13
13
|
id: `${t}-hint`,
|
|
@@ -16,5 +16,5 @@ const s = () => {
|
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
a as FieldHint
|
|
20
20
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),u=require("react"),p=require("styled-components"),h=require("./FieldContext.cjs"),y=require("../Flex/Flex.cjs"),g=require("../helpers/deprecations.cjs"),i=require("../Typography/Typography.cjs"),f=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},r=f(p),x=g.once(console.warn),F=u.forwardRef(({children:e,action:o,required:n,...l},s)=>{const{id:a,required:c}=h.useField(),d=c||n;return n!==void 0&&x('Deprecation warning: Usage of "required" prop in FieldLabel component is deprecated. This is discouraged and will be removed in the next major release. Please use the Field component to share the required prop.'),t.jsxs(j,{ref:s,variant:"pi",textColor:"neutral800",htmlFor:a,fontWeight:"bold",as:"label",...l,children:[e,d&&t.jsx(q,{textColor:"danger600",children:"*"}),o&&t.jsx(m,{marginLeft:1,children:o})]})}),j=r.default(i.Typography)`
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
`,q=r.default(i.Typography)`
|
|
2
5
|
line-height: 0;
|
|
3
|
-
`,
|
|
6
|
+
`,m=r.default(y.Flex)`
|
|
4
7
|
line-height: 0;
|
|
5
8
|
|
|
6
9
|
svg path {
|
package/dist/Field/FieldLabel.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import { useField as
|
|
5
|
-
import { Flex as
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c } from "react";
|
|
3
|
+
import r from "styled-components";
|
|
4
|
+
import { useField as h } from "./FieldContext.js";
|
|
5
|
+
import { Flex as f } from "../Flex/Flex.js";
|
|
6
6
|
import { once as g } from "../helpers/deprecations.js";
|
|
7
|
-
import { Typography as
|
|
8
|
-
const u = g(console.warn),
|
|
7
|
+
import { Typography as n } from "../Typography/Typography.js";
|
|
8
|
+
const u = g(console.warn), A = c(({
|
|
9
9
|
children: e,
|
|
10
10
|
action: o,
|
|
11
11
|
required: i,
|
|
12
|
-
...
|
|
13
|
-
},
|
|
12
|
+
...l
|
|
13
|
+
}, s) => {
|
|
14
14
|
const {
|
|
15
15
|
id: a,
|
|
16
|
-
required:
|
|
17
|
-
} =
|
|
18
|
-
return i !== void 0 && u('Deprecation warning: Usage of "required" prop in FieldLabel component is deprecated. This is discouraged and will be removed in the next major release. Please use the Field component to share the required prop.'),
|
|
19
|
-
ref:
|
|
16
|
+
required: d
|
|
17
|
+
} = h(), p = d || i;
|
|
18
|
+
return i !== void 0 && u('Deprecation warning: Usage of "required" prop in FieldLabel component is deprecated. This is discouraged and will be removed in the next major release. Please use the Field component to share the required prop.'), m(x, {
|
|
19
|
+
ref: s,
|
|
20
20
|
variant: "pi",
|
|
21
21
|
textColor: "neutral800",
|
|
22
22
|
htmlFor: a,
|
|
23
23
|
fontWeight: "bold",
|
|
24
24
|
as: "label",
|
|
25
|
-
...
|
|
26
|
-
children:
|
|
27
|
-
|
|
28
|
-
children:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
children: o
|
|
34
|
-
})]
|
|
35
|
-
})
|
|
25
|
+
...l,
|
|
26
|
+
children: [e, p && t(y, {
|
|
27
|
+
textColor: "danger600",
|
|
28
|
+
children: "*"
|
|
29
|
+
}), o && t(F, {
|
|
30
|
+
marginLeft: 1,
|
|
31
|
+
children: o
|
|
32
|
+
})]
|
|
36
33
|
});
|
|
37
|
-
}), x =
|
|
34
|
+
}), x = r(n)`
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
`, y = r(n)`
|
|
38
38
|
line-height: 0;
|
|
39
|
-
`, F =
|
|
39
|
+
`, F = r(f)`
|
|
40
40
|
line-height: 0;
|
|
41
41
|
|
|
42
42
|
svg path {
|
|
@@ -46,5 +46,5 @@ const u = g(console.warn), T = h(({
|
|
|
46
46
|
}
|
|
47
47
|
`;
|
|
48
48
|
export {
|
|
49
|
-
|
|
49
|
+
A as FieldLabel
|
|
50
50
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime")
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),j=require("react"),v=require("styled-components"),y=require("../BaseButton/BaseButton.cjs"),B=require("../Flex/Flex.cjs"),m=require("../Tooltip/Tooltip.cjs"),x=require("../VisuallyHidden/VisuallyHidden.cjs"),_=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function R(e){if(e&&e.__esModule)return e;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const u=R(j),c=_(v),q=u.forwardRef(({label:e,background:r,borderWidth:t,noBorder:o=!1,children:d,icon:f,disabled:l=!1,onClick:a,"aria-label":p,...b},g)=>{const $=h=>{!l&&a&&a(h)},s=n.jsxs(i,{"aria-disabled":l,background:l?"neutral150":r,borderWidth:o?0:t,justifyContent:"center",height:`${2}rem`,width:`${2}rem`,...b,ref:g,onClick:$,children:[n.jsx(x.VisuallyHidden,{as:"span",children:e??p}),u.cloneElement(f||d,{"aria-hidden":!0,focusable:!1})]});return e?n.jsx(m.Tooltip,{label:e,children:s}):s}),i=c.default(y.BaseButton)`
|
|
2
2
|
svg {
|
|
3
3
|
> g,
|
|
4
4
|
path {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
`,
|
|
34
|
+
`,O=c.default(B.Flex)`
|
|
35
35
|
& span:first-child button {
|
|
36
36
|
border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
37
37
|
border-radius: ${({theme:e})=>`${e.borderRadius} 0 0 ${e.borderRadius}`};
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
border-radius: ${({theme:e})=>`0 ${e.borderRadius} ${e.borderRadius} 0`};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
& ${
|
|
44
|
+
& ${i} {
|
|
45
45
|
border-radius: 0;
|
|
46
46
|
border-left: none;
|
|
47
47
|
|
|
@@ -78,4 +78,4 @@
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
`;exports.IconButton=
|
|
81
|
+
`;exports.IconButton=q;exports.IconButtonGroup=O;
|