@colisweb/rescript-toolkit 2.67.1 → 2.68.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/.yarn/install-state.gz +0 -0
- package/package.json +1 -1
- package/playground/PlaygroundComponents.res +5 -0
- package/playground/components/Playground_Alert.res +25 -0
- package/playground/components/Playground_Button.res +75 -0
- package/playground/components/Playground_Label.res +16 -0
- package/playground/components/Playground_Modal.res +53 -0
- package/playground/components/Playground_MultiSelect.res +91 -0
- package/playground/components/Playground_Switch.res +2 -2
- package/playground/custom.css +4 -1
- package/playground/docs/Setup.mdx +3 -10
- package/src/router/Toolkit__Router.res +2 -1
- package/src/ui/Toolkit__Ui_MultiSelect.res +21 -0
- package/src/ui/styles.css +6 -3
- package/vite.config.js +1 -0
- package/playground/stories/Toolkit__UI_AlertStory.res +0 -111
- package/playground/stories/Toolkit__UI_LabelStory.res +0 -39
- package/playground/stories/Toolkit__UI_ModalStory.res +0 -211
- package/playground/stories/Toolkit__UI_MultiSelectStory.res +0 -132
- package/playground/stories/Toolkit__Ui_ButtonStory.res +0 -324
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -8,6 +8,11 @@ module type Config = {
|
|
|
8
8
|
let components: array<(string, module(Config))> = [
|
|
9
9
|
("card", module(Playground_Card)),
|
|
10
10
|
("switch", module(Playground_Switch)),
|
|
11
|
+
("button", module(Playground_Button)),
|
|
12
|
+
("label", module(Playground_Label)),
|
|
13
|
+
("alert", module(Playground_Alert)),
|
|
14
|
+
("modal", module(Playground_Modal)),
|
|
15
|
+
("multiselect", module(Playground_MultiSelect)),
|
|
11
16
|
]
|
|
12
17
|
|
|
13
18
|
module List = {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
open Toolkit__Ui
|
|
2
|
+
|
|
3
|
+
@module("@root/src/ui/Toolkit__Ui_Alert.resi?raw")
|
|
4
|
+
external resi: string = "default"
|
|
5
|
+
|
|
6
|
+
@module("@root/playground/components/Playground_Alert.res?raw")
|
|
7
|
+
external codeExample: string = "default"
|
|
8
|
+
|
|
9
|
+
@react.component
|
|
10
|
+
let make = () => {
|
|
11
|
+
let variants: array<Alert.status> = [#success, #error, #info, #warning]
|
|
12
|
+
|
|
13
|
+
<div className="flex flex-col gap-8">
|
|
14
|
+
{variants
|
|
15
|
+
->Array.map(variant => {
|
|
16
|
+
<div key={(variant :> string)}>
|
|
17
|
+
<h3> {(variant :> string)->React.string} </h3>
|
|
18
|
+
<Alert
|
|
19
|
+
title={"Title"->React.string} description={"Description"->React.string} status=variant
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
})
|
|
23
|
+
->React.array}
|
|
24
|
+
</div>
|
|
25
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
@module("@root/src/ui/Toolkit__Ui_Button.resi?raw")
|
|
2
|
+
external resi: string = "default"
|
|
3
|
+
|
|
4
|
+
@module("@root/playground/components/Playground_Button.res?raw")
|
|
5
|
+
external codeExample: string = "default"
|
|
6
|
+
|
|
7
|
+
@react.component
|
|
8
|
+
let make = () => {
|
|
9
|
+
let colors: array<Toolkit__Ui_Button.color> = [
|
|
10
|
+
#primary,
|
|
11
|
+
#black,
|
|
12
|
+
#white,
|
|
13
|
+
#gray,
|
|
14
|
+
#success,
|
|
15
|
+
#info,
|
|
16
|
+
#danger,
|
|
17
|
+
#warning,
|
|
18
|
+
#neutral,
|
|
19
|
+
#neutralLight,
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
let sizes = Js.Dict.fromArray([("xs", #xs), ("sm", #sm), ("md", #md), ("lg", #lg)])
|
|
23
|
+
let variants = Js.Dict.fromArray([
|
|
24
|
+
("default", #default),
|
|
25
|
+
("text", #text),
|
|
26
|
+
("link", #link),
|
|
27
|
+
("outline", #outline),
|
|
28
|
+
("pill", #pill),
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
<div>
|
|
32
|
+
{colors
|
|
33
|
+
->Array.mapWithIndex((i, color) =>
|
|
34
|
+
<div
|
|
35
|
+
key={i->Int.toString ++ (color :> string)}
|
|
36
|
+
className="flex flex-col gap-4 first:border-0 border-t pt-4 first:pt-0 border-neutral-500">
|
|
37
|
+
<h2> {(color :> string)->React.string} </h2>
|
|
38
|
+
<div className="flex flex-row flex-wrap gap-8">
|
|
39
|
+
{variants
|
|
40
|
+
->Js.Dict.entries
|
|
41
|
+
->Array.map(((variantText, variant)) => {
|
|
42
|
+
<div>
|
|
43
|
+
<h4> {variantText->React.string} </h4>
|
|
44
|
+
<div className="flex flex-col">
|
|
45
|
+
{[false, true]
|
|
46
|
+
->Array.mapWithIndex(
|
|
47
|
+
(j, disabled) =>
|
|
48
|
+
<div className="flex items-center gap-1 mb-2">
|
|
49
|
+
{sizes
|
|
50
|
+
->Js.Dict.entries
|
|
51
|
+
->Array.mapWithIndex(
|
|
52
|
+
(k, (sizeText, size)) =>
|
|
53
|
+
<div
|
|
54
|
+
key={(i + j + k)->Int.toString ++ ((color :> string) ++ sizeText)}
|
|
55
|
+
className="flex flex-col justify-center items-center">
|
|
56
|
+
<Toolkit__Ui_Button variant color size disabled>
|
|
57
|
+
{"hello"->React.string}
|
|
58
|
+
</Toolkit__Ui_Button>
|
|
59
|
+
<span className="text-xxs"> {sizeText->React.string} </span>
|
|
60
|
+
</div>,
|
|
61
|
+
)
|
|
62
|
+
->React.array}
|
|
63
|
+
</div>,
|
|
64
|
+
)
|
|
65
|
+
->React.array}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
})
|
|
69
|
+
->React.array}
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
)
|
|
73
|
+
->React.array}
|
|
74
|
+
</div>
|
|
75
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
open Toolkit__Ui
|
|
2
|
+
|
|
3
|
+
@module("@root/src/ui/Toolkit__Ui_Label.resi?raw")
|
|
4
|
+
external resi: string = "default"
|
|
5
|
+
|
|
6
|
+
@module("@root/playground/components/Playground_Label.res?raw")
|
|
7
|
+
external codeExample: string = "default"
|
|
8
|
+
|
|
9
|
+
@react.component
|
|
10
|
+
let make = () =>
|
|
11
|
+
<div>
|
|
12
|
+
<Label htmlFor="test"> {"Label"->React.string} </Label>
|
|
13
|
+
<Label htmlFor="test" optionalMessage={"Optional"->React.string}>
|
|
14
|
+
{"Label"->React.string}
|
|
15
|
+
</Label>
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
open Toolkit__Ui
|
|
2
|
+
|
|
3
|
+
@module("@root/src/ui/Toolkit__Ui_Modal.resi?raw")
|
|
4
|
+
external resi: string = "default"
|
|
5
|
+
|
|
6
|
+
@module("@root/playground/components/Playground_Modal.res?raw")
|
|
7
|
+
external codeExample: string = "default"
|
|
8
|
+
|
|
9
|
+
@react.component
|
|
10
|
+
let make = () => {
|
|
11
|
+
let modalSize: array<Modal.size> = [#lg, #md, #sm, #xs]
|
|
12
|
+
|
|
13
|
+
let modalColor: array<Modal.color> = [#primary, #success, #danger, #neutral]
|
|
14
|
+
|
|
15
|
+
let (isVisible, setVisibility) = React.useState(() => false)
|
|
16
|
+
let (size, setSize) = React.useState(() => #md)
|
|
17
|
+
let (modalType, setModalType) = React.useState(() => #default)
|
|
18
|
+
|
|
19
|
+
<div className="flex flex-col gap-4 items-start">
|
|
20
|
+
<div>
|
|
21
|
+
<Toolkit__Ui_Label htmlFor="size"> {"Size :"->React.string} </Toolkit__Ui_Label>
|
|
22
|
+
<Toolkit__Ui.Select
|
|
23
|
+
id="size"
|
|
24
|
+
value={Obj.magic(size)}
|
|
25
|
+
onChange={value => {
|
|
26
|
+
setSize(_ => value)
|
|
27
|
+
}}
|
|
28
|
+
options={modalSize->Array.map(value => (value->Obj.magic, value->Obj.magic, true))}
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
<div>
|
|
32
|
+
<Toolkit__Ui_Label htmlFor="color"> {"Color :"->React.string} </Toolkit__Ui_Label>
|
|
33
|
+
<Toolkit__Ui.Select
|
|
34
|
+
id="size"
|
|
35
|
+
onChange={value => {
|
|
36
|
+
setModalType(_ => value === "" ? #default : #colored(Obj.magic(value)))
|
|
37
|
+
}}
|
|
38
|
+
options={[("default", "", true)]->Array.concat(
|
|
39
|
+
modalColor->Array.map(value => (value->Obj.magic, value->Obj.magic, true)),
|
|
40
|
+
)}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
<Button onClick={_ => setVisibility(_ => true)}> {"Show modal"->React.string} </Button>
|
|
44
|
+
<Modal
|
|
45
|
+
isVisible
|
|
46
|
+
title={"title"->React.string}
|
|
47
|
+
body={"Body"->React.string}
|
|
48
|
+
hide={() => setVisibility(_ => false)}
|
|
49
|
+
size
|
|
50
|
+
type_=modalType
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
@module("@root/src/ui/Toolkit__Ui_MultiSelect.resi?raw")
|
|
2
|
+
external resi: string = "default"
|
|
3
|
+
|
|
4
|
+
@module("@root/playground/components/Playground_MultiSelect.res?raw")
|
|
5
|
+
external codeExample: string = "default"
|
|
6
|
+
|
|
7
|
+
@react.component
|
|
8
|
+
let make = () => {
|
|
9
|
+
let options1: array<Toolkit__Ui_MultiSelect.item> = [
|
|
10
|
+
{
|
|
11
|
+
itemLabel: <p className="flex flex-row text-danger-500">
|
|
12
|
+
<BsReactIcons.FaAngleDown />
|
|
13
|
+
{"test"->React.string}
|
|
14
|
+
</p>,
|
|
15
|
+
label: "Test",
|
|
16
|
+
value: "test",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
itemLabel: <p> {"test2"->React.string} </p>,
|
|
20
|
+
label: "Test2",
|
|
21
|
+
value: "test2",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
itemLabel: <p> {"test3"->React.string} </p>,
|
|
25
|
+
label: "Test3",
|
|
26
|
+
value: "test3",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
itemLabel: <p> {"test4"->React.string} </p>,
|
|
30
|
+
label: "Test4",
|
|
31
|
+
value: "test4",
|
|
32
|
+
},
|
|
33
|
+
]
|
|
34
|
+
let options2: array<Toolkit__Ui_MultiSelect.item> = [
|
|
35
|
+
{
|
|
36
|
+
itemLabel: <p> {"test4"->React.string} </p>,
|
|
37
|
+
label: "Test4",
|
|
38
|
+
value: "test4",
|
|
39
|
+
},
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
let tmp = Toolkit__Hooks.useDisclosure()
|
|
43
|
+
|
|
44
|
+
let options = tmp.isOpen ? options2 : options1
|
|
45
|
+
|
|
46
|
+
<div className="flex flex-col gap-8 items-start">
|
|
47
|
+
<Toolkit__Ui_Button onClick={_ => tmp.toggle()}>
|
|
48
|
+
{"Change options"->React.string}
|
|
49
|
+
</Toolkit__Ui_Button>
|
|
50
|
+
<Toolkit__Ui_MultiSelect
|
|
51
|
+
searchPlaceholder="Filter"
|
|
52
|
+
buttonClassName={"w-48"}
|
|
53
|
+
dropdownClassName="w-60"
|
|
54
|
+
placeholder={<span> {"Select me"->React.string} </span>}
|
|
55
|
+
onChange={Js.log}
|
|
56
|
+
options
|
|
57
|
+
/>
|
|
58
|
+
<div>
|
|
59
|
+
<h3 className="mb-2"> {"Preselected options"->React.string} </h3>
|
|
60
|
+
<Toolkit__Ui_MultiSelect
|
|
61
|
+
searchPlaceholder="Filter"
|
|
62
|
+
buttonClassName={"w-48"}
|
|
63
|
+
dropdownClassName="w-60"
|
|
64
|
+
defaultValue={options}
|
|
65
|
+
placeholder={<span> {"Select me"->React.string} </span>}
|
|
66
|
+
onChange={Js.log}
|
|
67
|
+
options
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
<div>
|
|
71
|
+
<h3 className="mb-2"> {"Search"->React.string} </h3>
|
|
72
|
+
<p className="mb-1">
|
|
73
|
+
{"Search input is displayed when there are more than 5 options"->React.string}
|
|
74
|
+
</p>
|
|
75
|
+
<Toolkit__Ui_MultiSelect
|
|
76
|
+
searchPlaceholder="Filter"
|
|
77
|
+
buttonClassName={"w-48"}
|
|
78
|
+
dropdownClassName="w-60 max-h-[300px] overflow-auto"
|
|
79
|
+
options={Array.makeBy(10, (i): Toolkit__Ui.MultiSelect.item => {
|
|
80
|
+
{
|
|
81
|
+
itemLabel: <p> {`label ${i->Int.toString}`->React.string} </p>,
|
|
82
|
+
label: `label ${i->Int.toString}`,
|
|
83
|
+
value: `label ${i->Int.toString}`,
|
|
84
|
+
}
|
|
85
|
+
})}
|
|
86
|
+
placeholder={<span> {"Select me"->React.string} </span>}
|
|
87
|
+
onChange={Js.log}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
open Toolkit__Ui
|
|
2
2
|
|
|
3
|
-
@module("
|
|
3
|
+
@module("@root/src/ui/Toolkit__Ui_Switch.resi?raw")
|
|
4
4
|
external resi: string = "default"
|
|
5
5
|
|
|
6
|
-
@module("
|
|
6
|
+
@module("@root/playground/components/Playground_Switch.res?raw")
|
|
7
7
|
external codeExample: string = "default"
|
|
8
8
|
|
|
9
9
|
@react.component
|
package/playground/custom.css
CHANGED
|
@@ -30,16 +30,15 @@ We share a postcss config that you can include to your webpack config
|
|
|
30
30
|
|
|
31
31
|
## Usage
|
|
32
32
|
|
|
33
|
-
The bindings in the _vendors_ are **globaly accessible**.
|
|
33
|
+
The bindings in the _vendors_ are **globaly accessible**.
|
|
34
34
|
|
|
35
35
|
```rescript
|
|
36
|
-
open Toolkit;
|
|
37
36
|
|
|
38
37
|
@react.component
|
|
39
38
|
let make = () => {
|
|
40
|
-
let dialog = Hooks.useDisclosure();
|
|
39
|
+
let dialog = Toolkit.Hooks.useDisclosure();
|
|
41
40
|
|
|
42
|
-
<div className=
|
|
41
|
+
<div className="bg-white" />
|
|
43
42
|
};
|
|
44
43
|
```
|
|
45
44
|
|
|
@@ -50,9 +49,3 @@ Run bsb
|
|
|
50
49
|
```bash
|
|
51
50
|
npm run dev
|
|
52
51
|
```
|
|
53
|
-
|
|
54
|
-
Run storybook
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
npm run storybook
|
|
58
|
-
```
|
|
@@ -252,7 +252,7 @@ module Make = (Config: RouterConfig) => {
|
|
|
252
252
|
<a
|
|
253
253
|
href=url
|
|
254
254
|
target="_blank"
|
|
255
|
-
className={cx([commonClassName, "sidenav-link", isSubLink ? "ml-3" : ""])}>
|
|
255
|
+
className={cx([commonClassName, "py-3 sidenav-link", isSubLink ? "ml-3" : ""])}>
|
|
256
256
|
<span className="overflow-hidden flex">
|
|
257
257
|
{config.icon->Option.mapWithDefault(React.null, icon =>
|
|
258
258
|
<div className={cx(["text-neutral-800", isNavOpen ? "pl-2" : "px-2"])}> icon </div>
|
|
@@ -280,6 +280,7 @@ module Make = (Config: RouterConfig) => {
|
|
|
280
280
|
className={cx([
|
|
281
281
|
commonClassName,
|
|
282
282
|
isSubLink ? "ml-3" : "",
|
|
283
|
+
config.icon->Option.isNone ? "py-5" : "",
|
|
283
284
|
"sidenav-link",
|
|
284
285
|
isActive ? "bg-primary-100/75 text-neutral-700" : "",
|
|
285
286
|
])}
|
|
@@ -36,6 +36,18 @@ let make = (
|
|
|
36
36
|
None
|
|
37
37
|
}, (previousDefaultValue, defaultValue))
|
|
38
38
|
|
|
39
|
+
let filterOptionsBySearch = (~options, ~search) => {
|
|
40
|
+
options->Array.keep(({label}) =>
|
|
41
|
+
// normalize nfd -> replace by re remove split by commponents the accent letters and deletes the accent component only, leaving the un-accented letter
|
|
42
|
+
search == "" ||
|
|
43
|
+
label
|
|
44
|
+
->Js.String2.toLowerCase
|
|
45
|
+
->Js.String2.normalizeByForm("NFD")
|
|
46
|
+
->Js.String2.replaceByRe(%re("/[\u0300-\u036f]/g"), "")
|
|
47
|
+
->Js.String2.includes(search)
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
39
51
|
<Toolkit__Ui_Dropdown
|
|
40
52
|
buttonClassName
|
|
41
53
|
dropdownClassName
|
|
@@ -64,6 +76,15 @@ let make = (
|
|
|
64
76
|
id="search"
|
|
65
77
|
autoFocus={true}
|
|
66
78
|
placeholder=?{searchPlaceholder}
|
|
79
|
+
onKeyDown={event => {
|
|
80
|
+
if event->ReactEvent.Keyboard.key === "Enter" && search !== "" {
|
|
81
|
+
let selectedOptions = filterOptionsBySearch(~options, ~search)
|
|
82
|
+
onChange(selectedOptions)
|
|
83
|
+
setSelectedOptions(_ => {
|
|
84
|
+
selectedOptions
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
}}
|
|
67
88
|
onChange={event => {
|
|
68
89
|
let target = event->ReactEvent.Form.currentTarget
|
|
69
90
|
// normalize nfd -> replace by re remove split by commponents the accent letters and deletes the accent component only, leaving the un-accented letter
|
package/src/ui/styles.css
CHANGED
|
@@ -139,7 +139,6 @@ select:not([disabled]):not([tabindex="-1"]):focus,
|
|
|
139
139
|
textarea:not([disabled]):not([tabindex="-1"]):focus,
|
|
140
140
|
button:not([disabled]):not([tabindex="-1"]):focus,
|
|
141
141
|
iframe:not([tabindex="-1"]):focus,
|
|
142
|
-
[tabindex]:not([tabindex="-1"]):focus,
|
|
143
142
|
[contentEditable="true"]:not([tabindex="-1"]):focus,
|
|
144
143
|
.focus {
|
|
145
144
|
outline: none !important;
|
|
@@ -164,7 +163,9 @@ iframe:not([tabindex="-1"]):focus,
|
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
.input-range
|
|
167
|
-
.DayPicker-Day--selected:not(.DayPicker-Day--start):not(
|
|
166
|
+
.DayPicker-Day--selected:not(.DayPicker-Day--start):not(
|
|
167
|
+
.DayPicker-Day--end
|
|
168
|
+
):not(.DayPicker-Day--outside) {
|
|
168
169
|
background-color: #f0f8ff !important;
|
|
169
170
|
color: #4a90e2;
|
|
170
171
|
}
|
|
@@ -221,7 +222,9 @@ iframe:not([tabindex="-1"]):focus,
|
|
|
221
222
|
}
|
|
222
223
|
|
|
223
224
|
.Selectable
|
|
224
|
-
.DayPicker-Day--selected:not(.DayPicker-Day--start):not(
|
|
225
|
+
.DayPicker-Day--selected:not(.DayPicker-Day--start):not(
|
|
226
|
+
.DayPicker-Day--end
|
|
227
|
+
):not(.DayPicker-Day--outside) {
|
|
225
228
|
background-color: #f0f8ff !important;
|
|
226
229
|
color: #4a90e2;
|
|
227
230
|
}
|
package/vite.config.js
CHANGED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
open Storybook
|
|
2
|
-
open Toolkit__Ui
|
|
3
|
-
|
|
4
|
-
@module("!!raw-loader!../../../src/ui/Toolkit__Ui_Alert.resi")
|
|
5
|
-
external source: 'a = "default"
|
|
6
|
-
|
|
7
|
-
let default = CSF.make(~title="Components/Alert", ())
|
|
8
|
-
|
|
9
|
-
let success = () =>
|
|
10
|
-
<Alert title={"Title"->React.string} description={"Description"->React.string} status=#success />
|
|
11
|
-
|
|
12
|
-
success->CSF.addMeta(
|
|
13
|
-
~name="success",
|
|
14
|
-
~parameters={
|
|
15
|
-
"docs": {
|
|
16
|
-
"page": () => <>
|
|
17
|
-
<CodeBlock> source </CodeBlock>
|
|
18
|
-
<Docs.Source
|
|
19
|
-
language="rescript"
|
|
20
|
-
code=j`
|
|
21
|
-
<Alert
|
|
22
|
-
title={"Title"->React.string}
|
|
23
|
-
description={"Description"->React.string}
|
|
24
|
-
status=#success
|
|
25
|
-
/>;
|
|
26
|
-
`
|
|
27
|
-
/>
|
|
28
|
-
<Docs.Story id="components-alert--success" />
|
|
29
|
-
</>,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
(),
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
let error = () =>
|
|
36
|
-
<Alert title={"Title"->React.string} description={"Description"->React.string} status=#error />
|
|
37
|
-
|
|
38
|
-
error->CSF.addMeta(
|
|
39
|
-
~name="error",
|
|
40
|
-
~parameters={
|
|
41
|
-
"docs": {
|
|
42
|
-
"page": () => <>
|
|
43
|
-
<CodeBlock> source </CodeBlock>
|
|
44
|
-
<Docs.Source
|
|
45
|
-
language="rescript"
|
|
46
|
-
code=j`
|
|
47
|
-
<Alert
|
|
48
|
-
title={"Title"->React.string}
|
|
49
|
-
description={"Description"->React.string}
|
|
50
|
-
status=#error
|
|
51
|
-
/>;
|
|
52
|
-
`
|
|
53
|
-
/>
|
|
54
|
-
<Docs.Story id="components-alert--error" />
|
|
55
|
-
</>,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
(),
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
let warning = () =>
|
|
62
|
-
<Alert title={"Title"->React.string} description={"Description"->React.string} status=#warning />
|
|
63
|
-
|
|
64
|
-
warning->CSF.addMeta(
|
|
65
|
-
~name="warning",
|
|
66
|
-
~parameters={
|
|
67
|
-
"docs": {
|
|
68
|
-
"page": () => <>
|
|
69
|
-
<CodeBlock> source </CodeBlock>
|
|
70
|
-
<Docs.Source
|
|
71
|
-
language="rescript"
|
|
72
|
-
code=j`
|
|
73
|
-
<Alert
|
|
74
|
-
title={"Title"->React.string}
|
|
75
|
-
description={"Description"->React.string}
|
|
76
|
-
status=#warning
|
|
77
|
-
/>;
|
|
78
|
-
`
|
|
79
|
-
/>
|
|
80
|
-
<Docs.Story id="components-alert--warning" />
|
|
81
|
-
</>,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
(),
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
let info = () =>
|
|
88
|
-
<Alert title={"Title"->React.string} description={"Description"->React.string} status=#info />
|
|
89
|
-
|
|
90
|
-
info->CSF.addMeta(
|
|
91
|
-
~name="info",
|
|
92
|
-
~parameters={
|
|
93
|
-
"docs": {
|
|
94
|
-
"page": () => <>
|
|
95
|
-
<CodeBlock> source </CodeBlock>
|
|
96
|
-
<Docs.Source
|
|
97
|
-
language="rescript"
|
|
98
|
-
code=j`
|
|
99
|
-
<Alert
|
|
100
|
-
title={"Title"->React.string}
|
|
101
|
-
description={"Description"->React.string}
|
|
102
|
-
status=#info
|
|
103
|
-
/>;
|
|
104
|
-
`
|
|
105
|
-
/>
|
|
106
|
-
<Docs.Story id="components-alert--info" />
|
|
107
|
-
</>,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
(),
|
|
111
|
-
)
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
open Storybook
|
|
2
|
-
open Toolkit__Ui
|
|
3
|
-
|
|
4
|
-
@module("!!raw-loader!../../../src/ui/Toolkit__Ui_Label.resi")
|
|
5
|
-
external source: 'a = "default"
|
|
6
|
-
|
|
7
|
-
let default = CSF.make(~title="Form/Label", ())
|
|
8
|
-
|
|
9
|
-
let sample = () =>
|
|
10
|
-
<div>
|
|
11
|
-
<Label htmlFor="test"> {"Label"->React.string} </Label>
|
|
12
|
-
<Label htmlFor="test" optionalMessage={"Optional"->React.string}>
|
|
13
|
-
{"Label"->React.string}
|
|
14
|
-
</Label>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
sample->CSF.addMeta(
|
|
18
|
-
~name="sample",
|
|
19
|
-
~parameters={
|
|
20
|
-
"docs": {
|
|
21
|
-
"page": () => <>
|
|
22
|
-
<CodeBlock> source </CodeBlock>
|
|
23
|
-
<Docs.Source
|
|
24
|
-
language="rescript"
|
|
25
|
-
code=j`
|
|
26
|
-
<div>
|
|
27
|
-
<Label htmlFor="test"> "Label"->React.string </Label>
|
|
28
|
-
<Label htmlFor="test" optionalMessage={"Optional"->React.string}>
|
|
29
|
-
"Label"->React.string
|
|
30
|
-
</Label>
|
|
31
|
-
</div>
|
|
32
|
-
`
|
|
33
|
-
/>
|
|
34
|
-
<Docs.Story id="form-label--sample" />
|
|
35
|
-
</>,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
(),
|
|
39
|
-
)
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
open Storybook
|
|
2
|
-
open Toolkit__Ui
|
|
3
|
-
|
|
4
|
-
@module("!!raw-loader!../../../src/ui/Toolkit__Ui_Modal.resi")
|
|
5
|
-
external source: 'a = "default"
|
|
6
|
-
|
|
7
|
-
let default = CSF.make(~title="Components/Modal", ())
|
|
8
|
-
|
|
9
|
-
let defaultExample = () => {
|
|
10
|
-
let modalSize = [("lg", #lg), ("md", #md), ("sm", #sm), ("xs", #xs)]
|
|
11
|
-
|
|
12
|
-
let (isVisible, setVisibility) = React.useState(() => false)
|
|
13
|
-
let (size, setSize) = React.useState(() => #md)
|
|
14
|
-
|
|
15
|
-
<div>
|
|
16
|
-
<div className="mb-4">
|
|
17
|
-
<label htmlFor="size"> {"Size :"->React.string} </label>
|
|
18
|
-
<select
|
|
19
|
-
id="size"
|
|
20
|
-
onChange={event => {
|
|
21
|
-
let value = (event->ReactEvent.Form.target)["value"]
|
|
22
|
-
|
|
23
|
-
setSize(_ => value)
|
|
24
|
-
}}>
|
|
25
|
-
{modalSize
|
|
26
|
-
->Array.map(((label, value)) =>
|
|
27
|
-
<option value={value->Obj.magic} selected={value == size}> {label->React.string} </option>
|
|
28
|
-
)
|
|
29
|
-
->React.array}
|
|
30
|
-
</select>
|
|
31
|
-
</div>
|
|
32
|
-
<Button onClick={_ => setVisibility(_ => true)}> {"Show modal"->React.string} </Button>
|
|
33
|
-
<Modal
|
|
34
|
-
isVisible
|
|
35
|
-
title={"title"->React.string}
|
|
36
|
-
body={"Body"->React.string}
|
|
37
|
-
hide={() => setVisibility(_ => false)}
|
|
38
|
-
size
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
defaultExample->CSF.addMeta(
|
|
44
|
-
~name="default",
|
|
45
|
-
~parameters={
|
|
46
|
-
"docs": {
|
|
47
|
-
"page": () => <>
|
|
48
|
-
<CodeBlock> source </CodeBlock>
|
|
49
|
-
<Docs.Source
|
|
50
|
-
language="rescript"
|
|
51
|
-
code=j`
|
|
52
|
-
let (isVisible, setVisibility) = React.useState(() => false);
|
|
53
|
-
|
|
54
|
-
<>
|
|
55
|
-
<button onClick={_ => setVisibility(_ => true)}>
|
|
56
|
-
"Show modal"->React.string
|
|
57
|
-
</button>
|
|
58
|
-
<Modal
|
|
59
|
-
isVisible
|
|
60
|
-
title={"title"->React.string}
|
|
61
|
-
body={"Body"->React.string}
|
|
62
|
-
hide={() => setVisibility(_ => false)}
|
|
63
|
-
/>
|
|
64
|
-
</>;
|
|
65
|
-
`
|
|
66
|
-
/>
|
|
67
|
-
<Docs.Story id="components-modal--default" />
|
|
68
|
-
</>,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
(),
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
let coloredExample = () => {
|
|
75
|
-
let modalSize = [("lg", #lg), ("md", #md), ("sm", #sm), ("xs", #xs)]
|
|
76
|
-
|
|
77
|
-
let modalColor: array<(string, Modal.color)> = [
|
|
78
|
-
("primary", #primary),
|
|
79
|
-
("success", #success),
|
|
80
|
-
("danger", #danger),
|
|
81
|
-
("neutral", #neutral),
|
|
82
|
-
]
|
|
83
|
-
|
|
84
|
-
let (isVisible, setVisibility) = React.useState(() => false)
|
|
85
|
-
let (size, setSize) = React.useState(() => #md)
|
|
86
|
-
let (color, setColor) = React.useState(() => #primary)
|
|
87
|
-
|
|
88
|
-
<div>
|
|
89
|
-
<div>
|
|
90
|
-
<label htmlFor="size"> {"Size :"->React.string} </label>
|
|
91
|
-
<select
|
|
92
|
-
id="size"
|
|
93
|
-
onChange={event => {
|
|
94
|
-
let value = (event->ReactEvent.Form.target)["value"]
|
|
95
|
-
|
|
96
|
-
setSize(_ => value)
|
|
97
|
-
}}>
|
|
98
|
-
{modalSize
|
|
99
|
-
->Array.map(((label, value)) =>
|
|
100
|
-
<option value={value->Obj.magic} selected={value == size}> {label->React.string} </option>
|
|
101
|
-
)
|
|
102
|
-
->React.array}
|
|
103
|
-
</select>
|
|
104
|
-
</div>
|
|
105
|
-
<div>
|
|
106
|
-
<label htmlFor="color"> {"color :"->React.string} </label>
|
|
107
|
-
<select
|
|
108
|
-
onChange={event => {
|
|
109
|
-
let value = (event->ReactEvent.Form.target)["value"]
|
|
110
|
-
|
|
111
|
-
setColor(_ => value)
|
|
112
|
-
}}>
|
|
113
|
-
{modalColor
|
|
114
|
-
->Array.map(((label, value)) =>
|
|
115
|
-
<option value={value->Obj.magic} selected={value == color}>
|
|
116
|
-
{label->React.string}
|
|
117
|
-
</option>
|
|
118
|
-
)
|
|
119
|
-
->React.array}
|
|
120
|
-
</select>
|
|
121
|
-
</div>
|
|
122
|
-
<Button onClick={_ => setVisibility(_ => true)}> {"Show modal"->React.string} </Button>
|
|
123
|
-
<Modal
|
|
124
|
-
isVisible
|
|
125
|
-
title={"title"->React.string}
|
|
126
|
-
body={"Body"->React.string}
|
|
127
|
-
hide={() => setVisibility(_ => false)}
|
|
128
|
-
size
|
|
129
|
-
type_=#colored(color)
|
|
130
|
-
/>
|
|
131
|
-
</div>
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
coloredExample->CSF.addMeta(
|
|
135
|
-
~name="colored",
|
|
136
|
-
~parameters={
|
|
137
|
-
"docs": {
|
|
138
|
-
"page": () => <>
|
|
139
|
-
<CodeBlock> source </CodeBlock>
|
|
140
|
-
<Docs.Source
|
|
141
|
-
language="rescript"
|
|
142
|
-
code=j`
|
|
143
|
-
let modalSize = [|("lg", #lg), ("md", #md), ("sm", #sm), ("xs", #xs)|];
|
|
144
|
-
|
|
145
|
-
let modalColor: array((string, Modal.color)) = [|
|
|
146
|
-
("primary", #primary),
|
|
147
|
-
("success", #success),
|
|
148
|
-
("danger", #danger),
|
|
149
|
-
("neutral", #neutral),
|
|
150
|
-
|];
|
|
151
|
-
|
|
152
|
-
let (isVisible, setVisibility) = React.useState(() => false);
|
|
153
|
-
let (size, setSize) = React.useState(() => #md);
|
|
154
|
-
let (color, setColor) = React.useState(() => #primary);
|
|
155
|
-
|
|
156
|
-
<div>
|
|
157
|
-
<div>
|
|
158
|
-
<label htmlFor="size"> "Size :"->React.string </label>
|
|
159
|
-
<select
|
|
160
|
-
id="size"
|
|
161
|
-
onChange={event => {
|
|
162
|
-
let value = event->ReactEvent.Form.target##value;
|
|
163
|
-
|
|
164
|
-
setSize(_ => value);
|
|
165
|
-
}}>
|
|
166
|
-
{modalSize
|
|
167
|
-
->Array.map(((label, value)) => {
|
|
168
|
-
<option value={value->Obj.magic} selected={value == size}>
|
|
169
|
-
label->React.string
|
|
170
|
-
</option>
|
|
171
|
-
})
|
|
172
|
-
->React.array}
|
|
173
|
-
</select>
|
|
174
|
-
</div>
|
|
175
|
-
<div>
|
|
176
|
-
<label htmlFor="color"> "color :"->React.string </label>
|
|
177
|
-
<select
|
|
178
|
-
onChange={event => {
|
|
179
|
-
let value = event->ReactEvent.Form.target##value;
|
|
180
|
-
|
|
181
|
-
setColor(_ => value);
|
|
182
|
-
}}>
|
|
183
|
-
{modalColor
|
|
184
|
-
->Array.map(((label, value)) => {
|
|
185
|
-
<option value={value->Obj.magic} selected={value == color}>
|
|
186
|
-
label->React.string
|
|
187
|
-
</option>
|
|
188
|
-
})
|
|
189
|
-
->React.array}
|
|
190
|
-
</select>
|
|
191
|
-
</div>
|
|
192
|
-
<Button onClick={_ => setVisibility(_ => true)}>
|
|
193
|
-
"Show modal"->React.string
|
|
194
|
-
</Button>
|
|
195
|
-
<Modal
|
|
196
|
-
isVisible
|
|
197
|
-
title={"title"->React.string}
|
|
198
|
-
body={"Body"->React.string}
|
|
199
|
-
hide={() => setVisibility(_ => false)}
|
|
200
|
-
size
|
|
201
|
-
type_={#colored(color)}
|
|
202
|
-
/>
|
|
203
|
-
</div>;
|
|
204
|
-
`
|
|
205
|
-
/>
|
|
206
|
-
<Docs.Story id="components-modal--colored" />
|
|
207
|
-
</>,
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
(),
|
|
211
|
-
)
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
open Storybook
|
|
2
|
-
|
|
3
|
-
@module("!!raw-loader!../../../src/ui/Toolkit__Ui_MultiSelect.resi")
|
|
4
|
-
external source: 'a = "default"
|
|
5
|
-
|
|
6
|
-
let default = CSF.make(~title="Components/MultiSelect", ())
|
|
7
|
-
|
|
8
|
-
let example = () => {
|
|
9
|
-
let options1: array<Toolkit__Ui_MultiSelect.item> = [
|
|
10
|
-
{
|
|
11
|
-
itemLabel: <p className="flex flex-row text-danger-500">
|
|
12
|
-
<BsReactIcons.FaAngleDown /> {"test"->React.string}
|
|
13
|
-
</p>,
|
|
14
|
-
label: "Test",
|
|
15
|
-
value: "test",
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
itemLabel: <p> {"test2"->React.string} </p>,
|
|
19
|
-
label: "Test2",
|
|
20
|
-
value: "test2",
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
itemLabel: <p> {"test3"->React.string} </p>,
|
|
24
|
-
label: "Test3",
|
|
25
|
-
value: "test3",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
itemLabel: <p> {"test4"->React.string} </p>,
|
|
29
|
-
label: "Test4",
|
|
30
|
-
value: "test4",
|
|
31
|
-
},
|
|
32
|
-
]
|
|
33
|
-
let options2: array<Toolkit__Ui_MultiSelect.item> = [
|
|
34
|
-
{
|
|
35
|
-
itemLabel: <p> {"test4"->React.string} </p>,
|
|
36
|
-
label: "Test4",
|
|
37
|
-
value: "test4",
|
|
38
|
-
},
|
|
39
|
-
]
|
|
40
|
-
|
|
41
|
-
let tmp = Toolkit__Hooks.useDisclosure()
|
|
42
|
-
|
|
43
|
-
let options = tmp.isOpen ? options2 : options1
|
|
44
|
-
|
|
45
|
-
<div>
|
|
46
|
-
<Toolkit__Ui_Button onClick={_ => tmp.toggle()}>
|
|
47
|
-
{"Change options"->React.string}
|
|
48
|
-
</Toolkit__Ui_Button>
|
|
49
|
-
<div className="h-10" />
|
|
50
|
-
<Toolkit__Ui_MultiSelect
|
|
51
|
-
searchPlaceholder="Filter"
|
|
52
|
-
buttonClassName={"w-48"}
|
|
53
|
-
dropdownClassName="w-60"
|
|
54
|
-
placeholder={<span> {"Select me"->React.string} </span>}
|
|
55
|
-
onChange={Js.log}
|
|
56
|
-
options
|
|
57
|
-
/>
|
|
58
|
-
<div className="mt-8" />
|
|
59
|
-
<Toolkit__Ui_MultiSelect
|
|
60
|
-
searchPlaceholder="Filter"
|
|
61
|
-
buttonClassName={"w-48"}
|
|
62
|
-
dropdownClassName="w-60"
|
|
63
|
-
defaultValue={options}
|
|
64
|
-
placeholder={<span> {"Select me"->React.string} </span>}
|
|
65
|
-
onChange={Js.log}
|
|
66
|
-
options
|
|
67
|
-
/>
|
|
68
|
-
</div>
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
example->CSF.addMeta(
|
|
72
|
-
~name="example",
|
|
73
|
-
~parameters={
|
|
74
|
-
"docs": {
|
|
75
|
-
"page": () => <>
|
|
76
|
-
<CodeBlock> source </CodeBlock>
|
|
77
|
-
<Docs.Source
|
|
78
|
-
language="rescript"
|
|
79
|
-
code=j`
|
|
80
|
-
let options: array<Toolkit__Ui_MultiSelect.item> = [
|
|
81
|
-
{
|
|
82
|
-
itemLabel: <p className="flex flex-row text-danger-500">
|
|
83
|
-
<BsReactIcons.FaAngleDown /> {"test"->React.string}
|
|
84
|
-
</p>,
|
|
85
|
-
label: "Test",
|
|
86
|
-
value: "test",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
itemLabel: <p> {"test2"->React.string} </p>,
|
|
90
|
-
label: "Test2",
|
|
91
|
-
value: "test2",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
itemLabel: <p> {"test3"->React.string} </p>,
|
|
95
|
-
label: "Test3",
|
|
96
|
-
value: "test3",
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
itemLabel: <p> {"test4"->React.string} </p>,
|
|
100
|
-
label: "Test4",
|
|
101
|
-
value: "test4",
|
|
102
|
-
},
|
|
103
|
-
]
|
|
104
|
-
|
|
105
|
-
<div>
|
|
106
|
-
<Toolkit__Ui_MultiSelect
|
|
107
|
-
searchPlaceholder="Filter"
|
|
108
|
-
buttonClassName={"w-48"}
|
|
109
|
-
dropdownClassName="w-60"
|
|
110
|
-
placeholder={<span> {"Select me"->React.string} </span>}
|
|
111
|
-
onChange={Js.log}
|
|
112
|
-
options
|
|
113
|
-
/>
|
|
114
|
-
<div className="mt-8" />
|
|
115
|
-
<Toolkit__Ui_MultiSelect
|
|
116
|
-
searchPlaceholder="Filter"
|
|
117
|
-
buttonClassName={"w-48"}
|
|
118
|
-
dropdownClassName="w-60"
|
|
119
|
-
defaultValue={[options[0]->Option.getUnsafe]}
|
|
120
|
-
placeholder={<span> {"Select me"->React.string} </span>}
|
|
121
|
-
onChange={Js.log}
|
|
122
|
-
options
|
|
123
|
-
/>
|
|
124
|
-
</div>
|
|
125
|
-
`
|
|
126
|
-
/>
|
|
127
|
-
<Docs.Story id="components-multiselect--example" />
|
|
128
|
-
</>,
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
(),
|
|
132
|
-
)
|
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
open Storybook
|
|
2
|
-
|
|
3
|
-
@module("!!raw-loader!../../../src/ui/Toolkit__Ui_Button.resi")
|
|
4
|
-
external source: 'a = "default"
|
|
5
|
-
|
|
6
|
-
let default = CSF.make(~title="Components/Button", ())
|
|
7
|
-
|
|
8
|
-
let defaultPalette = () => {
|
|
9
|
-
let colors = Js.Dict.fromArray([
|
|
10
|
-
("primary", #primary),
|
|
11
|
-
("black", #black),
|
|
12
|
-
("white", #white),
|
|
13
|
-
("gray", #gray),
|
|
14
|
-
("success", #success),
|
|
15
|
-
("info", #info),
|
|
16
|
-
("danger", #danger),
|
|
17
|
-
("warning", #warning),
|
|
18
|
-
("neutral", #neutral),
|
|
19
|
-
("neutralLight", #neutralLight),
|
|
20
|
-
])
|
|
21
|
-
|
|
22
|
-
let sizes = Js.Dict.fromArray([("xs", #xs), ("sm", #sm), ("md", #md), ("lg", #lg)])
|
|
23
|
-
|
|
24
|
-
<div>
|
|
25
|
-
{colors
|
|
26
|
-
->Js.Dict.entries
|
|
27
|
-
->Array.mapWithIndex((i, (colorText, color)) =>
|
|
28
|
-
<div
|
|
29
|
-
key={i->Int.toString ++ colorText}
|
|
30
|
-
className="flex flex-row flex-col-gap-4 mb-4 items-center">
|
|
31
|
-
<strong className="w-40"> {colorText->React.string} </strong>
|
|
32
|
-
<div className="flex flex-col">
|
|
33
|
-
{[false, true]
|
|
34
|
-
->Array.mapWithIndex((j, disabled) =>
|
|
35
|
-
<div className="flex items-center flex-col-gap-1 mb-2">
|
|
36
|
-
{sizes
|
|
37
|
-
->Js.Dict.entries
|
|
38
|
-
->Array.mapWithIndex((k, (sizeText, size)) =>
|
|
39
|
-
<div key={(i + j + k)->Int.toString ++ (colorText ++ sizeText)}>
|
|
40
|
-
<Toolkit__Ui_Button color size disabled>
|
|
41
|
-
{"hello"->React.string}
|
|
42
|
-
</Toolkit__Ui_Button>
|
|
43
|
-
</div>
|
|
44
|
-
)
|
|
45
|
-
->React.array}
|
|
46
|
-
</div>
|
|
47
|
-
)
|
|
48
|
-
->React.array}
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
)
|
|
52
|
-
->React.array}
|
|
53
|
-
</div>
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
defaultPalette->CSF.addMeta(
|
|
57
|
-
~name="default palette",
|
|
58
|
-
~parameters={
|
|
59
|
-
"docs": {
|
|
60
|
-
"page": () => <>
|
|
61
|
-
<Docs.Title />
|
|
62
|
-
<CodeBlock> source </CodeBlock>
|
|
63
|
-
<Docs.Source
|
|
64
|
-
language="rescript"
|
|
65
|
-
code=j`
|
|
66
|
-
<Button variant=#default>"Content"->React.string</Button>
|
|
67
|
-
`
|
|
68
|
-
/>
|
|
69
|
-
</>,
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
(),
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
let pillPalette = () => {
|
|
76
|
-
let colors = Js.Dict.fromArray([
|
|
77
|
-
("primary", #primary),
|
|
78
|
-
("black", #black),
|
|
79
|
-
("white", #white),
|
|
80
|
-
("gray", #gray),
|
|
81
|
-
("success", #success),
|
|
82
|
-
("info", #info),
|
|
83
|
-
("danger", #danger),
|
|
84
|
-
("warning", #warning),
|
|
85
|
-
("neutral", #neutral),
|
|
86
|
-
("neutralLight", #neutralLight),
|
|
87
|
-
])
|
|
88
|
-
|
|
89
|
-
let sizes = Js.Dict.fromArray([("xs", #xs), ("sm", #sm), ("md", #md), ("lg", #lg)])
|
|
90
|
-
|
|
91
|
-
<div>
|
|
92
|
-
{colors
|
|
93
|
-
->Js.Dict.entries
|
|
94
|
-
->Array.mapWithIndex((i, (colorText, color)) =>
|
|
95
|
-
<div
|
|
96
|
-
key={i->Int.toString ++ colorText}
|
|
97
|
-
className="flex flex-row flex-col-gap-4 mb-4 items-center">
|
|
98
|
-
<strong className="w-40"> {colorText->React.string} </strong>
|
|
99
|
-
<div className="flex flex-col">
|
|
100
|
-
{[false, true]
|
|
101
|
-
->Array.mapWithIndex((j, disabled) =>
|
|
102
|
-
<div className="flex items-center flex-col-gap-1 mb-2">
|
|
103
|
-
{sizes
|
|
104
|
-
->Js.Dict.entries
|
|
105
|
-
->Array.mapWithIndex((k, (sizeText, size)) =>
|
|
106
|
-
<div key={(i + j + k)->Int.toString ++ (colorText ++ sizeText)}>
|
|
107
|
-
<Toolkit__Ui_Button variant=#pill color size disabled>
|
|
108
|
-
{"hello"->React.string}
|
|
109
|
-
</Toolkit__Ui_Button>
|
|
110
|
-
</div>
|
|
111
|
-
)
|
|
112
|
-
->React.array}
|
|
113
|
-
</div>
|
|
114
|
-
)
|
|
115
|
-
->React.array}
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
)
|
|
119
|
-
->React.array}
|
|
120
|
-
</div>
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
pillPalette->CSF.addMeta(
|
|
124
|
-
~name="pill palette",
|
|
125
|
-
~parameters={
|
|
126
|
-
"docs": {
|
|
127
|
-
"page": () => <>
|
|
128
|
-
<Docs.Title />
|
|
129
|
-
<CodeBlock> source </CodeBlock>
|
|
130
|
-
<Docs.Source
|
|
131
|
-
language="rescript"
|
|
132
|
-
code=j`
|
|
133
|
-
<Button variant=#pill>"Content"->React.string</Button>
|
|
134
|
-
`
|
|
135
|
-
/>
|
|
136
|
-
</>,
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
(),
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
let outlinePalette = () => {
|
|
143
|
-
let colors = Js.Dict.fromArray([
|
|
144
|
-
("primary", #primary),
|
|
145
|
-
("black", #black),
|
|
146
|
-
("white", #white),
|
|
147
|
-
("gray", #gray),
|
|
148
|
-
("success", #success),
|
|
149
|
-
("info", #info),
|
|
150
|
-
("danger", #danger),
|
|
151
|
-
("warning", #warning),
|
|
152
|
-
("neutral", #neutral),
|
|
153
|
-
("neutralLight", #neutralLight),
|
|
154
|
-
])
|
|
155
|
-
|
|
156
|
-
let sizes = Js.Dict.fromArray([("xs", #xs), ("sm", #sm), ("md", #md), ("lg", #lg)])
|
|
157
|
-
<div>
|
|
158
|
-
{colors
|
|
159
|
-
->Js.Dict.entries
|
|
160
|
-
->Array.mapWithIndex((i, (colorText, color)) =>
|
|
161
|
-
<div
|
|
162
|
-
key={i->Int.toString ++ colorText}
|
|
163
|
-
className="flex flex-row flex-col-gap-4 mb-4 items-center">
|
|
164
|
-
<strong className="w-40"> {colorText->React.string} </strong>
|
|
165
|
-
<div className="flex flex-col">
|
|
166
|
-
{[false, true]
|
|
167
|
-
->Array.mapWithIndex((j, disabled) =>
|
|
168
|
-
<div className="flex items-center flex-col-gap-1 mb-2">
|
|
169
|
-
{sizes
|
|
170
|
-
->Js.Dict.entries
|
|
171
|
-
->Array.mapWithIndex((k, (sizeText, size)) =>
|
|
172
|
-
<div key={(i + j + k)->Int.toString ++ (colorText ++ sizeText)}>
|
|
173
|
-
<Toolkit__Ui_Button color size disabled variant=#outline>
|
|
174
|
-
{"hello"->React.string}
|
|
175
|
-
</Toolkit__Ui_Button>
|
|
176
|
-
</div>
|
|
177
|
-
)
|
|
178
|
-
->React.array}
|
|
179
|
-
</div>
|
|
180
|
-
)
|
|
181
|
-
->React.array}
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
)
|
|
185
|
-
->React.array}
|
|
186
|
-
</div>
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
outlinePalette->CSF.addMeta(
|
|
190
|
-
~name="outline palette",
|
|
191
|
-
~parameters={
|
|
192
|
-
"docs": {
|
|
193
|
-
"page": () => <>
|
|
194
|
-
<Docs.Title />
|
|
195
|
-
<CodeBlock> source </CodeBlock>
|
|
196
|
-
<Docs.Source
|
|
197
|
-
language="rescript"
|
|
198
|
-
code=j`
|
|
199
|
-
<Button color=#primary variant=#outline>"Content"->React.string</Button>
|
|
200
|
-
`
|
|
201
|
-
/>
|
|
202
|
-
<Toolkit__Ui_Button color=#primary variant=#outline>
|
|
203
|
-
{"hello"->React.string}
|
|
204
|
-
</Toolkit__Ui_Button>
|
|
205
|
-
</>,
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
(),
|
|
209
|
-
)
|
|
210
|
-
|
|
211
|
-
let textPalette = () => {
|
|
212
|
-
let colors = Js.Dict.fromArray([
|
|
213
|
-
("primary", #primary),
|
|
214
|
-
("black", #black),
|
|
215
|
-
("white", #white),
|
|
216
|
-
("gray", #gray),
|
|
217
|
-
("success", #success),
|
|
218
|
-
("info", #info),
|
|
219
|
-
("danger", #danger),
|
|
220
|
-
("warning", #warning),
|
|
221
|
-
("neutral", #neutral),
|
|
222
|
-
("neutralLight", #neutralLight),
|
|
223
|
-
])
|
|
224
|
-
|
|
225
|
-
let sizes = Js.Dict.fromArray([("xs", #xs), ("sm", #sm), ("md", #md), ("lg", #lg)])
|
|
226
|
-
<div>
|
|
227
|
-
{colors
|
|
228
|
-
->Js.Dict.entries
|
|
229
|
-
->Array.mapWithIndex((i, (colorText, color)) =>
|
|
230
|
-
<div
|
|
231
|
-
key={i->Int.toString ++ colorText}
|
|
232
|
-
className="flex flex-row flex-col-gap-4 mb-4 items-center">
|
|
233
|
-
<strong className="w-40"> {colorText->React.string} </strong>
|
|
234
|
-
<div className="flex flex-col">
|
|
235
|
-
{[false, true]
|
|
236
|
-
->Array.mapWithIndex((j, disabled) =>
|
|
237
|
-
<div className="flex items-center flex-col-gap-1 mb-2">
|
|
238
|
-
{sizes
|
|
239
|
-
->Js.Dict.entries
|
|
240
|
-
->Array.mapWithIndex((k, (sizeText, size)) =>
|
|
241
|
-
<div key={(i + j + k)->Int.toString ++ (colorText ++ sizeText)}>
|
|
242
|
-
<Toolkit__Ui_Button color size disabled variant=#text>
|
|
243
|
-
{"hello"->React.string}
|
|
244
|
-
</Toolkit__Ui_Button>
|
|
245
|
-
</div>
|
|
246
|
-
)
|
|
247
|
-
->React.array}
|
|
248
|
-
</div>
|
|
249
|
-
)
|
|
250
|
-
->React.array}
|
|
251
|
-
</div>
|
|
252
|
-
</div>
|
|
253
|
-
)
|
|
254
|
-
->React.array}
|
|
255
|
-
</div>
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
textPalette->CSF.addMeta(
|
|
259
|
-
~name="text palette",
|
|
260
|
-
~parameters={
|
|
261
|
-
"docs": {
|
|
262
|
-
"page": () => <>
|
|
263
|
-
<Docs.Title />
|
|
264
|
-
<CodeBlock> source </CodeBlock>
|
|
265
|
-
<Docs.Source
|
|
266
|
-
language="rescript"
|
|
267
|
-
code=j`
|
|
268
|
-
<Button color=#primary variant=#text>"Content"->React.string</Button>
|
|
269
|
-
`
|
|
270
|
-
/>
|
|
271
|
-
<Toolkit__Ui_Button color=#primary variant=#text>
|
|
272
|
-
{"hello"->React.string}
|
|
273
|
-
</Toolkit__Ui_Button>
|
|
274
|
-
</>,
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
(),
|
|
278
|
-
)
|
|
279
|
-
|
|
280
|
-
let loading = () =>
|
|
281
|
-
<Toolkit__Ui_Button color=#primary isLoading=true> {"content"->React.string} </Toolkit__Ui_Button>
|
|
282
|
-
|
|
283
|
-
loading->CSF.addMeta(
|
|
284
|
-
~name="loading",
|
|
285
|
-
~parameters={
|
|
286
|
-
"docs": {
|
|
287
|
-
"page": () => <>
|
|
288
|
-
<Docs.Title />
|
|
289
|
-
<CodeBlock> source </CodeBlock>
|
|
290
|
-
<Docs.Source
|
|
291
|
-
language="rescript"
|
|
292
|
-
code=j`
|
|
293
|
-
<Button color=#primary isLoading=true>"Content"->React.string</Button>
|
|
294
|
-
`
|
|
295
|
-
/>
|
|
296
|
-
<Docs.Story id="components-button--loading" />
|
|
297
|
-
</>,
|
|
298
|
-
},
|
|
299
|
-
},
|
|
300
|
-
(),
|
|
301
|
-
)
|
|
302
|
-
|
|
303
|
-
let disabled = () =>
|
|
304
|
-
<Toolkit__Ui_Button color=#primary disabled=true> {"content"->React.string} </Toolkit__Ui_Button>
|
|
305
|
-
|
|
306
|
-
disabled->CSF.addMeta(
|
|
307
|
-
~name="disabled",
|
|
308
|
-
~parameters={
|
|
309
|
-
"docs": {
|
|
310
|
-
"page": () => <>
|
|
311
|
-
<Docs.Title />
|
|
312
|
-
<CodeBlock> source </CodeBlock>
|
|
313
|
-
<Docs.Source
|
|
314
|
-
language="rescript"
|
|
315
|
-
code=j`
|
|
316
|
-
<Button color=#primary disabled=true>"Content"->React.string</Button>
|
|
317
|
-
`
|
|
318
|
-
/>
|
|
319
|
-
<Docs.Story id="components-button--disabled" />
|
|
320
|
-
</>,
|
|
321
|
-
},
|
|
322
|
-
},
|
|
323
|
-
(),
|
|
324
|
-
)
|