@strapi/design-system 1.6.6 → 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 +1 -1
- package/dist/BaseButton/BaseButton.js +1 -1
- 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 +6 -2
- package/dist/DatePicker/DatePicker.js +55 -49
- package/dist/DateTimePicker/parseDate.cjs +1 -0
- package/dist/DateTimePicker/parseDate.js +8 -0
- package/dist/NumberInput/NumberInput.cjs +2 -2
- package/dist/NumberInput/NumberInput.js +31 -31
- 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 -207
- 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/TimePicker/TimePicker.cjs +2 -2
- package/dist/TimePicker/TimePicker.js +42 -40
- 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 +6 -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/Select/SelectButton.cjs +0 -19
- package/dist/Select/SelectButton.js +0 -69
- 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
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://strapi.io">
|
|
3
|
+
<img src="./assets/logo.svg" width="318px" alt="Strapi logo" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a style='margin-right:10px' href="https://design-system.strapi.io/">Documentation</a>|<a style='margin-left:10px' href="https://design-system-git-main-strapijs.vercel.app/">Try components</a></p>
|
|
8
|
+
<br />
|
|
9
|
+
|
|
10
|
+
[](https://www.npmjs.com/package/@strapi/design-system)
|
|
11
|
+
[](https://www.npmjs.com/package/@strapi/design-system)
|
|
12
|
+
[](https://discord.gg/strapi)
|
|
13
|
+
|
|
14
|
+
# Welcome! 👋👋👋
|
|
15
|
+
|
|
16
|
+
Strapi Design System provides guidelines and tools to help anyone make Strapi's contributions more cohesive and to build
|
|
17
|
+
plugins more efficiently.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Install Strapi Design System and itdesign-system dependencies:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
$ yarn add react react-dom @strapi/design-system @strapi/icons styled-components react-router-dom
|
|
25
|
+
|
|
26
|
+
# or
|
|
27
|
+
|
|
28
|
+
$ npm i react react-dom @strapi/design-system @strapi/icons styled-components react-router-dom
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Getting Started
|
|
32
|
+
|
|
33
|
+
Wrap your application with the `ThemeProvider` and pass the default `lightTheme` or `darkTheme` provided by `@strapi/design-system`.
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
import { ThemeProvider, lightTheme } from '@strapi/design-system';
|
|
37
|
+
|
|
38
|
+
function MyApp({ children }) {
|
|
39
|
+
return <ThemeProvider theme={lightTheme}>{children}</ThemeProvider>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default App;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Then, checkout the complete [Storybook documentation](https://design-system-git-main-strapijs.vercel.app/) to find the components you want to use and how to use them.
|
|
46
|
+
|
|
47
|
+
## Contributing
|
|
48
|
+
|
|
49
|
+
Please follow our [CONTRIBUTING](https://github.com/strapi/design-system/blob/main/CONTRIBUTING.md) guidelines.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
Licensed under the MIT License, Copyright © 2015-present [Strapi Solutions SAS](https://strapi.io).
|
|
54
|
+
|
|
55
|
+
See [LICENSE](https://github.com/strapi/design-system/blob/main/LICENSE) for more information.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),c=require("react"),i=require("styled-components"),d=require("../Flex/Flex.cjs"),p=require("../themes/utils.cjs"),t=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},f=t(c),b=t(i),s=b.default(d.Flex)`
|
|
2
|
-
svg {
|
|
2
|
+
> svg {
|
|
3
3
|
height: ${({theme:e})=>e.spaces[3]};
|
|
4
4
|
width: ${({theme:e})=>e.spaces[3]};
|
|
5
5
|
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
cursor: pointer;
|
|
3
|
-
`,n=d.default.forwardRef(({href:e,rel:s="noreferrer noopener",target:o="_self",disabled:t=!1,isExternal:r=!1,...u},l)=>c.jsx(p,{ref:l,target:r?"_blank":o,rel:r?s:void 0,href:t?"#":e,"aria-disabled":t,...u}));n.displayName="BaseLink";exports.BaseLink=n;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),c=require("react"),f=require("../Box/Box.cjs"),l=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},d=l(c),a=d.default.forwardRef(({href:e,rel:o="noreferrer noopener",target:n="_self",disabled:r=!1,isExternal:t=!1,...s},u)=>i.jsx(f.Box,{as:"a",ref:u,target:t?"_blank":n,rel:t?o:void 0,href:r?"#":e,"aria-disabled":r,cursor:"pointer",...s}));a.displayName="BaseLink";exports.BaseLink=a;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import i from "react";
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
cursor: pointer;
|
|
6
|
-
`, p = i.forwardRef(({
|
|
3
|
+
import { Box as m } from "../Box/Box.js";
|
|
4
|
+
const p = i.forwardRef(({
|
|
7
5
|
href: o,
|
|
8
6
|
rel: a = "noreferrer noopener",
|
|
9
7
|
target: f = "_self",
|
|
10
|
-
disabled:
|
|
11
|
-
isExternal:
|
|
12
|
-
...
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
8
|
+
disabled: r = !1,
|
|
9
|
+
isExternal: e = !1,
|
|
10
|
+
...n
|
|
11
|
+
}, t) => s(m, {
|
|
12
|
+
as: "a",
|
|
13
|
+
ref: t,
|
|
14
|
+
target: e ? "_blank" : f,
|
|
15
|
+
rel: e ? a : void 0,
|
|
16
|
+
href: r ? "#" : o,
|
|
17
|
+
"aria-disabled": r,
|
|
18
|
+
cursor: "pointer",
|
|
19
|
+
...n
|
|
20
20
|
}));
|
|
21
21
|
p.displayName = "BaseLink";
|
|
22
22
|
export {
|
|
@@ -1 +1,104 @@
|
|
|
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 o=require("react/jsx-runtime"),re=require("react"),R=require("@strapi/icons"),n=require("@strapi/ui-primitives"),te=require("styled-components"),V=require("../Box/Box.cjs"),ne=require("../Field/Field.cjs"),se=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const le=require("../Field/FieldHint.cjs"),ie=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const j=require("../Flex/Flex.cjs"),ae=require("../hooks/useControllableState.cjs"),ce=require("../hooks/useId.cjs"),de=require("../hooks/useIntersection.cjs"),ue=require("../Loader/Loader.cjs");require("../themes/lightTheme/index.cjs");require("../themes/darkTheme/index.cjs");require("lodash");const he=require("../themes/utils.cjs"),b=require("../Typography/Typography.cjs"),be=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function pe(e){if(e&&e.__esModule)return e;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,i.get?i:{enumerable:!0,get:()=>e[s]})}}return r.default=e,Object.freeze(r)}const c=pe(re),l=be(te),O=({children:e,clearLabel:r="clear",creatable:s=!1,createMessage:i=g=>`Create "${g}"`,disabled:d=!1,error:u,hasMoreItems:S=!1,hint:B,id:_,label:L,labelAction:P,loading:x=!1,loadingMessage:E="Loading content...",noOptionsMessage:D=()=>"No results found",onChange:m,onClear:f,onCreateOption:C,onInputChange:$,onLoadMore:y,placeholder:H="Select or enter a value",required:F=!1,defaultTextValue:M,textValue:N,value:z})=>{const[g,W]=c.useState(!1),[a,I]=ae.useControllableState({prop:N,defaultProp:M}),[A,q]=c.useState(""),w=c.useRef(null),T=c.useRef(null),U=c.useRef(null),h=ce.useId(_),G=t=>{f&&!d&&(I(""),q(""),f(t),T.current.focus())},J=t=>{W(t)},K=t=>{I(t)},Q=t=>{q(t)},X=t=>{$&&$(t)},Y=t=>{m&&m(t)},v=`intersection-${h}`,Z=t=>{y&&S&&!x&&y(t)},k=()=>{C&&a&&C(a)};de.useIntersection(w,Z,{selectorToWatch:`#${v}`,skipWhen:!g});const ee=`${h}-hint`,oe=`${h}-error`;return o.jsx(ne.Field,{hint:B,error:u,id:h,required:F,children:o.jsxs(j.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[o.jsx(se.FieldLabel,{action:P,children:L}),o.jsxs(n.Combobox.Root,{autocomplete:s?"list":"both",onOpenChange:J,onTextValueChange:K,textValue:a,allowCustomValue:!0,disabled:d,required:F,value:z,onValueChange:Y,filterValue:A,onFilterValueChange:Q,children:[o.jsxs(ge,{$hasError:Boolean(u),children:[o.jsx(je,{placeholder:H,id:h,"aria-invalid":Boolean(u),"aria-labelledby":`${ee} ${oe}`,onChange:X,ref:T}),o.jsxs(j.Flex,{as:"span",gap:3,children:[a&&f?o.jsx(fe,{as:"button",hasRadius:!0,background:"transparent",type:"button",onClick:G,"aria-disabled":d,"aria-label":r,title:r,ref:U,children:o.jsx(R.Cross,{})}):null,o.jsx(me,{children:o.jsx(R.CarretDown,{})})]})]}),o.jsx(n.Combobox.Portal,{children:o.jsx(Ce,{sideOffset:4,children:o.jsxs($e,{ref:w,children:[e,s?o.jsx(n.Combobox.CreateItem,{onPointerUp:k,onClick:k,asChild:!0,children:o.jsx(p,{children:o.jsx(b.Typography,{children:i(a??"")})})}):null,!s&&!x?o.jsx(n.Combobox.NoValueFound,{asChild:!0,children:o.jsx(p,{$hasHover:!1,children:o.jsx(b.Typography,{children:D(a??"")})})}):null,x?o.jsx(j.Flex,{justifyContent:"center",alignItems:"center",paddingTop:2,paddingBottom:2,children:o.jsx(ue.Loader,{small:!0,children:E})}):null,o.jsx(V.Box,{id:v,width:"100%",height:"1px"})]})})})]}),o.jsx(le.FieldHint,{}),o.jsx(ie.FieldError,{})]})})},xe=e=>o.jsx(O,{...e,creatable:!0}),fe=l.default(V.Box)`
|
|
2
|
+
border: none;
|
|
3
|
+
|
|
4
|
+
svg {
|
|
5
|
+
height: ${11/16}rem;
|
|
6
|
+
width: ${11/16}rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
svg path {
|
|
10
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
11
|
+
}
|
|
12
|
+
`,ge=l.default(n.Combobox.Trigger)`
|
|
13
|
+
position: relative;
|
|
14
|
+
border: 1px solid ${({theme:e,$hasError:r})=>r?e.colors.danger600:e.colors.neutral200};
|
|
15
|
+
padding-right: ${({theme:e})=>e.spaces[3]};
|
|
16
|
+
padding-left: ${({theme:e})=>e.spaces[3]};
|
|
17
|
+
border-radius: ${({theme:e})=>e.borderRadius};
|
|
18
|
+
background: ${({theme:e})=>e.colors.neutral0};
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: space-between;
|
|
23
|
+
gap: ${({theme:e})=>e.spaces[4]};
|
|
24
|
+
|
|
25
|
+
&[data-disabled] {
|
|
26
|
+
color: ${({theme:e})=>e.colors.neutral600};
|
|
27
|
+
background: ${({theme:e})=>e.colors.neutral150};
|
|
28
|
+
cursor: not-allowed;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Required to ensure the below inputFocusStyles are adhered too */
|
|
32
|
+
&:focus-visible {
|
|
33
|
+
outline: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
${({theme:e,$hasError:r})=>he.inputFocusStyle()({theme:e,hasError:r})};
|
|
37
|
+
`,je=l.default(n.Combobox.TextInput)`
|
|
38
|
+
width: 100%;
|
|
39
|
+
font-size: ${14/16}rem;
|
|
40
|
+
color: ${({theme:e})=>e.colors.neutral800};
|
|
41
|
+
min-height: ${40/16}rem;
|
|
42
|
+
border: none;
|
|
43
|
+
background-color: transparent;
|
|
44
|
+
|
|
45
|
+
&:focus-visible {
|
|
46
|
+
outline: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&[aria-disabled='true'] {
|
|
50
|
+
cursor: inherit;
|
|
51
|
+
}
|
|
52
|
+
`,me=l.default(n.Combobox.Icon)`
|
|
53
|
+
& > svg {
|
|
54
|
+
width: ${6/16}rem;
|
|
55
|
+
|
|
56
|
+
& > path {
|
|
57
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&[aria-disabled='true'] {
|
|
62
|
+
cursor: inherit;
|
|
63
|
+
}
|
|
64
|
+
`,Ce=l.default(n.Combobox.Content)`
|
|
65
|
+
background: ${({theme:e})=>e.colors.neutral0};
|
|
66
|
+
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
67
|
+
border: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
68
|
+
border-radius: ${({theme:e})=>e.borderRadius};
|
|
69
|
+
width: var(--radix-combobox-trigger-width);
|
|
70
|
+
/* This is from the design-system figma file. */
|
|
71
|
+
max-height: 15rem;
|
|
72
|
+
`,$e=l.default(n.Combobox.Viewport)`
|
|
73
|
+
padding: ${({theme:e})=>e.spaces[1]};
|
|
74
|
+
`,ye=c.forwardRef(({children:e,value:r,disabled:s,textValue:i,...d},u)=>o.jsx(n.Combobox.ComboboxItem,{asChild:!0,value:r,disabled:s,textValue:i,children:o.jsx(p,{ref:u,...d,children:o.jsx(n.Combobox.ItemText,{asChild:!0,children:o.jsx(b.Typography,{children:e})})})})),p=l.default.div`
|
|
75
|
+
width: 100%;
|
|
76
|
+
border: none;
|
|
77
|
+
text-align: left;
|
|
78
|
+
outline-offset: -3px;
|
|
79
|
+
padding: ${({theme:e})=>e.spaces[2]} ${({theme:e})=>e.spaces[4]};
|
|
80
|
+
background-color: ${({theme:e})=>e.colors.neutral0};
|
|
81
|
+
border-radius: ${({theme:e})=>e.borderRadius};
|
|
82
|
+
|
|
83
|
+
&[data-selected] {
|
|
84
|
+
background-color: ${({theme:e})=>e.colors.primary100};
|
|
85
|
+
|
|
86
|
+
${b.Typography} {
|
|
87
|
+
color: ${({theme:e})=>e.colors.primary600};
|
|
88
|
+
font-weight: bold;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&:hover,
|
|
93
|
+
&[data-highlighted] {
|
|
94
|
+
outline: none;
|
|
95
|
+
background-color: ${({theme:e,$hasHover:r=!0})=>r?e.colors.primary100:e.colors.neutral0};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&[data-highlighted] {
|
|
99
|
+
${b.Typography} {
|
|
100
|
+
color: ${({theme:e})=>e.colors.primary600};
|
|
101
|
+
font-weight: bold;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`;exports.Combobox=O;exports.CreatableCombobox=xe;exports.Option=ye;exports.OptionBox=p;
|