@ksojecki/purpose-ui 0.0.0-stage → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -2
  3. package/assets/fonts/Karla[wght].ttf +0 -0
  4. package/assets/fonts/OFL.txt +93 -0
  5. package/dist/Alert-D-5k0maf.js +23 -0
  6. package/dist/Button-T8UI5igR.js +112 -0
  7. package/dist/Dropdown-BZKzAbKB.js +56 -0
  8. package/dist/Heading-CWDWXU_n.js +27 -0
  9. package/dist/IconButton-P7nSooA3.js +18 -0
  10. package/dist/Link-9mNYgEzY.js +36 -0
  11. package/dist/Paragraph-DFwfb2Yt.js +14 -0
  12. package/dist/Switch-CI8vMkGz.js +84 -0
  13. package/dist/actions/Button.d.ts +69 -0
  14. package/dist/actions/ButtonGroup.d.ts +20 -0
  15. package/dist/actions/IconActionButtons.d.ts +34 -0
  16. package/dist/actions/IconButton.d.ts +21 -0
  17. package/dist/actions/index.d.ts +10 -0
  18. package/dist/actions/index.js +41 -0
  19. package/dist/classNames-x6JVYA2t.js +5 -0
  20. package/dist/data/DataTable.d.ts +47 -0
  21. package/dist/data/Metric.d.ts +46 -0
  22. package/dist/data/Table.d.ts +33 -0
  23. package/dist/data/index.d.ts +8 -0
  24. package/dist/data/index.js +85 -0
  25. package/dist/feedback/Alert.d.ts +23 -0
  26. package/dist/feedback/Badge.d.ts +23 -0
  27. package/dist/feedback/ConfirmDeletePanel.d.ts +32 -0
  28. package/dist/feedback/EmptyState.d.ts +22 -0
  29. package/dist/feedback/Progress.d.ts +24 -0
  30. package/dist/feedback/Skeleton.d.ts +10 -0
  31. package/dist/feedback/Spinner.d.ts +16 -0
  32. package/dist/feedback/Toast.d.ts +48 -0
  33. package/dist/feedback/Tooltip.d.ts +21 -0
  34. package/dist/feedback/index.d.ts +15 -0
  35. package/dist/feedback/index.js +138 -0
  36. package/dist/forms/Checkbox.d.ts +16 -0
  37. package/dist/forms/DatePicker.d.ts +51 -0
  38. package/dist/forms/Field.d.ts +65 -0
  39. package/dist/forms/FileInput.d.ts +20 -0
  40. package/dist/forms/FilterBar.d.ts +21 -0
  41. package/dist/forms/FilterRow.d.ts +20 -0
  42. package/dist/forms/FormActions.d.ts +28 -0
  43. package/dist/forms/FormField.d.ts +39 -0
  44. package/dist/forms/Input.d.ts +20 -0
  45. package/dist/forms/Radio.d.ts +52 -0
  46. package/dist/forms/Range.d.ts +24 -0
  47. package/dist/forms/SegmentedControl.d.ts +33 -0
  48. package/dist/forms/Select.d.ts +23 -0
  49. package/dist/forms/Switch.d.ts +15 -0
  50. package/dist/forms/Textarea.d.ts +20 -0
  51. package/dist/forms/TimePicker.d.ts +29 -0
  52. package/dist/forms/index.d.ts +21 -0
  53. package/dist/forms/index.js +429 -0
  54. package/dist/icons/index.d.ts +2 -0
  55. package/dist/icons/index.js +2 -0
  56. package/dist/icons-CMOARHwx.js +18 -0
  57. package/dist/internal/classNames.d.ts +1 -0
  58. package/dist/internal/purpose.d.ts +7 -0
  59. package/dist/layout/BottomSheet.d.ts +25 -0
  60. package/dist/layout/Card.d.ts +22 -0
  61. package/dist/layout/Disclosure.d.ts +18 -0
  62. package/dist/layout/Divider.d.ts +16 -0
  63. package/dist/layout/Page/Content.d.ts +11 -0
  64. package/dist/layout/Page/Page.d.ts +6 -0
  65. package/dist/layout/Page/index.d.ts +19 -0
  66. package/dist/layout/PageContainer.d.ts +18 -0
  67. package/dist/layout/PageHeader.d.ts +25 -0
  68. package/dist/layout/Section.d.ts +22 -0
  69. package/dist/layout/index.d.ts +13 -0
  70. package/dist/layout/index.js +173 -0
  71. package/dist/navigation/Dropdown.d.ts +47 -0
  72. package/dist/navigation/Link.d.ts +32 -0
  73. package/dist/navigation/Menu.d.ts +89 -0
  74. package/dist/navigation/NavMenu.d.ts +56 -0
  75. package/dist/navigation/index.d.ts +9 -0
  76. package/dist/navigation/index.js +128 -0
  77. package/dist/navigation/popoverFade.d.ts +5 -0
  78. package/dist/overlays/ConsentBanner/ConsentBanner.d.ts +35 -0
  79. package/dist/overlays/ConsentBanner/index.d.ts +1 -0
  80. package/dist/overlays/ConsentSettings/ConsentSettings.d.ts +48 -0
  81. package/dist/overlays/ConsentSettings/index.d.ts +1 -0
  82. package/dist/overlays/ModalWindow/ModalWindow.d.ts +60 -0
  83. package/dist/overlays/ModalWindow/index.d.ts +3 -0
  84. package/dist/overlays/index.d.ts +8 -0
  85. package/dist/overlays/index.js +195 -0
  86. package/dist/typography/Heading/Heading.d.ts +24 -0
  87. package/dist/typography/Heading/index.d.ts +1 -0
  88. package/dist/typography/Paragraph.d.ts +16 -0
  89. package/dist/typography/Prose.d.ts +17 -0
  90. package/dist/typography/index.d.ts +8 -0
  91. package/dist/typography/index.js +12 -0
  92. package/package.json +121 -4
  93. package/styles/budget.css +9 -0
  94. package/styles/generic.css +9 -0
  95. package/styles/roadsign.css +9 -0
  96. package/styles/traffic.css +9 -0
  97. package/theme.css +341 -0
  98. package/themes/budget.css +103 -0
  99. package/themes/generic.css +103 -0
  100. package/themes/roadsign.css +103 -0
  101. 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,80 @@
1
- # Temporary Holding Version
1
+ # @ksojecki/purpose-ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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
+ ```sh
10
+ pnpm add @ksojecki/purpose-ui react react-dom react-router daisyui tailwindcss
11
+ ```
12
+
13
+ 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.
14
+
15
+ ## Set up styles
16
+
17
+ In your app's main stylesheet, import Tailwind, then one palette entry:
18
+
19
+ ```css
20
+ @import 'tailwindcss';
21
+ @import '@ksojecki/purpose-ui/styles/generic.css';
22
+ ```
23
+
24
+ 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.
25
+
26
+ 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.
27
+
28
+ 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';`.
29
+
30
+ ## Use
31
+
32
+ Import from a group subpath, never from the package root.
33
+
34
+ ```tsx
35
+ import { Button } from '@ksojecki/purpose-ui/actions';
36
+ import { Alert } from '@ksojecki/purpose-ui/feedback';
37
+
38
+ export function Example() {
39
+ return (
40
+ <>
41
+ <Alert purpose="success">Saved.</Alert>
42
+ <Button purpose="save" type="submit">
43
+ Save
44
+ </Button>
45
+ </>
46
+ );
47
+ }
48
+ ```
49
+
50
+ 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.
51
+
52
+ `Link`, `NavMenu`, `Menu` and the consent components render `react-router` links, so mount them inside a router.
53
+
54
+ ## Icons
55
+
56
+ `@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.
57
+
58
+ ## Components
59
+
60
+ - `actions`: `Button`, `ButtonGroup`, `IconButton`, `EditButton`/`NewButton`/`DeleteButton`
61
+ - `forms`: `Field`, `FormField`, `FormActions`, `Input`, `Select`, `Textarea`, `Checkbox`, `Radio`/`RadioGroup`, `Switch`, `Range`, `FileInput`, `DatePicker`, `TimePicker`, `SegmentedControl`, `FilterBar`, `FilterRow`
62
+ - `feedback`: `Alert`, `Badge`, `Toast`, `Progress`, `Spinner`, `Skeleton`, `Tooltip`, `ConfirmDeletePanel`, `EmptyState`
63
+ - `typography`: `Heading`, `Paragraph`, `Prose`
64
+ - `layout`: `Page`, `PageContainer`, `PageHeader`, `Section`, `Card`, `Divider`, `Disclosure`, `BottomSheet`
65
+ - `navigation`: `Link`, `Menu`, `Dropdown`, `NavMenu`
66
+ - `overlays`: `ModalWindow`, `NativeDialog`, `ConsentBanner`, `ConsentSettings`
67
+ - `data`: `DataTable`, `Table`, `Metric`/`MetricGroup`
68
+ - `icons`: the Tabler icon set
69
+
70
+ Motion utilities (`animate-fade-in`, `animate-slide-up`, `animate-scale-in`) come from `theme.css` and switch off under `prefers-reduced-motion`.
71
+
72
+ ## Links
73
+
74
+ - [Documentation](https://sojecki.pl/ui/)
75
+ - [Changelog](https://github.com/ksojecki/purpose-ui/blob/main/CHANGELOG.md)
76
+ - [Source and issues](https://github.com/ksojecki/purpose-ui)
77
+
78
+ ## License
79
+
80
+ MIT
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 };
@@ -0,0 +1,69 @@
1
+ import { type ButtonHTMLAttributes, type ReactNode } from 'react';
2
+ import { type ActionPurpose } from '../internal/purpose';
3
+ export type ButtonTone = 'default' | 'primary' | 'secondary' | 'ghost' | 'neutral' | 'info' | 'success' | 'warning' | 'error';
4
+ export type ButtonVariant = 'solid' | 'soft' | 'outline';
5
+ export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
6
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
7
+ children: ReactNode;
8
+ fullWidth?: boolean;
9
+ isLoading?: boolean;
10
+ /** Semantic action meaning. Apps should prefer `purpose` over `tone`. */
11
+ purpose?: ActionPurpose;
12
+ size?: ButtonSize;
13
+ /** Square icon-only button. */
14
+ square?: boolean;
15
+ /** Explicit override of the purpose tone. */
16
+ tone?: ButtonTone;
17
+ /** Explicit override of the purpose variant. */
18
+ variant?: ButtonVariant;
19
+ }
20
+ export interface ButtonClassOptions {
21
+ className?: string;
22
+ fullWidth?: boolean;
23
+ purpose?: ActionPurpose;
24
+ size?: ButtonSize;
25
+ square?: boolean;
26
+ tone?: ButtonTone;
27
+ variant?: ButtonVariant;
28
+ }
29
+ /**
30
+ * Default size for the buttons and links rendered inside it. An explicit `size` prop still wins.
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * <ButtonSizeProvider size="sm">
35
+ * <Button>Small button</Button>
36
+ * <Link asButton to="/new">
37
+ * Small link
38
+ * </Link>
39
+ * </ButtonSizeProvider>
40
+ * ```
41
+ */
42
+ export declare function ButtonSizeProvider({ size, children }: {
43
+ size: ButtonSize;
44
+ children: ReactNode;
45
+ }): import("react").JSX.Element;
46
+ /** Explicit size, else the nearest `ButtonSizeProvider`, else `md`. */
47
+ export declare function useButtonSize(size?: ButtonSize): ButtonSize;
48
+ /** Explicit `tone`/`variant` win, then `purpose`, then primary/solid. */
49
+ export declare function resolveButtonStyle({ purpose, tone, variant, }: Pick<ButtonClassOptions, 'purpose' | 'tone' | 'variant'>): {
50
+ tone: ButtonTone;
51
+ variant: ButtonVariant;
52
+ };
53
+ /** Class string for any button-styled element. Shared by `Button` and `Link` with `asButton`. */
54
+ export declare function buttonClassName({ className, fullWidth, purpose, size, square, tone, variant, }: ButtonClassOptions): string;
55
+ /**
56
+ * Reusable button component for shared UI actions across applications.
57
+ * Resolution: explicit `tone`/`variant` win, then `purpose`, then primary/solid.
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * <Button purpose="save" type="submit">
62
+ * Save
63
+ * </Button>
64
+ * <Button isLoading purpose="save">
65
+ * Saving
66
+ * </Button>
67
+ * ```
68
+ */
69
+ export declare const Button: ({ children, className, disabled, fullWidth, isLoading, purpose, size: sizeProp, square, tone, variant, ...props }: ButtonProps) => import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface ButtonGroupProps {
3
+ children: ReactNode;
4
+ className?: string;
5
+ /** Accessible name of the group; omit for a plain container. */
6
+ label?: string;
7
+ }
8
+ /**
9
+ * Joins its children (buttons, links, icon buttons, badges) into one segmented strip.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * <ButtonGroup label="Range">
14
+ * <Button tone="neutral">Day</Button>
15
+ * <Button tone="neutral">Week</Button>
16
+ * <Button tone="neutral">Month</Button>
17
+ * </ButtonGroup>
18
+ * ```
19
+ */
20
+ export declare function ButtonGroup({ children, className, label }: ButtonGroupProps): import("react").JSX.Element;