@colisweb/rescript-toolkit 2.67.1 → 2.68.1

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.
Files changed (31) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/package.json +1 -1
  3. package/playground/PlaygroundComponents.res +10 -0
  4. package/playground/PlaygroundRouter.res +14 -6
  5. package/playground/components/Playground_Accordion.res +31 -0
  6. package/playground/components/Playground_Alert.res +25 -0
  7. package/playground/components/Playground_Button.res +75 -0
  8. package/playground/components/Playground_ButtonGroup.res +40 -0
  9. package/playground/components/Playground_Label.res +16 -0
  10. package/playground/components/Playground_Modal.res +53 -0
  11. package/playground/components/Playground_MultiSelect.res +91 -0
  12. package/playground/components/Playground_Notice.res +34 -0
  13. package/playground/components/Playground_Snackbar.res +43 -0
  14. package/playground/components/Playground_Spinner.res +48 -0
  15. package/playground/components/Playground_Switch.res +2 -2
  16. package/playground/custom.css +4 -1
  17. package/playground/docs/Setup.mdx +3 -10
  18. package/src/router/Toolkit__Router.res +2 -1
  19. package/src/ui/Toolkit__Ui_MultiSelect.res +21 -0
  20. package/src/ui/styles.css +6 -3
  21. package/vite.config.js +2 -1
  22. package/playground/stories/Toolkit__UI_AccordionStory.res +0 -34
  23. package/playground/stories/Toolkit__UI_AlertStory.res +0 -111
  24. package/playground/stories/Toolkit__UI_LabelStory.res +0 -39
  25. package/playground/stories/Toolkit__UI_ModalStory.res +0 -211
  26. package/playground/stories/Toolkit__UI_MultiSelectStory.res +0 -132
  27. package/playground/stories/Toolkit__UI_NoticeStory.res +0 -66
  28. package/playground/stories/Toolkit__UI_SnackbarStory.res +0 -209
  29. package/playground/stories/Toolkit__UI_SpinnerStory.res +0 -65
  30. package/playground/stories/Toolkit__Ui_ButtonGroupStory.res +0 -77
  31. package/playground/stories/Toolkit__Ui_ButtonStory.res +0 -324
@@ -1,209 +0,0 @@
1
- open Storybook
2
- open Toolkit__Ui
3
-
4
- @module("!!raw-loader!../../../src/ui/Toolkit__Ui_Snackbar.resi")
5
- external source: 'a = "default"
6
-
7
- let default = CSF.make(~title="Components/Snackbar", ())
8
-
9
- let success = () =>
10
- <div>
11
- <Snackbar.Provider />
12
- <div className="mb-4 flex flex-row flex-col-gap-4">
13
- <span>
14
- <Button onClick={_ => Snackbar.show(~title="Success", ~variant=#success, ())->ignore}>
15
- {"Success"->React.string}
16
- </Button>
17
- </span>
18
- <span>
19
- <Button
20
- onClick={_ =>
21
- Snackbar.show(
22
- ~title="Success",
23
- ~content="Description"->React.string,
24
- ~variant=#success,
25
- (),
26
- )->ignore}>
27
- {"Success with description"->React.string}
28
- </Button>
29
- </span>
30
- </div>
31
- </div>
32
-
33
- success->CSF.addMeta(
34
- ~name="success",
35
- ~parameters={
36
- "docs": {
37
- "page": () => <>
38
- <CodeBlock> source </CodeBlock>
39
- <Docs.Source
40
- language="rescript"
41
- code=j`
42
- <div>
43
- <Snackbar.Provider />
44
- <div className="mb-4 flex flex-row flex-col-gap-4">
45
- <span>
46
- <Button
47
- onClick={_ =>
48
- Snackbar.show(~title="Success", ~variant=#success, ())
49
- }>
50
- "Success"->React.string
51
- </Button>
52
- </span>
53
- <span>
54
- <Button
55
- onClick={_ =>
56
- Snackbar.show(
57
- ~title="Success",
58
- ~description="Description"->React.string,
59
- ~variant=#success,
60
- (),
61
- )
62
- }>
63
- "Success with description"->React.string
64
- </Button>
65
- </span>
66
- </div>
67
- </div>;
68
- `
69
- />
70
- <Docs.Story id="components-snackbar--success" />
71
- </>,
72
- },
73
- },
74
- (),
75
- )
76
-
77
- let warning = () =>
78
- <div>
79
- <Snackbar.Provider />
80
- <div className="mb-4 flex flex-row flex-col-gap-4">
81
- <span>
82
- <Button onClick={_ => Snackbar.show(~title="warning", ~variant=#warning, ())->ignore}>
83
- {"warning"->React.string}
84
- </Button>
85
- </span>
86
- <span>
87
- <Button
88
- onClick={_ =>
89
- Snackbar.show(
90
- ~title="warning",
91
- ~content="Description"->React.string,
92
- ~variant=#warning,
93
- (),
94
- )->ignore}>
95
- {"warning with description"->React.string}
96
- </Button>
97
- </span>
98
- </div>
99
- </div>
100
-
101
- warning->CSF.addMeta(
102
- ~name="warning",
103
- ~parameters={
104
- "docs": {
105
- "page": () => <>
106
- <CodeBlock> source </CodeBlock>
107
- <Docs.Source
108
- language="rescript"
109
- code=j`
110
- <div>
111
- <Snackbar.Provider />
112
- <div className="mb-4 flex flex-row flex-col-gap-4">
113
- <span>
114
- <Button
115
- onClick={_ =>
116
- Snackbar.show(~title="warning", ~variant=#warning, ())
117
- }>
118
- "warning"->React.string
119
- </Button>
120
- </span>
121
- <span>
122
- <Button
123
- onClick={_ =>
124
- Snackbar.show(
125
- ~title="warning",
126
- ~description="Description"->React.string,
127
- ~variant=#warning,
128
- (),
129
- )
130
- }>
131
- "warning with description"->React.string
132
- </Button>
133
- </span>
134
- </div>
135
- </div>;
136
- `
137
- />
138
- <Docs.Story id="components-snackbar--warning" />
139
- </>,
140
- },
141
- },
142
- (),
143
- )
144
-
145
- let danger = () =>
146
- <div>
147
- <Snackbar.Provider />
148
- <div className="mb-4 flex flex-row flex-col-gap-4">
149
- <span>
150
- <Button onClick={_ => Snackbar.show(~title="danger", ~variant=#danger, ())->ignore}>
151
- {"danger"->React.string}
152
- </Button>
153
- </span>
154
- <span>
155
- <Button
156
- onClick={_ =>
157
- Snackbar.show(
158
- ~title="danger title pretty long",
159
- ~content=<div> <p> {"Description with some text"->React.string} </p> </div>,
160
- ~variant=#danger,
161
- (),
162
- )->ignore}>
163
- {"danger with description"->React.string}
164
- </Button>
165
- </span>
166
- </div>
167
- </div>
168
-
169
- danger->CSF.addMeta(
170
- ~name="danger",
171
- ~parameters={
172
- "docs": {
173
- "page": () => <>
174
- <CodeBlock> source </CodeBlock>
175
- <Docs.Source
176
- language="rescript"
177
- code=j`
178
- <div>
179
- <Snackbar.Provider />
180
- <div className="mb-4 flex flex-row flex-col-gap-4">
181
- <span>
182
- <Button
183
- onClick={_ => Snackbar.show(~title="danger", ~variant=#danger, ())}>
184
- "danger"->React.string
185
- </Button>
186
- </span>
187
- <span>
188
- <Button
189
- onClick={_ =>
190
- Snackbar.show(
191
- ~title="danger",
192
- ~description="Description"->React.string,
193
- ~variant=#danger,
194
- (),
195
- )
196
- }>
197
- "danger with description"->React.string
198
- </Button>
199
- </span>
200
- </div>
201
- </div>;
202
- `
203
- />
204
- <Docs.Story id="components-snackbar--danger" />
205
- </>,
206
- },
207
- },
208
- (),
209
- )
@@ -1,65 +0,0 @@
1
- open Storybook
2
- open Toolkit__Ui
3
-
4
- @module("!!raw-loader!../../../src/ui/Toolkit__Ui_Spinner.resi")
5
- external source: 'a = "default"
6
-
7
- let default = CSF.make(~title="Components/Spinner", ())
8
-
9
- let defaultPalette = () => {
10
- let colors = Js.Dict.fromArray([
11
- ("current", #current),
12
- ("black", #black),
13
- ("white", #white),
14
- ("gray", #gray),
15
- ("success", #success),
16
- ("primary", #primary),
17
- ("warning", #warning),
18
- ("info", #info),
19
- ("danger", #danger),
20
- ])
21
-
22
- let sizes = Js.Dict.fromArray([("sm", #sm), ("md", #md), ("lg", #lg), ("xl", #xl)])
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 items-center flex-col-gap-6 mb-2">
33
- {sizes
34
- ->Js.Dict.entries
35
- ->Array.mapWithIndex((k, (sizeText, size)) =>
36
- <div key={(i + k)->Int.toString ++ (colorText ++ sizeText)}>
37
- <Spinner color size />
38
- </div>
39
- )
40
- ->React.array}
41
- </div>
42
- </div>
43
- )
44
- ->React.array}
45
- </div>
46
- }
47
-
48
- defaultPalette->CSF.addMeta(
49
- ~name="default palette",
50
- ~parameters={
51
- "docs": {
52
- "page": () => <>
53
- <CodeBlock> source </CodeBlock>
54
- <Docs.Source
55
- language="rescript"
56
- code=j`
57
- <Spinner color=#primary size=#md />
58
- `
59
- />
60
- <Spinner color=#primary size=#md />
61
- </>,
62
- },
63
- },
64
- (),
65
- )
@@ -1,77 +0,0 @@
1
- open Storybook
2
-
3
- @module("!!raw-loader!../../../src/ui/Toolkit__Ui_ButtonGroup.resi")
4
- external source: 'a = "default"
5
-
6
- let default = CSF.make(~title="Components/ButtonGroup", ())
7
-
8
- let sizePalette = () => {
9
- let sizes = Js.Dict.fromArray([("md", #md), ("lg", #xl)])
10
-
11
- let (selectedOption, setSelectedOption) = React.useState(() => #option1)
12
-
13
- <div>
14
- {sizes
15
- ->Js.Dict.entries
16
- ->Array.mapWithIndex((i, (sizeText, size)) =>
17
- <div key={i->Int.toString ++ sizeText} className="flex flex-row mb-4 items-center">
18
- <strong className="w-40"> {sizeText->React.string} </strong>
19
- <Toolkit__Ui_ButtonGroup className="my-4 self-center" size>
20
- <button
21
- className={selectedOption === #option1 ? "selected" : ""}
22
- onClick={_ => setSelectedOption(_ => #option1)}>
23
- {"Option 1"->React.string}
24
- </button>
25
- <button
26
- className={selectedOption === #option2 ? "selected" : ""}
27
- onClick={_ => setSelectedOption(_ => #option2)}>
28
- {"Option 2"->React.string}
29
- </button>
30
- <button
31
- className={selectedOption === #option3 ? "selected" : ""}
32
- onClick={_ => setSelectedOption(_ => #option3)}>
33
- {"Option 3"->React.string}
34
- </button>
35
- </Toolkit__Ui_ButtonGroup>
36
- </div>
37
- )
38
- ->React.array}
39
- </div>
40
- }
41
-
42
- sizePalette->CSF.addMeta(
43
- ~name="size palette",
44
- ~parameters={
45
- "docs": {
46
- "page": () => <>
47
- <CodeBlock> source </CodeBlock>
48
- <Docs.Source
49
- language="rescript"
50
- code=j`
51
- let (selectedOption, setSelectedOption) = React.useState(() => #option1);
52
-
53
- <Toolkit__Ui_ButtonGroup
54
- className="my-4 self-center" size>
55
- <button
56
- className={selectedOption === #option1 ? "selected" : ""}
57
- onClick={_ => setSelectedOption(_ => #option1)}>
58
- "Option 1"->React.string
59
- </button>
60
- <button
61
- className={selectedOption === #option2 ? "selected" : ""}
62
- onClick={_ => setSelectedOption(_ => #option2)}>
63
- "Option 2"->React.string
64
- </button>
65
- <button
66
- className={selectedOption === #option3 ? "selected" : ""}
67
- onClick={_ => setSelectedOption(_ => #option3)}>
68
- "Option 3"->React.string
69
- </button>
70
- </Toolkit__Ui_ButtonGroup>
71
- `
72
- />
73
- </>,
74
- },
75
- },
76
- (),
77
- )
@@ -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
- )