@colisweb/rescript-toolkit 2.67.0 → 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/.gitlab-ci.yml +3 -2
- package/.yarn/cache/boolbase-npm-1.0.0-965fe9af6d-3e25c80ef6.zip +0 -0
- package/.yarn/cache/camelcase-npm-3.0.0-0c65af0c7f-ae4fe1c17c.zip +0 -0
- package/.yarn/cache/comma-separated-tokens-npm-1.0.8-00dbbf3418-0adcb07174.zip +0 -0
- package/.yarn/cache/css-selector-parser-npm-1.4.1-b8c642c4c5-31948754e5.zip +0 -0
- package/.yarn/cache/fault-npm-2.0.1-c462630f58-c9b30f47d9.zip +0 -0
- package/.yarn/cache/format-npm-0.2.2-679f3acc64-646a60e133.zip +0 -0
- package/.yarn/cache/github-slugger-npm-2.0.0-3afba76e6c-250375cde2.zip +0 -0
- package/.yarn/cache/hast-util-has-property-npm-1.0.4-a09b607810-23025cee66.zip +0 -0
- package/.yarn/cache/hast-util-has-property-npm-2.0.1-aa6919669c-cc909b7e29.zip +0 -0
- package/.yarn/cache/hast-util-heading-rank-npm-2.1.1-0d71da5801-a49233e9ac.zip +0 -0
- package/.yarn/cache/hast-util-is-element-npm-1.1.0-be10e62fa7-30fad3f65e.zip +0 -0
- package/.yarn/cache/hast-util-is-element-npm-2.1.3-3051d610ff-9d988f6839.zip +0 -0
- package/.yarn/cache/hast-util-select-npm-1.0.1-115974f390-9cdb20850f.zip +0 -0
- package/.yarn/cache/hast-util-to-string-npm-2.0.0-c6108aa2b8-0c087f8dee.zip +0 -0
- package/.yarn/cache/hast-util-to-text-npm-3.1.2-922eb1f623-d17cf3344c.zip +0 -0
- package/.yarn/cache/hast-util-whitespace-npm-1.0.4-43bb1ff3d0-b7f4a1942b.zip +0 -0
- package/.yarn/cache/{husky-npm-8.0.2-46c70b41ed-e101656fcb.zip → husky-npm-8.0.3-b0b59c5127-837bc7e441.zip} +0 -0
- package/.yarn/cache/lowlight-npm-2.8.0-c65abb6cac-c45a91e715.zip +0 -0
- package/.yarn/cache/not-npm-0.1.0-a1712708cd-8043bb53bc.zip +0 -0
- package/.yarn/cache/nth-check-npm-1.0.2-3f6d0d22eb-59e115fdd7.zip +0 -0
- package/.yarn/cache/property-information-npm-3.2.0-ae434c241d-ed2614520d.zip +0 -0
- package/.yarn/cache/rehype-add-classes-npm-1.0.0-ddf6b4e74d-25c0e2dbf5.zip +0 -0
- package/.yarn/cache/rehype-autolink-headings-npm-6.1.1-fe8058cc11-60782fb2e5.zip +0 -0
- package/.yarn/cache/rehype-highlight-npm-6.0.0-5179257139-5a70e7ad45.zip +0 -0
- package/.yarn/cache/rehype-slug-npm-5.1.0-ae08840ba8-2a7c17fd74.zip +0 -0
- package/.yarn/cache/space-separated-tokens-npm-1.1.5-2352c83473-8ef68f1cfa.zip +0 -0
- package/.yarn/cache/unist-util-find-after-npm-4.0.0-11b3b7fb4f-8381ef0bad.zip +0 -0
- package/.yarn/cache/zwitch-npm-1.0.5-5911cef6ce-28a1bebaca.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/package.json +8 -5
- package/playground/{App.res → PlaygroundApp.res} +14 -7
- package/playground/PlaygroundComponents.res +114 -0
- package/playground/PlaygroundLocales.res +1 -0
- package/playground/PlaygroundRouter.res +23 -0
- package/playground/{CodeBlock.res → Playground_CodeBlock.res} +12 -16
- 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/{stories/IntroductionColors.stories.mdx → design/DesignSystem_Colors.mdx} +0 -0
- package/playground/{stories/IntroductionFonts.stories.mdx → design/DesignSystem_Fonts.mdx} +0 -0
- package/playground/{stories/IntroductionMediaQueries.stories.mdx → design/DesignSystem_MediaQueries.mdx} +0 -0
- package/playground/design/Playground_DesignSystem.res +12 -0
- package/playground/{stories/TailwindConfigBreakpoints.js → design/TailwindConfigBreakpoints.jsx} +1 -1
- package/playground/{stories/TailwindConfigColorsPreview.js → design/TailwindConfigColorsPreview.jsx} +1 -1
- package/playground/{stories/TailwindConfigFontsPreview.js → design/TailwindConfigFontsPreview.jsx} +1 -1
- package/playground/docs/ApiDecoding.mdx +70 -0
- package/playground/docs/Form.mdx +109 -0
- package/playground/docs/Identifiers.mdx +38 -0
- package/playground/{Doc.res → docs/Playground_Docs.res} +8 -8
- package/playground/docs/Primitives.mdx +53 -0
- package/playground/docs/Request.mdx +281 -0
- package/playground/docs/Router.mdx +43 -0
- package/playground/docs/Setup.mdx +51 -0
- package/playground/docs/Unleash.mdx +53 -0
- package/playground/main.jsx +1 -1
- package/src/intl/Toolkit__Intl.res +5 -9
- package/src/intl/Toolkit__Intl.resi +1 -0
- package/src/logger/Toolkit__BrowserLogger.res +15 -15
- package/src/router/Toolkit__Router.res +2 -1
- package/src/tailwind/tailwind.config.cjs +3 -5
- package/src/ui/Toolkit__Ui_MultiSelect.res +21 -0
- package/src/ui/styles.css +6 -3
- package/vite.config.js +44 -1
- package/.yarn/cache/cosmiconfig-npm-7.0.0-b9d0d7d156-6801feaa02.zip +0 -0
- package/.yarn/cache/import-fresh-npm-3.3.0-3e34265ca9-2cacfad06e.zip +0 -0
- package/.yarn/cache/klona-npm-2.0.4-6bc4e7cd86-abc6690882.zip +0 -0
- package/.yarn/cache/postcss-loader-npm-4.2.0-f01fec2503-c45ec1ca1b.zip +0 -0
- package/.yarn/cache/semver-npm-7.3.4-4c3baf0ead-96451bfd7c.zip +0 -0
- package/playground/Playground_Component.res +0 -33
- package/playground/Playground_ComponentDetails.res +0 -25
- package/playground/Playground_ComponentsList.res +0 -43
- 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
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# ReScript toolkit
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
Install the package :
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -S @colisweb/rescript-toolkit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Add the package to the `bsconfig.json` file :
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"bs-dependencies": ["@colisweb/rescript-toolkit"]
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Import the style in your app :
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
// App.js
|
|
23
|
+
import "@colisweb/rescript-toolkit/src/ui/styles.css";
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Add Tailwind
|
|
27
|
+
|
|
28
|
+
This toolkit is based on [tailwindcss](https://tailwindcss.com/).
|
|
29
|
+
We share a postcss config that you can include to your webpack config
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
The bindings in the _vendors_ are **globaly accessible**.
|
|
34
|
+
|
|
35
|
+
```rescript
|
|
36
|
+
|
|
37
|
+
@react.component
|
|
38
|
+
let make = () => {
|
|
39
|
+
let dialog = Toolkit.Hooks.useDisclosure();
|
|
40
|
+
|
|
41
|
+
<div className="bg-white" />
|
|
42
|
+
};
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Local development
|
|
46
|
+
|
|
47
|
+
Run bsb
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm run dev
|
|
51
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Unleash
|
|
2
|
+
|
|
3
|
+
[Unleash](https://github.com/Unleash/unleash) is feature flipping solution. It allows us to activate or restrain fonctionalities acording a configuration.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### 1. Create a rule
|
|
8
|
+
|
|
9
|
+
We use a functor to enforce several parameters :
|
|
10
|
+
|
|
11
|
+
| Params | value |
|
|
12
|
+
| ----------- | :--------------------------------------------: |
|
|
13
|
+
| parameters | 'parameters |
|
|
14
|
+
| input | 'input |
|
|
15
|
+
| output | 'output |
|
|
16
|
+
| envUrl | string |
|
|
17
|
+
| featureName | string |
|
|
18
|
+
| exec | ('input, Unleash.config(parameters)) => output |
|
|
19
|
+
|
|
20
|
+
```rescript
|
|
21
|
+
module OutdatedApplicationConfig = {
|
|
22
|
+
@decco
|
|
23
|
+
type parameters = {version: string}
|
|
24
|
+
type input = unit
|
|
25
|
+
type output = bool
|
|
26
|
+
let envUrl = Env.unleashUrl
|
|
27
|
+
let featureName = "minimum-supported-version"
|
|
28
|
+
|
|
29
|
+
let exec = (_, config: Unleash.config<parameters>) => {
|
|
30
|
+
let appVersion =
|
|
31
|
+
ReactNativeVersionNumber.appVersion->Js.Nullable.toOption->Option.getWithDefault("")
|
|
32
|
+
|
|
33
|
+
config.strategies
|
|
34
|
+
->Array.get(0)
|
|
35
|
+
->Option.mapWithDefault(false, strategy =>
|
|
36
|
+
config.enabled ? Semver.lt(appVersion, strategy.parameters.version) : false
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
module OutdatedApplication = Toolkit.Unleash.MakeFeature(OutdatedApplicationConfig)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 2. Use the rule
|
|
45
|
+
|
|
46
|
+
```rescript
|
|
47
|
+
OutdatedApplication.exec()
|
|
48
|
+
->Promise.tapOk(outdated => {
|
|
49
|
+
if (outdated) {
|
|
50
|
+
Js.log("app outdated");
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
```
|
package/playground/main.jsx
CHANGED
|
@@ -3,7 +3,7 @@ import ReactDOM from "react-dom/client";
|
|
|
3
3
|
import "../src/ui/styles.css";
|
|
4
4
|
import "../src/ui/Toolkit__Ui_DatetimeInput.css";
|
|
5
5
|
import "./custom.css";
|
|
6
|
-
import App from "../lib/es6_global/playground/
|
|
6
|
+
import App from "../lib/es6_global/playground/PlaygroundApp.bs";
|
|
7
7
|
|
|
8
8
|
const root = ReactDOM.createRoot(document.getElementById("root"));
|
|
9
9
|
|
|
@@ -31,16 +31,11 @@ let availableLanguagesFromString = v =>
|
|
|
31
31
|
| _ => #fr
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
let createIntl = (locale: availableLanguages, messages) => {
|
|
34
|
+
let createIntl = (~onError=?, locale: availableLanguages, messages) => {
|
|
35
35
|
let cache = createIntlCache()
|
|
36
36
|
|
|
37
37
|
createIntl(
|
|
38
|
-
intlConfig(
|
|
39
|
-
~locale=locale->availableLanguagesToString,
|
|
40
|
-
~messages,
|
|
41
|
-
~onError=message => Toolkit__BrowserLogger.error2("create intl error", message),
|
|
42
|
-
(),
|
|
43
|
-
),
|
|
38
|
+
intlConfig(~locale=locale->availableLanguagesToString, ~messages, ~onError?, ()),
|
|
44
39
|
cache,
|
|
45
40
|
)
|
|
46
41
|
}
|
|
@@ -48,6 +43,7 @@ let createIntl = (locale: availableLanguages, messages) => {
|
|
|
48
43
|
module type IntlConfig = {
|
|
49
44
|
let messages: messages
|
|
50
45
|
let defaultLocale: option<availableLanguages>
|
|
46
|
+
let onError: string => unit
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
module Make = (Config: IntlConfig) => {
|
|
@@ -67,10 +63,10 @@ module Make = (Config: IntlConfig) => {
|
|
|
67
63
|
|
|
68
64
|
type action = SetLocale(availableLanguages)
|
|
69
65
|
|
|
70
|
-
let store = Restorative.createStore({locale
|
|
66
|
+
let store = Restorative.createStore({locale, intl}, (_state, action) =>
|
|
71
67
|
switch action {
|
|
72
68
|
| SetLocale(locale) => {
|
|
73
|
-
locale
|
|
69
|
+
locale,
|
|
74
70
|
intl: {
|
|
75
71
|
let messages = switch locale {
|
|
76
72
|
| #fr => Config.messages.fr->toDict
|
|
@@ -51,22 +51,22 @@ let warning3 = (str, str2, str3) => {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
let error = (str: string) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
54
|
+
DatadogRum.Browser.addError(makeError(str))
|
|
55
|
+
// if nodeEnv !== "production" {
|
|
56
|
+
// Js.Console.log3("%cERROR", errorStyle, str)
|
|
57
|
+
// } else {
|
|
58
|
+
// }
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
let error2 = (str, str2) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
62
|
+
DatadogRum.Browser.addErrorWithContext(
|
|
63
|
+
makeError(str),
|
|
64
|
+
{
|
|
65
|
+
"cause": str2,
|
|
66
|
+
},
|
|
67
|
+
)
|
|
68
|
+
// if nodeEnv !== "production" {
|
|
69
|
+
// Js.Console.log4("%cERROR", errorStyle, str, str2)
|
|
70
|
+
// } else {
|
|
71
|
+
// }
|
|
72
72
|
}
|
|
@@ -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
|
])}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const defaultColors = require("tailwindcss/colors");
|
|
2
|
-
|
|
3
1
|
module.exports = {
|
|
4
2
|
theme: {
|
|
5
3
|
extend: {
|
|
@@ -65,9 +63,9 @@ module.exports = {
|
|
|
65
63
|
screen: "100vh",
|
|
66
64
|
},
|
|
67
65
|
colors: {
|
|
68
|
-
white:
|
|
69
|
-
black:
|
|
70
|
-
transparent:
|
|
66
|
+
white: "#fff",
|
|
67
|
+
black: "#000",
|
|
68
|
+
transparent: "transparent",
|
|
71
69
|
routeWithdraw: "#176693",
|
|
72
70
|
gray: {
|
|
73
71
|
100: "#f7fafc",
|
|
@@ -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
|
@@ -3,14 +3,57 @@ import react from "@vitejs/plugin-react";
|
|
|
3
3
|
import createReScriptPlugin from "@jihchi/vite-plugin-rescript";
|
|
4
4
|
import mdx from "@mdx-js/rollup";
|
|
5
5
|
import fs from "fs";
|
|
6
|
+
import addClasses from "rehype-add-classes";
|
|
7
|
+
import rehypeHighlight from "rehype-highlight";
|
|
8
|
+
import rescriptHighlight from "./playground/utils/rescript-highlight";
|
|
9
|
+
import rehypeAutolinkHeadings from "rehype-autolink-headings";
|
|
10
|
+
import rehypeSlug from "rehype-slug";
|
|
6
11
|
|
|
7
12
|
const appDirectory = fs.realpathSync(process.cwd());
|
|
13
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
8
14
|
|
|
9
15
|
export default defineConfig({
|
|
10
|
-
|
|
16
|
+
base: isProduction ? "/colisweb-open-source/rescript-toolkit/" : "",
|
|
17
|
+
build: {
|
|
18
|
+
sourcemap: true,
|
|
19
|
+
},
|
|
20
|
+
plugins: [
|
|
21
|
+
mdx({
|
|
22
|
+
rehypePlugins: [
|
|
23
|
+
[
|
|
24
|
+
addClasses,
|
|
25
|
+
{
|
|
26
|
+
h1: "text-4xl",
|
|
27
|
+
h2: "text-3xl",
|
|
28
|
+
h3: "text-2xl",
|
|
29
|
+
h4: "text-xl",
|
|
30
|
+
"h1,h2,h3,h4": "font-display font-bold underline mb-1",
|
|
31
|
+
p: "mb-1",
|
|
32
|
+
pre: "bg-white p-2 rounded-lg border my-4 block",
|
|
33
|
+
ul: "list-disc",
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
[rehypeSlug],
|
|
37
|
+
[rehypeAutolinkHeadings, { behavior: "wrap" }],
|
|
38
|
+
[
|
|
39
|
+
rehypeHighlight,
|
|
40
|
+
{
|
|
41
|
+
languages: {
|
|
42
|
+
rescript: rescriptHighlight,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
],
|
|
47
|
+
}),
|
|
48
|
+
createReScriptPlugin(),
|
|
49
|
+
react(),
|
|
50
|
+
],
|
|
11
51
|
define: {
|
|
12
52
|
global: {},
|
|
13
53
|
},
|
|
54
|
+
optimizeDeps: {
|
|
55
|
+
include: ["highlight.js"],
|
|
56
|
+
},
|
|
14
57
|
resolve: {
|
|
15
58
|
alias: [
|
|
16
59
|
{
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
module type Config = {
|
|
2
|
-
let resi: string
|
|
3
|
-
let codeExample: string
|
|
4
|
-
@react.component
|
|
5
|
-
let make: unit => React.element
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
module ComponentDetails = {
|
|
9
|
-
@react.component
|
|
10
|
-
let make = (~component: module(Config)) => {
|
|
11
|
-
let module(Config) = component
|
|
12
|
-
<div>
|
|
13
|
-
<ReachUi.Tabs>
|
|
14
|
-
<ReachUi.TabList className="mb-4">
|
|
15
|
-
<ReachUi.Tab> {"Example"->React.string} </ReachUi.Tab>
|
|
16
|
-
<ReachUi.Tab> {"Code example"->React.string} </ReachUi.Tab>
|
|
17
|
-
<ReachUi.Tab> {"API"->React.string} </ReachUi.Tab>
|
|
18
|
-
</ReachUi.TabList>
|
|
19
|
-
<ReachUi.TabPanels>
|
|
20
|
-
<ReachUi.TabPanel>
|
|
21
|
-
<Config />
|
|
22
|
-
</ReachUi.TabPanel>
|
|
23
|
-
<ReachUi.TabPanel>
|
|
24
|
-
<CodeBlock> {Config.codeExample->React.string} </CodeBlock>
|
|
25
|
-
</ReachUi.TabPanel>
|
|
26
|
-
<ReachUi.TabPanel>
|
|
27
|
-
<CodeBlock> {Config.resi->React.string} </CodeBlock>
|
|
28
|
-
</ReachUi.TabPanel>
|
|
29
|
-
</ReachUi.TabPanels>
|
|
30
|
-
</ReachUi.Tabs>
|
|
31
|
-
</div>
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
@react.component
|
|
2
|
-
let make = (~component: string) => {
|
|
3
|
-
PlaygroundRouter.Breadcrumb.use([
|
|
4
|
-
{
|
|
5
|
-
route: Components(List),
|
|
6
|
-
text: "Components"->React.string,
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
route: Components(Details(component)),
|
|
10
|
-
text: <span className="capitalize"> {`${component}`->React.string} </span>,
|
|
11
|
-
},
|
|
12
|
-
])
|
|
13
|
-
<div>
|
|
14
|
-
<h1 className="text-4xl font-bold font-display mb-4 capitalize"> {component->React.string} </h1>
|
|
15
|
-
<div>
|
|
16
|
-
{Playground_ComponentsList.components
|
|
17
|
-
->Array.getBy(((name, _)) => {
|
|
18
|
-
component === name
|
|
19
|
-
})
|
|
20
|
-
->Option.mapWithDefault("unknown"->React.string, ((_, playgroundModule)) => {
|
|
21
|
-
<Playground_Component.ComponentDetails component={playgroundModule} />
|
|
22
|
-
})}
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
let components: array<(string, module(Playground_Component.Config))> = [
|
|
2
|
-
("card", module(Playground_Card)),
|
|
3
|
-
("switch", module(Playground_Switch)),
|
|
4
|
-
]
|
|
5
|
-
|
|
6
|
-
module ComponentLink = {
|
|
7
|
-
@react.component
|
|
8
|
-
let make = (~name) => {
|
|
9
|
-
<PlaygroundRouter.Link
|
|
10
|
-
route={Components(Details(name))}
|
|
11
|
-
className="p-4 rounded-lg border bg-white hover:border-primary-700 w-64">
|
|
12
|
-
<strong className="capitalize"> {name->React.string} </strong>
|
|
13
|
-
</PlaygroundRouter.Link>
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@react.component
|
|
18
|
-
let make = () => {
|
|
19
|
-
let (search, setSearch) = React.useState(() => "")
|
|
20
|
-
|
|
21
|
-
<div>
|
|
22
|
-
<h1 className="text-4xl font-bold font-display mb-4 flex flex-row gap-4 items-center">
|
|
23
|
-
{"Components"->React.string}
|
|
24
|
-
<input
|
|
25
|
-
type_="search"
|
|
26
|
-
placeholder="Search"
|
|
27
|
-
value={search}
|
|
28
|
-
onChange={event => {
|
|
29
|
-
let target = event->ReactEvent.Form.target
|
|
30
|
-
|
|
31
|
-
setSearch(_ => target["value"])
|
|
32
|
-
}}
|
|
33
|
-
className="bg-white text-sm font-sans px-4 font-normal rounded-md border border-neutral-300 focus:border-primary-700 h-10 w-60"
|
|
34
|
-
/>
|
|
35
|
-
</h1>
|
|
36
|
-
<div className="flex flex-row flex-wrap gap-4">
|
|
37
|
-
{components
|
|
38
|
-
->Array.keep(((name, _)) => name->Js.String2.toLowerCase->Js.String2.includes(search))
|
|
39
|
-
->Array.map(((name, _)) => <ComponentLink name />)
|
|
40
|
-
->React.array}
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
}
|
|
@@ -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
|
-
)
|