@slimkhemiri/react-design-system 0.1.1 → 0.1.2
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 +84 -0
- package/dist/components.d.ts +13 -8
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +17 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/stories/Button.d.ts +16 -0
- package/dist/stories/Button.d.ts.map +1 -0
- package/dist/stories/Button.js +7 -0
- package/dist/stories/Button.stories.d.ts +25 -0
- package/dist/stories/Button.stories.d.ts.map +1 -0
- package/dist/stories/Button.stories.js +51 -0
- package/dist/stories/Header.d.ts +13 -0
- package/dist/stories/Header.d.ts.map +1 -0
- package/dist/stories/Header.js +4 -0
- package/dist/stories/Header.stories.d.ts +19 -0
- package/dist/stories/Header.stories.d.ts.map +1 -0
- package/dist/stories/Header.stories.js +26 -0
- package/dist/stories/Page.d.ts +4 -0
- package/dist/stories/Page.d.ts.map +1 -0
- package/dist/stories/Page.js +8 -0
- package/dist/stories/Page.stories.d.ts +13 -0
- package/dist/stories/Page.stories.d.ts.map +1 -0
- package/dist/stories/Page.stories.js +24 -0
- package/dist/stories/slim/SlimAlert.stories.d.ts +21 -0
- package/dist/stories/slim/SlimAlert.stories.d.ts.map +1 -0
- package/dist/stories/slim/SlimAlert.stories.js +35 -0
- package/dist/stories/slim/SlimBadge.stories.d.ts +24 -0
- package/dist/stories/slim/SlimBadge.stories.d.ts.map +1 -0
- package/dist/stories/slim/SlimBadge.stories.js +32 -0
- package/dist/stories/slim/SlimButton.stories.d.ts +28 -0
- package/dist/stories/slim/SlimButton.stories.d.ts.map +1 -0
- package/dist/stories/slim/SlimButton.stories.js +42 -0
- package/dist/stories/slim/SlimCheckbox.stories.d.ts +17 -0
- package/dist/stories/slim/SlimCheckbox.stories.d.ts.map +1 -0
- package/dist/stories/slim/SlimCheckbox.stories.js +29 -0
- package/dist/stories/slim/SlimInput.stories.d.ts +23 -0
- package/dist/stories/slim/SlimInput.stories.d.ts.map +1 -0
- package/dist/stories/slim/SlimInput.stories.js +38 -0
- package/dist/stories/slim/SlimSelect.stories.d.ts +17 -0
- package/dist/stories/slim/SlimSelect.stories.d.ts.map +1 -0
- package/dist/stories/slim/SlimSelect.stories.js +36 -0
- package/dist/stories/slim/SlimSwitch.stories.d.ts +17 -0
- package/dist/stories/slim/SlimSwitch.stories.d.ts.map +1 -0
- package/dist/stories/slim/SlimSwitch.stories.js +25 -0
- package/dist/stories/slim/SlimTextarea.stories.d.ts +17 -0
- package/dist/stories/slim/SlimTextarea.stories.d.ts.map +1 -0
- package/dist/stories/slim/SlimTextarea.stories.js +28 -0
- package/package.json +50 -30
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @slimkhemiri/react-design-system
|
|
2
|
+
|
|
3
|
+
React bindings for the **Slim Design System** (Stencil Web Components).
|
|
4
|
+
|
|
5
|
+
This package provides:
|
|
6
|
+
|
|
7
|
+
- React components like `SlimButton`, `SlimInput`, …
|
|
8
|
+
- `defineCustomElements()` to register the underlying web components
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm i @slimkhemiri/react-design-system
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
Register the custom elements once, then use the React components.
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// main.tsx / index.tsx
|
|
22
|
+
import React from "react";
|
|
23
|
+
import ReactDOM from "react-dom/client";
|
|
24
|
+
|
|
25
|
+
import { defineCustomElements } from "@slimkhemiri/react-design-system";
|
|
26
|
+
|
|
27
|
+
// Registers <slim-button />, <slim-input />, ... as custom elements
|
|
28
|
+
defineCustomElements();
|
|
29
|
+
|
|
30
|
+
import { App } from "./App";
|
|
31
|
+
|
|
32
|
+
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
33
|
+
<React.StrictMode>
|
|
34
|
+
<App />
|
|
35
|
+
</React.StrictMode>
|
|
36
|
+
);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
// App.tsx
|
|
41
|
+
import { SlimButton, SlimInput } from "@slimkhemiri/react-design-system";
|
|
42
|
+
|
|
43
|
+
export function App() {
|
|
44
|
+
return (
|
|
45
|
+
<div style={{ display: "grid", gap: 12, maxWidth: 360 }}>
|
|
46
|
+
<SlimInput label="Email" type="email" onSlimChange={(e) => console.log(e.detail)} />
|
|
47
|
+
<SlimButton variant="primary">Continue</SlimButton>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Next.js / SSR notes
|
|
54
|
+
|
|
55
|
+
Custom elements must be defined in the browser. In Next.js, call `defineCustomElements()` from a client component:
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
"use client";
|
|
59
|
+
|
|
60
|
+
import { useEffect } from "react";
|
|
61
|
+
import { defineCustomElements } from "@slimkhemiri/react-design-system";
|
|
62
|
+
|
|
63
|
+
export function SlimDesignSystemProvider({ children }: { children: React.ReactNode }) {
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
defineCustomElements();
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
return children;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Components
|
|
73
|
+
|
|
74
|
+
Currently exported:
|
|
75
|
+
|
|
76
|
+
- `SlimAlert`
|
|
77
|
+
- `SlimBadge`
|
|
78
|
+
- `SlimButton`
|
|
79
|
+
- `SlimCheckbox` (`onSlimChange` → `CustomEvent<boolean>`)
|
|
80
|
+
- `SlimInput` (`onSlimChange` → `CustomEvent<string>`)
|
|
81
|
+
- `SlimSelect` (`onSlimChange` → `CustomEvent<string>`)
|
|
82
|
+
- `SlimSwitch` (`onSlimChange` → `CustomEvent<boolean>`)
|
|
83
|
+
- `SlimTextarea` (`onSlimChange` → `CustomEvent<string>`)
|
|
84
|
+
|
package/dist/components.d.ts
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* This file was automatically generated by the Stencil React Output Target.
|
|
3
3
|
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4
4
|
*/
|
|
5
|
-
import { SlimAlert as SlimAlertElement } from "@
|
|
6
|
-
import { SlimBadge as SlimBadgeElement } from "@
|
|
7
|
-
import { SlimButton as SlimButtonElement } from "@
|
|
8
|
-
import { SlimCheckbox as SlimCheckboxElement } from "@
|
|
9
|
-
import { SlimInput as SlimInputElement } from "@
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { SlimAlert as SlimAlertElement } from "@slimkhemiri/web-components/dist/components/slim-alert.js";
|
|
6
|
+
import { SlimBadge as SlimBadgeElement } from "@slimkhemiri/web-components/dist/components/slim-badge.js";
|
|
7
|
+
import { SlimButton as SlimButtonElement } from "@slimkhemiri/web-components/dist/components/slim-button.js";
|
|
8
|
+
import { SlimCheckbox as SlimCheckboxElement } from "@slimkhemiri/web-components/dist/components/slim-checkbox.js";
|
|
9
|
+
import { SlimInput as SlimInputElement } from "@slimkhemiri/web-components/dist/components/slim-input.js";
|
|
10
|
+
import { SlimModal as SlimModalElement } from "@slimkhemiri/web-components/dist/components/slim-modal.js";
|
|
11
|
+
import { SlimSelect as SlimSelectElement } from "@slimkhemiri/web-components/dist/components/slim-select.js";
|
|
12
|
+
import { SlimSwitch as SlimSwitchElement } from "@slimkhemiri/web-components/dist/components/slim-switch.js";
|
|
13
|
+
import { SlimTextarea as SlimTextareaElement } from "@slimkhemiri/web-components/dist/components/slim-textarea.js";
|
|
13
14
|
import type { EventName, StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
14
15
|
type SlimAlertEvents = NonNullable<unknown>;
|
|
15
16
|
export declare const SlimAlert: StencilReactComponent<SlimAlertElement, SlimAlertEvents>;
|
|
@@ -25,6 +26,10 @@ type SlimInputEvents = {
|
|
|
25
26
|
onSlimChange: EventName<CustomEvent<string>>;
|
|
26
27
|
};
|
|
27
28
|
export declare const SlimInput: StencilReactComponent<SlimInputElement, SlimInputEvents>;
|
|
29
|
+
type SlimModalEvents = {
|
|
30
|
+
onSlimClose: EventName<CustomEvent<void>>;
|
|
31
|
+
};
|
|
32
|
+
export declare const SlimModal: StencilReactComponent<SlimModalElement, SlimModalEvents>;
|
|
28
33
|
type SlimSelectEvents = {
|
|
29
34
|
onSlimChange: EventName<CustomEvent<string>>;
|
|
30
35
|
};
|
package/dist/components.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAIH,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAA0C,MAAM,
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAIH,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAA0C,MAAM,2DAA2D,CAAC;AAClJ,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAA0C,MAAM,2DAA2D,CAAC;AAClJ,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAA2C,MAAM,4DAA4D,CAAC;AACtJ,OAAO,EAAE,YAAY,IAAI,mBAAmB,EAA6C,MAAM,8DAA8D,CAAC;AAC9J,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAA0C,MAAM,2DAA2D,CAAC;AAClJ,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAA0C,MAAM,2DAA2D,CAAC;AAClJ,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAA2C,MAAM,4DAA4D,CAAC;AACtJ,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAA2C,MAAM,4DAA4D,CAAC;AACtJ,OAAO,EAAE,YAAY,IAAI,mBAAmB,EAA6C,MAAM,8DAA8D,CAAC;AAC9J,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAI7F,KAAK,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAE5C,eAAO,MAAM,SAAS,EAAE,qBAAqB,CAAC,gBAAgB,EAAE,eAAe,CAO7E,CAAC;AAEH,KAAK,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAE5C,eAAO,MAAM,SAAS,EAAE,qBAAqB,CAAC,gBAAgB,EAAE,eAAe,CAO7E,CAAC;AAEH,KAAK,gBAAgB,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAE7C,eAAO,MAAM,UAAU,EAAE,qBAAqB,CAAC,iBAAiB,EAAE,gBAAgB,CAOhF,CAAC;AAEH,KAAK,kBAAkB,GAAG;IAAE,YAAY,EAAE,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;CAAE,CAAC;AAE5E,eAAO,MAAM,YAAY,EAAE,qBAAqB,CAAC,mBAAmB,EAAE,kBAAkB,CAOtF,CAAC;AAEH,KAAK,eAAe,GAAG;IAAE,YAAY,EAAE,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC;AAExE,eAAO,MAAM,SAAS,EAAE,qBAAqB,CAAC,gBAAgB,EAAE,eAAe,CAO7E,CAAC;AAEH,KAAK,eAAe,GAAG;IAAE,WAAW,EAAE,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,SAAS,EAAE,qBAAqB,CAAC,gBAAgB,EAAE,eAAe,CAO7E,CAAC;AAEH,KAAK,gBAAgB,GAAG;IAAE,YAAY,EAAE,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC;AAEzE,eAAO,MAAM,UAAU,EAAE,qBAAqB,CAAC,iBAAiB,EAAE,gBAAgB,CAOhF,CAAC;AAEH,KAAK,gBAAgB,GAAG;IAAE,YAAY,EAAE,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;CAAE,CAAC;AAE1E,eAAO,MAAM,UAAU,EAAE,qBAAqB,CAAC,iBAAiB,EAAE,gBAAgB,CAOhF,CAAC;AAEH,KAAK,kBAAkB,GAAG;IAAE,YAAY,EAAE,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC;AAE3E,eAAO,MAAM,YAAY,EAAE,qBAAqB,CAAC,mBAAmB,EAAE,kBAAkB,CAOtF,CAAC"}
|
package/dist/components.js
CHANGED
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
5
5
|
*/
|
|
6
6
|
/* eslint-disable */
|
|
7
|
-
import { SlimAlert as SlimAlertElement, defineCustomElement as defineSlimAlert } from "@
|
|
8
|
-
import { SlimBadge as SlimBadgeElement, defineCustomElement as defineSlimBadge } from "@
|
|
9
|
-
import { SlimButton as SlimButtonElement, defineCustomElement as defineSlimButton } from "@
|
|
10
|
-
import { SlimCheckbox as SlimCheckboxElement, defineCustomElement as defineSlimCheckbox } from "@
|
|
11
|
-
import { SlimInput as SlimInputElement, defineCustomElement as defineSlimInput } from "@
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
7
|
+
import { SlimAlert as SlimAlertElement, defineCustomElement as defineSlimAlert } from "@slimkhemiri/web-components/dist/components/slim-alert.js";
|
|
8
|
+
import { SlimBadge as SlimBadgeElement, defineCustomElement as defineSlimBadge } from "@slimkhemiri/web-components/dist/components/slim-badge.js";
|
|
9
|
+
import { SlimButton as SlimButtonElement, defineCustomElement as defineSlimButton } from "@slimkhemiri/web-components/dist/components/slim-button.js";
|
|
10
|
+
import { SlimCheckbox as SlimCheckboxElement, defineCustomElement as defineSlimCheckbox } from "@slimkhemiri/web-components/dist/components/slim-checkbox.js";
|
|
11
|
+
import { SlimInput as SlimInputElement, defineCustomElement as defineSlimInput } from "@slimkhemiri/web-components/dist/components/slim-input.js";
|
|
12
|
+
import { SlimModal as SlimModalElement, defineCustomElement as defineSlimModal } from "@slimkhemiri/web-components/dist/components/slim-modal.js";
|
|
13
|
+
import { SlimSelect as SlimSelectElement, defineCustomElement as defineSlimSelect } from "@slimkhemiri/web-components/dist/components/slim-select.js";
|
|
14
|
+
import { SlimSwitch as SlimSwitchElement, defineCustomElement as defineSlimSwitch } from "@slimkhemiri/web-components/dist/components/slim-switch.js";
|
|
15
|
+
import { SlimTextarea as SlimTextareaElement, defineCustomElement as defineSlimTextarea } from "@slimkhemiri/web-components/dist/components/slim-textarea.js";
|
|
15
16
|
import { createComponent } from '@stencil/react-output-target/runtime';
|
|
16
17
|
import React from 'react';
|
|
17
18
|
export const SlimAlert = /*@__PURE__*/ createComponent({
|
|
@@ -54,6 +55,14 @@ export const SlimInput = /*@__PURE__*/ createComponent({
|
|
|
54
55
|
events: { onSlimChange: 'slimChange' },
|
|
55
56
|
defineCustomElement: defineSlimInput
|
|
56
57
|
});
|
|
58
|
+
export const SlimModal = /*@__PURE__*/ createComponent({
|
|
59
|
+
tagName: 'slim-modal',
|
|
60
|
+
elementClass: SlimModalElement,
|
|
61
|
+
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
|
|
62
|
+
react: React,
|
|
63
|
+
events: { onSlimClose: 'slimClose' },
|
|
64
|
+
defineCustomElement: defineSlimModal
|
|
65
|
+
});
|
|
57
66
|
export const SlimSelect = /*@__PURE__*/ createComponent({
|
|
58
67
|
tagName: 'slim-select',
|
|
59
68
|
elementClass: SlimSelectElement,
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./components";
|
|
2
|
-
export { defineCustomElements } from "@
|
|
2
|
+
export { defineCustomElements } from "@slimkhemiri/web-components/loader";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import './button.css';
|
|
2
|
+
export interface ButtonProps {
|
|
3
|
+
/** Is this the principal call to action on the page? */
|
|
4
|
+
primary?: boolean;
|
|
5
|
+
/** What background color to use */
|
|
6
|
+
backgroundColor?: string;
|
|
7
|
+
/** How large should the button be? */
|
|
8
|
+
size?: 'small' | 'medium' | 'large';
|
|
9
|
+
/** Button contents */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Optional click handler */
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/** Primary UI component for user interaction */
|
|
15
|
+
export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/stories/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,WAAW,WAAW;IAC1B,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mCAAmC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gDAAgD;AAChD,eAAO,MAAM,MAAM,GAAI,qDAMpB,WAAW,4CAYb,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import './button.css';
|
|
3
|
+
/** Primary UI component for user interaction */
|
|
4
|
+
export const Button = ({ primary = false, size = 'medium', backgroundColor, label, ...props }) => {
|
|
5
|
+
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
6
|
+
return (_jsx("button", { type: "button", className: ['storybook-button', `storybook-button--${size}`, mode].join(' '), style: { backgroundColor }, ...props, children: label }));
|
|
7
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ primary, size, backgroundColor, label, ...props }: import("./Button").ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
argTypes: {
|
|
10
|
+
backgroundColor: {
|
|
11
|
+
control: "color";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
args: {
|
|
15
|
+
onClick: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
export declare const Primary: Story;
|
|
21
|
+
export declare const Secondary: Story;
|
|
22
|
+
export declare const Large: Story;
|
|
23
|
+
export declare const Small: Story;
|
|
24
|
+
export declare const Test: Story;
|
|
25
|
+
//# sourceMappingURL=Button.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../src/stories/Button.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAO5D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;CAeqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAGnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAKlB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { fn } from 'storybook/test';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Example/Button',
|
|
6
|
+
component: Button,
|
|
7
|
+
parameters: {
|
|
8
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
14
|
+
argTypes: {
|
|
15
|
+
backgroundColor: { control: 'color' },
|
|
16
|
+
},
|
|
17
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#story-args
|
|
18
|
+
args: { onClick: fn() },
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
22
|
+
export const Primary = {
|
|
23
|
+
args: {
|
|
24
|
+
primary: true,
|
|
25
|
+
label: "Click Me !",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const Secondary = {
|
|
29
|
+
args: {
|
|
30
|
+
label: 'Button',
|
|
31
|
+
backgroundColor: "#21eb2d"
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export const Large = {
|
|
35
|
+
args: {
|
|
36
|
+
size: 'large',
|
|
37
|
+
label: 'Button',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const Small = {
|
|
41
|
+
args: {
|
|
42
|
+
size: 'small',
|
|
43
|
+
label: 'Button',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export const Test = {
|
|
47
|
+
args: {
|
|
48
|
+
primary: false,
|
|
49
|
+
label: "test"
|
|
50
|
+
}
|
|
51
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './header.css';
|
|
2
|
+
type User = {
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
5
|
+
export interface HeaderProps {
|
|
6
|
+
user?: User;
|
|
7
|
+
onLogin?: () => void;
|
|
8
|
+
onLogout?: () => void;
|
|
9
|
+
onCreateAccount?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const Header: ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/stories/Header.tsx"],"names":[],"mappings":"AAGA,OAAO,cAAc,CAAC;AAEtB,KAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,MAAM,GAAI,8CAA8C,WAAW,4CAuC/E,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
import './header.css';
|
|
4
|
+
export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (_jsx("header", { children: _jsxs("div", { className: "storybook-header", children: [_jsxs("div", { children: [_jsx("svg", { width: "32", height: "32", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: _jsxs("g", { fill: "none", fillRule: "evenodd", children: [_jsx("path", { d: "M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z", fill: "#FFF" }), _jsx("path", { d: "M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z", fill: "#555AB9" }), _jsx("path", { d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z", fill: "#91BAF8" })] }) }), _jsx("h1", { children: "Acme" })] }), _jsx("div", { children: user ? (_jsxs(_Fragment, { children: [_jsxs("span", { className: "welcome", children: ["Welcome, ", _jsx("b", { children: user.name }), "!"] }), _jsx(Button, { size: "small", onClick: onLogout, label: "Log out" })] })) : (_jsxs(_Fragment, { children: [_jsx(Button, { size: "small", onClick: onLogin, label: "Log in" }), _jsx(Button, { primary: true, size: "small", onClick: onCreateAccount, label: "Sign up" })] })) })] }) }));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ user, onLogin, onLogout, onCreateAccount }: import("./Header").HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
tags: string[];
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
args: {
|
|
10
|
+
onLogin: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
11
|
+
onLogout: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
12
|
+
onCreateAccount: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
export declare const LoggedIn: Story;
|
|
18
|
+
export declare const LoggedOut: Story;
|
|
19
|
+
//# sourceMappingURL=Header.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.stories.d.ts","sourceRoot":"","sources":["../../src/stories/Header.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM5D,QAAA,MAAM,IAAI;;;;;;;;;;;;CAcqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAAU,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { fn } from 'storybook/test';
|
|
2
|
+
import { Header } from './Header';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Example/Header',
|
|
5
|
+
component: Header,
|
|
6
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
10
|
+
layout: 'fullscreen',
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
onLogin: fn(),
|
|
14
|
+
onLogout: fn(),
|
|
15
|
+
onCreateAccount: fn(),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const LoggedIn = {
|
|
20
|
+
args: {
|
|
21
|
+
user: {
|
|
22
|
+
name: 'Jane Doe',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const LoggedOut = {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../src/stories/Page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,YAAY,CAAC;AAMpB,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EA+DxB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Header } from './Header';
|
|
4
|
+
import './page.css';
|
|
5
|
+
export const Page = () => {
|
|
6
|
+
const [user, setUser] = React.useState();
|
|
7
|
+
return (_jsxs("article", { children: [_jsx(Header, { user: user, onLogin: () => setUser({ name: 'Jane Doe' }), onLogout: () => setUser(undefined), onCreateAccount: () => setUser({ name: 'Jane Doe' }) }), _jsxs("section", { className: "storybook-page", children: [_jsx("h2", { children: "Pages in Storybook" }), _jsxs("p", { children: ["We recommend building UIs with a", ' ', _jsx("a", { href: "https://componentdriven.org", target: "_blank", rel: "noopener noreferrer", children: _jsx("strong", { children: "component-driven" }) }), ' ', "process starting with atomic components and ending with pages."] }), _jsx("p", { children: "Render pages with mock data. This makes it easy to build and review page states without needing to navigate to them in your app. Here are some handy patterns for managing page data in Storybook:" }), _jsxs("ul", { children: [_jsx("li", { children: "Use a higher-level connected component. Storybook helps you compose such data from the \"args\" of child component stories" }), _jsx("li", { children: "Assemble data in the page component from your services. You can mock these services out using Storybook." })] }), _jsxs("p", { children: ["Get a guided tutorial on component-driven development at", ' ', _jsx("a", { href: "https://storybook.js.org/tutorials/", target: "_blank", rel: "noopener noreferrer", children: "Storybook tutorials" }), ". Read more in the", ' ', _jsx("a", { href: "https://storybook.js.org/docs", target: "_blank", rel: "noopener noreferrer", children: "docs" }), "."] }), _jsxs("div", { className: "tip-wrapper", children: [_jsx("span", { className: "tip", children: "Tip" }), " Adjust the width of the canvas with the", ' ', _jsx("svg", { width: "10", height: "10", viewBox: "0 0 12 12", xmlns: "http://www.w3.org/2000/svg", children: _jsx("g", { fill: "none", fillRule: "evenodd", children: _jsx("path", { d: "M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z", id: "a", fill: "#999" }) }) }), "Viewports addon in the toolbar"] })] })] }));
|
|
8
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("react").FC<{}>;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const LoggedOut: Story;
|
|
12
|
+
export declare const LoggedIn: Story;
|
|
13
|
+
//# sourceMappingURL=Page.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Page.stories.d.ts","sourceRoot":"","sources":["../../src/stories/Page.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM5D,QAAA,MAAM,IAAI;;;;;;CAOmB,CAAC;AAE9B,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,SAAS,EAAE,KAAU,CAAC;AAGnC,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { expect, userEvent, within } from 'storybook/test';
|
|
2
|
+
import { Page } from './Page';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Example/Page',
|
|
5
|
+
component: Page,
|
|
6
|
+
parameters: {
|
|
7
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
8
|
+
layout: 'fullscreen',
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const LoggedOut = {};
|
|
13
|
+
// More on component testing: https://storybook.js.org/docs/writing-tests/interaction-testing
|
|
14
|
+
export const LoggedIn = {
|
|
15
|
+
play: async ({ canvasElement }) => {
|
|
16
|
+
const canvas = within(canvasElement);
|
|
17
|
+
const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
|
18
|
+
await expect(loginButton).toBeInTheDocument();
|
|
19
|
+
await userEvent.click(loginButton);
|
|
20
|
+
await expect(loginButton).not.toBeInTheDocument();
|
|
21
|
+
const logoutButton = canvas.getByRole('button', { name: /Log out/i });
|
|
22
|
+
await expect(logoutButton).toBeInTheDocument();
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: any;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
argTypes: {
|
|
10
|
+
variant: {
|
|
11
|
+
control: "select";
|
|
12
|
+
options: string[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
export declare const Info: Story;
|
|
19
|
+
export declare const Danger: Story;
|
|
20
|
+
export declare const Warning: Story;
|
|
21
|
+
//# sourceMappingURL=SlimAlert.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlimAlert.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/slim/SlimAlert.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,QAAA,MAAM,IAAI;;;;;;;;;;;;;CAWwB,CAAC;AAEnC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,IAAI,EAAE,KAMlB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAMpB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SlimAlert } from "../../components";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: "Slim/Alert",
|
|
4
|
+
component: SlimAlert,
|
|
5
|
+
parameters: { layout: "centered" },
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
argTypes: {
|
|
8
|
+
variant: {
|
|
9
|
+
control: "select",
|
|
10
|
+
options: ["info", "success", "warning", "danger"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
export const Info = {
|
|
16
|
+
args: {
|
|
17
|
+
variant: "info",
|
|
18
|
+
heading: "Information",
|
|
19
|
+
children: "This is an info alert.",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const Danger = {
|
|
23
|
+
args: {
|
|
24
|
+
variant: "danger",
|
|
25
|
+
heading: "Error",
|
|
26
|
+
children: "Something went wrong.",
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export const Warning = {
|
|
30
|
+
args: {
|
|
31
|
+
variant: "warning",
|
|
32
|
+
heading: "Warning",
|
|
33
|
+
children: "This is a warning alert.",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: any;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
argTypes: {
|
|
10
|
+
variant: {
|
|
11
|
+
control: "select";
|
|
12
|
+
options: string[];
|
|
13
|
+
};
|
|
14
|
+
size: {
|
|
15
|
+
control: "radio";
|
|
16
|
+
options: string[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
export declare const Neutral: Story;
|
|
23
|
+
export declare const PrimarySmall: Story;
|
|
24
|
+
//# sourceMappingURL=SlimBadge.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlimBadge.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/slim/SlimBadge.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;CAewB,CAAC;AAEnC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAM1B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SlimBadge } from "../../components";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: "Slim/Badge",
|
|
4
|
+
component: SlimBadge,
|
|
5
|
+
parameters: { layout: "centered" },
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
argTypes: {
|
|
8
|
+
variant: {
|
|
9
|
+
control: "select",
|
|
10
|
+
options: ["neutral", "primary", "success", "warning", "danger"],
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
control: "radio",
|
|
14
|
+
options: ["sm", "md"],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const Neutral = {
|
|
20
|
+
args: {
|
|
21
|
+
variant: "neutral",
|
|
22
|
+
size: "md",
|
|
23
|
+
children: "Neutral",
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const PrimarySmall = {
|
|
27
|
+
args: {
|
|
28
|
+
variant: "primary",
|
|
29
|
+
size: "sm",
|
|
30
|
+
children: "Primary",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: any;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
argTypes: {
|
|
10
|
+
variant: {
|
|
11
|
+
control: "select";
|
|
12
|
+
options: string[];
|
|
13
|
+
};
|
|
14
|
+
size: {
|
|
15
|
+
control: "radio";
|
|
16
|
+
options: string[];
|
|
17
|
+
};
|
|
18
|
+
type: {
|
|
19
|
+
control: "radio";
|
|
20
|
+
options: string[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
export declare const Primary: Story;
|
|
27
|
+
export declare const Loading: Story;
|
|
28
|
+
//# sourceMappingURL=SlimButton.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlimButton.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/slim/SlimButton.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;CAmByB,CAAC;AAEpC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { fn } from "storybook/test";
|
|
2
|
+
import { SlimButton } from "../../components";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Slim/Button",
|
|
5
|
+
component: SlimButton,
|
|
6
|
+
parameters: { layout: "centered" },
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
argTypes: {
|
|
9
|
+
variant: {
|
|
10
|
+
control: "select",
|
|
11
|
+
options: ["primary", "secondary", "danger", "ghost"],
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
control: "radio",
|
|
15
|
+
options: ["sm", "md", "lg"],
|
|
16
|
+
},
|
|
17
|
+
type: {
|
|
18
|
+
control: "radio",
|
|
19
|
+
options: ["button", "submit", "reset"],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export default meta;
|
|
24
|
+
export const Primary = {
|
|
25
|
+
args: {
|
|
26
|
+
variant: "primary",
|
|
27
|
+
size: "md",
|
|
28
|
+
disabled: false,
|
|
29
|
+
loading: false,
|
|
30
|
+
type: "button",
|
|
31
|
+
children: "Continue",
|
|
32
|
+
onClick: fn(),
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export const Loading = {
|
|
36
|
+
args: {
|
|
37
|
+
variant: "secondary",
|
|
38
|
+
size: "md",
|
|
39
|
+
loading: true,
|
|
40
|
+
children: "Saving…",
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: any;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
args: {
|
|
10
|
+
onSlimChange: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
export declare const Default: Story;
|
|
16
|
+
export declare const CheckedWithError: Story;
|
|
17
|
+
//# sourceMappingURL=SlimCheckbox.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlimCheckbox.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/slim/SlimCheckbox.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,QAAA,MAAM,IAAI;;;;;;;;;;CAQ2B,CAAC;AAEtC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAM9B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { fn } from "storybook/test";
|
|
2
|
+
import { SlimCheckbox } from "../../components";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Slim/Checkbox",
|
|
5
|
+
component: SlimCheckbox,
|
|
6
|
+
parameters: { layout: "centered" },
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
onSlimChange: fn(),
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export const Default = {
|
|
14
|
+
args: {
|
|
15
|
+
label: "I agree to the terms",
|
|
16
|
+
hint: "You can unsubscribe later.",
|
|
17
|
+
checked: false,
|
|
18
|
+
disabled: false,
|
|
19
|
+
required: false,
|
|
20
|
+
value: "agree",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export const CheckedWithError = {
|
|
24
|
+
args: {
|
|
25
|
+
label: "Accept policy",
|
|
26
|
+
checked: true,
|
|
27
|
+
error: "This field is required for compliance.",
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: any;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
args: {
|
|
10
|
+
onSlimChange: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
11
|
+
};
|
|
12
|
+
argTypes: {
|
|
13
|
+
type: {
|
|
14
|
+
control: "select";
|
|
15
|
+
options: string[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
export declare const Text: Story;
|
|
22
|
+
export declare const WithError: Story;
|
|
23
|
+
//# sourceMappingURL=SlimInput.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlimInput.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/slim/SlimInput.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;CAcwB,CAAC;AAEnC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,IAAI,EAAE,KAUlB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAQvB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { fn } from "storybook/test";
|
|
2
|
+
import { SlimInput } from "../../components";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Slim/Input",
|
|
5
|
+
component: SlimInput,
|
|
6
|
+
parameters: { layout: "centered" },
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
onSlimChange: fn(),
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
type: {
|
|
13
|
+
control: "select",
|
|
14
|
+
options: ["text", "email", "password", "tel", "number"],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const Text = {
|
|
20
|
+
args: {
|
|
21
|
+
label: "Full name",
|
|
22
|
+
hint: "As shown on your ID.",
|
|
23
|
+
name: "fullName",
|
|
24
|
+
value: "",
|
|
25
|
+
type: "text",
|
|
26
|
+
required: true,
|
|
27
|
+
disabled: false,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export const WithError = {
|
|
31
|
+
args: {
|
|
32
|
+
label: "Email",
|
|
33
|
+
name: "email",
|
|
34
|
+
value: "not-an-email",
|
|
35
|
+
type: "email",
|
|
36
|
+
error: "Please enter a valid email address.",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: any;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
args: {
|
|
10
|
+
onSlimChange: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
export declare const Default: Story;
|
|
16
|
+
export declare const WithHintAndError: Story;
|
|
17
|
+
//# sourceMappingURL=SlimSelect.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlimSelect.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/slim/SlimSelect.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,QAAA,MAAM,IAAI;;;;;;;;;;CAQyB,CAAC;AAEpC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAWrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAW9B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { fn } from "storybook/test";
|
|
2
|
+
import { SlimSelect } from "../../components";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Slim/Select",
|
|
5
|
+
component: SlimSelect,
|
|
6
|
+
parameters: { layout: "centered" },
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
onSlimChange: fn(),
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export const Default = {
|
|
14
|
+
args: {
|
|
15
|
+
label: "Country",
|
|
16
|
+
name: "country",
|
|
17
|
+
value: "fr",
|
|
18
|
+
options: [
|
|
19
|
+
{ value: "fr", label: "France" },
|
|
20
|
+
{ value: "be", label: "Belgium" },
|
|
21
|
+
{ value: "de", label: "Germany", disabled: true },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export const WithHintAndError = {
|
|
26
|
+
args: {
|
|
27
|
+
label: "Team",
|
|
28
|
+
hint: "Pick the team that owns this service.",
|
|
29
|
+
error: "Please select a team.",
|
|
30
|
+
options: [
|
|
31
|
+
{ value: "", label: "Select…" },
|
|
32
|
+
{ value: "platform", label: "Platform" },
|
|
33
|
+
{ value: "design", label: "Design System" },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: any;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
args: {
|
|
10
|
+
onSlimChange: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
export declare const Off: Story;
|
|
16
|
+
export declare const On: Story;
|
|
17
|
+
//# sourceMappingURL=SlimSwitch.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlimSwitch.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/slim/SlimSwitch.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,QAAA,MAAM,IAAI;;;;;;;;;;CAQyB,CAAC;AAEpC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,GAAG,EAAE,KAMjB,CAAC;AAEF,eAAO,MAAM,EAAE,EAAE,KAKhB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { fn } from "storybook/test";
|
|
2
|
+
import { SlimSwitch } from "../../components";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Slim/Switch",
|
|
5
|
+
component: SlimSwitch,
|
|
6
|
+
parameters: { layout: "centered" },
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
onSlimChange: fn(),
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export const Off = {
|
|
14
|
+
args: {
|
|
15
|
+
label: "Enable notifications",
|
|
16
|
+
hint: "We’ll only notify you for important events.",
|
|
17
|
+
checked: false,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export const On = {
|
|
21
|
+
args: {
|
|
22
|
+
label: "Enable notifications",
|
|
23
|
+
checked: true,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: any;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
args: {
|
|
10
|
+
onSlimChange: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
export declare const Default: Story;
|
|
16
|
+
export declare const WithError: Story;
|
|
17
|
+
//# sourceMappingURL=SlimTextarea.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlimTextarea.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/slim/SlimTextarea.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,QAAA,MAAM,IAAI;;;;;;;;;;CAQ2B,CAAC;AAEtC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { fn } from "storybook/test";
|
|
2
|
+
import { SlimTextarea } from "../../components";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Slim/Textarea",
|
|
5
|
+
component: SlimTextarea,
|
|
6
|
+
parameters: { layout: "centered" },
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
onSlimChange: fn(),
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export const Default = {
|
|
14
|
+
args: {
|
|
15
|
+
label: "Message",
|
|
16
|
+
placeholder: "Type your message…",
|
|
17
|
+
rows: 4,
|
|
18
|
+
value: "",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export const WithError = {
|
|
22
|
+
args: {
|
|
23
|
+
label: "Message",
|
|
24
|
+
value: "Too short",
|
|
25
|
+
minlength: 20,
|
|
26
|
+
error: "Please provide at least 20 characters.",
|
|
27
|
+
},
|
|
28
|
+
};
|
package/package.json
CHANGED
|
@@ -1,30 +1,50 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@slimkhemiri/react-design-system",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"private": false,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"files": [
|
|
15
|
-
"dist/"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@slimkhemiri/react-design-system",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist/",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc -p tsconfig.build.json",
|
|
23
|
+
"clean": "node ./scripts/clean.mjs",
|
|
24
|
+
"storybook": "storybook dev -p 6006",
|
|
25
|
+
"build-storybook": "storybook build"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@slimkhemiri/web-components": "^0.1.1",
|
|
29
|
+
"@stencil/react-output-target": "^0.8.2",
|
|
30
|
+
"react": "^18.3.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@chromatic-com/storybook": "^5.0.1",
|
|
34
|
+
"@storybook/addon-a11y": "^10.2.7",
|
|
35
|
+
"@storybook/addon-docs": "^10.2.7",
|
|
36
|
+
"@storybook/addon-onboarding": "^10.2.7",
|
|
37
|
+
"@storybook/addon-vitest": "^10.2.7",
|
|
38
|
+
"@storybook/react-vite": "^10.2.7",
|
|
39
|
+
"@types/react": "^18.3.3",
|
|
40
|
+
"@types/react-dom": "^18.3.0",
|
|
41
|
+
"@vitest/browser-playwright": "^4.0.18",
|
|
42
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
43
|
+
"chromatic": "^15.0.0",
|
|
44
|
+
"playwright": "^1.58.2",
|
|
45
|
+
"react-dom": "^18.3.1",
|
|
46
|
+
"storybook": "^10.2.7",
|
|
47
|
+
"typescript": "^5.5.4",
|
|
48
|
+
"vitest": "^4.0.18"
|
|
49
|
+
}
|
|
50
|
+
}
|