@dashforge/tw 0.2.1-beta → 0.4.0-beta

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 (86) hide show
  1. package/CHANGELOG.md +257 -0
  2. package/CONSUMER-VALIDATION.md +130 -0
  3. package/PARITY.md +483 -0
  4. package/PERFORMANCE.md +169 -0
  5. package/dist/index.esm.js +801 -42
  6. package/dist/src/components/Accordion/Accordion.d.ts +21 -0
  7. package/dist/src/components/Accordion/Accordion.d.ts.map +1 -0
  8. package/dist/src/components/Accordion/accordion.types.d.ts +74 -0
  9. package/dist/src/components/Accordion/accordion.types.d.ts.map +1 -0
  10. package/dist/src/components/Accordion/accordion.variants.d.ts +58 -0
  11. package/dist/src/components/Accordion/accordion.variants.d.ts.map +1 -0
  12. package/dist/src/components/AppShell/AppShell.d.ts +14 -0
  13. package/dist/src/components/AppShell/AppShell.d.ts.map +1 -1
  14. package/dist/src/components/AppShell/appShell.variants.d.ts.map +1 -1
  15. package/dist/src/components/Autocomplete/Autocomplete.d.ts.map +1 -1
  16. package/dist/src/components/Autocomplete/autocomplete.variants.d.ts.map +1 -1
  17. package/dist/src/components/Breadcrumbs/breadcrumbs.variants.d.ts.map +1 -1
  18. package/dist/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  19. package/dist/src/components/Dialog/Dialog.d.ts +17 -0
  20. package/dist/src/components/Dialog/Dialog.d.ts.map +1 -0
  21. package/dist/src/components/Dialog/dialog.types.d.ts +75 -0
  22. package/dist/src/components/Dialog/dialog.types.d.ts.map +1 -0
  23. package/dist/src/components/Dialog/dialog.variants.d.ts +80 -0
  24. package/dist/src/components/Dialog/dialog.variants.d.ts.map +1 -0
  25. package/dist/src/components/LeftNav/leftNav.variants.d.ts.map +1 -1
  26. package/dist/src/components/Popover/Popover.d.ts +15 -0
  27. package/dist/src/components/Popover/Popover.d.ts.map +1 -0
  28. package/dist/src/components/Popover/popover.types.d.ts +45 -0
  29. package/dist/src/components/Popover/popover.types.d.ts.map +1 -0
  30. package/dist/src/components/Popover/popover.variants.d.ts +34 -0
  31. package/dist/src/components/Popover/popover.variants.d.ts.map +1 -0
  32. package/dist/src/components/Snackbar/snackbar.variants.d.ts.map +1 -1
  33. package/dist/src/components/Switch/switch.variants.d.ts.map +1 -1
  34. package/dist/src/components/Tabs/Tabs.d.ts +15 -0
  35. package/dist/src/components/Tabs/Tabs.d.ts.map +1 -0
  36. package/dist/src/components/Tabs/tabs.types.d.ts +55 -0
  37. package/dist/src/components/Tabs/tabs.types.d.ts.map +1 -0
  38. package/dist/src/components/Tabs/tabs.variants.d.ts +82 -0
  39. package/dist/src/components/Tabs/tabs.variants.d.ts.map +1 -0
  40. package/dist/src/components/TextField/TextField.d.ts.map +1 -1
  41. package/dist/src/components/TextField/textField.types.d.ts +29 -3
  42. package/dist/src/components/TextField/textField.types.d.ts.map +1 -1
  43. package/dist/src/components/TextField/textField.variants.d.ts +6 -0
  44. package/dist/src/components/TextField/textField.variants.d.ts.map +1 -1
  45. package/dist/src/components/Tooltip/Tooltip.d.ts +29 -0
  46. package/dist/src/components/Tooltip/Tooltip.d.ts.map +1 -0
  47. package/dist/src/components/Tooltip/tooltip.types.d.ts +47 -0
  48. package/dist/src/components/Tooltip/tooltip.types.d.ts.map +1 -0
  49. package/dist/src/components/Tooltip/tooltip.variants.d.ts +34 -0
  50. package/dist/src/components/Tooltip/tooltip.variants.d.ts.map +1 -0
  51. package/dist/src/index.d.ts +16 -1
  52. package/dist/src/index.d.ts.map +1 -1
  53. package/package.json +6 -1
  54. package/src/components/Accordion/Accordion.test.tsx +95 -0
  55. package/src/components/Accordion/Accordion.tsx +97 -0
  56. package/src/components/Accordion/accordion.types.ts +66 -0
  57. package/src/components/Accordion/accordion.variants.ts +30 -0
  58. package/src/components/AppShell/AppShell.tsx +126 -1
  59. package/src/components/AppShell/appShell.variants.ts +8 -2
  60. package/src/components/Autocomplete/Autocomplete.tsx +77 -4
  61. package/src/components/Autocomplete/autocomplete.variants.ts +6 -0
  62. package/src/components/Breadcrumbs/breadcrumbs.variants.ts +5 -0
  63. package/src/components/Checkbox/Checkbox.tsx +43 -9
  64. package/src/components/Dialog/Dialog.test.tsx +96 -0
  65. package/src/components/Dialog/Dialog.tsx +93 -0
  66. package/src/components/Dialog/dialog.types.ts +62 -0
  67. package/src/components/Dialog/dialog.variants.ts +62 -0
  68. package/src/components/LeftNav/leftNav.variants.ts +12 -1
  69. package/src/components/Popover/Popover.test.tsx +72 -0
  70. package/src/components/Popover/Popover.tsx +55 -0
  71. package/src/components/Popover/popover.types.ts +42 -0
  72. package/src/components/Popover/popover.variants.ts +18 -0
  73. package/src/components/Snackbar/snackbar.variants.ts +4 -2
  74. package/src/components/Switch/switch.variants.ts +6 -1
  75. package/src/components/Tabs/Tabs.test.tsx +74 -0
  76. package/src/components/Tabs/Tabs.tsx +66 -0
  77. package/src/components/Tabs/tabs.types.ts +49 -0
  78. package/src/components/Tabs/tabs.variants.ts +58 -0
  79. package/src/components/TextField/TextField.tsx +29 -0
  80. package/src/components/TextField/textField.types.ts +23 -3
  81. package/src/components/TextField/textField.variants.ts +18 -0
  82. package/src/components/Tooltip/Tooltip.test.tsx +73 -0
  83. package/src/components/Tooltip/Tooltip.tsx +70 -0
  84. package/src/components/Tooltip/tooltip.types.ts +44 -0
  85. package/src/components/Tooltip/tooltip.variants.ts +18 -0
  86. package/src/index.ts +40 -1
@@ -0,0 +1,82 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ export declare const tabsVariants: import("tailwind-variants").TVReturnType<{
3
+ variant: {
4
+ underline: {
5
+ list: string;
6
+ trigger: string[];
7
+ };
8
+ pill: {
9
+ list: string;
10
+ trigger: string[];
11
+ };
12
+ };
13
+ orientation: {
14
+ horizontal: {
15
+ root: string;
16
+ list: string;
17
+ };
18
+ vertical: {
19
+ root: string;
20
+ list: string;
21
+ };
22
+ };
23
+ }, {
24
+ root: string;
25
+ list: string;
26
+ trigger: string[];
27
+ content: string[];
28
+ }, undefined, {
29
+ variant: {
30
+ underline: {
31
+ list: string;
32
+ trigger: string[];
33
+ };
34
+ pill: {
35
+ list: string;
36
+ trigger: string[];
37
+ };
38
+ };
39
+ orientation: {
40
+ horizontal: {
41
+ root: string;
42
+ list: string;
43
+ };
44
+ vertical: {
45
+ root: string;
46
+ list: string;
47
+ };
48
+ };
49
+ }, {
50
+ root: string;
51
+ list: string;
52
+ trigger: string[];
53
+ content: string[];
54
+ }, import("tailwind-variants").TVReturnType<{
55
+ variant: {
56
+ underline: {
57
+ list: string;
58
+ trigger: string[];
59
+ };
60
+ pill: {
61
+ list: string;
62
+ trigger: string[];
63
+ };
64
+ };
65
+ orientation: {
66
+ horizontal: {
67
+ root: string;
68
+ list: string;
69
+ };
70
+ vertical: {
71
+ root: string;
72
+ list: string;
73
+ };
74
+ };
75
+ }, {
76
+ root: string;
77
+ list: string;
78
+ trigger: string[];
79
+ content: string[];
80
+ }, undefined, unknown, unknown, undefined>>;
81
+ export type TabsVariants = VariantProps<typeof tabsVariants>;
82
+ //# sourceMappingURL=tabs.variants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Tabs/tabs.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAqDvB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,kDAuL9C"}
1
+ {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,kDAoN9C"}
@@ -5,9 +5,27 @@ import type { TextFieldVariants } from './textField.variants.js';
5
5
  /**
6
6
  * Per-slot overrides for `<TextField>`.
7
7
  *
8
- * Each slot accepts `{ className: string }` so the override path is
9
- * extensible (style / aria-* / data-* can be added without a breaking
10
- * change). Mirrors the MUI-side `slotProps` shape.
8
+ * Each slot accepts `{ className: string }` (and, for `prefix` /
9
+ * `suffix`, a `children` node) so the override path is extensible —
10
+ * extra fields like `style`, `aria-*`, `data-*` can be added without
11
+ * a breaking change. Mirrors the MUI-side `slotProps` shape.
12
+ *
13
+ * **`prefix` / `suffix`** are inline adornments rendered INSIDE the
14
+ * `inputWrapper`, before / after the `<input>` element. Typical use:
15
+ * currency symbols, units, status icons. Passing only `className`
16
+ * (no `children`) is allowed but renders an empty slot — usually
17
+ * you'll always pair the two.
18
+ *
19
+ * ```tsx
20
+ * <TextField
21
+ * name="price"
22
+ * type="number"
23
+ * slotProps={{
24
+ * prefix: { children: '$' },
25
+ * suffix: { children: 'USD' },
26
+ * }}
27
+ * />
28
+ * ```
11
29
  */
12
30
  export interface TextFieldSlotProps {
13
31
  root?: {
@@ -31,6 +49,14 @@ export interface TextFieldSlotProps {
31
49
  errorText?: {
32
50
  className?: string;
33
51
  };
52
+ prefix?: {
53
+ children?: ReactNode;
54
+ className?: string;
55
+ };
56
+ suffix?: {
57
+ children?: ReactNode;
58
+ className?: string;
59
+ };
34
60
  }
35
61
  /**
36
62
  * Props for the Dashforge TW `<TextField>`.
@@ -1 +1 @@
1
- {"version":3,"file":"textField.types.d.ts","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E;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,EACvE,IAAI,CAAC,iBAAiB,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC1D,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IAEb,qBAAqB;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAE1C,mCAAmC;IACnC,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,wBAAwB;IACxB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B,2EAA2E;IAC3E,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,qDAAqD;IACrD,SAAS,CAAC,EAAE,kBAAkB,CAAC;CAChC"}
@@ -59,6 +59,8 @@ export declare const textFieldVariants: import("tailwind-variants").TVReturnType
59
59
  input: string[];
60
60
  helperText: string;
61
61
  errorText: string;
62
+ prefix: string[];
63
+ suffix: string[];
62
64
  }, undefined, {
63
65
  size: {
64
66
  sm: {
@@ -107,6 +109,8 @@ export declare const textFieldVariants: import("tailwind-variants").TVReturnType
107
109
  input: string[];
108
110
  helperText: string;
109
111
  errorText: string;
112
+ prefix: string[];
113
+ suffix: string[];
110
114
  }, import("tailwind-variants").TVReturnType<{
111
115
  size: {
112
116
  sm: {
@@ -155,6 +159,8 @@ export declare const textFieldVariants: import("tailwind-variants").TVReturnType
155
159
  input: string[];
156
160
  helperText: string;
157
161
  errorText: string;
162
+ prefix: string[];
163
+ suffix: string[];
158
164
  }, undefined, unknown, unknown, undefined>>;
159
165
  export type TextFieldVariants = VariantProps<typeof textFieldVariants>;
160
166
  //# sourceMappingURL=textField.variants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"textField.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/TextField/textField.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAsE5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
1
+ {"version":3,"file":"textField.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/TextField/textField.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAwF5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { TooltipProps } from './tooltip.types.js';
2
+ /**
3
+ * Dashforge TW `<Tooltip>` — hoverable / focusable tooltip.
4
+ *
5
+ * Built on `@radix-ui/react-tooltip`:
6
+ * - APG tooltip pattern: `role="tooltip"`, `aria-describedby` wired
7
+ * to the trigger automatically (Radix manages the id linkage).
8
+ * - Shows on hover OR keyboard focus.
9
+ * - Dismissed on Escape or pointer leave.
10
+ *
11
+ * Wrap any single React node — it becomes the trigger via Radix's
12
+ * `asChild` slot. The trigger inherits `aria-describedby` so screen
13
+ * readers announce the tooltip content along with the trigger.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <Tooltip content="Delete this item">
18
+ * <Button variant="ghost">
19
+ * <TrashIcon />
20
+ * </Button>
21
+ * </Tooltip>
22
+ * ```
23
+ *
24
+ * Each consumer can also wrap the entire app once in
25
+ * `<RadixTooltip.Provider>` to share delay/skip configuration; we
26
+ * include a per-component provider here for ease-of-use.
27
+ */
28
+ export declare function Tooltip(props: TooltipProps): import("react/jsx-runtime").JSX.Element;
29
+ //# sourceMappingURL=Tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,2CAsC1C"}
@@ -0,0 +1,47 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface TooltipSlotProps {
3
+ content?: {
4
+ className?: string;
5
+ };
6
+ arrow?: {
7
+ className?: string;
8
+ };
9
+ }
10
+ /**
11
+ * Props for `<Tooltip>`.
12
+ *
13
+ * Built on `@radix-ui/react-tooltip`. Wrap any element with a tooltip
14
+ * that follows APG semantics (`role="tooltip"`, `aria-describedby`
15
+ * wired to the trigger).
16
+ *
17
+ * Renders an arrow by default. Three side options
18
+ * (top / right / bottom / left) with 'top' as default. Delay
19
+ * configurable via `delayDuration` (forwarded to Radix Provider).
20
+ */
21
+ export interface TooltipProps {
22
+ /** The element that, when hovered/focused, shows the tooltip. */
23
+ children: ReactNode;
24
+ /** Tooltip body content. */
25
+ content: ReactNode;
26
+ /** Side of the trigger to show the tooltip on. @default 'top' */
27
+ side?: 'top' | 'right' | 'bottom' | 'left';
28
+ /** Alignment along the perpendicular axis. @default 'center' */
29
+ align?: 'start' | 'center' | 'end';
30
+ /** Hide the arrow indicator. @default false (arrow shown) */
31
+ hideArrow?: boolean;
32
+ /** Delay before the tooltip shows on hover (ms). @default 200 */
33
+ delayDuration?: number;
34
+ /**
35
+ * Controlled open state. Use when the tooltip should be programmatic
36
+ * (e.g. revealed on a manual button press). Omit for default
37
+ * hover / focus behavior.
38
+ */
39
+ open?: boolean;
40
+ /** Called when the tooltip's open state changes. */
41
+ onOpenChange?: (open: boolean) => void;
42
+ /** Side offset in pixels from the trigger. @default 4 */
43
+ sideOffset?: number;
44
+ /** Per-slot overrides. */
45
+ slotProps?: TooltipSlotProps;
46
+ }
47
+ //# sourceMappingURL=tooltip.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Tooltip/tooltip.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,KAAK,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAChC;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC3B,iEAAiE;IACjE,QAAQ,EAAE,SAAS,CAAC;IACpB,4BAA4B;IAC5B,OAAO,EAAE,SAAS,CAAC;IACnB,iEAAiE;IACjE,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,oDAAoD;IACpD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B"}
@@ -0,0 +1,34 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ export declare const tooltipVariants: import("tailwind-variants").TVReturnType<{
3
+ [key: string]: {
4
+ [key: string]: import("tailwind-merge").ClassNameValue | {
5
+ content?: import("tailwind-merge").ClassNameValue;
6
+ arrow?: import("tailwind-merge").ClassNameValue;
7
+ };
8
+ };
9
+ } | {
10
+ [x: string]: {
11
+ [x: string]: import("tailwind-merge").ClassNameValue | {
12
+ content?: import("tailwind-merge").ClassNameValue;
13
+ arrow?: import("tailwind-merge").ClassNameValue;
14
+ };
15
+ };
16
+ } | {}, {
17
+ content: string[];
18
+ arrow: string;
19
+ }, undefined, {
20
+ [key: string]: {
21
+ [key: string]: import("tailwind-merge").ClassNameValue | {
22
+ content?: import("tailwind-merge").ClassNameValue;
23
+ arrow?: import("tailwind-merge").ClassNameValue;
24
+ };
25
+ };
26
+ } | {}, {
27
+ content: string[];
28
+ arrow: string;
29
+ }, import("tailwind-variants").TVReturnType<unknown, {
30
+ content: string[];
31
+ arrow: string;
32
+ }, undefined, unknown, unknown, undefined>>;
33
+ export type TooltipVariants = VariantProps<typeof tooltipVariants>;
34
+ //# sourceMappingURL=tooltip.variants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Tooltip/tooltip.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAa1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -93,6 +93,21 @@ export { AspectRatio } from './components/AspectRatio/AspectRatio.js';
93
93
  export type { AspectRatioProps } from './components/AspectRatio/aspectRatio.types.js';
94
94
  export { VisuallyHidden } from './components/VisuallyHidden/VisuallyHidden.js';
95
95
  export type { VisuallyHiddenProps } from './components/VisuallyHidden/visuallyHidden.types.js';
96
+ export { Dialog } from './components/Dialog/Dialog.js';
97
+ export type { DialogProps, DialogSlotProps, } from './components/Dialog/dialog.types.js';
98
+ export { dialogVariants } from './components/Dialog/dialog.variants.js';
99
+ export { Tabs } from './components/Tabs/Tabs.js';
100
+ export type { TabsProps, TabsSlotProps, TabItem, } from './components/Tabs/tabs.types.js';
101
+ export { tabsVariants } from './components/Tabs/tabs.variants.js';
102
+ export { Tooltip } from './components/Tooltip/Tooltip.js';
103
+ export type { TooltipProps, TooltipSlotProps, } from './components/Tooltip/tooltip.types.js';
104
+ export { tooltipVariants } from './components/Tooltip/tooltip.variants.js';
105
+ export { Popover } from './components/Popover/Popover.js';
106
+ export type { PopoverProps, PopoverSlotProps, } from './components/Popover/popover.types.js';
107
+ export { popoverVariants } from './components/Popover/popover.variants.js';
108
+ export { Accordion } from './components/Accordion/Accordion.js';
109
+ export type { AccordionProps, AccordionSlotProps, AccordionItem, } from './components/Accordion/accordion.types.js';
110
+ export { accordionVariants } from './components/Accordion/accordion.variants.js';
96
111
  export { useAccessState } from './hooks/useAccessState.js';
97
112
  export { cn } from './utils/cn.js';
98
113
  export { tv } from 'tailwind-variants';
@@ -100,5 +115,5 @@ export type { VariantProps } from 'tailwind-variants';
100
115
  /**
101
116
  * Package version (synced with `package.json` at publish time).
102
117
  */
103
- export declare const VERSION = "0.2.1-beta";
118
+ export declare const VERSION = "0.4.0-beta";
104
119
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,YAAY,EACV,cAAc,EACd,kBAAkB,GACnB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,YAAY,EACV,aAAa,EACb,iBAAiB,GAClB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,YAAY,EACV,WAAW,EACX,eAAe,GAChB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAIxE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAEpF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AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAGjF,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAInC,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,OAAO,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashforge/tw",
3
- "version": "0.2.1-beta",
3
+ "version": "0.4.0-beta",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.esm.js",
@@ -16,10 +16,15 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
+ "@radix-ui/react-accordion": "^1.2.0",
19
20
  "@radix-ui/react-checkbox": "^1.1.0",
21
+ "@radix-ui/react-dialog": "^1.1.0",
22
+ "@radix-ui/react-popover": "^1.1.0",
20
23
  "@radix-ui/react-radio-group": "^1.3.8",
21
24
  "@radix-ui/react-slot": "^1.1.0",
22
25
  "@radix-ui/react-switch": "^1.1.0",
26
+ "@radix-ui/react-tabs": "^1.1.0",
27
+ "@radix-ui/react-tooltip": "^1.1.0",
23
28
  "@vitejs/plugin-react": "*",
24
29
  "clsx": "^2.1.0",
25
30
  "tailwind-merge": "^2.5.0",
@@ -0,0 +1,95 @@
1
+ // @vitest-environment jsdom
2
+ import * as React from 'react';
3
+ import { describe, it, expect, afterEach } from 'vitest';
4
+ import { render, screen, fireEvent, cleanup } from '@testing-library/react';
5
+ import { Accordion } from './Accordion.js';
6
+
7
+ void React;
8
+ afterEach(() => cleanup());
9
+
10
+ const items = [
11
+ { value: 'one', header: 'Section one', content: <p>One body</p> },
12
+ { value: 'two', header: 'Section two', content: <p>Two body</p> },
13
+ { value: 'three', header: 'Section three', content: <p>Three body</p> },
14
+ ];
15
+
16
+ function regionIsOpen(bodyText: string): boolean {
17
+ const node = screen.queryByText(bodyText);
18
+ if (!node) return false;
19
+ const region = node.closest('[role="region"]');
20
+ if (!region) return false;
21
+ // Radix sets `hidden` attr on closed regions in jsdom.
22
+ return region.getAttribute('hidden') === null && !(region as HTMLElement).hidden;
23
+ }
24
+
25
+ describe('Accordion — single mode (default)', () => {
26
+ it('renders all triggers', () => {
27
+ render(<Accordion items={items} />);
28
+ expect(screen.queryByText('Section one')).not.toBeNull();
29
+ expect(screen.queryByText('Section two')).not.toBeNull();
30
+ expect(screen.queryByText('Section three')).not.toBeNull();
31
+ });
32
+
33
+ it('opens a panel on trigger click', () => {
34
+ render(<Accordion items={items} />);
35
+ expect(regionIsOpen('Two body')).toBe(false);
36
+ fireEvent.click(screen.getByText('Section two'));
37
+ expect(regionIsOpen('Two body')).toBe(true);
38
+ });
39
+
40
+ it('closes the open panel when clicked again (collapsible default)', () => {
41
+ render(<Accordion items={items} />);
42
+ const trigger = screen.getByText('Section two');
43
+ fireEvent.click(trigger);
44
+ expect(regionIsOpen('Two body')).toBe(true);
45
+ fireEvent.click(trigger);
46
+ expect(regionIsOpen('Two body')).toBe(false);
47
+ });
48
+
49
+ it('respects defaultValue', () => {
50
+ render(<Accordion items={items} defaultValue="three" />);
51
+ expect(regionIsOpen('Three body')).toBe(true);
52
+ });
53
+
54
+ it('emits onValueChange', () => {
55
+ let last: string | null = null;
56
+ render(<Accordion items={items} onValueChange={(v) => (last = v)} />);
57
+ fireEvent.click(screen.getByText('Section one'));
58
+ expect(last).toBe('one');
59
+ });
60
+ });
61
+
62
+ describe('Accordion — multiple mode', () => {
63
+ it('allows multiple panels open simultaneously', () => {
64
+ render(<Accordion type="multiple" items={items} defaultValue={['one', 'three']} />);
65
+ expect(regionIsOpen('One body')).toBe(true);
66
+ expect(regionIsOpen('Three body')).toBe(true);
67
+ });
68
+
69
+ it('emits onValueChange with the updated array', () => {
70
+ let last: string[] = [];
71
+ render(
72
+ <Accordion
73
+ type="multiple"
74
+ items={items}
75
+ defaultValue={['one']}
76
+ onValueChange={(v) => (last = v)}
77
+ />
78
+ );
79
+ fireEvent.click(screen.getByText('Section two'));
80
+ expect(last).toEqual(expect.arrayContaining(['one', 'two']));
81
+ });
82
+ });
83
+
84
+ describe('Accordion — disabled items', () => {
85
+ it('does not open a disabled section', () => {
86
+ const disabledItems = [
87
+ ...items.slice(0, 2),
88
+ { ...items[2]!, disabled: true },
89
+ ];
90
+ render(<Accordion items={disabledItems} />);
91
+ const trigger = screen.getByText('Section three');
92
+ fireEvent.click(trigger);
93
+ expect(regionIsOpen('Three body')).toBe(false);
94
+ });
95
+ });
@@ -0,0 +1,97 @@
1
+ import * as RadixAccordion from '@radix-ui/react-accordion';
2
+ import { cn } from '../../utils/cn.js';
3
+ import { accordionVariants } from './accordion.variants.js';
4
+ import type {
5
+ AccordionProps,
6
+ AccordionItem,
7
+ AccordionSlotProps,
8
+ } from './accordion.types.js';
9
+
10
+ /**
11
+ * Dashforge TW `<Accordion>` — collapsible section list.
12
+ *
13
+ * Built on `@radix-ui/react-accordion`:
14
+ * - APG accordion pattern: `role="region"` on content, header
15
+ * button with `aria-expanded` and `aria-controls` linked to
16
+ * the panel.
17
+ * - Keyboard support: Space / Enter toggle, ArrowDown / ArrowUp
18
+ * move focus between triggers, Home / End to extremes.
19
+ * - Two modes:
20
+ * - `type="single"` — at most one section open at a time;
21
+ * `collapsible` allows clicking the open section to close it
22
+ * (default true).
23
+ * - `type="multiple"` — multiple sections open simultaneously.
24
+ *
25
+ * The trigger renders a chevron that flips 180° via CSS
26
+ * (`data-state=open` selector) — no React state, no JS animation.
27
+ */
28
+ export function Accordion(props: AccordionProps) {
29
+ const v = accordionVariants();
30
+ const { items, sx, slotProps } = props;
31
+
32
+ const renderItems = (items: AccordionItem[], slotProps?: AccordionSlotProps) =>
33
+ items.map((item) => (
34
+ <RadixAccordion.Item
35
+ key={item.value}
36
+ value={item.value}
37
+ disabled={item.disabled}
38
+ className={cn(v.item(), slotProps?.item?.className)}
39
+ >
40
+ <RadixAccordion.Header
41
+ className={cn(v.header(), slotProps?.header?.className)}
42
+ >
43
+ <RadixAccordion.Trigger
44
+ className={cn(v.trigger(), slotProps?.trigger?.className)}
45
+ >
46
+ {item.header}
47
+ <svg
48
+ className={cn(v.chevron(), slotProps?.chevron?.className)}
49
+ width="1em"
50
+ height="1em"
51
+ viewBox="0 0 16 16"
52
+ fill="none"
53
+ stroke="currentColor"
54
+ strokeWidth="1.5"
55
+ strokeLinecap="round"
56
+ strokeLinejoin="round"
57
+ aria-hidden="true"
58
+ >
59
+ <path d="M4 6l4 4 4-4" />
60
+ </svg>
61
+ </RadixAccordion.Trigger>
62
+ </RadixAccordion.Header>
63
+ <RadixAccordion.Content
64
+ className={cn(v.content(), slotProps?.content?.className)}
65
+ >
66
+ <div className="pb-3 pt-0">{item.content}</div>
67
+ </RadixAccordion.Content>
68
+ </RadixAccordion.Item>
69
+ ));
70
+
71
+ if (props.type === 'multiple') {
72
+ return (
73
+ <RadixAccordion.Root
74
+ type="multiple"
75
+ value={props.value}
76
+ defaultValue={props.defaultValue}
77
+ onValueChange={props.onValueChange}
78
+ className={cn(v.root(), sx, slotProps?.root?.className)}
79
+ >
80
+ {renderItems(items, slotProps)}
81
+ </RadixAccordion.Root>
82
+ );
83
+ }
84
+
85
+ return (
86
+ <RadixAccordion.Root
87
+ type="single"
88
+ collapsible={props.collapsible ?? true}
89
+ value={props.value}
90
+ defaultValue={props.defaultValue}
91
+ onValueChange={props.onValueChange}
92
+ className={cn(v.root(), sx, slotProps?.root?.className)}
93
+ >
94
+ {renderItems(items, slotProps)}
95
+ </RadixAccordion.Root>
96
+ );
97
+ }
@@ -0,0 +1,66 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface AccordionSlotProps {
4
+ root?: { className?: string };
5
+ item?: { className?: string };
6
+ header?: { className?: string };
7
+ trigger?: { className?: string };
8
+ content?: { className?: string };
9
+ chevron?: { className?: string };
10
+ }
11
+
12
+ /**
13
+ * Single accordion section — paired `{ value, header, content }`.
14
+ * The `value` is the canonical id (used in `value` / `defaultValue`
15
+ * to control which sections are expanded).
16
+ */
17
+ export interface AccordionItem {
18
+ value: string;
19
+ /** Trigger label (clickable to expand / collapse). */
20
+ header: ReactNode;
21
+ /** Section body, revealed when this item is expanded. */
22
+ content: ReactNode;
23
+ /** Per-item disabled flag. */
24
+ disabled?: boolean;
25
+ }
26
+
27
+ interface AccordionBaseProps {
28
+ items: AccordionItem[];
29
+ /** Root className shortcut. */
30
+ sx?: string;
31
+ /** Per-slot overrides. */
32
+ slotProps?: AccordionSlotProps;
33
+ }
34
+
35
+ /**
36
+ * Single-mode props — at most one section open at a time.
37
+ * `collapsible: true` (default) lets the user close the open
38
+ * section by clicking it again.
39
+ */
40
+ export interface AccordionSingleProps extends AccordionBaseProps {
41
+ type?: 'single';
42
+ value?: string;
43
+ defaultValue?: string;
44
+ onValueChange?: (value: string) => void;
45
+ /** @default true */
46
+ collapsible?: boolean;
47
+ }
48
+
49
+ /**
50
+ * Multiple-mode props — any number of sections open simultaneously.
51
+ */
52
+ export interface AccordionMultipleProps extends AccordionBaseProps {
53
+ type: 'multiple';
54
+ value?: string[];
55
+ defaultValue?: string[];
56
+ onValueChange?: (value: string[]) => void;
57
+ }
58
+
59
+ /**
60
+ * Props for `<Accordion>`.
61
+ *
62
+ * Built on `@radix-ui/react-accordion`. Discriminated by `type`:
63
+ * - `type="single"` (default) — `value` is `string`.
64
+ * - `type="multiple"` — `value` is `string[]`.
65
+ */
66
+ export type AccordionProps = AccordionSingleProps | AccordionMultipleProps;