@jesusgm/react-components 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +158 -0
- package/dist/components/atoms/avatar/index.d.ts +19 -0
- package/dist/components/atoms/avatar/index.js +44 -0
- package/dist/components/atoms/avatar/index.js.map +1 -0
- package/dist/components/atoms/avatar/styles.css +50 -0
- package/dist/components/atoms/badge/index.d.ts +17 -0
- package/dist/components/atoms/badge/index.js +37 -0
- package/dist/components/atoms/badge/index.js.map +1 -0
- package/dist/components/atoms/badge/styles.css +83 -0
- package/dist/components/atoms/button/index.d.ts +16 -0
- package/dist/components/atoms/button/index.js +22 -0
- package/dist/components/atoms/button/index.js.map +1 -0
- package/dist/components/atoms/button/styles.css +77 -0
- package/dist/components/atoms/checkbox/index.d.ts +13 -0
- package/dist/components/atoms/checkbox/index.js +63 -0
- package/dist/components/atoms/checkbox/index.js.map +1 -0
- package/dist/components/atoms/checkbox/styles.css +87 -0
- package/dist/components/atoms/code-highlighter/index.d.ts +8 -0
- package/dist/components/atoms/code-highlighter/index.js +24 -0
- package/dist/components/atoms/code-highlighter/index.js.map +1 -0
- package/dist/components/atoms/code-highlighter/railscasts.css +1 -0
- package/dist/components/atoms/code-highlighter/styles.css +17 -0
- package/dist/components/atoms/divider/index.d.ts +10 -0
- package/dist/components/atoms/divider/index.js +25 -0
- package/dist/components/atoms/divider/index.js.map +1 -0
- package/dist/components/atoms/divider/styles.css +56 -0
- package/dist/components/atoms/icon/index.d.ts +23 -0
- package/dist/components/atoms/icon/index.js +20 -0
- package/dist/components/atoms/icon/index.js.map +1 -0
- package/dist/components/atoms/icon/styles.css +13 -0
- package/dist/components/atoms/kbd/index.d.ts +7 -0
- package/dist/components/atoms/kbd/index.js +26 -0
- package/dist/components/atoms/kbd/index.js.map +1 -0
- package/dist/components/atoms/kbd/styles.css +29 -0
- package/dist/components/atoms/label/index.d.ts +9 -0
- package/dist/components/atoms/label/index.js +18 -0
- package/dist/components/atoms/label/index.js.map +1 -0
- package/dist/components/atoms/label/styles.css +19 -0
- package/dist/components/atoms/link/index.d.ts +12 -0
- package/dist/components/atoms/link/index.js +32 -0
- package/dist/components/atoms/link/index.js.map +1 -0
- package/dist/components/atoms/link/styles.css +54 -0
- package/dist/components/atoms/progress-bar/index.d.ts +23 -0
- package/dist/components/atoms/progress-bar/index.js +45 -0
- package/dist/components/atoms/progress-bar/index.js.map +1 -0
- package/dist/components/atoms/progress-bar/styles.css +75 -0
- package/dist/components/atoms/radio/context.d.ts +9 -0
- package/dist/components/atoms/radio/context.js +9 -0
- package/dist/components/atoms/radio/context.js.map +1 -0
- package/dist/components/atoms/radio/index.d.ts +15 -0
- package/dist/components/atoms/radio/index.js +44 -0
- package/dist/components/atoms/radio/index.js.map +1 -0
- package/dist/components/atoms/radio/radio-group.d.ts +25 -0
- package/dist/components/atoms/radio/radio-group.js +49 -0
- package/dist/components/atoms/radio/radio-group.js.map +1 -0
- package/dist/components/atoms/radio/styles.css +110 -0
- package/dist/components/atoms/skeleton/index.d.ts +15 -0
- package/dist/components/atoms/skeleton/index.js +38 -0
- package/dist/components/atoms/skeleton/index.js.map +1 -0
- package/dist/components/atoms/skeleton/styles.css +57 -0
- package/dist/components/atoms/spinner/index.d.ts +11 -0
- package/dist/components/atoms/spinner/index.js +22 -0
- package/dist/components/atoms/spinner/index.js.map +1 -0
- package/dist/components/atoms/spinner/styles.css +51 -0
- package/dist/components/atoms/switch/index.d.ts +14 -0
- package/dist/components/atoms/switch/index.js +33 -0
- package/dist/components/atoms/switch/index.js.map +1 -0
- package/dist/components/atoms/switch/styles.css +99 -0
- package/dist/components/atoms/text-input/index.d.ts +20 -0
- package/dist/components/atoms/text-input/index.js +33 -0
- package/dist/components/atoms/text-input/index.js.map +1 -0
- package/dist/components/atoms/text-input/styles.css +80 -0
- package/dist/components/atoms/textarea/index.d.ts +14 -0
- package/dist/components/atoms/textarea/index.js +43 -0
- package/dist/components/atoms/textarea/index.js.map +1 -0
- package/dist/components/atoms/textarea/styles.css +49 -0
- package/dist/components/atoms/typography/index.d.ts +30 -0
- package/dist/components/atoms/typography/index.js +30 -0
- package/dist/components/atoms/typography/index.js.map +1 -0
- package/dist/components/atoms/typography/styles.css +50 -0
- package/dist/components/atoms/video-player/index.d.ts +9 -0
- package/dist/components/atoms/video-player/index.js +17 -0
- package/dist/components/atoms/video-player/index.js.map +1 -0
- package/dist/components/atoms/video-player/styles.css +18 -0
- package/dist/components/atoms/visually-hidden/index.d.ts +7 -0
- package/dist/components/atoms/visually-hidden/index.js +13 -0
- package/dist/components/atoms/visually-hidden/index.js.map +1 -0
- package/dist/components/atoms/visually-hidden/styles.css +12 -0
- package/dist/components/hooks/index.d.ts +3 -0
- package/dist/components/hooks/index.js +4 -0
- package/dist/components/hooks/use-click-outside.d.ts +6 -0
- package/dist/components/hooks/use-click-outside.js +30 -0
- package/dist/components/hooks/use-click-outside.js.map +1 -0
- package/dist/components/hooks/use-controllable-state.d.ts +5 -0
- package/dist/components/hooks/use-controllable-state.js +22 -0
- package/dist/components/hooks/use-controllable-state.js.map +1 -0
- package/dist/components/hooks/use-focus-trap.d.ts +8 -0
- package/dist/components/hooks/use-focus-trap.js +57 -0
- package/dist/components/hooks/use-focus-trap.js.map +1 -0
- package/dist/components/index.d.ts +122 -0
- package/dist/components/index.js +74 -0
- package/dist/components/molecules/accordion/index.d.ts +27 -0
- package/dist/components/molecules/accordion/index.js +98 -0
- package/dist/components/molecules/accordion/index.js.map +1 -0
- package/dist/components/molecules/accordion/styles.css +75 -0
- package/dist/components/molecules/alert/index.d.ts +18 -0
- package/dist/components/molecules/alert/index.js +91 -0
- package/dist/components/molecules/alert/index.js.map +1 -0
- package/dist/components/molecules/alert/styles.css +97 -0
- package/dist/components/molecules/binary-clock/index.d.ts +16 -0
- package/dist/components/molecules/binary-clock/index.js +66 -0
- package/dist/components/molecules/binary-clock/index.js.map +1 -0
- package/dist/components/molecules/binary-clock/styles.css +46 -0
- package/dist/components/molecules/breadcrumb/index.d.ts +23 -0
- package/dist/components/molecules/breadcrumb/index.js +79 -0
- package/dist/components/molecules/breadcrumb/index.js.map +1 -0
- package/dist/components/molecules/breadcrumb/styles.css +61 -0
- package/dist/components/molecules/card/index.d.ts +39 -0
- package/dist/components/molecules/card/index.js +60 -0
- package/dist/components/molecules/card/index.js.map +1 -0
- package/dist/components/molecules/card/styles.css +105 -0
- package/dist/components/molecules/chart/index.d.ts +14 -0
- package/dist/components/molecules/chart/index.js +104 -0
- package/dist/components/molecules/chart/index.js.map +1 -0
- package/dist/components/molecules/conflict-resolver/components/conflictItem.d.ts +8 -0
- package/dist/components/molecules/conflict-resolver/components/conflictItem.js +58 -0
- package/dist/components/molecules/conflict-resolver/components/conflictItem.js.map +1 -0
- package/dist/components/molecules/conflict-resolver/components/styles.css +64 -0
- package/dist/components/molecules/conflict-resolver/index.d.ts +10 -0
- package/dist/components/molecules/conflict-resolver/index.js +35 -0
- package/dist/components/molecules/conflict-resolver/index.js.map +1 -0
- package/dist/components/molecules/conflict-resolver/types.d.ts +10 -0
- package/dist/components/molecules/dropable-list/draggable.d.ts +9 -0
- package/dist/components/molecules/dropable-list/draggable.js +18 -0
- package/dist/components/molecules/dropable-list/draggable.js.map +1 -0
- package/dist/components/molecules/dropable-list/index.d.ts +20 -0
- package/dist/components/molecules/dropable-list/index.js +52 -0
- package/dist/components/molecules/dropable-list/index.js.map +1 -0
- package/dist/components/molecules/dropable-list/styles.css +63 -0
- package/dist/components/molecules/dropdown-menu/index.d.ts +43 -0
- package/dist/components/molecules/dropdown-menu/index.js +226 -0
- package/dist/components/molecules/dropdown-menu/index.js.map +1 -0
- package/dist/components/molecules/dropdown-menu/styles.css +94 -0
- package/dist/components/molecules/empty-state/index.d.ts +16 -0
- package/dist/components/molecules/empty-state/index.js +32 -0
- package/dist/components/molecules/empty-state/index.js.map +1 -0
- package/dist/components/molecules/empty-state/styles.css +64 -0
- package/dist/components/molecules/file-input/index.d.ts +39 -0
- package/dist/components/molecules/file-input/index.js +121 -0
- package/dist/components/molecules/file-input/index.js.map +1 -0
- package/dist/components/molecules/file-input/styles.css +86 -0
- package/dist/components/molecules/form-field/index.d.ts +38 -0
- package/dist/components/molecules/form-field/index.js +71 -0
- package/dist/components/molecules/form-field/index.js.map +1 -0
- package/dist/components/molecules/form-field/styles.css +43 -0
- package/dist/components/molecules/list/index.d.ts +25 -0
- package/dist/components/molecules/list/index.js +30 -0
- package/dist/components/molecules/list/index.js.map +1 -0
- package/dist/components/molecules/list/styles.css +28 -0
- package/dist/components/molecules/number-stepper/index.d.ts +31 -0
- package/dist/components/molecules/number-stepper/index.js +163 -0
- package/dist/components/molecules/number-stepper/index.js.map +1 -0
- package/dist/components/molecules/number-stepper/styles.css +69 -0
- package/dist/components/molecules/pagination/index.d.ts +39 -0
- package/dist/components/molecules/pagination/index.js +111 -0
- package/dist/components/molecules/pagination/index.js.map +1 -0
- package/dist/components/molecules/pagination/styles.css +41 -0
- package/dist/components/molecules/popover/index.d.ts +22 -0
- package/dist/components/molecules/popover/index.js +76 -0
- package/dist/components/molecules/popover/index.js.map +1 -0
- package/dist/components/molecules/popover/positioning.d.ts +40 -0
- package/dist/components/molecules/popover/positioning.js +115 -0
- package/dist/components/molecules/popover/positioning.js.map +1 -0
- package/dist/components/molecules/popover/styles.css +36 -0
- package/dist/components/molecules/rating/index.d.ts +33 -0
- package/dist/components/molecules/rating/index.js +117 -0
- package/dist/components/molecules/rating/index.js.map +1 -0
- package/dist/components/molecules/rating/styles.css +94 -0
- package/dist/components/molecules/search-input/index.d.ts +23 -0
- package/dist/components/molecules/search-input/index.js +118 -0
- package/dist/components/molecules/search-input/index.js.map +1 -0
- package/dist/components/molecules/search-input/styles.css +69 -0
- package/dist/components/molecules/segmented-control/button-group.d.ts +10 -0
- package/dist/components/molecules/segmented-control/button-group.js +15 -0
- package/dist/components/molecules/segmented-control/button-group.js.map +1 -0
- package/dist/components/molecules/segmented-control/index.d.ts +38 -0
- package/dist/components/molecules/segmented-control/index.js +80 -0
- package/dist/components/molecules/segmented-control/index.js.map +1 -0
- package/dist/components/molecules/segmented-control/styles.css +130 -0
- package/dist/components/molecules/select/index.d.ts +30 -0
- package/dist/components/molecules/select/index.js +48 -0
- package/dist/components/molecules/select/index.js.map +1 -0
- package/dist/components/molecules/select/styles.css +102 -0
- package/dist/components/molecules/tabs/index.d.ts +31 -0
- package/dist/components/molecules/tabs/index.js +87 -0
- package/dist/components/molecules/tabs/index.js.map +1 -0
- package/dist/components/molecules/tabs/styles.css +87 -0
- package/dist/components/molecules/tag-cloud/index.d.ts +16 -0
- package/dist/components/molecules/tag-cloud/index.js +133 -0
- package/dist/components/molecules/tag-cloud/index.js.map +1 -0
- package/dist/components/molecules/tag-cloud/styles.css +29 -0
- package/dist/components/molecules/tooltip/index.d.ts +22 -0
- package/dist/components/molecules/tooltip/index.js +83 -0
- package/dist/components/molecules/tooltip/index.js.map +1 -0
- package/dist/components/molecules/tooltip/styles.css +30 -0
- package/dist/components/molecules/virtualized-list/index.d.ts +5 -0
- package/dist/components/molecules/virtualized-list/index.js +3 -0
- package/dist/components/molecules/virtualized-list/lista/index.d.ts +11 -0
- package/dist/components/molecules/virtualized-list/lista/index.js +30 -0
- package/dist/components/molecules/virtualized-list/lista/index.js.map +1 -0
- package/dist/components/molecules/virtualized-list/lista/styles.css +27 -0
- package/dist/components/molecules/virtualized-list/lista-slow/index.d.ts +10 -0
- package/dist/components/molecules/virtualized-list/lista-slow/index.js +17 -0
- package/dist/components/molecules/virtualized-list/lista-slow/index.js.map +1 -0
- package/dist/components/molecules/virtualized-list/row/index.d.ts +9 -0
- package/dist/components/molecules/virtualized-list/row/index.js +30 -0
- package/dist/components/molecules/virtualized-list/row/index.js.map +1 -0
- package/dist/components/molecules/virtualized-list/types.d.ts +4 -0
- package/dist/components/organisms/combobox/index.d.ts +82 -0
- package/dist/components/organisms/combobox/index.js +386 -0
- package/dist/components/organisms/combobox/index.js.map +1 -0
- package/dist/components/organisms/combobox/styles.css +269 -0
- package/dist/components/organisms/command-palette/index.d.ts +49 -0
- package/dist/components/organisms/command-palette/index.js +239 -0
- package/dist/components/organisms/command-palette/index.js.map +1 -0
- package/dist/components/organisms/command-palette/score.d.ts +12 -0
- package/dist/components/organisms/command-palette/score.js +43 -0
- package/dist/components/organisms/command-palette/score.js.map +1 -0
- package/dist/components/organisms/command-palette/styles.css +212 -0
- package/dist/components/organisms/date-picker/calendar.d.ts +29 -0
- package/dist/components/organisms/date-picker/calendar.js +178 -0
- package/dist/components/organisms/date-picker/calendar.js.map +1 -0
- package/dist/components/organisms/date-picker/date-utils.d.ts +52 -0
- package/dist/components/organisms/date-picker/date-utils.js +139 -0
- package/dist/components/organisms/date-picker/date-utils.js.map +1 -0
- package/dist/components/organisms/date-picker/index.d.ts +54 -0
- package/dist/components/organisms/date-picker/index.js +173 -0
- package/dist/components/organisms/date-picker/index.js.map +1 -0
- package/dist/components/organisms/date-picker/styles.css +179 -0
- package/dist/components/organisms/drawer/index.d.ts +16 -0
- package/dist/components/organisms/drawer/index.js +15 -0
- package/dist/components/organisms/drawer/index.js.map +1 -0
- package/dist/components/organisms/drawer/styles.css +163 -0
- package/dist/components/organisms/editor/index.d.ts +13 -0
- package/dist/components/organisms/editor/index.js +56 -0
- package/dist/components/organisms/editor/index.js.map +1 -0
- package/dist/components/organisms/editor/styles.css +61 -0
- package/dist/components/organisms/form/context.d.ts +7 -0
- package/dist/components/organisms/form/context.js +11 -0
- package/dist/components/organisms/form/context.js.map +1 -0
- package/dist/components/organisms/form/field.d.ts +18 -0
- package/dist/components/organisms/form/field.js +98 -0
- package/dist/components/organisms/form/field.js.map +1 -0
- package/dist/components/organisms/form/form-actions.d.ts +8 -0
- package/dist/components/organisms/form/form-actions.js +13 -0
- package/dist/components/organisms/form/form-actions.js.map +1 -0
- package/dist/components/organisms/form/index.d.ts +24 -0
- package/dist/components/organisms/form/index.js +215 -0
- package/dist/components/organisms/form/index.js.map +1 -0
- package/dist/components/organisms/form/styles.css +29 -0
- package/dist/components/organisms/form/types.d.ts +95 -0
- package/dist/components/organisms/form/validation.d.ts +5 -0
- package/dist/components/organisms/form/validation.js +35 -0
- package/dist/components/organisms/form/validation.js.map +1 -0
- package/dist/components/organisms/header/index.d.ts +40 -0
- package/dist/components/organisms/header/index.js +186 -0
- package/dist/components/organisms/header/index.js.map +1 -0
- package/dist/components/organisms/header/styles.css +126 -0
- package/dist/components/organisms/modal/dialog-base.d.ts +31 -0
- package/dist/components/organisms/modal/dialog-base.js +123 -0
- package/dist/components/organisms/modal/dialog-base.js.map +1 -0
- package/dist/components/organisms/modal/index.d.ts +13 -0
- package/dist/components/organisms/modal/index.js +15 -0
- package/dist/components/organisms/modal/index.js.map +1 -0
- package/dist/components/organisms/modal/styles.css +143 -0
- package/dist/components/organisms/presenter/components/slides/simple/index.d.ts +13 -0
- package/dist/components/organisms/presenter/components/slides/simple/index.js +16 -0
- package/dist/components/organisms/presenter/components/slides/simple/index.js.map +1 -0
- package/dist/components/organisms/presenter/components/slides/simple/styles.css +6 -0
- package/dist/components/organisms/presenter/index.d.ts +17 -0
- package/dist/components/organisms/presenter/index.js +63 -0
- package/dist/components/organisms/presenter/index.js.map +1 -0
- package/dist/components/organisms/presenter/styles.css +75 -0
- package/dist/components/organisms/sidebar/index.d.ts +50 -0
- package/dist/components/organisms/sidebar/index.js +157 -0
- package/dist/components/organisms/sidebar/index.js.map +1 -0
- package/dist/components/organisms/sidebar/styles.css +197 -0
- package/dist/components/organisms/slider/index.d.ts +47 -0
- package/dist/components/organisms/slider/index.js +214 -0
- package/dist/components/organisms/slider/index.js.map +1 -0
- package/dist/components/organisms/slider/styles.css +110 -0
- package/dist/components/organisms/table/components/cell/index.d.ts +8 -0
- package/dist/components/organisms/table/components/cell/index.js +11 -0
- package/dist/components/organisms/table/components/cell/index.js.map +1 -0
- package/dist/components/organisms/table/index.d.ts +29 -0
- package/dist/components/organisms/table/index.js +105 -0
- package/dist/components/organisms/table/index.js.map +1 -0
- package/dist/components/organisms/table/styles.css +66 -0
- package/dist/components/organisms/terminal/index.d.ts +15 -0
- package/dist/components/organisms/terminal/index.js +111 -0
- package/dist/components/organisms/terminal/index.js.map +1 -0
- package/dist/components/organisms/terminal/styles.css +123 -0
- package/dist/components/organisms/toast/index.d.ts +66 -0
- package/dist/components/organisms/toast/index.js +142 -0
- package/dist/components/organisms/toast/index.js.map +1 -0
- package/dist/components/organisms/toast/styles.css +138 -0
- package/dist/components/organisms/wizard/index.d.ts +44 -0
- package/dist/components/organisms/wizard/index.js +171 -0
- package/dist/components/organisms/wizard/index.js.map +1 -0
- package/dist/components/organisms/wizard/styles.css +160 -0
- package/dist/components/utils/cx.d.ts +2 -0
- package/dist/components/utils/cx.js +8 -0
- package/dist/components/utils/cx.js.map +1 -0
- package/dist/components/utils/portal/index.d.ts +9 -0
- package/dist/components/utils/portal/index.js +13 -0
- package/dist/components/utils/portal/index.js.map +1 -0
- package/dist/components/utils/theme-provider/index.d.ts +22 -0
- package/dist/components/utils/theme-provider/index.js +36 -0
- package/dist/components/utils/theme-provider/index.js.map +1 -0
- package/dist/styles.css +743 -0
- package/dist/tokens.css +299 -0
- package/package.json +390 -4
- package/README.md +0 -3
package/Readme.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# React components [](https://github.com/jesusgm/react-components/actions/workflows/ci.yml)
|
|
2
|
+
|
|
3
|
+
A library of reusable React components, written in TypeScript, with its own design system (CSS tokens, light and dark theme).
|
|
4
|
+
|
|
5
|
+
The documentation (Storybook, deployed automatically with GitHub Actions) is available [here](https://jesusgm.github.io/react-components/).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @jesusgm/react-components
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
It requires `react` and `react-dom` 18 or 19. Every other dependency is an **optional peer dependency**: install only the ones for the components you use (see the table).
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
// 1. Once, at the root of the app: normalize + tokens + base styles.
|
|
19
|
+
// Without this stylesheet the components have no colors, spacing or typography.
|
|
20
|
+
import "@jesusgm/react-components/styles.css";
|
|
21
|
+
|
|
22
|
+
// 2. Each component from its own entry point. Its CSS loads automatically.
|
|
23
|
+
import Button from "@jesusgm/react-components/button";
|
|
24
|
+
import Table, { type TableProps } from "@jesusgm/react-components/table";
|
|
25
|
+
|
|
26
|
+
export default function App() {
|
|
27
|
+
return <Button variant="primary">Save</Button>;
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
There is also a barrel (`import { Button, Table } from "@jesusgm/react-components"`), but it **requires every optional peer dependency to be installed**, because the bundler resolves all the imports before dropping the unused ones. Prefer the per-component entry points.
|
|
32
|
+
|
|
33
|
+
Each component exports the types of its props (`ButtonProps`, `TableProps`…).
|
|
34
|
+
|
|
35
|
+
Dark theme: `document.documentElement.dataset.theme = "dark"`. If you only want the variables, without normalize or base styles: `@jesusgm/react-components/tokens.css`.
|
|
36
|
+
|
|
37
|
+
### Components and dependencies
|
|
38
|
+
|
|
39
|
+
| Import | Component | Required peer dependencies |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| `/button` | Button | — |
|
|
42
|
+
| `/icon` | Icon | `@fortawesome/fontawesome-free@^5`, `line-awesome`, `bootstrap-icons` |
|
|
43
|
+
| `/code-highlighter` | CodeHighlighter | `highlight.js` |
|
|
44
|
+
| `/video-player` | VideoPlayer | — |
|
|
45
|
+
| `/binary-clock` | BinaryClock | — |
|
|
46
|
+
| `/chart` | Chart | `chart.js`, `react-chartjs-2` |
|
|
47
|
+
| `/conflict-resolver` | ConflictResolver | `@fortawesome/react-fontawesome`, `@fortawesome/fontawesome-svg-core`, `@fortawesome/free-solid-svg-icons` |
|
|
48
|
+
| `/dropable-list` | DropableList, Draggable | — |
|
|
49
|
+
| `/file-input` | FileInput | `@fortawesome/react-fontawesome`, `@fortawesome/fontawesome-svg-core`, `@fortawesome/free-solid-svg-icons` |
|
|
50
|
+
| `/list` | List | — |
|
|
51
|
+
| `/tag-cloud` | TagCloud | — |
|
|
52
|
+
| `/virtualized-list` | VirtualizedList, SlowList | `react-window` |
|
|
53
|
+
| `/editor` | Editor | `ckeditor5`, `@ckeditor/ckeditor5-react` |
|
|
54
|
+
| `/presenter` | Presenter | — |
|
|
55
|
+
| `/slider` | Slider | — |
|
|
56
|
+
| `/table` | Table | — |
|
|
57
|
+
| `/terminal` | Terminal | — |
|
|
58
|
+
| `/spinner` | Spinner | — |
|
|
59
|
+
| `/badge` | Badge | — |
|
|
60
|
+
| `/avatar` | Avatar | — |
|
|
61
|
+
| `/link` | Link | — |
|
|
62
|
+
| `/typography` | Text, Heading | — |
|
|
63
|
+
| `/skeleton` | Skeleton | — |
|
|
64
|
+
| `/progress-bar` | ProgressBar | — |
|
|
65
|
+
| `/divider` | Divider | — |
|
|
66
|
+
| `/header` | Header | — |
|
|
67
|
+
| `/sidebar` | Sidebar | — |
|
|
68
|
+
| `/wizard` | Wizard | — |
|
|
69
|
+
| `/tabs` | Tabs | — |
|
|
70
|
+
| `/pagination` | Pagination | — |
|
|
71
|
+
| `/card` | Card, CardHeader, CardBody, CardFooter, CardMedia | — |
|
|
72
|
+
| `/breadcrumb` | Breadcrumb | — |
|
|
73
|
+
| `/accordion` | Accordion | — |
|
|
74
|
+
| `/empty-state` | EmptyState | — |
|
|
75
|
+
| `/alert` | Alert | — |
|
|
76
|
+
| `/label` | Label | — |
|
|
77
|
+
| `/text-input` | TextInput | — |
|
|
78
|
+
| `/textarea` | Textarea | — |
|
|
79
|
+
| `/checkbox` | Checkbox | — |
|
|
80
|
+
| `/radio` | Radio, RadioGroup | — |
|
|
81
|
+
| `/switch` | Switch | — |
|
|
82
|
+
| `/visually-hidden` | VisuallyHidden | — |
|
|
83
|
+
| `/kbd` | Kbd | — |
|
|
84
|
+
| `/popover` | Popover | — |
|
|
85
|
+
| `/tooltip` | Tooltip | — |
|
|
86
|
+
| `/dropdown-menu` | DropdownMenu | — |
|
|
87
|
+
| `/modal` | Modal | — |
|
|
88
|
+
| `/drawer` | Drawer | — |
|
|
89
|
+
| `/toast` | ToastProvider, Toast, useToast | — |
|
|
90
|
+
| `/portal` | Portal | — |
|
|
91
|
+
| `/theme-provider` | ThemeProvider, useTheme | — |
|
|
92
|
+
| `/hooks` | useControllableState, useClickOutside, useFocusTrap | — |
|
|
93
|
+
| `/form-field` | FormField | — |
|
|
94
|
+
| `/select` | Select | — |
|
|
95
|
+
| `/search-input` | SearchInput | — |
|
|
96
|
+
| `/number-stepper` | NumberStepper | — |
|
|
97
|
+
| `/segmented-control` | SegmentedControl, ButtonGroup | — |
|
|
98
|
+
| `/rating` | Rating | — |
|
|
99
|
+
| `/form` | Form, useForm, Field, FormActions | — |
|
|
100
|
+
| `/combobox` | Combobox | — |
|
|
101
|
+
| `/date-picker` | DatePicker, Calendar | — |
|
|
102
|
+
| `/command-palette` | CommandPalette | — |
|
|
103
|
+
|
|
104
|
+
### Requirements for the consuming project
|
|
105
|
+
|
|
106
|
+
- **ESM only**: there is no CommonJS build. Jest with its default (CJS) configuration cannot import it; use Vitest or configure Jest in ESM mode.
|
|
107
|
+
- The bundler must support `import "./x.css"` inside dependencies (Vite, Next.js, webpack with css-loader, Parcel…).
|
|
108
|
+
- If you use TypeScript with `Editor`, enable `skipLibCheck`: the ckeditor5 types report their own errors without it.
|
|
109
|
+
|
|
110
|
+
## Changes from the JS version (breaking changes)
|
|
111
|
+
|
|
112
|
+
- **Slider** no longer ships with bundled images: it takes the required prop `images` (URLs or `{ src, alt }` objects). It is now a function component built on `Button`, no longer needs Font Awesome, follows the WAI-ARIA carousel pattern (keyboard, swipe, pause button when `autoSlideSeconds` is set) and its arrow labels are "Previous slide" / "Next slide".
|
|
113
|
+
- **FileInput** no longer returns `lastModifiedDate` for each file (it is not standard); use `lastModified`.
|
|
114
|
+
- **Icon** with `font="bootstrap"` is rendered with the Bootstrap Icons font (`<i class="bi bi-…">`) instead of an SVG `<img>`, so it inherits the text color. With `font="la"` it now really uses the Line Awesome font (it used to be rendered with Font Awesome).
|
|
115
|
+
- `prop-types` has been removed: TypeScript validates the props.
|
|
116
|
+
- All the built-in texts (default labels, `aria-label`s, pagination texts) are now in English.
|
|
117
|
+
|
|
118
|
+
## Structure
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
src/
|
|
122
|
+
├── design-system/ # Tokens (CSS variables), base styles and DS documentation
|
|
123
|
+
│ ├── tokens.css # Primitive + semantic tokens, light/dark theme
|
|
124
|
+
│ ├── base.css
|
|
125
|
+
│ ├── index.css # Entry point: normalize + tokens + base → dist/styles.css
|
|
126
|
+
│ └── docs/ # Storybook MDX pages (Introduction, Design System/*)
|
|
127
|
+
└── components/ # Organized following Atomic Design
|
|
128
|
+
├── atoms/
|
|
129
|
+
├── molecules/
|
|
130
|
+
├── organisms/
|
|
131
|
+
├── entries.json # Public entry points (subpath → folder)
|
|
132
|
+
└── index.ts # Barrel: exports every component and its types
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
To add a public component: create its folder with `index.tsx`, and add it to `src/components/index.ts`, to `src/components/entries.json` and to `exports` in `package.json`.
|
|
136
|
+
|
|
137
|
+
## Scripts
|
|
138
|
+
|
|
139
|
+
| Script | Description |
|
|
140
|
+
| --- | --- |
|
|
141
|
+
| `npm run dev` | Demo app with Vite |
|
|
142
|
+
| `npm run build` | Library build in `dist/` (ESM JS + `.d.ts` + per-component CSS) |
|
|
143
|
+
| `npm run build:demo` | Demo app build in `demo-dist/` |
|
|
144
|
+
| `npm run typecheck` | Type checking |
|
|
145
|
+
| `npm test` | Tests with Vitest |
|
|
146
|
+
| `npm run test:keyboard` | Keyboard checks in headless Chrome against the built Storybook (run `npm run storybook:build` first) |
|
|
147
|
+
| `npm run lint:pkg` | Validates the published `package.json` with publint |
|
|
148
|
+
| `npm run storybook:dev` | Local Storybook (port 6006) |
|
|
149
|
+
| `npm run storybook:build` | Static Storybook build in `storybook-static/` |
|
|
150
|
+
|
|
151
|
+
## Publishing
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npm run build && npm pack --dry-run # check which files get published
|
|
155
|
+
npm publish # prepublishOnly runs typecheck, tests, build and publint
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`publishConfig` already publishes the scoped package as public. If you later publish from GitHub Actions (trusted publishing with OIDC), add `--provenance` to sign the package origin.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export type AvatarSize = "sm" | "md" | "lg" | "xl";
|
|
3
|
+
export type AvatarShape = "circle" | "square";
|
|
4
|
+
export interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
5
|
+
/** Image URL. When missing or failing to load, initials from `name` are shown */
|
|
6
|
+
src?: string;
|
|
7
|
+
/** Alternative text of the image. Defaults to `name` */
|
|
8
|
+
alt?: string;
|
|
9
|
+
/** Full name, used to compute the initials and the fallback accessible label */
|
|
10
|
+
name?: string;
|
|
11
|
+
/** Dimensions */
|
|
12
|
+
size?: AvatarSize;
|
|
13
|
+
/** Outline shape */
|
|
14
|
+
shape?: AvatarShape;
|
|
15
|
+
}
|
|
16
|
+
/** Returns up to two uppercase initials from a name ("Ada Lovelace" -> "AL"). */
|
|
17
|
+
export declare function getInitials(name?: string): string;
|
|
18
|
+
declare function Avatar({ src, alt, name, size, shape, className, ...rest }: AvatarProps): import("react").JSX.Element;
|
|
19
|
+
export default Avatar;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { cx } from "../../utils/cx.js";
|
|
3
|
+
import './styles.css';/* empty css */
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/components/atoms/avatar/index.tsx
|
|
6
|
+
/** Returns up to two uppercase initials from a name ("Ada Lovelace" -> "AL"). */
|
|
7
|
+
function getInitials(name = "") {
|
|
8
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
9
|
+
if (parts.length === 0) return "";
|
|
10
|
+
return (parts[0].charAt(0) + (parts.length > 1 ? parts[parts.length - 1].charAt(0) : "")).toUpperCase();
|
|
11
|
+
}
|
|
12
|
+
function Avatar({ src, alt, name, size = "md", shape = "circle", className, ...rest }) {
|
|
13
|
+
const [failed, setFailed] = useState(false);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setFailed(false);
|
|
16
|
+
}, [src]);
|
|
17
|
+
const showImage = Boolean(src) && !failed;
|
|
18
|
+
const label = alt ?? name;
|
|
19
|
+
const classes = cx("ds-avatar", `ds-avatar--${size}`, `ds-avatar--${shape}`, className);
|
|
20
|
+
if (showImage) return /* @__PURE__ */ jsx("span", {
|
|
21
|
+
className: classes,
|
|
22
|
+
...rest,
|
|
23
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
24
|
+
className: "ds-avatar__image",
|
|
25
|
+
src,
|
|
26
|
+
alt: label ?? "",
|
|
27
|
+
onError: () => setFailed(true)
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
return /* @__PURE__ */ jsx("span", {
|
|
31
|
+
className: cx(classes, "ds-avatar--fallback"),
|
|
32
|
+
role: "img",
|
|
33
|
+
"aria-label": label || void 0,
|
|
34
|
+
...rest,
|
|
35
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
36
|
+
className: "ds-avatar__initials",
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
children: getInitials(name)
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export { Avatar as default, getInitials };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsx"],"sources":["../../../../src/components/atoms/avatar/index.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport type { HTMLAttributes } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\nexport type AvatarSize = \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type AvatarShape = \"circle\" | \"square\";\n\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {\n /** Image URL. When missing or failing to load, initials from `name` are shown */\n src?: string;\n /** Alternative text of the image. Defaults to `name` */\n alt?: string;\n /** Full name, used to compute the initials and the fallback accessible label */\n name?: string;\n /** Dimensions */\n size?: AvatarSize;\n /** Outline shape */\n shape?: AvatarShape;\n}\n\n/** Returns up to two uppercase initials from a name (\"Ada Lovelace\" -> \"AL\"). */\nexport function getInitials(name = \"\"): string {\n const parts = name.trim().split(/\\s+/).filter(Boolean);\n if (parts.length === 0) return \"\";\n const first = parts[0].charAt(0);\n const last = parts.length > 1 ? parts[parts.length - 1].charAt(0) : \"\";\n return (first + last).toUpperCase();\n}\n\nfunction Avatar({\n src,\n alt,\n name,\n size = \"md\",\n shape = \"circle\",\n className,\n ...rest\n}: AvatarProps) {\n const [failed, setFailed] = useState(false);\n\n useEffect(() => {\n setFailed(false);\n }, [src]);\n\n const showImage = Boolean(src) && !failed;\n const label = alt ?? name;\n const classes = cx(\"ds-avatar\", `ds-avatar--${size}`, `ds-avatar--${shape}`, className);\n\n if (showImage) {\n return (\n <span className={classes} {...rest}>\n <img className=\"ds-avatar__image\" src={src} alt={label ?? \"\"} onError={() => setFailed(true)} />\n </span>\n );\n }\n\n return (\n <span\n className={cx(classes, \"ds-avatar--fallback\")}\n role=\"img\"\n aria-label={label || undefined}\n {...rest}\n >\n <span className=\"ds-avatar__initials\" aria-hidden=\"true\">\n {getInitials(name)}\n </span>\n </span>\n );\n}\n\nexport default Avatar;\n"],"mappings":";;;;;;AAsBA,SAAgB,YAAY,OAAO,IAAY;CAC7C,MAAM,QAAQ,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO;CACrD,IAAI,MAAM,WAAW,GAAG,OAAO;CAG/B,QAFc,MAAM,EAAE,CAAC,OAAO,CAEtB,KADK,MAAM,SAAS,IAAI,MAAM,MAAM,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,IAAA,CAC9C,YAAY;AACpC;AAEA,SAAS,OAAO,EACd,KACA,KACA,MACA,OAAO,MACP,QAAQ,UACR,WACA,GAAG,QACW;CACd,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAE1C,gBAAgB;EACd,UAAU,KAAK;CACjB,GAAG,CAAC,GAAG,CAAC;CAER,MAAM,YAAY,QAAQ,GAAG,KAAK,CAAC;CACnC,MAAM,QAAQ,OAAO;CACrB,MAAM,UAAU,GAAG,aAAa,cAAc,QAAQ,cAAc,SAAS,SAAS;CAEtF,IAAI,WACF,OACEA,oBAAC,QAAD;EAAM,WAAW;EAAS,GAAI;EAC5B,UAAAA,oBAAC,OAAD;GAAK,WAAU;GAAwB;GAAK,KAAK,SAAS;GAAI,eAAe,UAAU,IAAI;EAAI,CAAA;CAC3F,CAAA;CAIV,OACEA,oBAAC,QAAD;EACE,WAAW,GAAG,SAAS,qBAAqB;EAC5C,MAAK;EACL,cAAY,SAAS,KAAA;EACrB,GAAI;EAEJ,UAAAA,oBAAC,QAAD;GAAM,WAAU;GAAsB,eAAY;GAC/C,UAAA,YAAY,IAAI;EACb,CAAA;CACF,CAAA;AAEV"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.ds-avatar {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
width: var(--control-height-md);
|
|
7
|
+
height: var(--control-height-md);
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
background: var(--color-neutral);
|
|
10
|
+
color: var(--color-text-muted);
|
|
11
|
+
font-family: var(--font-sans);
|
|
12
|
+
font-size: var(--font-size-sm);
|
|
13
|
+
font-weight: var(--font-weight-semibold);
|
|
14
|
+
line-height: 1;
|
|
15
|
+
vertical-align: middle;
|
|
16
|
+
user-select: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ds-avatar--circle {
|
|
20
|
+
border-radius: var(--radius-full);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ds-avatar--square {
|
|
24
|
+
border-radius: var(--radius-md);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ds-avatar--sm {
|
|
28
|
+
width: var(--space-6);
|
|
29
|
+
height: var(--space-6);
|
|
30
|
+
font-size: var(--font-size-xs);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ds-avatar--lg {
|
|
34
|
+
width: var(--space-12);
|
|
35
|
+
height: var(--space-12);
|
|
36
|
+
font-size: var(--font-size-lg);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ds-avatar--xl {
|
|
40
|
+
width: var(--space-16);
|
|
41
|
+
height: var(--space-16);
|
|
42
|
+
font-size: var(--font-size-xl);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ds-avatar__image {
|
|
46
|
+
display: block;
|
|
47
|
+
width: 100%;
|
|
48
|
+
height: 100%;
|
|
49
|
+
object-fit: cover;
|
|
50
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HTMLAttributes, MouseEvent } from "react";
|
|
2
|
+
export type BadgeVariant = "neutral" | "primary" | "success" | "warning" | "danger" | "info";
|
|
3
|
+
export type BadgeSize = "sm" | "md";
|
|
4
|
+
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
5
|
+
/** Color scheme */
|
|
6
|
+
variant?: BadgeVariant;
|
|
7
|
+
/** Height and font size */
|
|
8
|
+
size?: BadgeSize;
|
|
9
|
+
/** Show a small dot before the text */
|
|
10
|
+
dot?: boolean;
|
|
11
|
+
/** When provided, renders a remove button that calls this handler */
|
|
12
|
+
onRemove?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
13
|
+
/** Accessible label of the remove button */
|
|
14
|
+
removeLabel?: string;
|
|
15
|
+
}
|
|
16
|
+
declare function Badge({ variant, size, dot, onRemove, removeLabel, className, children, ...rest }: BadgeProps): import("react").JSX.Element;
|
|
17
|
+
export default Badge;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './styles.css';/* empty css */
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/atoms/badge/index.tsx
|
|
5
|
+
function Badge({ variant = "neutral", size = "md", dot = false, onRemove, removeLabel = "Remove", className, children, ...rest }) {
|
|
6
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
7
|
+
className: cx("ds-badge", `ds-badge--${variant}`, `ds-badge--${size}`, className),
|
|
8
|
+
...rest,
|
|
9
|
+
children: [
|
|
10
|
+
dot && /* @__PURE__ */ jsx("span", {
|
|
11
|
+
className: "ds-badge__dot",
|
|
12
|
+
"aria-hidden": "true"
|
|
13
|
+
}),
|
|
14
|
+
children,
|
|
15
|
+
onRemove && /* @__PURE__ */ jsx("button", {
|
|
16
|
+
type: "button",
|
|
17
|
+
className: "ds-badge__remove",
|
|
18
|
+
"aria-label": removeLabel,
|
|
19
|
+
onClick: onRemove,
|
|
20
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
21
|
+
viewBox: "0 0 16 16",
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
focusable: "false",
|
|
24
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
25
|
+
d: "M4 4l8 8M12 4l-8 8",
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
strokeWidth: "1.5",
|
|
28
|
+
strokeLinecap: "round"
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export { Badge as default };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsxs","_jsx"],"sources":["../../../../src/components/atoms/badge/index.tsx"],"sourcesContent":["import type { HTMLAttributes, MouseEvent } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\nexport type BadgeVariant = \"neutral\" | \"primary\" | \"success\" | \"warning\" | \"danger\" | \"info\";\nexport type BadgeSize = \"sm\" | \"md\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n /** Color scheme */\n variant?: BadgeVariant;\n /** Height and font size */\n size?: BadgeSize;\n /** Show a small dot before the text */\n dot?: boolean;\n /** When provided, renders a remove button that calls this handler */\n onRemove?: (event: MouseEvent<HTMLButtonElement>) => void;\n /** Accessible label of the remove button */\n removeLabel?: string;\n}\n\nfunction Badge({\n variant = \"neutral\",\n size = \"md\",\n dot = false,\n onRemove,\n removeLabel = \"Remove\",\n className,\n children,\n ...rest\n}: BadgeProps) {\n return (\n <span className={cx(\"ds-badge\", `ds-badge--${variant}`, `ds-badge--${size}`, className)} {...rest}>\n {dot && <span className=\"ds-badge__dot\" aria-hidden=\"true\" />}\n {children}\n {onRemove && (\n <button type=\"button\" className=\"ds-badge__remove\" aria-label={removeLabel} onClick={onRemove}>\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M4 4l8 8M12 4l-8 8\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n </button>\n )}\n </span>\n );\n}\n\nexport default Badge;\n"],"mappings":";;;;AAoBA,SAAS,MAAM,EACb,UAAU,WACV,OAAO,MACP,MAAM,OACN,UACA,cAAc,UACd,WACA,UACA,GAAG,QACU;CACb,OACEA,qBAAC,QAAD;EAAM,WAAW,GAAG,YAAY,aAAa,WAAW,aAAa,QAAQ,SAAS;EAAG,GAAI;EAA7F,UAAA;GACG,OAAOC,oBAAC,QAAD;IAAM,WAAU;IAAgB,eAAY;GAAQ,CAAA;GAC3D;GACA,YACCA,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAAmB,cAAY;IAAa,SAAS;IACnF,UAAAA,oBAAC,OAAD;KAAK,SAAQ;KAAY,eAAY;KAAO,WAAU;KACpD,UAAAA,oBAAC,QAAD;MAAM,GAAE;MAAqB,QAAO;MAAe,aAAY;MAAM,eAAc;KAAS,CAAA;IACzF,CAAA;GACC,CAAA;EAEN;;AAEV"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
.ds-badge {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--space-1);
|
|
5
|
+
height: var(--space-6);
|
|
6
|
+
padding: 0 var(--space-2);
|
|
7
|
+
border-radius: var(--radius-full);
|
|
8
|
+
font-family: var(--font-sans);
|
|
9
|
+
font-size: var(--font-size-xs);
|
|
10
|
+
font-weight: var(--font-weight-medium);
|
|
11
|
+
line-height: 1;
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
vertical-align: middle;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ds-badge--sm {
|
|
17
|
+
height: var(--space-5);
|
|
18
|
+
padding: 0 var(--space-1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ds-badge__dot {
|
|
22
|
+
width: var(--space-2);
|
|
23
|
+
height: var(--space-2);
|
|
24
|
+
border-radius: var(--radius-full);
|
|
25
|
+
background: currentColor;
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ds-badge__remove {
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
width: var(--icon-size-sm);
|
|
34
|
+
height: var(--icon-size-sm);
|
|
35
|
+
margin-right: calc(var(--space-1) * -1);
|
|
36
|
+
padding: 0;
|
|
37
|
+
border: 0;
|
|
38
|
+
border-radius: var(--radius-full);
|
|
39
|
+
background: transparent;
|
|
40
|
+
color: inherit;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
transition: background-color var(--duration-fast) var(--easing-standard);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ds-badge__remove svg {
|
|
46
|
+
width: 75%;
|
|
47
|
+
height: 75%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ds-badge__remove:hover {
|
|
51
|
+
background: var(--color-neutral-hover);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ds-badge__remove:focus-visible {
|
|
55
|
+
outline: var(--border-width-2) solid var(--color-focus-ring);
|
|
56
|
+
outline-offset: 2px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Variants */
|
|
60
|
+
.ds-badge--neutral {
|
|
61
|
+
background: var(--color-neutral);
|
|
62
|
+
color: var(--color-text);
|
|
63
|
+
}
|
|
64
|
+
.ds-badge--primary {
|
|
65
|
+
background: var(--color-primary-subtle);
|
|
66
|
+
color: var(--color-primary-text);
|
|
67
|
+
}
|
|
68
|
+
.ds-badge--success {
|
|
69
|
+
background: var(--color-success-subtle);
|
|
70
|
+
color: var(--color-success-text);
|
|
71
|
+
}
|
|
72
|
+
.ds-badge--warning {
|
|
73
|
+
background: var(--color-warning-subtle);
|
|
74
|
+
color: var(--color-warning-text);
|
|
75
|
+
}
|
|
76
|
+
.ds-badge--danger {
|
|
77
|
+
background: var(--color-danger-subtle);
|
|
78
|
+
color: var(--color-danger-text);
|
|
79
|
+
}
|
|
80
|
+
.ds-badge--info {
|
|
81
|
+
background: var(--color-info-subtle);
|
|
82
|
+
color: var(--color-info-text);
|
|
83
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes } from "react";
|
|
2
|
+
export type ButtonVariant = "primary" | "secondary" | "ghost" | "danger";
|
|
3
|
+
export type ButtonSize = "sm" | "md" | "lg";
|
|
4
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
/** Visual style */
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
/** Height and padding, from the control-size tokens */
|
|
8
|
+
size?: ButtonSize;
|
|
9
|
+
/** Stretch to the container width */
|
|
10
|
+
fullWidth?: boolean;
|
|
11
|
+
/** Square button for a single icon (pass `aria-label`) */
|
|
12
|
+
iconOnly?: boolean;
|
|
13
|
+
type?: "button" | "submit" | "reset";
|
|
14
|
+
}
|
|
15
|
+
declare function Button({ variant, size, fullWidth, iconOnly, type, className, children, ...rest }: ButtonProps): import("react").JSX.Element;
|
|
16
|
+
export default Button;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import './styles.css';/* empty css */
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/atoms/button/index.tsx
|
|
4
|
+
function Button({ variant = "secondary", size = "md", fullWidth = false, iconOnly = false, type = "button", className = "", children, ...rest }) {
|
|
5
|
+
const classes = [
|
|
6
|
+
"ds-button",
|
|
7
|
+
`ds-button--${variant}`,
|
|
8
|
+
`ds-button--${size}`,
|
|
9
|
+
fullWidth ? "ds-button--full" : "",
|
|
10
|
+
iconOnly ? "ds-button--icon" : "",
|
|
11
|
+
className
|
|
12
|
+
].filter(Boolean).join(" ");
|
|
13
|
+
return /* @__PURE__ */ jsx("button", {
|
|
14
|
+
type,
|
|
15
|
+
className: classes,
|
|
16
|
+
...rest,
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export { Button as default };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsx"],"sources":["../../../../src/components/atoms/button/index.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes } from \"react\";\nimport \"./styles.css\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"danger\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual style */\n variant?: ButtonVariant;\n /** Height and padding, from the control-size tokens */\n size?: ButtonSize;\n /** Stretch to the container width */\n fullWidth?: boolean;\n /** Square button for a single icon (pass `aria-label`) */\n iconOnly?: boolean;\n type?: \"button\" | \"submit\" | \"reset\";\n}\n\nfunction Button({\n variant = \"secondary\",\n size = \"md\",\n fullWidth = false,\n iconOnly = false,\n type = \"button\",\n className = \"\",\n children,\n ...rest\n}: ButtonProps) {\n const classes = [\n \"ds-button\",\n `ds-button--${variant}`,\n `ds-button--${size}`,\n fullWidth ? \"ds-button--full\" : \"\",\n iconOnly ? \"ds-button--icon\" : \"\",\n className,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <button type={type} className={classes} {...rest}>\n {children}\n </button>\n );\n}\n\nexport default Button;\n"],"mappings":";;;AAkBA,SAAS,OAAO,EACd,UAAU,aACV,OAAO,MACP,YAAY,OACZ,WAAW,OACX,OAAO,UACP,YAAY,IACZ,UACA,GAAG,QACW;CACd,MAAM,UAAU;EACd;EACA,cAAc;EACd,cAAc;EACd,YAAY,oBAAoB;EAChC,WAAW,oBAAoB;EAC/B;CACF,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;CAEX,OACEA,oBAAC,UAAD;EAAc;EAAM,WAAW;EAAS,GAAI;EACzC;CACK,CAAA;AAEZ"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
.ds-button {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
gap: var(--space-2);
|
|
6
|
+
height: var(--control-height-md);
|
|
7
|
+
padding: 0 var(--control-padding-x-md);
|
|
8
|
+
border: var(--border-width-1) solid transparent;
|
|
9
|
+
border-radius: var(--radius-md);
|
|
10
|
+
font-family: var(--font-sans);
|
|
11
|
+
font-size: var(--font-size-sm);
|
|
12
|
+
font-weight: var(--font-weight-medium);
|
|
13
|
+
line-height: 1;
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
user-select: none;
|
|
17
|
+
transition:
|
|
18
|
+
background-color var(--duration-fast) var(--easing-standard),
|
|
19
|
+
border-color var(--duration-fast) var(--easing-standard),
|
|
20
|
+
color var(--duration-fast) var(--easing-standard);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ds-button:disabled {
|
|
24
|
+
cursor: not-allowed;
|
|
25
|
+
opacity: 0.5;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Sizes */
|
|
29
|
+
.ds-button--sm {
|
|
30
|
+
height: var(--control-height-sm);
|
|
31
|
+
padding: 0 var(--control-padding-x-sm);
|
|
32
|
+
font-size: var(--font-size-xs);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ds-button--lg {
|
|
36
|
+
height: var(--control-height-lg);
|
|
37
|
+
padding: 0 var(--control-padding-x-lg);
|
|
38
|
+
font-size: var(--font-size-md);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ds-button--full {
|
|
42
|
+
width: 100%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ds-button--icon {
|
|
46
|
+
padding: 0;
|
|
47
|
+
aspect-ratio: 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Variants */
|
|
51
|
+
.ds-button--primary {
|
|
52
|
+
background: var(--color-primary);
|
|
53
|
+
color: var(--color-text-on-primary);
|
|
54
|
+
}
|
|
55
|
+
.ds-button--primary:hover:not(:disabled) { background: var(--color-primary-hover); }
|
|
56
|
+
.ds-button--primary:active:not(:disabled) { background: var(--color-primary-active); }
|
|
57
|
+
|
|
58
|
+
.ds-button--secondary {
|
|
59
|
+
background: var(--color-surface);
|
|
60
|
+
border-color: var(--color-border-strong);
|
|
61
|
+
color: var(--color-text);
|
|
62
|
+
}
|
|
63
|
+
.ds-button--secondary:hover:not(:disabled) { background: var(--color-neutral); }
|
|
64
|
+
.ds-button--secondary:active:not(:disabled) { background: var(--color-neutral-hover); }
|
|
65
|
+
|
|
66
|
+
.ds-button--ghost {
|
|
67
|
+
background: transparent;
|
|
68
|
+
color: var(--color-text);
|
|
69
|
+
}
|
|
70
|
+
.ds-button--ghost:hover:not(:disabled) { background: var(--color-neutral); }
|
|
71
|
+
.ds-button--ghost:active:not(:disabled) { background: var(--color-neutral-hover); }
|
|
72
|
+
|
|
73
|
+
.ds-button--danger {
|
|
74
|
+
background: var(--color-danger);
|
|
75
|
+
color: var(--color-text-on-primary);
|
|
76
|
+
}
|
|
77
|
+
.ds-button--danger:hover:not(:disabled) { background: var(--color-danger-hover); }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
3
|
+
/** Text or content shown next to the box; clicking it toggles the checkbox */
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
/** Shows the mixed state (sets the native `indeterminate` property and `aria-checked="mixed"`) */
|
|
6
|
+
indeterminate?: boolean;
|
|
7
|
+
/** Marks the value as invalid (sets `aria-invalid` and a danger border) */
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
/** Class name applied to the root element (the native input receives the rest of the props) */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
13
|
+
export default Checkbox;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useEffect, useRef } from "react";
|
|
2
|
+
import { cx } from "../../utils/cx.js";
|
|
3
|
+
import './styles.css';/* empty css */
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/atoms/checkbox/index.tsx
|
|
6
|
+
var Checkbox = forwardRef(function Checkbox({ label, indeterminate = false, invalid = false, className, disabled, style, ...rest }, forwardedRef) {
|
|
7
|
+
const innerRef = useRef(null);
|
|
8
|
+
const setRef = useCallback((node) => {
|
|
9
|
+
innerRef.current = node;
|
|
10
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
11
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
12
|
+
}, [forwardedRef]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (innerRef.current) innerRef.current.indeterminate = indeterminate;
|
|
15
|
+
});
|
|
16
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
17
|
+
className: cx("ds-checkbox", invalid && "ds-checkbox--invalid", disabled && "ds-checkbox--disabled", indeterminate && "ds-checkbox--indeterminate", className),
|
|
18
|
+
style,
|
|
19
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
20
|
+
className: "ds-checkbox__control",
|
|
21
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
22
|
+
ref: setRef,
|
|
23
|
+
type: "checkbox",
|
|
24
|
+
className: "ds-checkbox__input",
|
|
25
|
+
disabled,
|
|
26
|
+
"aria-invalid": invalid || void 0,
|
|
27
|
+
"aria-checked": indeterminate ? "mixed" : void 0,
|
|
28
|
+
...rest
|
|
29
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
30
|
+
className: "ds-checkbox__box",
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
children: [/* @__PURE__ */ jsx("svg", {
|
|
33
|
+
className: "ds-checkbox__check",
|
|
34
|
+
viewBox: "0 0 16 16",
|
|
35
|
+
fill: "none",
|
|
36
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
37
|
+
d: "M3.5 8.5l3 3 6-7",
|
|
38
|
+
stroke: "currentColor",
|
|
39
|
+
strokeWidth: "2",
|
|
40
|
+
strokeLinecap: "round",
|
|
41
|
+
strokeLinejoin: "round"
|
|
42
|
+
})
|
|
43
|
+
}), /* @__PURE__ */ jsx("svg", {
|
|
44
|
+
className: "ds-checkbox__dash",
|
|
45
|
+
viewBox: "0 0 16 16",
|
|
46
|
+
fill: "none",
|
|
47
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
48
|
+
d: "M4 8h8",
|
|
49
|
+
stroke: "currentColor",
|
|
50
|
+
strokeWidth: "2",
|
|
51
|
+
strokeLinecap: "round"
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
})]
|
|
55
|
+
}), label != null && /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: "ds-checkbox__label",
|
|
57
|
+
children: label
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
export { Checkbox as default };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsxs","_jsx"],"sources":["../../../../src/components/atoms/checkbox/index.tsx"],"sourcesContent":["import { forwardRef, useCallback, useEffect, useRef } from \"react\";\nimport type { InputHTMLAttributes, ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport \"./styles.css\";\n\nexport interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\"> {\n /** Text or content shown next to the box; clicking it toggles the checkbox */\n label?: ReactNode;\n /** Shows the mixed state (sets the native `indeterminate` property and `aria-checked=\"mixed\"`) */\n indeterminate?: boolean;\n /** Marks the value as invalid (sets `aria-invalid` and a danger border) */\n invalid?: boolean;\n /** Class name applied to the root element (the native input receives the rest of the props) */\n className?: string;\n}\n\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { label, indeterminate = false, invalid = false, className, disabled, style, ...rest },\n forwardedRef\n) {\n const innerRef = useRef<HTMLInputElement | null>(null);\n\n const setRef = useCallback(\n (node: HTMLInputElement | null) => {\n innerRef.current = node;\n if (typeof forwardedRef === \"function\") forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n },\n [forwardedRef]\n );\n\n // Runs after every render so the DOM property stays in sync even after a user click clears it.\n useEffect(() => {\n if (innerRef.current) innerRef.current.indeterminate = indeterminate;\n });\n\n return (\n <label\n className={cx(\n \"ds-checkbox\",\n invalid && \"ds-checkbox--invalid\",\n disabled && \"ds-checkbox--disabled\",\n indeterminate && \"ds-checkbox--indeterminate\",\n className\n )}\n style={style}\n >\n <span className=\"ds-checkbox__control\">\n <input\n ref={setRef}\n type=\"checkbox\"\n className=\"ds-checkbox__input\"\n disabled={disabled}\n aria-invalid={invalid || undefined}\n aria-checked={indeterminate ? \"mixed\" : undefined}\n {...rest}\n />\n <span className=\"ds-checkbox__box\" aria-hidden=\"true\">\n <svg className=\"ds-checkbox__check\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path d=\"M3.5 8.5l3 3 6-7\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n <svg className=\"ds-checkbox__dash\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path d=\"M4 8h8\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" />\n </svg>\n </span>\n </span>\n {label != null && <span className=\"ds-checkbox__label\">{label}</span>}\n </label>\n );\n});\n\nexport default Checkbox;\n"],"mappings":";;;;;AAgBA,IAAM,WAAW,WAA4C,SAAS,SACpE,EAAE,OAAO,gBAAgB,OAAO,UAAU,OAAO,WAAW,UAAU,OAAO,GAAG,QAChF,cACA;CACA,MAAM,WAAW,OAAgC,IAAI;CAErD,MAAM,SAAS,aACZ,SAAkC;EACjC,SAAS,UAAU;EACnB,IAAI,OAAO,iBAAiB,YAAY,aAAa,IAAI;OACpD,IAAI,cAAc,aAAa,UAAU;CAChD,GACA,CAAC,YAAY,CACf;CAGA,gBAAgB;EACd,IAAI,SAAS,SAAS,SAAS,QAAQ,gBAAgB;CACzD,CAAC;CAED,OACEA,qBAAC,SAAD;EACE,WAAW,GACT,eACA,WAAW,wBACX,YAAY,yBACZ,iBAAiB,8BACjB,SACF;EACO;EART,UAAA,CAUEA,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACEC,oBAAC,SAAD;IACE,KAAK;IACL,MAAK;IACL,WAAU;IACA;IACV,gBAAc,WAAW,KAAA;IACzB,gBAAc,gBAAgB,UAAU,KAAA;IACxC,GAAI;GACL,CAAA,GACDD,qBAAC,QAAD;IAAM,WAAU;IAAmB,eAAY;IAA/C,UAAA,CACEC,oBAAC,OAAD;KAAK,WAAU;KAAqB,SAAQ;KAAY,MAAK;KAC3D,UAAAA,oBAAC,QAAD;MAAM,GAAE;MAAmB,QAAO;MAAe,aAAY;MAAI,eAAc;MAAQ,gBAAe;KAAS,CAAA;IAC5G,CAAA,GACLA,oBAAC,OAAD;KAAK,WAAU;KAAoB,SAAQ;KAAY,MAAK;KAC1D,UAAAA,oBAAC,QAAD;MAAM,GAAE;MAAS,QAAO;MAAe,aAAY;MAAI,eAAc;KAAS,CAAA;IAC3E,CAAA,CACD;GACF,CAAA,CAAA;EACL,CAAA,GAAA,SAAS,QAAQA,oBAAC,QAAD;GAAM,WAAU;GAAsB,UAAA;EAAY,CAAA,CAC/D;;AAEX,CAAC"}
|