@citrusworx/juiceui 0.9.2 → 0.9.3

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 (37) hide show
  1. package/README.md +34 -11
  2. package/dist/components/accordion/accordion.d.ts +2 -1
  3. package/dist/index.css +1499 -89
  4. package/dist/index.d.ts +33 -25
  5. package/dist/index.js +3035 -2253
  6. package/dist/js/juice.d.ts +33 -25
  7. package/dist/js/src/accordion/accordion-runtime.d.ts +6 -0
  8. package/dist/js/src/avatar/avatar-runtime.d.ts +74 -0
  9. package/dist/js/src/banner/banner-runtime.d.ts +5 -0
  10. package/dist/js/src/breadcrumb/breadcrumb-runtime.d.ts +6 -0
  11. package/dist/js/src/checkbox/checkbox-runtime.d.ts +4 -0
  12. package/dist/js/src/combobox/combobox-runtime.d.ts +6 -0
  13. package/dist/js/src/disclosure/disclosure-runtime.d.ts +5 -0
  14. package/dist/js/src/drawer/drawer-runtime.d.ts +5 -0
  15. package/dist/js/src/field/field-runtime.d.ts +5 -0
  16. package/dist/js/src/icon-button/icon-button-runtime.d.ts +67 -0
  17. package/dist/js/src/input/input-runtime.d.ts +8 -0
  18. package/dist/js/src/menu/menu-runtime.d.ts +5 -0
  19. package/dist/js/src/modal/modal-runtime.d.ts +5 -0
  20. package/dist/js/src/nav/navigation.d.ts +5 -0
  21. package/dist/js/src/pagination/pagination-runtime.d.ts +6 -0
  22. package/dist/js/src/popover/popover-runtime.d.ts +5 -0
  23. package/dist/js/src/progress/progress-runtime.d.ts +5 -0
  24. package/dist/js/src/radio/radio-runtime.d.ts +7 -0
  25. package/dist/js/src/select/select-runtime.d.ts +9 -0
  26. package/dist/js/src/shared/change.d.ts +32 -0
  27. package/dist/js/src/slider/slider-runtime.d.ts +4 -0
  28. package/dist/js/src/spinner/spinner-runtime.d.ts +4 -0
  29. package/dist/js/src/switch/switch-runtime.d.ts +4 -0
  30. package/dist/js/src/table/table-runtime.d.ts +99 -0
  31. package/dist/js/src/tabs/tabs-runtime.d.ts +6 -0
  32. package/dist/js/src/textarea/textarea-runtime.d.ts +8 -0
  33. package/dist/js/src/toast/toast-runtime.d.ts +5 -0
  34. package/dist/js/src/tooltip/tooltip-runtime.d.ts +5 -0
  35. package/dist/js/src/wizard/wizard-runtime.d.ts +4 -0
  36. package/dist/themes/tide.css +7 -0
  37. package/package.json +2 -2
@@ -0,0 +1,99 @@
1
+ /**
2
+ * DOM-first sortable headers for Juice table chrome.
3
+ *
4
+ * Markup contract (Slice A — do not rename attrs):
5
+ * [table] host. A real <table>. <div table> is not a
6
+ * host. Sync does not rewrite [table].
7
+ * th[sortable] opt-in header inside that table. [sortable]
8
+ * was free (no other Juice attribute uses it),
9
+ * so the name did not need a [table-sortable]
10
+ * fallback. A sortable cell outside [table] is
11
+ * left alone.
12
+ * [numeric] on the th or on a cell in that column. The
13
+ * column compares as numbers. One numeric cell
14
+ * makes the whole column numeric, including
15
+ * every tbody. Slice A still owns tabular nums.
16
+ * [data-sort-value] on a body cell. Compared instead of the
17
+ * visible text. Parsed as a number when the
18
+ * column is numeric.
19
+ *
20
+ * The runtime wraps each sortable header's contents in
21
+ * <button type="button"> so the header is keyboard and screen-reader
22
+ * operable. Enter and Space stay with the browser: a native button
23
+ * turns them into a click, and a key handler here would sort twice.
24
+ * Wrapping is idempotent. destroy moves the original nodes back out
25
+ * and removes that button. An accessible name is the header text.
26
+ * This runtime does not invent one.
27
+ *
28
+ * Activation cycles that column ascending -> descending -> none.
29
+ * Single-column sort. The active th gets aria-sort="ascending" or
30
+ * "descending". Every other sortable th in the table gets
31
+ * aria-sort="none". An author aria-sort of ascending or descending is
32
+ * adopted as the initial state and is not a client reorder (server
33
+ * HTML can already be sorted). The next activation continues the cycle.
34
+ *
35
+ * Each tbody is reordered on its own. The original row order is the
36
+ * DOM order first observed while this runtime is not itself holding a
37
+ * client sort. Rows first seen during a client sort are appended to
38
+ * that memory. direction "none" puts the memory back. Sort is stable:
39
+ * equal keys keep original order.
40
+ *
41
+ * Comparison, in order:
42
+ * 1. data-sort-value when that attribute is present (trimmed).
43
+ * 2. Otherwise the cell's text, whitespace collapsed and trimmed.
44
+ * 3. Numeric columns use a finite decimal parse (commas removed).
45
+ * Values that do not parse sort after every number, in both
46
+ * directions, and tie with each other.
47
+ * 4. Text columns use Intl.Collator numeric: true, sensitivity:
48
+ * "base" (case-insensitive, natural numeric).
49
+ *
50
+ * Column identity is the header's cellIndex. Colspan and rowspan are
51
+ * not expanded into a visual grid. A body cell is the cell at that
52
+ * same cellIndex, or empty when the row has no cell there. A colspan
53
+ * on an earlier cell shifts later cellIndexes, so the sorted value can
54
+ * disagree with the painted column. Put one cell per column in each
55
+ * body row when the sort must follow the painted grid. Sortable
56
+ * headers belong in thead. A th[sortable] inside tbody is not special:
57
+ * its row is sorted with the other rows of that tbody.
58
+ *
59
+ * Before a reorder, the table dispatches a bubbling cancelable
60
+ * juice:sort CustomEvent. detail is { column, direction } where column
61
+ * is the activated header's cellIndex even when direction is "none".
62
+ * If defaultPrevented, aria-sort and state still update and rows stay
63
+ * put (server-side sort). sync() while that canceled sort is current
64
+ * refreshes the remembered order from the DOM and still does not
65
+ * reorder. The next activation that is not canceled sorts from the
66
+ * DOM order at that moment.
67
+ *
68
+ * State is { column: number | null, direction }. column is null when
69
+ * direction is "none", and is the header cellIndex otherwise. The
70
+ * first observation does not dispatch. Later changes dispatch a
71
+ * bubbling juice:change CustomEvent with detail
72
+ * { runtime: "table", state }. sync() re-reads headers and rows,
73
+ * wraps new sortable headers, and re-applies a client sort so rows
74
+ * added later join it.
75
+ *
76
+ * destroy restores original contents, restores row order when this
77
+ * runtime had reordered them, and puts author aria-sort back. Shared
78
+ * sort memory is cleared, so a second live controller re-reads the
79
+ * restored DOM on its next sync. No Sig Table factory.
80
+ */
81
+ export type TableOptions = {
82
+ root?: ParentNode;
83
+ tableSelector?: string;
84
+ sortableSelector?: string;
85
+ };
86
+ export type TableSortDirection = 'ascending' | 'descending' | 'none';
87
+ export type TableState = {
88
+ column: number | null;
89
+ direction: TableSortDirection;
90
+ };
91
+ export type TableController = {
92
+ destroy: () => void;
93
+ sync: () => void;
94
+ getState: (target?: HTMLElement | null) => TableState | null;
95
+ };
96
+ export declare const createTable: (options?: TableOptions) => TableController;
97
+ export declare const initTable: (options?: TableOptions) => TableController;
98
+ export declare const startTableRuntime: () => TableController | null;
99
+ export declare const stopTableRuntime: () => void;
@@ -5,10 +5,16 @@ export type TabsOptions = {
5
5
  triggerSelector?: string;
6
6
  panelSelector?: string;
7
7
  };
8
+ /** `selected` is the trigger index. `-1` when the tab list is empty. */
9
+ export type TabsState = {
10
+ selected: number;
11
+ };
8
12
  export type TabsController = {
9
13
  destroy: () => void;
10
14
  sync: () => void;
11
15
  select: (trigger?: HTMLElement | null) => void;
16
+ selected: (target?: HTMLElement | null) => HTMLElement | null;
17
+ getState: (target?: HTMLElement | null) => TabsState | null;
12
18
  };
13
19
  export declare const createTabs: (options?: TabsOptions) => TabsController;
14
20
  export declare const initTabs: (options?: TabsOptions) => TabsController;
@@ -41,9 +41,17 @@ export type TextareaOptions = {
41
41
  root?: ParentNode;
42
42
  textareaSelector?: string;
43
43
  };
44
+ /**
45
+ * Value changes stay on the native `input` and `change` events.
46
+ * This runtime does not dispatch `juice:change`.
47
+ */
48
+ export type TextareaState = {
49
+ value: string;
50
+ };
44
51
  export type TextareaController = {
45
52
  destroy: () => void;
46
53
  sync: () => void;
54
+ getState: (target?: HTMLElement | null) => TextareaState | null;
47
55
  };
48
56
  export declare const createTextarea: (options?: TextareaOptions) => TextareaController;
49
57
  export declare const initTextarea: (options?: TextareaOptions) => TextareaController;
@@ -41,11 +41,16 @@ export type ToastOptions = {
41
41
  closeSelector?: string;
42
42
  defaultDuration?: number;
43
43
  };
44
+ export type ToastState = {
45
+ shown: boolean;
46
+ };
44
47
  export type ToastController = {
45
48
  destroy: () => void;
46
49
  sync: () => void;
47
50
  show: (target?: HTMLElement | null) => void;
48
51
  dismiss: (target?: HTMLElement | null) => void;
52
+ isShown: (target?: HTMLElement | null) => boolean;
53
+ getState: (target?: HTMLElement | null) => ToastState | null;
49
54
  };
50
55
  export declare const createToast: (options?: ToastOptions) => ToastController;
51
56
  export declare const initToast: (options?: ToastOptions) => ToastController;
@@ -48,11 +48,16 @@ export type TooltipOptions = {
48
48
  gap?: number;
49
49
  hideDelay?: number;
50
50
  };
51
+ export type TooltipState = {
52
+ shown: boolean;
53
+ };
51
54
  export type TooltipController = {
52
55
  destroy: () => void;
53
56
  sync: () => void;
54
57
  show: (target?: HTMLElement | null) => void;
55
58
  hide: (target?: HTMLElement | null) => void;
59
+ isShown: (target?: HTMLElement | null) => boolean;
60
+ getState: (target?: HTMLElement | null) => TooltipState | null;
56
61
  };
57
62
  export declare const createTooltip: (options?: TooltipOptions) => TooltipController;
58
63
  export declare const initTooltip: (options?: TooltipOptions) => TooltipController;
@@ -40,6 +40,9 @@ export type WizardOptions = {
40
40
  prevSelector?: string;
41
41
  completeSelector?: string;
42
42
  };
43
+ export type WizardState = {
44
+ current: number;
45
+ };
43
46
  export type WizardController = {
44
47
  destroy: () => void;
45
48
  sync: () => void;
@@ -47,6 +50,7 @@ export type WizardController = {
47
50
  prev: (target?: HTMLElement | null) => void;
48
51
  goTo: (step: number | string, target?: HTMLElement | null) => void;
49
52
  current: (target?: HTMLElement | null) => number;
53
+ getState: (target?: HTMLElement | null) => WizardState | null;
50
54
  };
51
55
  export declare const createWizard: (options?: WizardOptions) => WizardController;
52
56
  export declare const initWizard: (options?: WizardOptions) => WizardController;
@@ -217,6 +217,13 @@
217
217
  --juice-banner-info-soft: var(--tide-banner-info-soft);
218
218
  --juice-banner-warning: var(--tide-banner-warning);
219
219
  --juice-banner-warning-soft: var(--tide-banner-warning-soft);
220
+ /* Avatar away dot. Core maps away to banner warning, which on Tide is
221
+ lagoon-800. That step sits on the muted surface (the same hue at low
222
+ alpha) and the dot disappears (about 1.6:1). Lift the warning hue
223
+ toward the text color so the dot stays in-family and readable.
224
+ Online, busy, and offline already clear the surface. No other
225
+ --juice-avatar-* override. */
226
+ --juice-avatar-status-away: color-mix(in srgb, var(--tide-banner-warning) 45%, var(--tide-text));
220
227
  /* Popover chrome — dark panel, not white glass. Close is a surface
221
228
  control, not the CTA gradient. Distinct from modal/drawer/toast. */
222
229
  --tide-popover-panel: var(--tide-surface-strong);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citrusworx/juiceui",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -174,7 +174,7 @@
174
174
  "access": "public"
175
175
  },
176
176
  "dependencies": {
177
- "@citrusworx/sigjs": "^0.3.0"
177
+ "@citrusworx/sigjs": "^0.7.0"
178
178
  },
179
179
  "devDependencies": {
180
180
  "@testing-library/jest-dom": "^6.9.1",