@strapi/design-system 1.6.4 → 1.6.5
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/Accordion.cjs +1 -1
- package/dist/Accordion/Accordion.js +1 -1
- package/dist/Accordion/AccordionToggle.cjs +6 -6
- package/dist/Accordion/AccordionToggle.js +48 -51
- package/dist/BaseRadio/BaseRadio.cjs +1 -1
- package/dist/BaseRadio/BaseRadio.js +1 -1
- package/dist/Box/Box.cjs +3 -3
- package/dist/Box/Box.js +26 -26
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.js +1 -1
- package/dist/CarouselInput/CarouselActions.cjs +1 -1
- package/dist/CarouselInput/CarouselActions.js +16 -4
- package/dist/CarouselInput/CarouselInput.cjs +1 -1
- package/dist/CarouselInput/CarouselInput.js +13 -13
- package/dist/Checkbox/Checkbox.cjs +2 -2
- package/dist/Checkbox/Checkbox.js +13 -13
- package/dist/Combobox/Combobox.cjs +1 -1
- package/dist/Combobox/Combobox.js +62 -63
- package/dist/DatePicker/DatePickerCalendar.cjs +1 -1
- package/dist/DatePicker/DatePickerCalendar.js +2 -1
- package/dist/DatePicker/DatePickerTd.cjs +3 -3
- package/dist/DatePicker/DatePickerTd.js +8 -9
- package/dist/DatePicker/DatePickerTh.cjs +2 -2
- package/dist/DatePicker/DatePickerTh.js +3 -4
- package/dist/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/DateTimePicker/DateTimePicker.js +28 -28
- package/dist/Dialog/Dialog.cjs +4 -4
- package/dist/Dialog/Dialog.js +2 -2
- package/dist/Dialog/DialogFooter.cjs +3 -3
- package/dist/Dialog/DialogFooter.js +2 -2
- package/dist/Field/Field.cjs +1 -1
- package/dist/Field/Field.js +31 -27
- package/dist/Field/FieldAction.cjs +2 -8
- package/dist/Field/FieldAction.js +27 -16
- package/dist/Field/FieldContext.cjs +1 -1
- package/dist/Field/FieldContext.js +2 -2
- package/dist/Field/FieldError.cjs +1 -1
- package/dist/Field/FieldError.js +14 -4
- package/dist/Field/FieldHint.cjs +1 -1
- package/dist/Field/FieldHint.js +17 -7
- package/dist/Field/FieldInput.cjs +14 -16
- package/dist/Field/FieldInput.js +104 -72
- package/dist/Field/FieldLabel.cjs +3 -3
- package/dist/Field/FieldLabel.js +43 -25
- package/dist/FocusTrap/FocusTrap.cjs +1 -1
- package/dist/FocusTrap/FocusTrap.js +34 -38
- package/dist/JSONInput/JSONInput.cjs +1 -1
- package/dist/JSONInput/JSONInput.js +29 -27
- package/dist/Layout/HeaderLayout.cjs +2 -2
- package/dist/Layout/HeaderLayout.js +3 -3
- package/dist/MainNav/NavSection.cjs +1 -1
- package/dist/MainNav/NavSection.js +33 -13
- package/dist/MainNav/NavSections.cjs +2 -2
- package/dist/MainNav/NavSections.js +20 -10
- package/dist/ModalLayout/ModalLayout.cjs +1 -1
- package/dist/ModalLayout/ModalLayout.js +1 -1
- package/dist/NumberInput/NumberInput.cjs +2 -2
- package/dist/NumberInput/NumberInput.js +32 -32
- package/dist/Popover/Popover.cjs +3 -3
- package/dist/Popover/Popover.js +1 -1
- package/dist/RawTable/RawCell.cjs +1 -1
- package/dist/RawTable/RawCell.js +61 -67
- package/dist/RawTable/RawTable.cjs +1 -1
- package/dist/RawTable/RawTable.js +39 -37
- package/dist/RawTable/RawTbody.cjs +1 -1
- package/dist/RawTable/RawTbody.js +14 -11
- package/dist/RawTable/RawThead.cjs +1 -1
- package/dist/RawTable/RawThead.js +13 -8
- package/dist/RawTable/RawTr.cjs +1 -1
- package/dist/RawTable/RawTr.js +20 -13
- package/dist/Searchbar/Searchbar.cjs +2 -2
- package/dist/Searchbar/Searchbar.js +7 -6
- package/dist/Select/Select.cjs +2 -2
- package/dist/Select/Select.js +24 -25
- package/dist/Select/SelectList.cjs +1 -1
- package/dist/Select/SelectList.js +10 -8
- package/dist/SimpleMenu/SimpleMenu.cjs +1 -1
- package/dist/SimpleMenu/SimpleMenu.js +1 -1
- package/dist/SubNav/SubNavHeader.cjs +2 -2
- package/dist/SubNav/SubNavHeader.js +2 -2
- package/dist/SubNav/SubNavLinkSection.cjs +3 -3
- package/dist/SubNav/SubNavLinkSection.js +1 -1
- package/dist/SubNav/SubNavSection.cjs +2 -2
- package/dist/SubNav/SubNavSection.js +7 -7
- package/dist/SubNav/SubNavSections.cjs +1 -1
- package/dist/SubNav/SubNavSections.js +17 -7
- package/dist/Tabs/TabGroup.cjs +1 -1
- package/dist/Tabs/TabGroup.js +1 -1
- package/dist/Tag/Tag.cjs +8 -8
- package/dist/Tag/Tag.js +52 -49
- package/dist/TextInput/TextInput.cjs +1 -1
- package/dist/TextInput/TextInput.js +13 -13
- package/dist/Textarea/Textarea.cjs +2 -2
- package/dist/Textarea/Textarea.js +12 -13
- package/dist/Textarea/TextareaInput.cjs +4 -4
- package/dist/Textarea/TextareaInput.js +13 -12
- package/dist/TimePicker/TimePicker.cjs +2 -2
- package/dist/TimePicker/TimePicker.js +1 -1
- package/dist/ToggleCheckbox/ToggleCheckbox.cjs +2 -2
- package/dist/ToggleCheckbox/ToggleCheckbox.js +1 -0
- package/dist/ToggleInput/ToggleInput.cjs +3 -3
- package/dist/ToggleInput/ToggleInput.js +28 -29
- package/dist/Tooltip/Tooltip.cjs +1 -1
- package/dist/Tooltip/Tooltip.js +1 -1
- package/dist/helpers/deprecations.cjs +1 -1
- package/dist/helpers/deprecations.js +7 -7
- package/dist/helpers/useElementOnScreen.cjs +1 -1
- package/dist/helpers/useElementOnScreen.js +4 -13
- package/dist/helpers/useId.cjs +1 -1
- package/dist/helpers/useId.js +4 -11
- package/dist/helpers/useIntersection.cjs +1 -1
- package/dist/helpers/useIntersection.js +4 -21
- package/dist/helpers/useLockScroll.cjs +1 -1
- package/dist/helpers/useLockScroll.js +4 -7
- package/dist/helpers/usePrevious.cjs +1 -1
- package/dist/helpers/usePrevious.js +4 -8
- package/dist/helpers/useResizeObserver.cjs +1 -1
- package/dist/helpers/useResizeObserver.js +4 -14
- package/dist/hooks/useElementOnScreen.cjs +1 -0
- package/dist/hooks/useElementOnScreen.js +15 -0
- package/dist/hooks/useIntersection.cjs +1 -1
- package/dist/hooks/useIntersection.js +3 -3
- package/dist/hooks/useLockScroll.cjs +1 -0
- package/dist/hooks/useLockScroll.js +9 -0
- package/dist/hooks/usePrevious.cjs +1 -0
- package/dist/hooks/usePrevious.js +10 -0
- package/dist/hooks/useResizeObserver.cjs +1 -0
- package/dist/hooks/useResizeObserver.js +16 -0
- package/dist/v2/MainNav/NavSection.cjs +1 -1
- package/dist/v2/MainNav/NavSection.js +33 -13
- package/dist/v2/MainNav/NavSections.cjs +2 -2
- package/dist/v2/MainNav/NavSections.js +20 -10
- package/dist/v2/SimpleMenu/SimpleMenu.cjs +1 -1
- package/dist/v2/SimpleMenu/SimpleMenu.js +1 -1
- package/dist/v2/SubNav/SubNavHeader.cjs +2 -2
- package/dist/v2/SubNav/SubNavHeader.js +2 -2
- package/dist/v2/SubNav/SubNavLinkSection.cjs +3 -3
- package/dist/v2/SubNav/SubNavLinkSection.js +1 -1
- package/dist/v2/SubNav/SubNavSection.cjs +2 -2
- package/dist/v2/SubNav/SubNavSection.js +10 -10
- package/dist/v2/SubNav/SubNavSections.cjs +1 -1
- package/dist/v2/SubNav/SubNavSections.js +17 -7
- package/package.json +4 -3
- package/dist/Select/SingleSelect.cjs +0 -82
- package/dist/Select/SingleSelect.js +0 -285
|
@@ -2,7 +2,7 @@ import e from "react";
|
|
|
2
2
|
import r from "prop-types";
|
|
3
3
|
import n from "styled-components";
|
|
4
4
|
import { Box as p } from "../Box/Box.js";
|
|
5
|
-
import {
|
|
5
|
+
import { Flex as a } from "../Flex/Flex.js";
|
|
6
6
|
const d = n(p)`
|
|
7
7
|
border-top: 1px solid ${({ theme: o }) => o.colors.neutral150};
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ const d = n(p)`
|
|
|
11
11
|
display: inline-flex;
|
|
12
12
|
justify-content: center;
|
|
13
13
|
}
|
|
14
|
-
`, t = ({ startAction: o, endAction: i }) => /* @__PURE__ */ e.createElement(d, { padding: 4 }, /* @__PURE__ */ e.createElement(a, {
|
|
14
|
+
`, t = ({ startAction: o, endAction: i }) => /* @__PURE__ */ e.createElement(d, { padding: 4 }, /* @__PURE__ */ e.createElement(a, { gap: 2 }, o, i));
|
|
15
15
|
t.displayName = "DialogFooter";
|
|
16
16
|
t.defaultProps = {
|
|
17
17
|
endAction: void 0,
|
package/dist/Field/Field.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),i=require("react"),a=require("./FieldContext.cjs"),j=require("../Box/Box.cjs"),f=require("../hooks/useId.cjs"),F=i.forwardRef(({children:n,name:e,error:t,hint:o,id:u,required:s=!1,...d},l)=>{const r=f.useId(u),x=i.useMemo(()=>({name:e,id:r,error:t,hint:o,required:s}),[t,r,o,e,s]);return c.jsx(j.Box,{ref:l,...d,children:c.jsx(a.FieldContext.Provider,{value:x,children:n})})});exports.Field=F;
|
package/dist/Field/Field.js
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { FieldContext as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as l, useMemo as p } from "react";
|
|
3
|
+
import { FieldContext as x } from "./FieldContext.js";
|
|
4
|
+
import { Box as a } from "../Box/Box.js";
|
|
5
|
+
import { useId as u } from "../hooks/useId.js";
|
|
6
|
+
const j = l(({
|
|
7
|
+
children: f,
|
|
8
|
+
name: o,
|
|
9
|
+
error: r,
|
|
10
|
+
hint: e,
|
|
11
|
+
id: i,
|
|
12
|
+
required: t = !1,
|
|
13
|
+
...n
|
|
14
|
+
}, s) => {
|
|
15
|
+
const m = u(i), c = p(() => ({
|
|
16
|
+
name: o,
|
|
17
|
+
id: m,
|
|
18
|
+
error: r,
|
|
19
|
+
hint: e,
|
|
20
|
+
required: t
|
|
21
|
+
}), [r, m, e, o, t]);
|
|
22
|
+
return d(a, {
|
|
23
|
+
ref: s,
|
|
24
|
+
...n,
|
|
25
|
+
children: d(x.Provider, {
|
|
26
|
+
value: c,
|
|
27
|
+
children: f
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
});
|
|
27
31
|
export {
|
|
28
|
-
|
|
32
|
+
j as Field
|
|
29
33
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
border: none;
|
|
3
|
-
background: transparent;
|
|
4
|
-
// TODO: Make sure to use the theme when it's ready
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),n=require("react"),r=require("styled-components"),o=require("../Flex/Flex.cjs"),d=require("../VisuallyHidden/VisuallyHidden.cjs"),a=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},u=a(r),c=u.default(o.Flex)`
|
|
5
2
|
font-size: 1.6rem;
|
|
6
|
-
width: auto;
|
|
7
3
|
padding: 0;
|
|
8
|
-
|
|
9
|
-
align-items: center;
|
|
10
|
-
`,n=({label:e,children:r,...a})=>i.default.createElement(c,{"aria-label":e,type:"button",...a},r);n.propTypes={children:o.default.node.isRequired,label:o.default.string.isRequired};exports.FieldAction=n;
|
|
4
|
+
`,f=n.forwardRef(({label:e,children:s,...l},i)=>t.jsxs(c,{justifyContent:"unset",background:"transparent",borderStyle:"none",type:"button",...l,as:"button",ref:i,children:[t.jsx(d.VisuallyHidden,{as:"span",children:e}),n.cloneElement(s,{"aria-hidden":!0,focusable:!1})]}));exports.FieldAction=f;
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
import i from "react";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// TODO: Make sure to use the theme when it's ready
|
|
1
|
+
import { jsxs as n, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as s, cloneElement as a } from "react";
|
|
3
|
+
import d from "styled-components";
|
|
4
|
+
import { Flex as l } from "../Flex/Flex.js";
|
|
5
|
+
import { VisuallyHidden as f } from "../VisuallyHidden/VisuallyHidden.js";
|
|
6
|
+
const m = d(l)`
|
|
8
7
|
font-size: 1.6rem;
|
|
9
|
-
width: auto;
|
|
10
8
|
padding: 0;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
`, x = s(({
|
|
10
|
+
label: e,
|
|
11
|
+
children: r,
|
|
12
|
+
...t
|
|
13
|
+
}, o) => n(m, {
|
|
14
|
+
justifyContent: "unset",
|
|
15
|
+
background: "transparent",
|
|
16
|
+
borderStyle: "none",
|
|
17
|
+
type: "button",
|
|
18
|
+
...t,
|
|
19
|
+
as: "button",
|
|
20
|
+
ref: o,
|
|
21
|
+
children: [i(f, {
|
|
22
|
+
as: "span",
|
|
23
|
+
children: e
|
|
24
|
+
}), a(r, {
|
|
25
|
+
"aria-hidden": !0,
|
|
26
|
+
focusable: !1
|
|
27
|
+
})]
|
|
28
|
+
}));
|
|
18
29
|
export {
|
|
19
|
-
|
|
30
|
+
x as FieldAction
|
|
20
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react"),t=e.createContext({
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react"),t=e.createContext({id:"",required:!1}),o=()=>e.useContext(t);exports.FieldContext=t;exports.useField=o;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext as e, useContext as t } from "react";
|
|
2
|
-
const o = e({
|
|
2
|
+
const o = e({ id: "", required: !1 }), i = () => t(o);
|
|
3
3
|
export {
|
|
4
4
|
o as FieldContext,
|
|
5
|
-
|
|
5
|
+
i as useField
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react"),o=require("./FieldContext.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),o=require("./FieldContext.cjs"),i=require("../Typography/Typography.cjs"),n=()=>{const{id:e,error:r}=o.useField();return!r||typeof r!="string"?null:t.jsx(i.Typography,{variant:"pi",as:"p",id:`${e}-error`,textColor:"danger600","data-strapi-field-error":!0,children:r})};exports.FieldError=n;
|
package/dist/Field/FieldError.js
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import t from "react";
|
|
2
|
-
import { useField as
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useField as e } from "./FieldContext.js";
|
|
3
3
|
import { Typography as i } from "../Typography/Typography.js";
|
|
4
4
|
const d = () => {
|
|
5
|
-
const {
|
|
6
|
-
|
|
5
|
+
const {
|
|
6
|
+
id: o,
|
|
7
|
+
error: r
|
|
8
|
+
} = e();
|
|
9
|
+
return !r || typeof r != "string" ? null : t(i, {
|
|
10
|
+
variant: "pi",
|
|
11
|
+
as: "p",
|
|
12
|
+
id: `${o}-error`,
|
|
13
|
+
textColor: "danger600",
|
|
14
|
+
"data-strapi-field-error": !0,
|
|
15
|
+
children: r
|
|
16
|
+
});
|
|
7
17
|
};
|
|
8
18
|
export {
|
|
9
19
|
d as FieldError
|
package/dist/Field/FieldHint.cjs
CHANGED
|
@@ -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"),n=require("./FieldContext.cjs"),o=require("../Typography/Typography.cjs"),s=()=>{const{id:t,hint:e,error:r}=n.useField();return!e||typeof e!="string"||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,10 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useField as
|
|
3
|
-
import { Typography as
|
|
4
|
-
const
|
|
5
|
-
const {
|
|
6
|
-
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useField as n } from "./FieldContext.js";
|
|
3
|
+
import { Typography as e } from "../Typography/Typography.js";
|
|
4
|
+
const s = () => {
|
|
5
|
+
const {
|
|
6
|
+
id: t,
|
|
7
|
+
hint: r,
|
|
8
|
+
error: i
|
|
9
|
+
} = n();
|
|
10
|
+
return !r || typeof r != "string" || i ? null : o(e, {
|
|
11
|
+
variant: "pi",
|
|
12
|
+
as: "p",
|
|
13
|
+
id: `${t}-hint`,
|
|
14
|
+
textColor: "neutral600",
|
|
15
|
+
children: r
|
|
16
|
+
});
|
|
7
17
|
};
|
|
8
18
|
export {
|
|
9
|
-
|
|
19
|
+
s as FieldHint
|
|
10
20
|
};
|
|
@@ -1,16 +1,15 @@
|
|
|
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=require("react/jsx-runtime"),F=require("react"),c=require("styled-components"),q=require("./FieldContext.cjs"),l=require("../Box/Box.cjs"),B=require("../Flex/Flex.cjs"),R=require("../themes/utils.cjs"),I=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},p=I(c),u={S:6.5,M:10.5},w=F.forwardRef(({endAction:e,startAction:r,disabled:o=!1,onChange:a,size:g="M",...b},h)=>{const{id:t,error:s,hint:$,name:x,required:j}=q.useField();let i;s?i=`${t}-error`:$&&(i=`${t}-hint`);const d=Boolean(s),y=m=>{!o&&a&&a(m)};return n.jsxs(f,{justifyContent:"space-between",hasError:d,disabled:o,children:[r?n.jsx(l.Box,{paddingLeft:3,paddingRight:2,children:r}):null,n.jsx(_,{id:t,name:x,ref:h,"aria-describedby":i,"aria-invalid":d,"aria-disabled":o,disabled:o,"data-disabled":o?"":void 0,hasLeftAction:Boolean(r),hasRightAction:Boolean(e),onChange:y,"aria-required":j,$size:g,...b}),e?n.jsx(l.Box,{paddingLeft:2,paddingRight:3,children:e}):null]})}),_=p.default.input`
|
|
2
2
|
border: none;
|
|
3
3
|
border-radius: ${({theme:e})=>e.borderRadius};
|
|
4
|
-
padding-bottom: ${({size:e})=>`${
|
|
5
|
-
padding-left: ${({theme:e,hasLeftAction:
|
|
6
|
-
padding-right: ${({theme:e,hasRightAction:
|
|
7
|
-
padding-top: ${({size:e})=>`${
|
|
4
|
+
padding-bottom: ${({$size:e})=>`${u[e]/16}rem`};
|
|
5
|
+
padding-left: ${({theme:e,hasLeftAction:r})=>r?0:e.spaces[4]};
|
|
6
|
+
padding-right: ${({theme:e,hasRightAction:r})=>r?0:e.spaces[4]};
|
|
7
|
+
padding-top: ${({$size:e})=>`${u[e]/16}rem`};
|
|
8
8
|
cursor: ${e=>e["aria-disabled"]?"not-allowed":void 0};
|
|
9
9
|
|
|
10
10
|
color: ${({theme:e})=>e.colors.neutral800};
|
|
11
11
|
font-weight: 400;
|
|
12
|
-
|
|
13
|
-
font-size: ${14/16}rem;
|
|
12
|
+
font-size: ${e=>e.theme.fontSizes[2]};
|
|
14
13
|
display: block;
|
|
15
14
|
width: 100%;
|
|
16
15
|
background: inherit;
|
|
@@ -29,15 +28,14 @@
|
|
|
29
28
|
outline: none;
|
|
30
29
|
box-shadow: none;
|
|
31
30
|
}
|
|
32
|
-
`,
|
|
33
|
-
border: 1px solid ${({theme:e,hasError:
|
|
31
|
+
`,f=p.default(B.Flex)`
|
|
32
|
+
border: 1px solid ${({theme:e,hasError:r})=>r?e.colors.danger600:e.colors.neutral200};
|
|
34
33
|
border-radius: ${({theme:e})=>e.borderRadius};
|
|
35
34
|
background: ${({theme:e})=>e.colors.neutral0};
|
|
36
|
-
${
|
|
35
|
+
${R.inputFocusStyle()}
|
|
37
36
|
|
|
38
|
-
${({theme:e,disabled:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
`,a=g.forwardRef(({endAction:e,startAction:t,disabled:n,onChange:$,size:l,...y},m)=>{const{id:s,error:u,hint:x,name:F,required:q}=R.useField();let i;u?i=`${s}-error`:x&&(i=`${s}-hint`);const c=Boolean(u),_=j=>{n||$(j)};return r.default.createElement(h,{size:l,justifyContent:"space-between",hasError:c,disabled:n},t&&r.default.createElement(p.Box,{paddingLeft:3,paddingRight:2},t),r.default.createElement(k,{id:s,name:F,ref:m,"aria-describedby":i,"aria-invalid":c,"aria-disabled":n,hasLeftAction:Boolean(t),hasRightAction:Boolean(e),onChange:_,"aria-required":q,size:l,...y}),e&&r.default.createElement(p.Box,{paddingLeft:2,paddingRight:3},e))});a.displayName="FieldInput";a.defaultProps={disabled:!1,endAction:void 0,size:"M",startAction:void 0,onChange(){}};a.propTypes={disabled:o.default.bool,endAction:o.default.element,onChange:o.default.func,size:o.default.oneOf(Object.keys(w.sizes.input)),startAction:o.default.element};exports.FieldInput=a;exports.InputWrapper=h;
|
|
37
|
+
${({theme:e,disabled:r})=>r?c.css`
|
|
38
|
+
color: ${e.colors.neutral600};
|
|
39
|
+
background: ${e.colors.neutral150};
|
|
40
|
+
`:void 0}
|
|
41
|
+
`;exports.FieldInput=w;exports.InputWrapper=f;
|
package/dist/Field/FieldInput.js
CHANGED
|
@@ -1,33 +1,96 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as y, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as w } from "react";
|
|
3
|
+
import p, { css as R } from "styled-components";
|
|
4
4
|
import { useField as I } from "./FieldContext.js";
|
|
5
|
-
import { Box as
|
|
6
|
-
import { Flex as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const u = {
|
|
5
|
+
import { Box as l } from "../Box/Box.js";
|
|
6
|
+
import { Flex as k } from "../Flex/Flex.js";
|
|
7
|
+
import { inputFocusStyle as B } from "../themes/utils.js";
|
|
8
|
+
const c = {
|
|
10
9
|
S: 6.5,
|
|
11
10
|
M: 10.5
|
|
12
|
-
},
|
|
11
|
+
}, M = w(({
|
|
12
|
+
endAction: r,
|
|
13
|
+
startAction: o,
|
|
14
|
+
disabled: e = !1,
|
|
15
|
+
onChange: d,
|
|
16
|
+
size: u = "M",
|
|
17
|
+
...f
|
|
18
|
+
}, $) => {
|
|
19
|
+
const {
|
|
20
|
+
id: i,
|
|
21
|
+
error: t,
|
|
22
|
+
hint: h,
|
|
23
|
+
name: g,
|
|
24
|
+
required: m
|
|
25
|
+
} = I();
|
|
26
|
+
let n;
|
|
27
|
+
t ? n = `${i}-error` : h && (n = `${i}-hint`);
|
|
28
|
+
const s = Boolean(t), b = (x) => {
|
|
29
|
+
!e && d && d(x);
|
|
30
|
+
};
|
|
31
|
+
return y(j, {
|
|
32
|
+
justifyContent: "space-between",
|
|
33
|
+
hasError: s,
|
|
34
|
+
disabled: e,
|
|
35
|
+
children: [o ? a(l, {
|
|
36
|
+
paddingLeft: 3,
|
|
37
|
+
paddingRight: 2,
|
|
38
|
+
children: o
|
|
39
|
+
}) : null, a(F, {
|
|
40
|
+
id: i,
|
|
41
|
+
name: g,
|
|
42
|
+
ref: $,
|
|
43
|
+
"aria-describedby": n,
|
|
44
|
+
"aria-invalid": s,
|
|
45
|
+
"aria-disabled": e,
|
|
46
|
+
disabled: e,
|
|
47
|
+
"data-disabled": e ? "" : void 0,
|
|
48
|
+
hasLeftAction: Boolean(o),
|
|
49
|
+
hasRightAction: Boolean(r),
|
|
50
|
+
onChange: b,
|
|
51
|
+
"aria-required": m,
|
|
52
|
+
$size: u,
|
|
53
|
+
...f
|
|
54
|
+
}), r ? a(l, {
|
|
55
|
+
paddingLeft: 2,
|
|
56
|
+
paddingRight: 3,
|
|
57
|
+
children: r
|
|
58
|
+
}) : null]
|
|
59
|
+
});
|
|
60
|
+
}), F = p.input`
|
|
13
61
|
border: none;
|
|
14
|
-
border-radius: ${({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
padding-
|
|
18
|
-
|
|
19
|
-
|
|
62
|
+
border-radius: ${({
|
|
63
|
+
theme: r
|
|
64
|
+
}) => r.borderRadius};
|
|
65
|
+
padding-bottom: ${({
|
|
66
|
+
$size: r
|
|
67
|
+
}) => `${c[r] / 16}rem`};
|
|
68
|
+
padding-left: ${({
|
|
69
|
+
theme: r,
|
|
70
|
+
hasLeftAction: o
|
|
71
|
+
}) => o ? 0 : r.spaces[4]};
|
|
72
|
+
padding-right: ${({
|
|
73
|
+
theme: r,
|
|
74
|
+
hasRightAction: o
|
|
75
|
+
}) => o ? 0 : r.spaces[4]};
|
|
76
|
+
padding-top: ${({
|
|
77
|
+
$size: r
|
|
78
|
+
}) => `${c[r] / 16}rem`};
|
|
79
|
+
cursor: ${(r) => r["aria-disabled"] ? "not-allowed" : void 0};
|
|
20
80
|
|
|
21
|
-
color: ${({
|
|
81
|
+
color: ${({
|
|
82
|
+
theme: r
|
|
83
|
+
}) => r.colors.neutral800};
|
|
22
84
|
font-weight: 400;
|
|
23
|
-
|
|
24
|
-
font-size: ${14 / 16}rem;
|
|
85
|
+
font-size: ${(r) => r.theme.fontSizes[2]};
|
|
25
86
|
display: block;
|
|
26
87
|
width: 100%;
|
|
27
88
|
background: inherit;
|
|
28
89
|
|
|
29
90
|
::placeholder {
|
|
30
|
-
color: ${({
|
|
91
|
+
color: ${({
|
|
92
|
+
theme: r
|
|
93
|
+
}) => r.colors.neutral500};
|
|
31
94
|
opacity: 1;
|
|
32
95
|
}
|
|
33
96
|
|
|
@@ -40,59 +103,28 @@ const u = {
|
|
|
40
103
|
outline: none;
|
|
41
104
|
box-shadow: none;
|
|
42
105
|
}
|
|
43
|
-
`,
|
|
44
|
-
border: 1px solid ${({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
106
|
+
`, j = p(k)`
|
|
107
|
+
border: 1px solid ${({
|
|
108
|
+
theme: r,
|
|
109
|
+
hasError: o
|
|
110
|
+
}) => o ? r.colors.danger600 : r.colors.neutral200};
|
|
111
|
+
border-radius: ${({
|
|
112
|
+
theme: r
|
|
113
|
+
}) => r.borderRadius};
|
|
114
|
+
background: ${({
|
|
115
|
+
theme: r
|
|
116
|
+
}) => r.colors.neutral0};
|
|
117
|
+
${B()}
|
|
48
118
|
|
|
49
|
-
${({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
l ? i = `${n}-error` : h && (i = `${n}-hint`);
|
|
58
|
-
const p = Boolean(l), w = (R) => {
|
|
59
|
-
a || f(R);
|
|
60
|
-
};
|
|
61
|
-
return /* @__PURE__ */ t.createElement(F, { size: s, justifyContent: "space-between", hasError: p, disabled: a }, o && /* @__PURE__ */ t.createElement(c, { paddingLeft: 3, paddingRight: 2 }, o), /* @__PURE__ */ t.createElement(
|
|
62
|
-
E,
|
|
63
|
-
{
|
|
64
|
-
id: n,
|
|
65
|
-
name: $,
|
|
66
|
-
ref: b,
|
|
67
|
-
"aria-describedby": i,
|
|
68
|
-
"aria-invalid": p,
|
|
69
|
-
"aria-disabled": a,
|
|
70
|
-
hasLeftAction: Boolean(o),
|
|
71
|
-
hasRightAction: Boolean(e),
|
|
72
|
-
onChange: w,
|
|
73
|
-
"aria-required": y,
|
|
74
|
-
size: s,
|
|
75
|
-
...g
|
|
76
|
-
}
|
|
77
|
-
), e && /* @__PURE__ */ t.createElement(c, { paddingLeft: 2, paddingRight: 3 }, e));
|
|
78
|
-
});
|
|
79
|
-
d.displayName = "FieldInput";
|
|
80
|
-
d.defaultProps = {
|
|
81
|
-
disabled: !1,
|
|
82
|
-
endAction: void 0,
|
|
83
|
-
size: "M",
|
|
84
|
-
startAction: void 0,
|
|
85
|
-
onChange() {
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
d.propTypes = {
|
|
89
|
-
disabled: r.bool,
|
|
90
|
-
endAction: r.element,
|
|
91
|
-
onChange: r.func,
|
|
92
|
-
size: r.oneOf(Object.keys(x.input)),
|
|
93
|
-
startAction: r.element
|
|
94
|
-
};
|
|
119
|
+
${({
|
|
120
|
+
theme: r,
|
|
121
|
+
disabled: o
|
|
122
|
+
}) => o ? R`
|
|
123
|
+
color: ${r.colors.neutral600};
|
|
124
|
+
background: ${r.colors.neutral150};
|
|
125
|
+
` : void 0}
|
|
126
|
+
`;
|
|
95
127
|
export {
|
|
96
|
-
|
|
97
|
-
|
|
128
|
+
M as FieldInput,
|
|
129
|
+
j as InputWrapper
|
|
98
130
|
};
|
|
@@ -1,9 +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 r=require("react/jsx-runtime"),p=require("react"),h=require("styled-components"),g=require("./FieldContext.cjs"),o=require("../Flex/Flex.cjs"),y=require("../helpers/deprecations.cjs"),i=require("../Typography/Typography.cjs"),f=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},l=f(h),x=y.once(console.warn),F=p.forwardRef(({children:e,action:t,required:n,...s},a)=>{const{id:c,required:d}=g.useField(),u=d||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.'),r.jsx(i.Typography,{ref:a,variant:"pi",textColor:"neutral800",htmlFor:c,fontWeight:"bold",as:"label",...s,children:r.jsxs(o.Flex,{alignItems:"center",children:[e,u&&r.jsx(j,{textColor:"danger600",children:"*"}),t&&r.jsx(q,{marginLeft:1,children:t})]})})}),j=l.default(i.Typography)`
|
|
2
2
|
line-height: 0;
|
|
3
|
-
`,
|
|
3
|
+
`,q=l.default(o.Flex)`
|
|
4
4
|
line-height: 0;
|
|
5
5
|
|
|
6
6
|
svg path {
|
|
7
7
|
fill: ${({theme:e})=>e.colors.neutral500};
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
`;exports.FieldLabel=F;
|
package/dist/Field/FieldLabel.js
CHANGED
|
@@ -1,32 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useField as
|
|
5
|
-
import { Flex as
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as h } from "react";
|
|
3
|
+
import t from "styled-components";
|
|
4
|
+
import { useField as f } from "./FieldContext.js";
|
|
5
|
+
import { Flex as n } from "../Flex/Flex.js";
|
|
6
|
+
import { once as g } from "../helpers/deprecations.js";
|
|
7
|
+
import { Typography as l } from "../Typography/Typography.js";
|
|
8
|
+
const u = g(console.warn), T = h(({
|
|
9
|
+
children: e,
|
|
10
|
+
action: o,
|
|
11
|
+
required: i,
|
|
12
|
+
...s
|
|
13
|
+
}, d) => {
|
|
14
|
+
const {
|
|
15
|
+
id: a,
|
|
16
|
+
required: m
|
|
17
|
+
} = f(), p = m || 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.'), r(l, {
|
|
19
|
+
ref: d,
|
|
20
|
+
variant: "pi",
|
|
21
|
+
textColor: "neutral800",
|
|
22
|
+
htmlFor: a,
|
|
23
|
+
fontWeight: "bold",
|
|
24
|
+
as: "label",
|
|
25
|
+
...s,
|
|
26
|
+
children: c(n, {
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
children: [e, p && r(x, {
|
|
29
|
+
textColor: "danger600",
|
|
30
|
+
children: "*"
|
|
31
|
+
}), o && r(F, {
|
|
32
|
+
marginLeft: 1,
|
|
33
|
+
children: o
|
|
34
|
+
})]
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}), x = t(l)`
|
|
8
38
|
line-height: 0;
|
|
9
|
-
`,
|
|
39
|
+
`, F = t(n)`
|
|
10
40
|
line-height: 0;
|
|
11
41
|
|
|
12
42
|
svg path {
|
|
13
|
-
fill: ${({
|
|
43
|
+
fill: ${({
|
|
44
|
+
theme: e
|
|
45
|
+
}) => e.colors.neutral500};
|
|
14
46
|
}
|
|
15
|
-
|
|
16
|
-
const { id: p, required: m } = u(), c = m || i;
|
|
17
|
-
return i !== void 0 && console.warn(
|
|
18
|
-
'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
|
-
), /* @__PURE__ */ e.createElement(a, { variant: "pi", textColor: "neutral800", htmlFor: p, fontWeight: "bold", as: "label", ...s }, /* @__PURE__ */ e.createElement(l, { alignItems: "center" }, r, c && /* @__PURE__ */ e.createElement(h, { textColor: "danger600" }, "*"), t && /* @__PURE__ */ e.createElement(f, { marginLeft: 1 }, t)));
|
|
20
|
-
};
|
|
21
|
-
d.defaultProps = {
|
|
22
|
-
action: void 0,
|
|
23
|
-
required: void 0
|
|
24
|
-
};
|
|
25
|
-
d.propTypes = {
|
|
26
|
-
action: o.element,
|
|
27
|
-
children: o.node.isRequired,
|
|
28
|
-
required: o.bool
|
|
29
|
-
};
|
|
47
|
+
`;
|
|
30
48
|
export {
|
|
31
|
-
|
|
49
|
+
T as FieldLabel
|
|
32
50
|
};
|
|
@@ -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 d=require("react/jsx-runtime"),r=require("react"),l=require("../helpers/getFocusableNodes.cjs"),a=require("../helpers/keyboardKeys.cjs"),m=({onEscape:n,restoreFocus:o=!0,...f})=>{const s=r.useRef(null);r.useEffect(()=>{let e=null;return o&&(e=document.activeElement),()=>{e&&e.focus()}},[o]),r.useEffect(()=>{if(!s.current)return;const e=l.getFocusableNodes(s.current);e.length>0?e[0].focus():console.warn("[FocusTrap]: it seems there are no focusable elements in the focus trap tree. Make sure there s at least one.")},[]);const i=e=>{if(e.key===a.KeyboardKeys.ESCAPE&&n){n();return}if(e.key!==a.KeyboardKeys.TAB)return;const t=l.getFocusableNodes(s.current);if(t.length>0){const u=t[0],c=t[t.length-1];e.shiftKey?u===document.activeElement&&(e.preventDefault(),c.focus()):c===document.activeElement&&(e.preventDefault(),u.focus())}};return d.jsx("div",{ref:s,onKeyDown:i,...f})};exports.FocusTrap=m;
|