@middag-io/react 0.51.1 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/{DateField-lPZsiWfC.js → DateField-CduB6lUv.js} +21 -23
- package/dist-lib/{DateRangeField-B7zWB48D.js → DateRangeField-DlA_9i4w.js} +17 -13
- package/dist-lib/{FormField-BGqAQLtX.js → FormField-CDdY7-md.js} +2090 -2054
- package/dist-lib/{FormPanelBlock-CGgA83Mu.js → FormPanelBlock-zo8tCgtS.js} +1 -2
- package/dist-lib/base/blocks/CardGridBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/EmptyStateBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/FormPanelBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/MetricCardBlock.d.ts.map +1 -1
- package/dist-lib/base/form/FormField.d.ts +8 -1
- package/dist-lib/base/form/FormField.d.ts.map +1 -1
- package/dist-lib/base/form/fields/DateField.d.ts +1 -1
- package/dist-lib/base/form/fields/DateField.d.ts.map +1 -1
- package/dist-lib/base/form/fields/DateRangeField.d.ts +3 -1
- package/dist-lib/base/form/fields/DateRangeField.d.ts.map +1 -1
- package/dist-lib/base/form/fields/MultiSelectField.d.ts +3 -1
- package/dist-lib/base/form/fields/MultiSelectField.d.ts.map +1 -1
- package/dist-lib/base/form/fields/RadioField.d.ts +3 -1
- package/dist-lib/base/form/fields/RadioField.d.ts.map +1 -1
- package/dist-lib/base/form/fields/RatingField.d.ts +3 -1
- package/dist-lib/base/form/fields/RatingField.d.ts.map +1 -1
- package/dist-lib/base/form/fields/SliderField.d.ts +3 -1
- package/dist-lib/base/form/fields/SliderField.d.ts.map +1 -1
- package/dist-lib/base/form/fields/TagsField.d.ts.map +1 -1
- package/dist-lib/base/partials/DataTable/cell-renderers.d.ts.map +1 -1
- package/dist-lib/base/partials/DataTable/index.d.ts.map +1 -1
- package/dist-lib/base/partials/DataTable/types.d.ts +2 -2
- package/dist-lib/base/partials/DataTable/types.d.ts.map +1 -1
- package/dist-lib/base/partials/EmptyPlaceholder/index.d.ts.map +1 -1
- package/dist-lib/base/shell/BasicShell.d.ts +12 -1
- package/dist-lib/base/shell/BasicShell.d.ts.map +1 -1
- package/dist-lib/base/shell/BasicShell.js +126 -111
- package/dist-lib/base/shell/partials/InlineEditablePanel.js +193 -176
- package/dist-lib/base/shell/partials/InspectorContext.js +1 -1
- package/dist-lib/base/theme/tailwind-theme.css +13 -5
- package/dist-lib/base/theme/theme-bridge.css +8 -0
- package/dist-lib/base/theme/themes/classic.css +15 -11
- package/dist-lib/base/theme/tokens.css +36 -10
- package/dist-lib/base/utils/php-wire.d.ts +33 -0
- package/dist-lib/base/utils/php-wire.d.ts.map +1 -0
- package/dist-lib/base/utils/php-wire.js +19 -0
- package/dist-lib/chunks/{subpath-DjkzcIPp.js → subpath-Bb5vw3A_.js} +21 -23
- package/dist-lib/chunks/{subpath-fEhy6n_U.js → subpath-CZB5_RY7.js} +2 -0
- package/dist-lib/chunks/subpath-DVHs9lfh.js +29 -0
- package/dist-lib/contracts/block-data/data-display.d.ts +12 -287
- package/dist-lib/contracts/block-data/data-display.d.ts.map +1 -1
- package/dist-lib/contracts/block-data/interactive.d.ts +14 -22
- package/dist-lib/contracts/block-data/interactive.d.ts.map +1 -1
- package/dist-lib/contracts/block-data/shared.d.ts +2 -17
- package/dist-lib/contracts/block-data/shared.d.ts.map +1 -1
- package/dist-lib/contracts/generated/index.d.ts +2 -2
- package/dist-lib/contracts/generated/schemas.d.ts +1584 -192
- package/dist-lib/contracts/generated/schemas.d.ts.map +1 -1
- package/dist-lib/contracts/generated/types.d.ts +288 -8
- package/dist-lib/contracts/generated/types.d.ts.map +1 -1
- package/dist-lib/contracts/page-contract-schema.d.ts +15 -0
- package/dist-lib/contracts/page-contract-schema.d.ts.map +1 -1
- package/dist-lib/i18n/I18nProvider.js +1 -1
- package/dist-lib/i18n/instance.js +1 -1
- package/dist-lib/i18n/locales/en/ui.json +1 -0
- package/dist-lib/i18n/locales/pt-BR/ui.json +1 -0
- package/dist-lib/i18n/register-strings.js +1 -1
- package/dist-lib/index.d.ts +2 -2
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/lib/hooks/use-prefers-reduced-motion.d.ts +6 -0
- package/dist-lib/lib/hooks/use-prefers-reduced-motion.d.ts.map +1 -0
- package/dist-lib/lib/hooks/use-prefers-reduced-motion.js +21 -0
- package/dist-lib/middag-react.css +1 -1
- package/dist-lib/middag-react.js +10407 -10012
- package/dist-lib/primitives/reui/badge.d.ts +5 -0
- package/dist-lib/primitives/reui/badge.d.ts.map +1 -1
- package/dist-lib/primitives/reui/badge.js +14 -14
- package/dist-lib/primitives/reui/sidebar.d.ts.map +1 -1
- package/dist-lib/primitives/reui/sidebar.js +46 -34
- package/docs/public/schemas/fragment.json +1258 -19
- package/docs/public/schemas/page-contract.json +1258 -19
- package/docs/public/schemas/shared-props.json +1258 -19
- package/package.json +6 -1
- package/src/base/blocks/CardGridBlock.tsx +10 -2
- package/src/base/blocks/DenseTableBlock.tsx +18 -11
- package/src/base/blocks/DetailPanelBlock.tsx +1 -1
- package/src/base/blocks/EmptyStateBlock.tsx +5 -1
- package/src/base/blocks/FormPanelBlock.tsx +0 -1
- package/src/base/blocks/MetricCardBlock.tsx +9 -2
- package/src/base/form/FormField.tsx +40 -7
- package/src/base/form/fields/DateField.tsx +3 -3
- package/src/base/form/fields/DateRangeField.tsx +19 -14
- package/src/base/form/fields/MultiSelectField.tsx +9 -8
- package/src/base/form/fields/RadioField.tsx +4 -0
- package/src/base/form/fields/RatingField.tsx +4 -0
- package/src/base/form/fields/SliderField.tsx +4 -1
- package/src/base/form/fields/TagsField.tsx +3 -0
- package/src/base/partials/DataTable/cell-renderers.tsx +23 -12
- package/src/base/partials/DataTable/index.tsx +5 -2
- package/src/base/partials/DataTable/types.ts +2 -5
- package/src/base/partials/DetailSection/index.tsx +2 -2
- package/src/base/partials/EmptyPlaceholder/index.tsx +7 -3
- package/src/base/partials/MarkdownContent/index.tsx +1 -1
- package/src/base/shell/BasicShell.tsx +47 -8
- package/src/base/shell/partials/InspectorContext.tsx +1 -1
- package/src/base/theme/tailwind-theme.css +13 -5
- package/src/base/theme/theme-bridge.css +8 -0
- package/src/base/theme/themes/classic.css +15 -11
- package/src/base/theme/tokens.css +36 -10
- package/src/base/utils/php-wire.ts +54 -0
- package/src/contracts/block-data/data-display.ts +46 -337
- package/src/contracts/block-data/interactive.ts +18 -23
- package/src/contracts/block-data/shared.ts +2 -14
- package/src/contracts/generated/index.ts +2 -2
- package/src/contracts/generated/schemas.ts +312 -9
- package/src/contracts/generated/types.ts +314 -8
- package/src/i18n/locales/en/ui.json +1 -0
- package/src/i18n/locales/pt-BR/ui.json +1 -0
- package/src/lib/hooks/use-prefers-reduced-motion.ts +32 -0
- package/src/primitives/reui/badge.tsx +19 -14
- package/src/primitives/reui/sidebar.tsx +30 -3
- package/src/theme.css +11 -5
- package/dist-lib/chunks/subpath-DoiyWIYV.js +0 -25
|
@@ -19,7 +19,7 @@ function o({ field: e }) {
|
|
|
19
19
|
className: "text-muted-foreground",
|
|
20
20
|
children: "---"
|
|
21
21
|
}) : e.kind === "boolean" ? /* @__PURE__ */ n("span", { children: e.value ? "✓" : "✗" }) : e.kind === "status" || e.kind === "badge" ? /* @__PURE__ */ n("span", {
|
|
22
|
-
className: `inline-flex rounded-full px-2 py-0.5 text-[10px] font-semibold ${e.value === "active" || e.value === "granted" ? "bg-success-subtle text-success" : e.value === "failed" || e.value === "revoked" ? "bg-destructive-subtle text-destructive" : "bg-muted text-muted-foreground"}`,
|
|
22
|
+
className: `inline-flex rounded-full px-2 py-0.5 text-[10px] font-semibold ${e.value === "active" || e.value === "granted" ? "bg-success-subtle text-success-text" : e.value === "failed" || e.value === "revoked" ? "bg-destructive-subtle text-destructive" : "bg-muted text-muted-foreground"}`,
|
|
23
23
|
children: String(e.value)
|
|
24
24
|
}) : e.kind === "timestamp" && typeof e.value == "number" ? /* @__PURE__ */ n("span", { children: (/* @__PURE__ */ new Date(e.value * 1e3)).toLocaleDateString() }) : e.kind === "code" ? /* @__PURE__ */ n("code", {
|
|
25
25
|
className: "bg-muted rounded-[3px] px-1.5 py-px font-mono text-xs",
|
|
@@ -62,6 +62,12 @@
|
|
|
62
62
|
--color-info-subtle: var(--info-subtle);
|
|
63
63
|
--color-info-muted: var(--info-muted);
|
|
64
64
|
|
|
65
|
+
/* ── Status text (AA on canvas, card, subtle and tinted fills) ── */
|
|
66
|
+
--color-destructive-text: var(--destructive-text);
|
|
67
|
+
--color-success-text: var(--success-text);
|
|
68
|
+
--color-warning-text: var(--warning-text);
|
|
69
|
+
--color-info-text: var(--info-text);
|
|
70
|
+
|
|
65
71
|
/* ── Chart colors ── */
|
|
66
72
|
--color-chart-1: var(--chart-1);
|
|
67
73
|
--color-chart-2: var(--chart-2);
|
|
@@ -85,11 +91,13 @@
|
|
|
85
91
|
--font-sans: var(--font-sans);
|
|
86
92
|
--font-mono: var(--font-mono);
|
|
87
93
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
--radius-
|
|
91
|
-
--radius-
|
|
92
|
-
--radius-
|
|
94
|
+
/* Radius values live in tokens.css (the unlayered :root value is the one
|
|
95
|
+
that renders); the utilities only point at them. */
|
|
96
|
+
--radius-sm: var(--radius-sm);
|
|
97
|
+
--radius-md: var(--radius-md);
|
|
98
|
+
--radius-lg: var(--radius-lg);
|
|
99
|
+
--radius-xl: var(--radius-xl);
|
|
100
|
+
--radius-2xl: var(--radius-2xl);
|
|
93
101
|
|
|
94
102
|
/* ── Spacing scale as Tailwind spacing ── */
|
|
95
103
|
--spacing-0: var(--space-0);
|
|
@@ -41,24 +41,28 @@
|
|
|
41
41
|
--color-destructive-foreground: var(--destructive-foreground);
|
|
42
42
|
--color-destructive-subtle: var(--destructive-subtle);
|
|
43
43
|
--color-destructive-muted: var(--destructive-muted);
|
|
44
|
+
--color-destructive-text: var(--destructive-text);
|
|
44
45
|
|
|
45
46
|
/* Success */
|
|
46
47
|
--color-success: var(--success);
|
|
47
48
|
--color-success-foreground: var(--success-foreground);
|
|
48
49
|
--color-success-subtle: var(--success-subtle);
|
|
49
50
|
--color-success-muted: var(--success-muted);
|
|
51
|
+
--color-success-text: var(--success-text);
|
|
50
52
|
|
|
51
53
|
/* Warning */
|
|
52
54
|
--color-warning: var(--warning);
|
|
53
55
|
--color-warning-foreground: var(--warning-foreground);
|
|
54
56
|
--color-warning-subtle: var(--warning-subtle);
|
|
55
57
|
--color-warning-muted: var(--warning-muted);
|
|
58
|
+
--color-warning-text: var(--warning-text);
|
|
56
59
|
|
|
57
60
|
/* Info */
|
|
58
61
|
--color-info: var(--info);
|
|
59
62
|
--color-info-foreground: var(--info-foreground);
|
|
60
63
|
--color-info-subtle: var(--info-subtle);
|
|
61
64
|
--color-info-muted: var(--info-muted);
|
|
65
|
+
--color-info-text: var(--info-text);
|
|
62
66
|
|
|
63
67
|
/* Neutral */
|
|
64
68
|
--color-muted: var(--muted);
|
|
@@ -122,18 +126,22 @@
|
|
|
122
126
|
--color-destructive-foreground: var(--destructive-foreground);
|
|
123
127
|
--color-destructive-subtle: var(--destructive-subtle);
|
|
124
128
|
--color-destructive-muted: var(--destructive-muted);
|
|
129
|
+
--color-destructive-text: var(--destructive-text);
|
|
125
130
|
--color-success: var(--success);
|
|
126
131
|
--color-success-foreground: var(--success-foreground);
|
|
127
132
|
--color-success-subtle: var(--success-subtle);
|
|
128
133
|
--color-success-muted: var(--success-muted);
|
|
134
|
+
--color-success-text: var(--success-text);
|
|
129
135
|
--color-warning: var(--warning);
|
|
130
136
|
--color-warning-foreground: var(--warning-foreground);
|
|
131
137
|
--color-warning-subtle: var(--warning-subtle);
|
|
132
138
|
--color-warning-muted: var(--warning-muted);
|
|
139
|
+
--color-warning-text: var(--warning-text);
|
|
133
140
|
--color-info: var(--info);
|
|
134
141
|
--color-info-foreground: var(--info-foreground);
|
|
135
142
|
--color-info-subtle: var(--info-subtle);
|
|
136
143
|
--color-info-muted: var(--info-muted);
|
|
144
|
+
--color-info-text: var(--info-text);
|
|
137
145
|
--color-muted: var(--muted);
|
|
138
146
|
--color-muted-foreground: var(--muted-foreground);
|
|
139
147
|
--color-accent: var(--accent);
|
|
@@ -36,25 +36,29 @@
|
|
|
36
36
|
--accent-foreground: oklch(0.21 0.014 285.82);
|
|
37
37
|
|
|
38
38
|
/* --- Colors: status ---------------------------------------------------- */
|
|
39
|
-
--success: oklch(0.
|
|
39
|
+
--success: oklch(0.52 0.16 155);
|
|
40
40
|
--success-foreground: oklch(0.98 0 0);
|
|
41
41
|
--success-subtle: oklch(0.95 0.04 155);
|
|
42
42
|
--success-muted: oklch(0.88 0.06 155);
|
|
43
|
+
--success-text: oklch(0.45 0.13 155);
|
|
43
44
|
|
|
44
45
|
--warning: oklch(0.75 0.18 75);
|
|
45
46
|
--warning-foreground: oklch(0.18 0.02 75);
|
|
46
47
|
--warning-subtle: oklch(0.96 0.04 75);
|
|
47
48
|
--warning-muted: oklch(0.9 0.06 75);
|
|
49
|
+
--warning-text: oklch(0.48 0.11 60);
|
|
48
50
|
|
|
49
|
-
--destructive: oklch(0.
|
|
51
|
+
--destructive: oklch(0.56 0.23 27.33);
|
|
50
52
|
--destructive-foreground: oklch(0.98 0 0);
|
|
51
53
|
--destructive-subtle: oklch(0.95 0.05 27.33);
|
|
52
54
|
--destructive-muted: oklch(0.88 0.08 27.33);
|
|
55
|
+
--destructive-text: oklch(0.48 0.2 27.33);
|
|
53
56
|
|
|
54
|
-
--info: oklch(0.
|
|
57
|
+
--info: oklch(0.54 0.16 250);
|
|
55
58
|
--info-foreground: oklch(0.98 0 0);
|
|
56
59
|
--info-subtle: oklch(0.95 0.04 250);
|
|
57
60
|
--info-muted: oklch(0.88 0.06 250);
|
|
61
|
+
--info-text: oklch(0.47 0.15 250);
|
|
58
62
|
|
|
59
63
|
/* --- Colors: surfaces & neutrals (warm) -------------------------------- */
|
|
60
64
|
--background: oklch(0.99 0.001 286);
|
|
@@ -64,11 +68,11 @@
|
|
|
64
68
|
--popover: oklch(1 0 0);
|
|
65
69
|
--popover-foreground: oklch(0.145 0.014 285.82);
|
|
66
70
|
--muted: oklch(0.97 0.001 286);
|
|
67
|
-
--muted-foreground: oklch(0.
|
|
71
|
+
--muted-foreground: oklch(0.52 0.008 286);
|
|
68
72
|
|
|
69
73
|
--border: oklch(0.975 0.001 286);
|
|
70
74
|
--input: oklch(0.89 0.004 286);
|
|
71
|
-
--ring: oklch(0.
|
|
75
|
+
--ring: oklch(0.64 0.03 256.85);
|
|
72
76
|
|
|
73
77
|
/* --- Colors: sidebar --------------------------------------------------- */
|
|
74
78
|
--sidebar: oklch(0.975 0.002 286);
|
|
@@ -89,11 +93,7 @@
|
|
|
89
93
|
|
|
90
94
|
/* --- Radii (Maia — generous) ------------------------------------------- */
|
|
91
95
|
--radius: 0.625rem;
|
|
92
|
-
--radius-sm
|
|
93
|
-
--radius-md: 6px;
|
|
94
|
-
--radius-lg: 8px;
|
|
95
|
-
--radius-xl: 12px;
|
|
96
|
-
--radius-2xl: 16px;
|
|
96
|
+
/* --radius-sm … --radius-2xl come from tokens.css (single source). */
|
|
97
97
|
|
|
98
98
|
/* --- Layout ------------------------------------------------------------- */
|
|
99
99
|
--sidebar-width: 260px;
|
|
@@ -128,21 +128,25 @@
|
|
|
128
128
|
--success-foreground: oklch(0.1 0.01 155);
|
|
129
129
|
--success-subtle: oklch(0.2 0.04 155);
|
|
130
130
|
--success-muted: oklch(0.26 0.06 155);
|
|
131
|
+
--success-text: oklch(0.76 0.15 155);
|
|
131
132
|
|
|
132
133
|
--warning: oklch(0.78 0.18 75);
|
|
133
134
|
--warning-foreground: oklch(0.15 0.02 75);
|
|
134
135
|
--warning-subtle: oklch(0.22 0.04 75);
|
|
135
136
|
--warning-muted: oklch(0.28 0.06 75);
|
|
137
|
+
--warning-text: oklch(0.82 0.15 75);
|
|
136
138
|
|
|
137
139
|
--destructive: oklch(0.63 0.24 27.33);
|
|
138
140
|
--destructive-foreground: oklch(0.1 0.01 27.33);
|
|
139
141
|
--destructive-subtle: oklch(0.22 0.06 27.33);
|
|
140
142
|
--destructive-muted: oklch(0.28 0.08 27.33);
|
|
143
|
+
--destructive-text: oklch(0.74 0.16 27.33);
|
|
141
144
|
|
|
142
145
|
--info: oklch(0.65 0.16 250);
|
|
143
146
|
--info-foreground: oklch(0.1 0.01 250);
|
|
144
147
|
--info-subtle: oklch(0.2 0.04 250);
|
|
145
148
|
--info-muted: oklch(0.26 0.06 250);
|
|
149
|
+
--info-text: oklch(0.76 0.12 250);
|
|
146
150
|
|
|
147
151
|
--background: oklch(0.13 0.01 285.82);
|
|
148
152
|
--foreground: oklch(0.93 0.005 285.82);
|
|
@@ -151,7 +155,7 @@
|
|
|
151
155
|
--popover: oklch(0.18 0.008 285.82);
|
|
152
156
|
--popover-foreground: oklch(0.93 0.005 285.82);
|
|
153
157
|
--muted: oklch(0.2 0.005 286.38);
|
|
154
|
-
--muted-foreground: oklch(0.
|
|
158
|
+
--muted-foreground: oklch(0.62 0.01 285.82);
|
|
155
159
|
|
|
156
160
|
--border: oklch(0.24 0.004 286.32);
|
|
157
161
|
--input: oklch(0.32 0.005 286.32);
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Source of truth for all visual tokens.
|
|
5
5
|
* Consumed by Tailwind CSS v4 via @theme in tailwind.css.
|
|
6
|
+
*
|
|
7
|
+
* Contrast: text pairs reach WCAG AA (4.5:1) in light and dark mode, the focus
|
|
8
|
+
* ring 3:1. `npm run theme:contrast` (scripts/check-contrast.mjs) measures
|
|
9
|
+
* them and runs in CI. A status color (--success, --warning, --info,
|
|
10
|
+
* --destructive) is a fill; text in a status color uses its `--*-text` token
|
|
11
|
+
* (`text-success-text`, ...), which stays readable on the canvas, the card,
|
|
12
|
+
* the `*-subtle` surface and the badge tints.
|
|
6
13
|
*/
|
|
7
14
|
|
|
8
15
|
:root {
|
|
@@ -21,39 +28,43 @@
|
|
|
21
28
|
--secondary-foreground: oklch(0.45 0.01 286);
|
|
22
29
|
|
|
23
30
|
/* ── Destructive ── */
|
|
24
|
-
--destructive: oklch(0.
|
|
31
|
+
--destructive: oklch(0.56 0.23 27.33);
|
|
25
32
|
--destructive-foreground: oklch(0.98 0 0);
|
|
26
33
|
--destructive-subtle: oklch(0.95 0.05 27.33);
|
|
27
34
|
--destructive-muted: oklch(0.88 0.08 27.33);
|
|
35
|
+
--destructive-text: oklch(0.48 0.2 27.33);
|
|
28
36
|
|
|
29
37
|
/* ── Success ── */
|
|
30
|
-
--success: oklch(0.
|
|
38
|
+
--success: oklch(0.52 0.16 155);
|
|
31
39
|
--success-foreground: oklch(0.98 0 0);
|
|
32
40
|
--success-subtle: oklch(0.95 0.04 155);
|
|
33
41
|
--success-muted: oklch(0.88 0.06 155);
|
|
42
|
+
--success-text: oklch(0.45 0.13 155);
|
|
34
43
|
|
|
35
44
|
/* ── Warning ── */
|
|
36
45
|
--warning: oklch(0.75 0.18 75);
|
|
37
46
|
--warning-foreground: oklch(0.18 0.02 75);
|
|
38
47
|
--warning-subtle: oklch(0.96 0.04 75);
|
|
39
48
|
--warning-muted: oklch(0.9 0.06 75);
|
|
49
|
+
--warning-text: oklch(0.48 0.11 60);
|
|
40
50
|
|
|
41
51
|
/* ── Info ── */
|
|
42
|
-
--info: oklch(0.
|
|
52
|
+
--info: oklch(0.54 0.16 250);
|
|
43
53
|
--info-foreground: oklch(0.98 0 0);
|
|
44
54
|
--info-subtle: oklch(0.95 0.04 250);
|
|
45
55
|
--info-muted: oklch(0.88 0.06 250);
|
|
56
|
+
--info-text: oklch(0.47 0.15 250);
|
|
46
57
|
|
|
47
58
|
/* ── Neutral (Surface & Structure) ── */
|
|
48
59
|
--muted: oklch(0.97 0.001 286);
|
|
49
|
-
--muted-foreground: oklch(0.
|
|
60
|
+
--muted-foreground: oklch(0.52 0.008 286);
|
|
50
61
|
--accent: oklch(0.97 0.001 286);
|
|
51
62
|
--accent-foreground: oklch(0.21 0.014 285.82);
|
|
52
63
|
|
|
53
64
|
/* ── Structure ── */
|
|
54
65
|
--border: oklch(0.975 0.001 286);
|
|
55
66
|
--input: oklch(0.89 0.004 286);
|
|
56
|
-
--ring: oklch(0.
|
|
67
|
+
--ring: oklch(0.64 0.03 256.85);
|
|
57
68
|
|
|
58
69
|
/* ── Overlays ── */
|
|
59
70
|
--popover: oklch(1 0 0);
|
|
@@ -117,7 +128,10 @@
|
|
|
117
128
|
--space-16: 64px;
|
|
118
129
|
--space-20: 80px;
|
|
119
130
|
|
|
120
|
-
/* ── Typography Scale ──
|
|
131
|
+
/* ── Typography Scale ──
|
|
132
|
+
Public override points: no engine component reads --text-* today (the
|
|
133
|
+
components use Tailwind text utilities). Hosts may set or read them, so
|
|
134
|
+
they stay; do not remove them as unused. */
|
|
121
135
|
--text-display: clamp(1.75rem, 4vw, 2rem); /* 32px — hero, page title destaque */
|
|
122
136
|
--text-h1: 1.5rem; /* 24px — page title (1 per page) */
|
|
123
137
|
--text-h2: 1.25rem; /* 20px — section title */
|
|
@@ -158,7 +172,10 @@
|
|
|
158
172
|
--breakpoint-xl: 1280px;
|
|
159
173
|
--breakpoint-2xl: 1536px;
|
|
160
174
|
|
|
161
|
-
/* ── Component Sizing (touch targets) ──
|
|
175
|
+
/* ── Component Sizing (touch targets) ──
|
|
176
|
+
Public override points: no engine component reads --size-* today
|
|
177
|
+
(tailwind-theme.css maps some of them, but no utility uses the mapping).
|
|
178
|
+
Hosts may set or read them, so they stay; do not remove them as unused. */
|
|
162
179
|
--size-button-sm: 32px;
|
|
163
180
|
--size-button-md: 36px;
|
|
164
181
|
--size-button-lg: 44px;
|
|
@@ -169,7 +186,10 @@
|
|
|
169
186
|
--size-avatar-md: 32px;
|
|
170
187
|
--size-avatar-lg: 40px;
|
|
171
188
|
|
|
172
|
-
/* ── Z-Index Scale ──
|
|
189
|
+
/* ── Z-Index Scale ──
|
|
190
|
+
Public override points: only --z-toast is read by the engine (tailwind.css,
|
|
191
|
+
page progress bar). The rest are kept for hosts to set or read; do not
|
|
192
|
+
remove them as unused. */
|
|
173
193
|
--z-base: 0;
|
|
174
194
|
--z-sticky: 10;
|
|
175
195
|
--z-dropdown: 20;
|
|
@@ -179,7 +199,9 @@
|
|
|
179
199
|
--z-toast: 60;
|
|
180
200
|
--z-command: 100;
|
|
181
201
|
|
|
182
|
-
/* ── Border Radius Scale (Maia) ──
|
|
202
|
+
/* ── Border Radius Scale (Maia) ──
|
|
203
|
+
Single source of the radius values: tailwind-theme.css, theme.css and the
|
|
204
|
+
named themes reference these, they do not redeclare them. */
|
|
183
205
|
--radius-none: 0px;
|
|
184
206
|
--radius-sm: 4px;
|
|
185
207
|
--radius-md: 6px;
|
|
@@ -210,28 +232,32 @@
|
|
|
210
232
|
--destructive-foreground: oklch(0.1 0.01 27.33);
|
|
211
233
|
--destructive-subtle: oklch(0.22 0.06 27.33);
|
|
212
234
|
--destructive-muted: oklch(0.28 0.08 27.33);
|
|
235
|
+
--destructive-text: oklch(0.74 0.16 27.33);
|
|
213
236
|
|
|
214
237
|
/* ── Success ── */
|
|
215
238
|
--success: oklch(0.62 0.17 155);
|
|
216
239
|
--success-foreground: oklch(0.1 0.01 155);
|
|
217
240
|
--success-subtle: oklch(0.2 0.04 155);
|
|
218
241
|
--success-muted: oklch(0.26 0.06 155);
|
|
242
|
+
--success-text: oklch(0.76 0.15 155);
|
|
219
243
|
|
|
220
244
|
/* ── Warning ── */
|
|
221
245
|
--warning: oklch(0.78 0.18 75);
|
|
222
246
|
--warning-foreground: oklch(0.15 0.02 75);
|
|
223
247
|
--warning-subtle: oklch(0.22 0.04 75);
|
|
224
248
|
--warning-muted: oklch(0.28 0.06 75);
|
|
249
|
+
--warning-text: oklch(0.82 0.15 75);
|
|
225
250
|
|
|
226
251
|
/* ── Info ── */
|
|
227
252
|
--info: oklch(0.65 0.16 250);
|
|
228
253
|
--info-foreground: oklch(0.1 0.01 250);
|
|
229
254
|
--info-subtle: oklch(0.2 0.04 250);
|
|
230
255
|
--info-muted: oklch(0.26 0.06 250);
|
|
256
|
+
--info-text: oklch(0.76 0.12 250);
|
|
231
257
|
|
|
232
258
|
/* ── Neutral (Surface & Structure) ── */
|
|
233
259
|
--muted: oklch(0.2 0.005 286.38);
|
|
234
|
-
--muted-foreground: oklch(0.
|
|
260
|
+
--muted-foreground: oklch(0.62 0.01 285.82);
|
|
235
261
|
--accent: oklch(0.22 0.005 286.38);
|
|
236
262
|
--accent-foreground: oklch(0.9 0.005 285.82);
|
|
237
263
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boundary helpers for block data sent by a PHP producer.
|
|
3
|
+
*
|
|
4
|
+
* PHP encodes an empty associative array as a JSON list (`[]`), so the wire
|
|
5
|
+
* contract accepts `[]` wherever a map may be empty: table and card rows,
|
|
6
|
+
* `filters`, `filters.applied` and a column's `statusMap`. Blocks normalise
|
|
7
|
+
* those values here, once, before rendering. Open enums arrive as any string;
|
|
8
|
+
* `knownValue` keeps a value the renderer supports and drops the rest, so the
|
|
9
|
+
* caller falls back to its default.
|
|
10
|
+
*/
|
|
11
|
+
/** A map as PHP may send it: the map, or `[]` when it is empty. */
|
|
12
|
+
export type PhpMap<T extends object> = T | [];
|
|
13
|
+
/** The map, or `undefined` when PHP sent an empty list or nothing. */
|
|
14
|
+
export declare function mapOrUndefined<T extends object>(value: PhpMap<T> | null | undefined): T | undefined;
|
|
15
|
+
/** Rows with every `[]` row turned into an empty record. */
|
|
16
|
+
export declare function normalizeRows(rows: ReadonlyArray<PhpMap<Record<string, unknown>>>): Record<string, unknown>[];
|
|
17
|
+
/** Applied filter values, as PHP may send them. */
|
|
18
|
+
type AppliedFilterValues = Record<string, string | string[]>;
|
|
19
|
+
/**
|
|
20
|
+
* A table's `filters` with `[]` normalised: no filters when the whole slot is
|
|
21
|
+
* an empty list, and no applied values when `applied` is one.
|
|
22
|
+
*/
|
|
23
|
+
export declare function normalizeFilters<TFilter>(filters: PhpMap<{
|
|
24
|
+
available: TFilter[];
|
|
25
|
+
applied: PhpMap<AppliedFilterValues>;
|
|
26
|
+
}> | null | undefined): {
|
|
27
|
+
available: TFilter[];
|
|
28
|
+
applied: AppliedFilterValues;
|
|
29
|
+
} | undefined;
|
|
30
|
+
/** The value when it is one of `known`, otherwise `undefined`. */
|
|
31
|
+
export declare function knownValue<T extends string>(value: string | null | undefined, known: readonly T[]): T | undefined;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=php-wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php-wire.d.ts","sourceRoot":"","sources":["../../../src/base/utils/php-wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,mEAAmE;AACnE,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;AAE9C,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAClC,CAAC,GAAG,SAAS,CAGf;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAC3B,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GACnD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAE3B;AAED,mDAAmD;AACnD,KAAK,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EACtC,OAAO,EACH,MAAM,CAAC;IAAE,SAAS,EAAE,OAAO,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAA;CAAE,CAAC,GACtE,IAAI,GACJ,SAAS,GACZ;IAAE,SAAS,EAAE,OAAO,EAAE,CAAC;IAAC,OAAO,EAAE,mBAAmB,CAAA;CAAE,GAAG,SAAS,CAIpE;AAED,kEAAkE;AAClE,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EACzC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,KAAK,EAAE,SAAS,CAAC,EAAE,GAClB,CAAC,GAAG,SAAS,CAEf"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/base/utils/php-wire.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (!(e == null || Array.isArray(e))) return e;
|
|
4
|
+
}
|
|
5
|
+
function t(e) {
|
|
6
|
+
return e.map((e) => Array.isArray(e) ? {} : e);
|
|
7
|
+
}
|
|
8
|
+
function n(t) {
|
|
9
|
+
let n = e(t);
|
|
10
|
+
if (n !== void 0) return {
|
|
11
|
+
available: n.available,
|
|
12
|
+
applied: e(n.applied) ?? {}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function r(e, t) {
|
|
16
|
+
return e != null && t.includes(e) ? e : void 0;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { r as knownValue, e as mapOrUndefined, n as normalizeFilters, t as normalizeRows };
|
|
@@ -45,27 +45,27 @@ function g() {
|
|
|
45
45
|
]
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function _({ id: _, value: v, onChange: y, mode: b = "date", placeholder: x, disabled: S,
|
|
49
|
-
let { t:
|
|
48
|
+
function _({ id: _, value: v, onChange: y, mode: b = "date", placeholder: x, disabled: S, error: C, helpTextId: w, errorId: T }) {
|
|
49
|
+
let { t: E } = o(), [D, O] = c(!1), k = [C ? T : void 0, w].filter(Boolean).join(" ") || void 0, A = v ? p(v.split("T")[0], m, /* @__PURE__ */ new Date()) : void 0, j = A && f(A) ? A : void 0, M = b === "datetime" && v?.includes("T") ? v.split("T")[1]?.slice(0, 5) : "", N = s((e) => {
|
|
50
50
|
if (!e) {
|
|
51
|
-
y(""),
|
|
51
|
+
y(""), O(!1);
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
let t = d(e, m);
|
|
55
|
-
y(b === "datetime" ? `${t}T${
|
|
55
|
+
y(b === "datetime" ? `${t}T${M || "00:00"}` : t), b === "date" && O(!1);
|
|
56
56
|
}, [
|
|
57
57
|
y,
|
|
58
58
|
b,
|
|
59
|
-
|
|
60
|
-
]),
|
|
59
|
+
M
|
|
60
|
+
]), P = s((e) => {
|
|
61
61
|
let t = e.target.value;
|
|
62
62
|
y(`${v?.split("T")[0] ?? d(/* @__PURE__ */ new Date(), m)}T${t}`);
|
|
63
|
-
}, [y, v]),
|
|
64
|
-
y(""),
|
|
65
|
-
}, [y]),
|
|
63
|
+
}, [y, v]), F = s(() => {
|
|
64
|
+
y(""), O(!1);
|
|
65
|
+
}, [y]), I = j ? b === "datetime" && M ? `${d(j, h)} ${M}` : d(j, h) : "", L = E(b === "datetime" ? "middag.ui.form.datetime_placeholder" : "middag.ui.form.date_placeholder");
|
|
66
66
|
return /* @__PURE__ */ l(r, {
|
|
67
|
-
open:
|
|
68
|
-
onOpenChange:
|
|
67
|
+
open: D,
|
|
68
|
+
onOpenChange: O,
|
|
69
69
|
children: /* @__PURE__ */ u("div", {
|
|
70
70
|
className: "relative",
|
|
71
71
|
children: [/* @__PURE__ */ l(a, {
|
|
@@ -74,13 +74,11 @@ function _({ id: _, value: v, onChange: y, mode: b = "date", placeholder: x, dis
|
|
|
74
74
|
type: "button",
|
|
75
75
|
id: _,
|
|
76
76
|
disabled: S,
|
|
77
|
-
"aria-
|
|
78
|
-
"aria-required": C || void 0,
|
|
79
|
-
"aria-describedby": A,
|
|
77
|
+
"aria-describedby": k,
|
|
80
78
|
className: "border-input bg-background ring-ring focus:ring-ring flex h-9 w-full items-center rounded-md border px-3 py-1 text-sm shadow-xs transition-colors focus:ring-1 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
81
79
|
children: [/* @__PURE__ */ l("span", {
|
|
82
|
-
className:
|
|
83
|
-
children:
|
|
80
|
+
className: I ? "text-foreground flex-1 text-left" : "text-muted-foreground flex-1 text-left",
|
|
81
|
+
children: I || x || L
|
|
84
82
|
}), /* @__PURE__ */ l(g, {})]
|
|
85
83
|
})
|
|
86
84
|
}), /* @__PURE__ */ u(i, {
|
|
@@ -89,17 +87,17 @@ function _({ id: _, value: v, onChange: y, mode: b = "date", placeholder: x, dis
|
|
|
89
87
|
children: [
|
|
90
88
|
/* @__PURE__ */ l(t, {
|
|
91
89
|
mode: "single",
|
|
92
|
-
selected:
|
|
93
|
-
onSelect:
|
|
90
|
+
selected: j,
|
|
91
|
+
onSelect: N,
|
|
94
92
|
captionLayout: "dropdown"
|
|
95
93
|
}),
|
|
96
94
|
b === "datetime" && /* @__PURE__ */ l("div", {
|
|
97
95
|
className: "border-border flex items-center gap-2 border-t px-3 py-2",
|
|
98
96
|
children: /* @__PURE__ */ l(n, {
|
|
99
97
|
type: "time",
|
|
100
|
-
value:
|
|
101
|
-
onChange:
|
|
102
|
-
placeholder:
|
|
98
|
+
value: M,
|
|
99
|
+
onChange: P,
|
|
100
|
+
placeholder: E("middag.ui.form.time_placeholder"),
|
|
103
101
|
className: "h-8 w-auto"
|
|
104
102
|
})
|
|
105
103
|
}),
|
|
@@ -109,8 +107,8 @@ function _({ id: _, value: v, onChange: y, mode: b = "date", placeholder: x, dis
|
|
|
109
107
|
type: "button",
|
|
110
108
|
variant: "ghost",
|
|
111
109
|
size: "sm",
|
|
112
|
-
onClick:
|
|
113
|
-
children:
|
|
110
|
+
onClick: F,
|
|
111
|
+
children: E("middag.ui.form.date_clear")
|
|
114
112
|
})
|
|
115
113
|
})
|
|
116
114
|
]
|
|
@@ -171,6 +171,7 @@ var r = {
|
|
|
171
171
|
"middag.ui.form.multiselect_selected": "{count} selected",
|
|
172
172
|
"middag.ui.form.no_fields": "No fields configured for this form.",
|
|
173
173
|
"middag.ui.form.phone_placeholder": "Phone number",
|
|
174
|
+
"middag.ui.form.required_hint": "(required)",
|
|
174
175
|
"middag.ui.form.required_label": "Required",
|
|
175
176
|
"middag.ui.form.save": "Save",
|
|
176
177
|
"middag.ui.form.saving": "Saving...",
|
|
@@ -459,6 +460,7 @@ var r = {
|
|
|
459
460
|
"middag.ui.form.multiselect_selected": "{count} selecionado(s)",
|
|
460
461
|
"middag.ui.form.no_fields": "Nenhum campo configurado para este formulário.",
|
|
461
462
|
"middag.ui.form.phone_placeholder": "Número de telefone",
|
|
463
|
+
"middag.ui.form.required_hint": "(obrigatório)",
|
|
462
464
|
"middag.ui.form.required_label": "Obrigatório",
|
|
463
465
|
"middag.ui.form.save": "Salvar",
|
|
464
466
|
"middag.ui.form.saving": "Salvando...",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DateSelector as e } from "../primitives/reui/date-selector.js";
|
|
2
|
+
import { useCallback as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/base/form/fields/DateRangeField.tsx
|
|
5
|
+
function r({ id: r, value: i, onChange: a, operator: o, required: s, error: c, helpTextId: l, errorId: u, labelId: d }) {
|
|
6
|
+
let f = [c ? u : void 0, l].filter(Boolean).join(" ") || void 0, p = t((e) => {
|
|
7
|
+
a(e);
|
|
8
|
+
}, [a]);
|
|
9
|
+
return /* @__PURE__ */ n("div", {
|
|
10
|
+
role: "group",
|
|
11
|
+
"aria-labelledby": d,
|
|
12
|
+
children: /* @__PURE__ */ n("div", {
|
|
13
|
+
id: r,
|
|
14
|
+
"aria-required": s || void 0,
|
|
15
|
+
"aria-invalid": c ? !0 : void 0,
|
|
16
|
+
"aria-describedby": f,
|
|
17
|
+
children: /* @__PURE__ */ n(e, {
|
|
18
|
+
value: i,
|
|
19
|
+
onChange: p,
|
|
20
|
+
allowRange: !0,
|
|
21
|
+
defaultFilterType: o ?? "is",
|
|
22
|
+
presetMode: o || void 0,
|
|
23
|
+
showInput: !0
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { r as DateRangeField };
|