@ksojecki/purpose-ui 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +123 -2
- package/assets/fonts/Karla[wght].ttf +0 -0
- package/assets/fonts/OFL.txt +93 -0
- package/dist/Alert-D-5k0maf.js +23 -0
- package/dist/Button-T8UI5igR.js +112 -0
- package/dist/Dropdown-BZKzAbKB.js +56 -0
- package/dist/Heading-CWDWXU_n.js +27 -0
- package/dist/IconButton-P7nSooA3.js +18 -0
- package/dist/Link-9mNYgEzY.js +36 -0
- package/dist/Paragraph-DFwfb2Yt.js +14 -0
- package/dist/Switch-CI8vMkGz.js +84 -0
- package/dist/actions/Button.d.ts +69 -0
- package/dist/actions/ButtonGroup.d.ts +20 -0
- package/dist/actions/IconActionButtons.d.ts +34 -0
- package/dist/actions/IconButton.d.ts +21 -0
- package/dist/actions/index.d.ts +10 -0
- package/dist/actions/index.js +41 -0
- package/dist/classNames-x6JVYA2t.js +5 -0
- package/dist/data/DataTable.d.ts +47 -0
- package/dist/data/Metric.d.ts +46 -0
- package/dist/data/Table.d.ts +33 -0
- package/dist/data/index.d.ts +8 -0
- package/dist/data/index.js +85 -0
- package/dist/feedback/Alert.d.ts +23 -0
- package/dist/feedback/Badge.d.ts +23 -0
- package/dist/feedback/ConfirmDeletePanel.d.ts +32 -0
- package/dist/feedback/EmptyState.d.ts +22 -0
- package/dist/feedback/Progress.d.ts +24 -0
- package/dist/feedback/Skeleton.d.ts +10 -0
- package/dist/feedback/Spinner.d.ts +16 -0
- package/dist/feedback/Toast.d.ts +48 -0
- package/dist/feedback/Tooltip.d.ts +21 -0
- package/dist/feedback/index.d.ts +15 -0
- package/dist/feedback/index.js +138 -0
- package/dist/forms/Checkbox.d.ts +16 -0
- package/dist/forms/DatePicker.d.ts +51 -0
- package/dist/forms/Field.d.ts +65 -0
- package/dist/forms/FileInput.d.ts +20 -0
- package/dist/forms/FilterBar.d.ts +21 -0
- package/dist/forms/FilterRow.d.ts +20 -0
- package/dist/forms/FormActions.d.ts +28 -0
- package/dist/forms/FormField.d.ts +39 -0
- package/dist/forms/Input.d.ts +20 -0
- package/dist/forms/Radio.d.ts +52 -0
- package/dist/forms/Range.d.ts +24 -0
- package/dist/forms/SegmentedControl.d.ts +33 -0
- package/dist/forms/Select.d.ts +23 -0
- package/dist/forms/Switch.d.ts +15 -0
- package/dist/forms/Textarea.d.ts +20 -0
- package/dist/forms/TimePicker.d.ts +29 -0
- package/dist/forms/index.d.ts +21 -0
- package/dist/forms/index.js +429 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +2 -0
- package/dist/icons-CMOARHwx.js +18 -0
- package/dist/internal/classNames.d.ts +1 -0
- package/dist/internal/purpose.d.ts +7 -0
- package/dist/layout/BottomSheet.d.ts +25 -0
- package/dist/layout/Card.d.ts +22 -0
- package/dist/layout/Disclosure.d.ts +18 -0
- package/dist/layout/Divider.d.ts +16 -0
- package/dist/layout/Page/Content.d.ts +11 -0
- package/dist/layout/Page/Page.d.ts +6 -0
- package/dist/layout/Page/index.d.ts +19 -0
- package/dist/layout/PageContainer.d.ts +18 -0
- package/dist/layout/PageHeader.d.ts +25 -0
- package/dist/layout/Section.d.ts +22 -0
- package/dist/layout/index.d.ts +13 -0
- package/dist/layout/index.js +173 -0
- package/dist/navigation/Dropdown.d.ts +47 -0
- package/dist/navigation/Link.d.ts +32 -0
- package/dist/navigation/Menu.d.ts +89 -0
- package/dist/navigation/NavMenu.d.ts +56 -0
- package/dist/navigation/index.d.ts +9 -0
- package/dist/navigation/index.js +128 -0
- package/dist/navigation/popoverFade.d.ts +5 -0
- package/dist/overlays/ConsentBanner/ConsentBanner.d.ts +35 -0
- package/dist/overlays/ConsentBanner/index.d.ts +1 -0
- package/dist/overlays/ConsentSettings/ConsentSettings.d.ts +48 -0
- package/dist/overlays/ConsentSettings/index.d.ts +1 -0
- package/dist/overlays/ModalWindow/ModalWindow.d.ts +60 -0
- package/dist/overlays/ModalWindow/index.d.ts +3 -0
- package/dist/overlays/index.d.ts +8 -0
- package/dist/overlays/index.js +195 -0
- package/dist/typography/Heading/Heading.d.ts +24 -0
- package/dist/typography/Heading/index.d.ts +1 -0
- package/dist/typography/Paragraph.d.ts +16 -0
- package/dist/typography/Prose.d.ts +17 -0
- package/dist/typography/index.d.ts +8 -0
- package/dist/typography/index.js +12 -0
- package/package.json +121 -4
- package/styles/budget.css +9 -0
- package/styles/generic.css +9 -0
- package/styles/roadsign.css +9 -0
- package/styles/traffic.css +9 -0
- package/theme.css +341 -0
- package/themes/budget.css +103 -0
- package/themes/generic.css +103 -0
- package/themes/roadsign.css +103 -0
- package/themes/traffic.css +103 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kamil Sojecki
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,124 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ksojecki/purpose-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React components and daisyUI themes with semantic `purpose` props: buttons, forms, tables, feedback, navigation, overlays and page layout.
|
|
4
|
+
|
|
5
|
+
Documentation, with live examples and props for every component: [sojecki.pl/ui](https://sojecki.pl/ui/).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Stable releases are on npmjs:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @ksojecki/purpose-ui react react-dom react-router daisyui tailwindcss
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Peer dependencies: `react` and `react-dom` ^19, `react-router` ^8, `daisyui` ^5.6.0, `tailwindcss` ^4. The package is ESM only. `FormField` takes the result of react-hook-form's `register()` but does not depend on that package.
|
|
16
|
+
|
|
17
|
+
### Development builds
|
|
18
|
+
|
|
19
|
+
Builds from the `next` branch are published to GitHub Packages only, as `<next version>-next.<UTC timestamp>` under the `next` dist-tag. To use them, add the scope to your project's `.npmrc`:
|
|
20
|
+
|
|
21
|
+
```ini
|
|
22
|
+
@ksojecki:registry=https://npm.pkg.github.com
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
and the token reference to your user `~/.npmrc`:
|
|
26
|
+
|
|
27
|
+
```ini
|
|
28
|
+
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Set `NODE_AUTH_TOKEN` to a GitHub personal access token (classic) with `read:packages`. In GitHub Actions, use `GITHUB_TOKEN` with `packages: read` after granting the workflow repository access in the package settings. Pin an exact version (`pnpm add @ksojecki/purpose-ui@next` records it); dev versions exist only on GitHub Packages, so a missing scope mapping fails the install instead of silently installing a stable build. Stable versions are mirrored there too.
|
|
32
|
+
|
|
33
|
+
Before `0.2.0` the package was `@ksojecki/ui` on GitHub Packages. Replace the dependency and change imports from `@ksojecki/ui/<group>` to `@ksojecki/purpose-ui/<group>`; exports, components and props are unchanged.
|
|
34
|
+
|
|
35
|
+
## Set up styles
|
|
36
|
+
|
|
37
|
+
In your app's main stylesheet, import Tailwind, then one palette entry:
|
|
38
|
+
|
|
39
|
+
```css
|
|
40
|
+
@import 'tailwindcss';
|
|
41
|
+
@import '@ksojecki/purpose-ui/styles/generic.css';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Each entry loads daisyUI with its built-in themes off, the shared rules from `theme.css` (including the Karla font and motion utilities), one palette, and a Tailwind `@source` for the built components, so their classes are generated.
|
|
45
|
+
|
|
46
|
+
Palettes: `generic`, `budget`, `traffic`, `roadsign`. Each defines a light theme `<name>` and a dark theme `<name>-dark`. With no `data-theme` on `<html>`, the OS colour scheme decides. Set `data-theme="<name>"` or `"<name>-dark"` to force one. Use exactly one entry.
|
|
47
|
+
|
|
48
|
+
To compose the pieces yourself, import `@ksojecki/purpose-ui/theme.css` and one `@ksojecki/purpose-ui/themes/<name>.css` after `@plugin 'daisyui' { themes: false; }`, and add `@source '../node_modules/@ksojecki/purpose-ui/dist';`.
|
|
49
|
+
|
|
50
|
+
## Use
|
|
51
|
+
|
|
52
|
+
Import from a group subpath, never from the package root.
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { Button } from '@ksojecki/purpose-ui/actions';
|
|
56
|
+
import { Alert } from '@ksojecki/purpose-ui/feedback';
|
|
57
|
+
|
|
58
|
+
export function Example() {
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<Alert purpose="success">Saved.</Alert>
|
|
62
|
+
<Button purpose="save" type="submit">
|
|
63
|
+
Save
|
|
64
|
+
</Button>
|
|
65
|
+
</>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Choose a `purpose` (`ActionPurpose`, `StatusPurpose`, `BadgePurpose`), not a colour. `tone` and `variant` are escape hatches. Keep colours in theme tokens; do not use hex values or palette classes.
|
|
71
|
+
|
|
72
|
+
`Link`, `NavMenu`, `Menu` and the consent components render `react-router` links, so mount them inside a router.
|
|
73
|
+
|
|
74
|
+
## Icons
|
|
75
|
+
|
|
76
|
+
`@ksojecki/purpose-ui/icons` re-exports the whole [Tabler icon set](https://react-icons.github.io/react-icons/icons/tb/) from `react-icons/tb` (`TbPlus`, `TbTrash`, `TbBrandGoogle`, and the rest) plus the `IconType` type. `react-icons` is external and the package marks its JavaScript as side-effect free, so a bundler keeps only the icons you import. Import by name; do not use `import * as icons`, which pulls in all of them.
|
|
77
|
+
|
|
78
|
+
## Components
|
|
79
|
+
|
|
80
|
+
- `actions`: `Button`, `ButtonGroup`, `IconButton`, `EditButton`/`NewButton`/`DeleteButton`
|
|
81
|
+
- `forms`: `Field`, `FormField`, `FormActions`, `Input`, `Select`, `Textarea`, `Checkbox`, `Radio`/`RadioGroup`, `Switch`, `Range`, `FileInput`, `DatePicker`, `TimePicker`, `SegmentedControl`, `FilterBar`, `FilterRow`
|
|
82
|
+
- `feedback`: `Alert`, `Badge`, `Toast`, `Progress`, `Spinner`, `Skeleton`, `Tooltip`, `ConfirmDeletePanel`, `EmptyState`
|
|
83
|
+
- `typography`: `Heading`, `Paragraph`, `Prose`
|
|
84
|
+
- `layout`: `Page`, `PageContainer`, `PageHeader`, `Section`, `Card`, `Divider`, `Disclosure`, `BottomSheet`
|
|
85
|
+
- `navigation`: `Link`, `Menu`, `Dropdown`, `NavMenu`
|
|
86
|
+
- `overlays`: `ModalWindow`, `NativeDialog`, `ConsentBanner`, `ConsentSettings`
|
|
87
|
+
- `data`: `DataTable`, `Table`, `Metric`/`MetricGroup`
|
|
88
|
+
- `icons`: the Tabler icon set
|
|
89
|
+
|
|
90
|
+
Motion utilities (`animate-fade-in`, `animate-slide-up`, `animate-scale-in`) come from `theme.css` and switch off under `prefers-reduced-motion`.
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
MIT
|
|
95
|
+
|
|
96
|
+
## Working in this repository
|
|
97
|
+
|
|
98
|
+
Use Node 26 and pnpm 12. The repository pins their versions in `.node-version` and `package.json`.
|
|
99
|
+
|
|
100
|
+
Run `pnpm install --frozen-lockfile && pnpm dev:docs`, then open [localhost:4400](http://localhost:4400). The docs site in `docs/` is built with Astro, loads components from source and previews all four palettes in light and dark. It is not included in the package tarball. `pnpm build:docs` builds it; set `DOCS_BASE=/ui/` to serve it under a path.
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
pnpm install --frozen-lockfile
|
|
104
|
+
pnpm lint
|
|
105
|
+
pnpm format:check
|
|
106
|
+
pnpm typecheck
|
|
107
|
+
pnpm test
|
|
108
|
+
pnpm build
|
|
109
|
+
pnpm pack
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Vite builds the ESM entry points, and TypeScript emits the declarations alongside them in `dist/`. Specs run in Vitest with jsdom. See [AGENTS.md](./AGENTS.md) for contribution conventions.
|
|
113
|
+
|
|
114
|
+
## Releases
|
|
115
|
+
|
|
116
|
+
Work lands on `next`, the default PR branch. A PR that changes the published library includes a changeset (`pnpm changeset`).
|
|
117
|
+
|
|
118
|
+
- **Dev build:** each push to `next` with pending changesets publishes `<version>-next.<timestamp>` to GitHub Packages under `next`. The version is calculated from the pending changesets and is not committed. Publishing fails if `main` is not merged into `next`, or if the new version would sort below the current `next` build (for example after reverting the only `minor` changeset); add a changeset with a bump at least as large.
|
|
119
|
+
- **Promotion:** open a PR from `next` to `main` and merge it with a merge commit, not squash, so `main` stays an ancestor of `next`.
|
|
120
|
+
- **Stable release:** on `main`, the release workflow opens a Version packages PR that bumps the version and writes `CHANGELOG.md`. Merging it publishes the version to npmjs with provenance, mirrors the same tarball to GitHub Packages, and creates the `v<version>` GitHub release. Re-running a failed release publishes only what is missing. Other pushes to `main` publish nothing.
|
|
121
|
+
- **Hotfix:** branch from `main`, add a changeset, merge into `main`, then merge the Version packages PR.
|
|
122
|
+
- **Back-merge:** after every push to `main`, the release workflow opens a PR merging `main` into `next` (or leaves the open one, which follows `main`). Merge it with a merge commit; until then dev builds fail the ancestry check.
|
|
123
|
+
|
|
124
|
+
Owner setup: the `npm` environment (branch `main`) and the `github-packages` environment (branches `main`, `next`), the npmjs trusted publisher for `ksojecki/purpose-ui` and `release.yml` with environment `npm`, and "Allow GitHub Actions to create and approve pull requests" in Actions settings. Grant consuming repositories Actions read access in the GitHub Packages settings of `@ksojecki/purpose-ui`.
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2019 The Karla Project Authors (https://github.com/googlefonts/karla)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { t as e } from "./classNames-x6JVYA2t.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
// src/feedback/Alert.tsx
|
|
4
|
+
var n = {
|
|
5
|
+
info: "alert-info",
|
|
6
|
+
success: "alert-success",
|
|
7
|
+
warning: "alert-warning",
|
|
8
|
+
error: "alert-error"
|
|
9
|
+
}, r = {
|
|
10
|
+
solid: "",
|
|
11
|
+
soft: "alert-soft"
|
|
12
|
+
}, i = {
|
|
13
|
+
info: "status",
|
|
14
|
+
success: "status",
|
|
15
|
+
warning: "alert",
|
|
16
|
+
error: "alert"
|
|
17
|
+
}, a = ({ announce: a = !0, children: o, className: s, purpose: c = "info", role: l, variant: u = "solid", ...d }) => /* @__PURE__ */ t("div", {
|
|
18
|
+
role: a ? l ?? i[c] : void 0,
|
|
19
|
+
className: e("alert", "animate-fade-in", n[c], r[u], s),
|
|
20
|
+
...d,
|
|
21
|
+
children: o
|
|
22
|
+
});
|
|
23
|
+
export { a as t };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { t as e } from "./classNames-x6JVYA2t.js";
|
|
2
|
+
import { createContext as t, useContext as n } from "react";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
// src/internal/purpose.ts
|
|
5
|
+
var a = {
|
|
6
|
+
save: {
|
|
7
|
+
tone: "primary",
|
|
8
|
+
variant: "solid"
|
|
9
|
+
},
|
|
10
|
+
confirm: {
|
|
11
|
+
tone: "primary",
|
|
12
|
+
variant: "solid"
|
|
13
|
+
},
|
|
14
|
+
create: {
|
|
15
|
+
tone: "primary",
|
|
16
|
+
variant: "soft"
|
|
17
|
+
},
|
|
18
|
+
edit: {
|
|
19
|
+
tone: "neutral",
|
|
20
|
+
variant: "soft"
|
|
21
|
+
},
|
|
22
|
+
delete: {
|
|
23
|
+
tone: "error",
|
|
24
|
+
variant: "soft"
|
|
25
|
+
},
|
|
26
|
+
cancel: {
|
|
27
|
+
tone: "default",
|
|
28
|
+
variant: "solid"
|
|
29
|
+
},
|
|
30
|
+
neutral: {
|
|
31
|
+
tone: "default",
|
|
32
|
+
variant: "solid"
|
|
33
|
+
}
|
|
34
|
+
}, o = {
|
|
35
|
+
xs: "loading-xs",
|
|
36
|
+
sm: "loading-sm",
|
|
37
|
+
md: "loading-md",
|
|
38
|
+
lg: "loading-lg"
|
|
39
|
+
}, s = ({ className: t, label: n, size: i = "md", ...a }) => /* @__PURE__ */ r("span", {
|
|
40
|
+
...a,
|
|
41
|
+
"aria-hidden": !n || void 0,
|
|
42
|
+
className: e("loading loading-spinner", o[i], t),
|
|
43
|
+
role: n ? "status" : void 0,
|
|
44
|
+
children: n ? /* @__PURE__ */ r("span", {
|
|
45
|
+
className: "sr-only",
|
|
46
|
+
children: n
|
|
47
|
+
}) : null
|
|
48
|
+
}), c = "btn", l = {
|
|
49
|
+
solid: void 0,
|
|
50
|
+
soft: "btn-soft",
|
|
51
|
+
outline: "btn-outline"
|
|
52
|
+
}, u = {
|
|
53
|
+
default: "btn-default",
|
|
54
|
+
primary: "btn-primary",
|
|
55
|
+
secondary: "btn-secondary",
|
|
56
|
+
ghost: "btn-ghost",
|
|
57
|
+
neutral: "btn-neutral",
|
|
58
|
+
info: "btn-info",
|
|
59
|
+
success: "btn-success",
|
|
60
|
+
warning: "btn-warning",
|
|
61
|
+
error: "btn-error"
|
|
62
|
+
}, d = {
|
|
63
|
+
xs: "btn-xs",
|
|
64
|
+
sm: "btn-sm",
|
|
65
|
+
md: "",
|
|
66
|
+
lg: "btn-lg"
|
|
67
|
+
}, f = t(void 0);
|
|
68
|
+
function p({ size: e, children: t }) {
|
|
69
|
+
return /* @__PURE__ */ r(f.Provider, {
|
|
70
|
+
value: e,
|
|
71
|
+
children: t
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function m(e) {
|
|
75
|
+
let t = n(f);
|
|
76
|
+
return e ?? t ?? "md";
|
|
77
|
+
}
|
|
78
|
+
function h({ purpose: e, tone: t, variant: n }) {
|
|
79
|
+
let r = e ? a[e] : void 0;
|
|
80
|
+
return {
|
|
81
|
+
tone: t ?? r?.tone ?? "primary",
|
|
82
|
+
variant: n ?? r?.variant ?? "solid"
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function g({ className: t, fullWidth: n = !1, purpose: r, size: i = "md", square: a = !1, tone: o, variant: s }) {
|
|
86
|
+
let f = h({
|
|
87
|
+
purpose: r,
|
|
88
|
+
tone: o,
|
|
89
|
+
variant: s
|
|
90
|
+
});
|
|
91
|
+
return e(c, u[f.tone], l[f.variant], d[i], a ? "btn-square" : void 0, n ? "w-full" : void 0, t);
|
|
92
|
+
}
|
|
93
|
+
var _ = ({ children: e, className: t, disabled: n, fullWidth: a = !1, isLoading: o = !1, purpose: c, size: l, square: u, tone: d, variant: f, ...p }) => {
|
|
94
|
+
let h = m(l);
|
|
95
|
+
return /* @__PURE__ */ i("button", {
|
|
96
|
+
className: g({
|
|
97
|
+
className: t,
|
|
98
|
+
fullWidth: a,
|
|
99
|
+
purpose: c,
|
|
100
|
+
size: h,
|
|
101
|
+
square: u,
|
|
102
|
+
tone: d,
|
|
103
|
+
variant: f
|
|
104
|
+
}),
|
|
105
|
+
"aria-busy": o || void 0,
|
|
106
|
+
disabled: n || o,
|
|
107
|
+
type: "button",
|
|
108
|
+
...p,
|
|
109
|
+
children: [o ? /* @__PURE__ */ r(s, { size: "sm" }) : null, e]
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
export { m as a, h as i, p as n, s as o, g as r, a as s, _ as t };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { t as e } from "./Button-T8UI5igR.js";
|
|
2
|
+
import { t } from "./classNames-x6JVYA2t.js";
|
|
3
|
+
import { useEffect as n, useId as r, useRef as i, useState as a } from "react";
|
|
4
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
// src/navigation/popoverFade.ts
|
|
6
|
+
var l = "opacity-0 transition-[opacity,scale,translate,display,overlay] transition-discrete duration-(--motion-base) motion-reduce:transition-none [&:popover-open]:opacity-100 starting:[&:popover-open]:opacity-0", u = "backdrop:bg-base-content/0 backdrop:transition-[background-color,display,overlay] backdrop:transition-discrete backdrop:duration-(--motion-base) motion-reduce:backdrop:transition-none [&:popover-open]:backdrop:bg-(--overlay-backdrop) starting:[&:popover-open]:backdrop:bg-base-content/0", d = "max-md:opacity-0 max-md:transition-[opacity,scale,translate,display,overlay] max-md:transition-discrete max-md:duration-(--motion-base) max-md:motion-reduce:transition-none max-md:[&:popover-open]:opacity-100 max-md:starting:[&:popover-open]:opacity-0", f = "max-md:backdrop:bg-base-content/0 max-md:backdrop:transition-[background-color,display,overlay] max-md:backdrop:transition-discrete max-md:backdrop:duration-(--motion-base) max-md:motion-reduce:backdrop:transition-none max-md:[&:popover-open]:backdrop:bg-(--overlay-backdrop) max-md:starting:[&:popover-open]:backdrop:bg-base-content/0", p = "md:opacity-0 md:transition-[opacity,scale,translate,display,overlay] md:transition-discrete md:duration-(--motion-base) md:motion-reduce:transition-none md:[&:popover-open]:opacity-100 md:starting:[&:popover-open]:opacity-0", m = {
|
|
7
|
+
start: "bottom span-right",
|
|
8
|
+
end: "bottom span-left"
|
|
9
|
+
};
|
|
10
|
+
function h(e, t) {
|
|
11
|
+
n(() => {
|
|
12
|
+
let n = e.current;
|
|
13
|
+
t !== void 0 && n && (t ? n.showPopover?.() : n.hidePopover?.());
|
|
14
|
+
}, [t, e]);
|
|
15
|
+
}
|
|
16
|
+
function g({ children: u, className: d, contentClassName: f, closeOnSelect: p = !1, disabled: g = !1, align: _ = "start", onOpenChange: v, open: y, trigger: b, triggerClassName: x, triggerId: S, triggerLabel: C, triggerPurpose: w = "neutral", triggerSize: T, triggerSquare: E = !1, triggerTone: D }) {
|
|
17
|
+
let O = r(), k = `--dropdown-${O.replaceAll(/\W/g, "")}`, A = i(null), [j, M] = a(!1);
|
|
18
|
+
function N(e) {
|
|
19
|
+
let t = e.newState === "open";
|
|
20
|
+
M(t), v?.(t);
|
|
21
|
+
}
|
|
22
|
+
return n(() => {
|
|
23
|
+
let e = A.current;
|
|
24
|
+
if (!p || !e) return;
|
|
25
|
+
let t = (t) => {
|
|
26
|
+
t.target instanceof Element && t.target.closest("a, button") && e.hidePopover?.();
|
|
27
|
+
};
|
|
28
|
+
return e.addEventListener("click", t), () => e.removeEventListener("click", t);
|
|
29
|
+
}, [p]), h(A, y), /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(e, {
|
|
30
|
+
"aria-expanded": j,
|
|
31
|
+
"aria-haspopup": "true",
|
|
32
|
+
"aria-label": C,
|
|
33
|
+
className: t(x, d),
|
|
34
|
+
disabled: g,
|
|
35
|
+
id: S,
|
|
36
|
+
popoverTarget: O,
|
|
37
|
+
purpose: w,
|
|
38
|
+
size: T,
|
|
39
|
+
square: E,
|
|
40
|
+
style: { anchorName: k },
|
|
41
|
+
tone: D,
|
|
42
|
+
children: b
|
|
43
|
+
}), /* @__PURE__ */ s("div", {
|
|
44
|
+
className: t("z-10 mt-2 rounded-box border border-base-300 bg-base-100 p-2 bg-linear-to-b from-(--surface-highlight) to-transparent text-base-content shadow-(--elevation-3)", l, f),
|
|
45
|
+
id: O,
|
|
46
|
+
onToggle: N,
|
|
47
|
+
popover: "auto",
|
|
48
|
+
ref: A,
|
|
49
|
+
style: {
|
|
50
|
+
positionAnchor: k,
|
|
51
|
+
positionArea: m[_]
|
|
52
|
+
},
|
|
53
|
+
children: u
|
|
54
|
+
})] });
|
|
55
|
+
}
|
|
56
|
+
export { d as a, p as i, u as n, f as r, g as t };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { t as e } from "./classNames-x6JVYA2t.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
// src/typography/Heading/Heading.tsx
|
|
4
|
+
var n = [
|
|
5
|
+
"h1",
|
|
6
|
+
"h2",
|
|
7
|
+
"h3",
|
|
8
|
+
"h4",
|
|
9
|
+
"h5",
|
|
10
|
+
"h6"
|
|
11
|
+
], r = [
|
|
12
|
+
"text-3xl",
|
|
13
|
+
"text-2xl",
|
|
14
|
+
"text-xl",
|
|
15
|
+
"text-lg",
|
|
16
|
+
"text-base",
|
|
17
|
+
"text-base font-light"
|
|
18
|
+
], i = (e) => Number.isInteger(e) && e >= 1 && e <= 6, a = (e) => e === "label" ? "text-sm font-semibold" : i(e) ? r[e - 1] : "text-3xl", o = ({ children: r, className: o, id: s, level: c, size: l = c, title: u }) => {
|
|
19
|
+
let d = n[i(c) ? c - 1 : -1] ?? "h6";
|
|
20
|
+
return /* @__PURE__ */ t(d, {
|
|
21
|
+
className: e(a(l), o),
|
|
22
|
+
id: s,
|
|
23
|
+
title: u,
|
|
24
|
+
children: r
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export { o as t };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { t as e } from "./Button-T8UI5igR.js";
|
|
2
|
+
import { t } from "./classNames-x6JVYA2t.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
// src/actions/IconButton.tsx
|
|
5
|
+
function r({ icon: r, label: i, purpose: a, size: o, tone: s, variant: c, className: l, ...u }) {
|
|
6
|
+
return /* @__PURE__ */ n(e, {
|
|
7
|
+
...u,
|
|
8
|
+
"aria-label": i,
|
|
9
|
+
className: t("btn-square", l),
|
|
10
|
+
purpose: a,
|
|
11
|
+
size: o,
|
|
12
|
+
title: i,
|
|
13
|
+
tone: s ?? (a ? void 0 : "ghost"),
|
|
14
|
+
variant: c,
|
|
15
|
+
children: r
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { r as t };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { a as e, i as t, r as n } from "./Button-T8UI5igR.js";
|
|
2
|
+
import { t as r } from "./classNames-x6JVYA2t.js";
|
|
3
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
4
|
+
import { Link as a } from "react-router";
|
|
5
|
+
// src/navigation/Link.tsx
|
|
6
|
+
var o = "link", s = {
|
|
7
|
+
default: "",
|
|
8
|
+
primary: "link-primary",
|
|
9
|
+
secondary: "link-secondary",
|
|
10
|
+
ghost: "",
|
|
11
|
+
neutral: "link-neutral",
|
|
12
|
+
info: "link-info",
|
|
13
|
+
success: "link-success",
|
|
14
|
+
warning: "link-warning",
|
|
15
|
+
error: "link-error"
|
|
16
|
+
}, c = ({ children: c, className: l, to: u, asButton: d = !1, fullWidth: f = !1, purpose: p, size: m, square: h = !1, tone: g, variant: _, ...v }) => {
|
|
17
|
+
let y = e(m), b = d ? n({
|
|
18
|
+
className: l,
|
|
19
|
+
fullWidth: f,
|
|
20
|
+
purpose: p,
|
|
21
|
+
size: y,
|
|
22
|
+
square: h,
|
|
23
|
+
tone: g,
|
|
24
|
+
variant: _
|
|
25
|
+
}) : r(o, s[t({
|
|
26
|
+
purpose: p,
|
|
27
|
+
tone: g
|
|
28
|
+
}).tone], l);
|
|
29
|
+
return /* @__PURE__ */ i(a, {
|
|
30
|
+
className: b,
|
|
31
|
+
to: u,
|
|
32
|
+
...v,
|
|
33
|
+
children: c
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export { c as t };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as e } from "./classNames-x6JVYA2t.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
// src/typography/Paragraph.tsx
|
|
4
|
+
var n = {
|
|
5
|
+
default: "text-base-content",
|
|
6
|
+
muted: "text-base-content/70"
|
|
7
|
+
};
|
|
8
|
+
function r({ children: r, className: i, tone: a = "default" }) {
|
|
9
|
+
return /* @__PURE__ */ t("p", {
|
|
10
|
+
className: e("leading-6", n[a], i),
|
|
11
|
+
children: r
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export { r as t };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { t as e } from "./classNames-x6JVYA2t.js";
|
|
2
|
+
import { useId as t } from "react";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
// src/forms/Field.tsx
|
|
5
|
+
var a = (e) => ({
|
|
6
|
+
hint: `${e}-hint`,
|
|
7
|
+
error: `${e}-error`
|
|
8
|
+
});
|
|
9
|
+
function o(e, t, n, r) {
|
|
10
|
+
let i = a(e);
|
|
11
|
+
return [
|
|
12
|
+
r,
|
|
13
|
+
t && i.hint,
|
|
14
|
+
n && i.error
|
|
15
|
+
].filter(Boolean).join(" ") || void 0;
|
|
16
|
+
}
|
|
17
|
+
function s({ children: e, id: t, tone: n = "hint" }) {
|
|
18
|
+
return n === "error" ? /* @__PURE__ */ r("p", {
|
|
19
|
+
className: "label whitespace-normal text-error",
|
|
20
|
+
id: t,
|
|
21
|
+
role: "alert",
|
|
22
|
+
children: e
|
|
23
|
+
}) : /* @__PURE__ */ r("p", {
|
|
24
|
+
className: "label whitespace-normal",
|
|
25
|
+
id: t,
|
|
26
|
+
children: e
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function c({ controlId: e, hint: t, error: o }) {
|
|
30
|
+
let c = a(e);
|
|
31
|
+
return /* @__PURE__ */ i(n, { children: [t ? /* @__PURE__ */ r(s, {
|
|
32
|
+
id: c.hint,
|
|
33
|
+
children: t
|
|
34
|
+
}) : null, o ? /* @__PURE__ */ r(s, {
|
|
35
|
+
id: c.error,
|
|
36
|
+
tone: "error",
|
|
37
|
+
children: o
|
|
38
|
+
}) : null] });
|
|
39
|
+
}
|
|
40
|
+
function l({ label: n, hint: a, error: s, controlId: l, id: u, children: d, className: f }) {
|
|
41
|
+
let p = t(), m = u ?? l ?? p;
|
|
42
|
+
return /* @__PURE__ */ i("fieldset", {
|
|
43
|
+
"aria-describedby": l ? void 0 : o(m, a, s),
|
|
44
|
+
className: e("fieldset", f),
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ r("legend", {
|
|
47
|
+
className: "fieldset-legend",
|
|
48
|
+
children: l ? /* @__PURE__ */ r("label", {
|
|
49
|
+
htmlFor: l,
|
|
50
|
+
children: n
|
|
51
|
+
}) : n
|
|
52
|
+
}),
|
|
53
|
+
d,
|
|
54
|
+
/* @__PURE__ */ r(c, {
|
|
55
|
+
controlId: m,
|
|
56
|
+
error: s,
|
|
57
|
+
hint: a
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// src/forms/Switch.tsx
|
|
63
|
+
function u({ label: a, hint: s, error: l, className: u, id: d, "aria-describedby": f, ...p }) {
|
|
64
|
+
let m = t(), h = d ?? m;
|
|
65
|
+
return /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ i("label", {
|
|
66
|
+
className: "label cursor-pointer justify-between gap-2",
|
|
67
|
+
children: [/* @__PURE__ */ r("span", {
|
|
68
|
+
className: "text-sm text-base-content",
|
|
69
|
+
children: a
|
|
70
|
+
}), /* @__PURE__ */ r("input", {
|
|
71
|
+
...p,
|
|
72
|
+
"aria-describedby": o(h, s, l, f),
|
|
73
|
+
"aria-invalid": l ? !0 : p["aria-invalid"],
|
|
74
|
+
className: e("toggle toggle-sm", l ? "toggle-error" : void 0, u),
|
|
75
|
+
id: h,
|
|
76
|
+
type: "checkbox"
|
|
77
|
+
})]
|
|
78
|
+
}), /* @__PURE__ */ r(c, {
|
|
79
|
+
controlId: h,
|
|
80
|
+
error: l,
|
|
81
|
+
hint: s
|
|
82
|
+
})] });
|
|
83
|
+
}
|
|
84
|
+
export { o as a, c as i, l as n, a as o, s as r, u as t };
|