@glyphui/ui 0.1.1 → 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.
Files changed (85) hide show
  1. package/README.md +1 -1
  2. package/dist/data-table.js +2 -2
  3. package/dist/{field-DXZD0l8w.js → field-CCecIzdq.js} +1 -1
  4. package/dist/{field-context-B8cYheXz.js → field-context-B6WOcK5m.js} +99 -99
  5. package/dist/form.js +2 -2
  6. package/dist/index.d.ts +2743 -93
  7. package/dist/index.js +2748 -111
  8. package/dist/{states-BxPjCUxz.js → states-Rp8wZ_jH.js} +1 -1
  9. package/package.json +4 -2
  10. package/src/components/accordion/accordion.styles.ts +41 -0
  11. package/src/components/accordion/accordion.tsx +86 -0
  12. package/src/components/accordion/index.ts +8 -0
  13. package/src/components/alert/alert-icons.tsx +66 -0
  14. package/src/components/alert/alert.styles.ts +57 -0
  15. package/src/components/alert/alert.tsx +86 -0
  16. package/src/components/alert/index.ts +2 -0
  17. package/src/components/alert-dialog/alert-dialog.styles.ts +24 -0
  18. package/src/components/alert-dialog/alert-dialog.tsx +118 -0
  19. package/src/components/alert-dialog/confirm.tsx +111 -0
  20. package/src/components/alert-dialog/index.ts +15 -0
  21. package/src/components/aspect-ratio/aspect-ratio.tsx +40 -0
  22. package/src/components/aspect-ratio/index.ts +1 -0
  23. package/src/components/badge/badge.styles.ts +1 -1
  24. package/src/components/banner/banner.styles.ts +40 -0
  25. package/src/components/banner/banner.tsx +101 -0
  26. package/src/components/banner/index.ts +2 -0
  27. package/src/components/blockquote/blockquote.tsx +59 -0
  28. package/src/components/blockquote/index.ts +1 -0
  29. package/src/components/breadcrumb/breadcrumb.styles.ts +20 -0
  30. package/src/components/breadcrumb/breadcrumb.tsx +135 -0
  31. package/src/components/breadcrumb/index.ts +12 -0
  32. package/src/components/button/button.tsx +11 -8
  33. package/src/components/code/code.styles.ts +33 -0
  34. package/src/components/code/code.tsx +96 -0
  35. package/src/components/code/index.ts +2 -0
  36. package/src/components/combobox/combobox.styles.ts +50 -0
  37. package/src/components/combobox/combobox.tsx +203 -0
  38. package/src/components/combobox/index.ts +2 -0
  39. package/src/components/command-menu/command-menu.styles.ts +41 -0
  40. package/src/components/command-menu/command-menu.tsx +217 -0
  41. package/src/components/command-menu/index.ts +14 -0
  42. package/src/components/description-list/description-list.styles.ts +31 -0
  43. package/src/components/description-list/description-list.tsx +56 -0
  44. package/src/components/description-list/index.ts +7 -0
  45. package/src/components/dialog/close-icon.tsx +22 -0
  46. package/src/components/dialog/dialog.styles.ts +41 -0
  47. package/src/components/dialog/dialog.tsx +111 -0
  48. package/src/components/dialog/index.ts +13 -0
  49. package/src/components/dropdown-menu/dropdown-menu.styles.ts +45 -0
  50. package/src/components/dropdown-menu/dropdown-menu.tsx +230 -0
  51. package/src/components/dropdown-menu/index.ts +19 -0
  52. package/src/components/grid/grid.tsx +144 -0
  53. package/src/components/grid/index.ts +1 -0
  54. package/src/components/link/index.ts +2 -0
  55. package/src/components/link/link.styles.ts +39 -0
  56. package/src/components/link/link.tsx +62 -0
  57. package/src/components/pagination/index.ts +3 -0
  58. package/src/components/pagination/pagination-range.ts +35 -0
  59. package/src/components/pagination/pagination.styles.ts +41 -0
  60. package/src/components/pagination/pagination.tsx +130 -0
  61. package/src/components/popover/index.ts +9 -0
  62. package/src/components/popover/popover.tsx +66 -0
  63. package/src/components/progress/index.ts +7 -0
  64. package/src/components/progress/progress.styles.ts +68 -0
  65. package/src/components/progress/progress.tsx +158 -0
  66. package/src/components/prose/index.ts +1 -0
  67. package/src/components/prose/prose.tsx +82 -0
  68. package/src/components/radio-group/index.ts +7 -0
  69. package/src/components/radio-group/radio-group.styles.ts +64 -0
  70. package/src/components/radio-group/radio-group.tsx +128 -0
  71. package/src/components/scroll-area/index.ts +1 -0
  72. package/src/components/scroll-area/scroll-area.tsx +68 -0
  73. package/src/components/sheet/index.ts +13 -0
  74. package/src/components/sheet/sheet.styles.ts +60 -0
  75. package/src/components/sheet/sheet.tsx +108 -0
  76. package/src/components/slider/index.ts +2 -0
  77. package/src/components/slider/slider.styles.ts +32 -0
  78. package/src/components/slider/slider.tsx +131 -0
  79. package/src/components/stat-card/index.ts +2 -0
  80. package/src/components/stat-card/stat-card.styles.ts +24 -0
  81. package/src/components/stat-card/stat-card.tsx +108 -0
  82. package/src/components/toast/index.ts +1 -0
  83. package/src/components/toast/toast.tsx +91 -0
  84. package/src/index.ts +25 -0
  85. package/src/provider/glyph-provider.tsx +16 -2
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  React components on Tailwind CSS v4 that take their whole look from **one typed theme file**, with the parts every app rebuilds already solved: forms, data tables, app layout, and loading / empty / error states.
4
4
 
5
- [Live showcase](https://khalmohak.github.io/glyph/) · [GitHub](https://github.com/khalmohak/glyph) · [Changelog](https://github.com/khalmohak/glyph/blob/main/packages/ui/CHANGELOG.md)
5
+ [Docs](https://khalmohak.github.io/glyph/) · [Components](https://khalmohak.github.io/glyph/components) · [Showcase](https://khalmohak.github.io/glyph/showcase/) · [GitHub](https://github.com/khalmohak/glyph) · [Changelog](https://github.com/khalmohak/glyph/blob/main/packages/ui/CHANGELOG.md)
6
6
 
7
7
  ## Install
8
8
 
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { E as tv, O as useComponentConfig, S as focusRing, _ as Button, a as ArrowUpIcon, c as ChevronLeftIcon, h as SearchIcon, i as ArrowDownIcon, l as ChevronRightIcon, u as ChevronsUpDownIcon, v as IconButton, w as themedBorder } from "./field-context-B8cYheXz.js";
3
- import { a as Table, c as TableCell, d as TableRow, h as Input, l as TableHead, n as ErrorState, o as TableBody, p as Skeleton, t as EmptyState, u as TableHeader, v as Checkbox } from "./states-BxPjCUxz.js";
2
+ import { E as SearchIcon, O as useComponentConfig, b as ChevronRightIcon, c as tv, f as themedBorder, g as ArrowUpIcon, h as ArrowDownIcon, i as IconButton, r as Button, u as focusRing, x as ChevronsUpDownIcon, y as ChevronLeftIcon } from "./field-context-B6WOcK5m.js";
3
+ import { a as Table, c as TableCell, d as TableRow, h as Input, l as TableHead, n as ErrorState, o as TableBody, p as Skeleton, t as EmptyState, u as TableHeader, v as Checkbox } from "./states-Rp8wZ_jH.js";
4
4
  import { useEffect, useMemo, useState } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { createColumnHelper, flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { E as tv, O as useComponentConfig, t as FieldContext } from "./field-context-B8cYheXz.js";
2
+ import { O as useComponentConfig, c as tv, t as FieldContext } from "./field-context-B6WOcK5m.js";
3
3
  import { Label } from "radix-ui";
4
4
  import { useId, useMemo } from "react";
5
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -2,8 +2,8 @@
2
2
  import { textTokens } from "@glyphui/tokens";
3
3
  import { Slot } from "radix-ui";
4
4
  import { Fragment, createContext, useContext } from "react";
5
- import { createTV } from "tailwind-variants";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { createTV } from "tailwind-variants";
7
7
  //#region src/provider/glyph-context.ts
8
8
  const GlyphContext = createContext(null);
9
9
  /** The active theme and app-level settings. Must be used under `GlyphProvider`. */
@@ -35,6 +35,102 @@ function useComponentConfig(name, props) {
35
35
  return [merged, override.className ?? {}];
36
36
  }
37
37
  //#endregion
38
+ //#region src/internal/icons.tsx
39
+ function Icon({ children, ...props }) {
40
+ return /* @__PURE__ */ jsx("svg", {
41
+ xmlns: "http://www.w3.org/2000/svg",
42
+ width: "16",
43
+ height: "16",
44
+ viewBox: "0 0 24 24",
45
+ fill: "none",
46
+ stroke: "currentColor",
47
+ strokeWidth: "2",
48
+ strokeLinecap: "round",
49
+ strokeLinejoin: "round",
50
+ "aria-hidden": "true",
51
+ ...props,
52
+ children
53
+ });
54
+ }
55
+ const CheckIcon = (p) => /* @__PURE__ */ jsx(Icon, {
56
+ ...p,
57
+ children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
58
+ });
59
+ const MinusIcon = (p) => /* @__PURE__ */ jsx(Icon, {
60
+ ...p,
61
+ children: /* @__PURE__ */ jsx("path", { d: "M5 12h14" })
62
+ });
63
+ const ChevronDownIcon = (p) => /* @__PURE__ */ jsx(Icon, {
64
+ ...p,
65
+ children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
66
+ });
67
+ const ChevronLeftIcon = (p) => /* @__PURE__ */ jsx(Icon, {
68
+ ...p,
69
+ children: /* @__PURE__ */ jsx("path", { d: "m15 18-6-6 6-6" })
70
+ });
71
+ const ChevronRightIcon = (p) => /* @__PURE__ */ jsx(Icon, {
72
+ ...p,
73
+ children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
74
+ });
75
+ const ArrowUpIcon = (p) => /* @__PURE__ */ jsx(Icon, {
76
+ ...p,
77
+ children: /* @__PURE__ */ jsx("path", { d: "m5 12 7-7 7 7M12 19V5" })
78
+ });
79
+ const ArrowDownIcon = (p) => /* @__PURE__ */ jsx(Icon, {
80
+ ...p,
81
+ children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M19 12l-7 7-7-7" })
82
+ });
83
+ const ChevronsUpDownIcon = (p) => /* @__PURE__ */ jsx(Icon, {
84
+ ...p,
85
+ children: /* @__PURE__ */ jsx("path", { d: "m7 15 5 5 5-5M7 9l5-5 5 5" })
86
+ });
87
+ const XIcon = (p) => /* @__PURE__ */ jsx(Icon, {
88
+ ...p,
89
+ children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" })
90
+ });
91
+ const MenuIcon = (p) => /* @__PURE__ */ jsx(Icon, {
92
+ ...p,
93
+ children: /* @__PURE__ */ jsx("path", { d: "M4 6h16M4 12h16M4 18h16" })
94
+ });
95
+ const PanelLeftIcon = (p) => /* @__PURE__ */ jsxs(Icon, {
96
+ ...p,
97
+ children: [/* @__PURE__ */ jsx("rect", {
98
+ width: "18",
99
+ height: "18",
100
+ x: "3",
101
+ y: "3",
102
+ rx: "2"
103
+ }), /* @__PURE__ */ jsx("path", { d: "M9 3v18" })]
104
+ });
105
+ const SearchIcon = (p) => /* @__PURE__ */ jsxs(Icon, {
106
+ ...p,
107
+ children: [/* @__PURE__ */ jsx("circle", {
108
+ cx: "11",
109
+ cy: "11",
110
+ r: "7"
111
+ }), /* @__PURE__ */ jsx("path", { d: "m20 20-3.5-3.5" })]
112
+ });
113
+ const InboxIcon = (p) => /* @__PURE__ */ jsxs(Icon, {
114
+ ...p,
115
+ children: [/* @__PURE__ */ jsx("path", { d: "M22 12h-6l-2 3h-4l-2-3H2" }), /* @__PURE__ */ jsx("path", { d: "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" })]
116
+ });
117
+ const AlertIcon = (p) => /* @__PURE__ */ jsxs(Icon, {
118
+ ...p,
119
+ children: [/* @__PURE__ */ jsx("circle", {
120
+ cx: "12",
121
+ cy: "12",
122
+ r: "10"
123
+ }), /* @__PURE__ */ jsx("path", { d: "M12 8v4M12 16h.01" })]
124
+ });
125
+ //#endregion
126
+ //#region src/utils/styles.ts
127
+ /** Shared class fragments. Kept as literals so Tailwind's scanner picks them up. */
128
+ const focusRing = "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background";
129
+ const themedBorder = "border-(length:--glyph-border-width)";
130
+ const transition = "transition-[color,background-color,border-color,box-shadow,transform,opacity] duration-(--glyph-duration-base) ease-standard";
131
+ /** Popover surfaces: Select, Tooltip-like menus. */
132
+ const popover = "z-50 overflow-hidden rounded-[min(var(--radius-md),var(--radius-lg))] border-(length:--glyph-border-width) border-border bg-raised text-foreground shadow-lg animate-pop-in";
133
+ //#endregion
38
134
  //#region src/utils/tw-merge-config.ts
39
135
  /**
40
136
  * Teaches tailwind-merge about Glyph's custom utilities so `cn('text-h1', 'text-small')`
@@ -49,14 +145,6 @@ const twMergeConfig = { extend: { theme: {
49
145
  /** `tailwind-variants` preconfigured with Glyph's merge rules. All component styles use this. */
50
146
  const tv = createTV({ twMergeConfig });
51
147
  //#endregion
52
- //#region src/utils/styles.ts
53
- /** Shared class fragments. Kept as literals so Tailwind's scanner picks them up. */
54
- const focusRing = "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background";
55
- const themedBorder = "border-(length:--glyph-border-width)";
56
- const transition = "transition-[color,background-color,border-color,box-shadow,transform,opacity] duration-(--glyph-duration-base) ease-standard";
57
- /** Popover surfaces: Select, Tooltip-like menus. */
58
- const popover = "z-50 overflow-hidden rounded-[min(var(--radius-md),var(--radius-lg))] border-(length:--glyph-border-width) border-border bg-raised text-foreground shadow-lg animate-pop-in";
59
- //#endregion
60
148
  //#region src/components/spinner/spinner.styles.ts
61
149
  const spinnerStyles = tv({
62
150
  slots: {
@@ -189,7 +277,7 @@ function Button(inProps) {
189
277
  disabled: disabled || loading
190
278
  },
191
279
  ...rest,
192
- children: iconOnly ? icon(loading ? /* @__PURE__ */ jsx(Spinner, { size: size === "lg" ? "md" : "sm" }) : children) : [
280
+ children: iconOnly && asChild ? children : iconOnly ? icon(loading ? /* @__PURE__ */ jsx(Spinner, { size: size === "lg" ? "md" : "sm" }) : children) : [
193
281
  /* @__PURE__ */ jsx(Fragment, { children: icon(loading ? /* @__PURE__ */ jsx(Spinner, { size: "sm" }) : leftIcon) }, "start"),
194
282
  /* @__PURE__ */ jsx(Slot.Slottable, { children }, "content"),
195
283
  /* @__PURE__ */ jsx(Fragment, { children: icon(rightIcon) }, "end")
@@ -206,94 +294,6 @@ function IconButton({ icon, variant = "ghost", ...props }) {
206
294
  });
207
295
  }
208
296
  //#endregion
209
- //#region src/internal/icons.tsx
210
- function Icon({ children, ...props }) {
211
- return /* @__PURE__ */ jsx("svg", {
212
- xmlns: "http://www.w3.org/2000/svg",
213
- width: "16",
214
- height: "16",
215
- viewBox: "0 0 24 24",
216
- fill: "none",
217
- stroke: "currentColor",
218
- strokeWidth: "2",
219
- strokeLinecap: "round",
220
- strokeLinejoin: "round",
221
- "aria-hidden": "true",
222
- ...props,
223
- children
224
- });
225
- }
226
- const CheckIcon = (p) => /* @__PURE__ */ jsx(Icon, {
227
- ...p,
228
- children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
229
- });
230
- const MinusIcon = (p) => /* @__PURE__ */ jsx(Icon, {
231
- ...p,
232
- children: /* @__PURE__ */ jsx("path", { d: "M5 12h14" })
233
- });
234
- const ChevronDownIcon = (p) => /* @__PURE__ */ jsx(Icon, {
235
- ...p,
236
- children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
237
- });
238
- const ChevronLeftIcon = (p) => /* @__PURE__ */ jsx(Icon, {
239
- ...p,
240
- children: /* @__PURE__ */ jsx("path", { d: "m15 18-6-6 6-6" })
241
- });
242
- const ChevronRightIcon = (p) => /* @__PURE__ */ jsx(Icon, {
243
- ...p,
244
- children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
245
- });
246
- const ArrowUpIcon = (p) => /* @__PURE__ */ jsx(Icon, {
247
- ...p,
248
- children: /* @__PURE__ */ jsx("path", { d: "m5 12 7-7 7 7M12 19V5" })
249
- });
250
- const ArrowDownIcon = (p) => /* @__PURE__ */ jsx(Icon, {
251
- ...p,
252
- children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M19 12l-7 7-7-7" })
253
- });
254
- const ChevronsUpDownIcon = (p) => /* @__PURE__ */ jsx(Icon, {
255
- ...p,
256
- children: /* @__PURE__ */ jsx("path", { d: "m7 15 5 5 5-5M7 9l5-5 5 5" })
257
- });
258
- const XIcon = (p) => /* @__PURE__ */ jsx(Icon, {
259
- ...p,
260
- children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" })
261
- });
262
- const MenuIcon = (p) => /* @__PURE__ */ jsx(Icon, {
263
- ...p,
264
- children: /* @__PURE__ */ jsx("path", { d: "M4 6h16M4 12h16M4 18h16" })
265
- });
266
- const PanelLeftIcon = (p) => /* @__PURE__ */ jsxs(Icon, {
267
- ...p,
268
- children: [/* @__PURE__ */ jsx("rect", {
269
- width: "18",
270
- height: "18",
271
- x: "3",
272
- y: "3",
273
- rx: "2"
274
- }), /* @__PURE__ */ jsx("path", { d: "M9 3v18" })]
275
- });
276
- const SearchIcon = (p) => /* @__PURE__ */ jsxs(Icon, {
277
- ...p,
278
- children: [/* @__PURE__ */ jsx("circle", {
279
- cx: "11",
280
- cy: "11",
281
- r: "7"
282
- }), /* @__PURE__ */ jsx("path", { d: "m20 20-3.5-3.5" })]
283
- });
284
- const InboxIcon = (p) => /* @__PURE__ */ jsxs(Icon, {
285
- ...p,
286
- children: [/* @__PURE__ */ jsx("path", { d: "M22 12h-6l-2 3h-4l-2-3H2" }), /* @__PURE__ */ jsx("path", { d: "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" })]
287
- });
288
- const AlertIcon = (p) => /* @__PURE__ */ jsxs(Icon, {
289
- ...p,
290
- children: [/* @__PURE__ */ jsx("circle", {
291
- cx: "12",
292
- cy: "12",
293
- r: "10"
294
- }), /* @__PURE__ */ jsx("path", { d: "M12 8v4M12 16h.01" })]
295
- });
296
- //#endregion
297
297
  //#region src/components/field/field-context.ts
298
298
  const FieldContext = createContext(null);
299
299
  /**
@@ -318,4 +318,4 @@ function useFieldControl(props) {
318
318
  };
319
319
  }
320
320
  //#endregion
321
- export { useGlyph as A, popover as C, twMergeConfig as D, tv as E, useComponentConfig as O, focusRing as S, transition as T, Button as _, ArrowUpIcon as a, Spinner as b, ChevronLeftIcon as c, InboxIcon as d, MenuIcon as f, XIcon as g, SearchIcon as h, ArrowDownIcon as i, useLinkComponent as j, GlyphContext as k, ChevronRightIcon as l, PanelLeftIcon as m, useFieldControl as n, CheckIcon as o, MinusIcon as p, AlertIcon as r, ChevronDownIcon as s, FieldContext as t, ChevronsUpDownIcon as u, IconButton as v, themedBorder as w, spinnerStyles as x, buttonStyles as y };
321
+ export { useGlyph as A, MenuIcon as C, XIcon as D, SearchIcon as E, useComponentConfig as O, InboxIcon as S, PanelLeftIcon as T, CheckIcon as _, buttonStyles as a, ChevronRightIcon as b, tv as c, popover as d, themedBorder as f, ArrowUpIcon as g, ArrowDownIcon as h, IconButton as i, useLinkComponent as j, GlyphContext as k, twMergeConfig as l, AlertIcon as m, useFieldControl as n, Spinner as o, transition as p, Button as r, spinnerStyles as s, FieldContext as t, focusRing as u, ChevronDownIcon as v, MinusIcon as w, ChevronsUpDownIcon as x, ChevronLeftIcon as y };
package/dist/form.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { E as tv, _ as Button, r as AlertIcon } from "./field-context-B8cYheXz.js";
3
- import { t as Field } from "./field-DXZD0l8w.js";
2
+ import { c as tv, m as AlertIcon, r as Button } from "./field-context-B6WOcK5m.js";
3
+ import { t as Field } from "./field-CCecIzdq.js";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
6
6
  import { Controller, FormProvider, useForm as useForm$1, useFormState } from "react-hook-form";