@usefidel/design-system 0.3.0 → 0.4.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/fidel.manifest.json +2 -2
- package/dist/index.cjs +77 -49
- package/dist/index.css +32 -1
- package/dist/index.d.cts +32 -9
- package/dist/index.d.ts +32 -9
- package/dist/index.js +78 -50
- package/package.json +1 -1
package/dist/fidel.manifest.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -128,68 +128,96 @@ function DiffSection({
|
|
|
128
128
|
mismatchCount,
|
|
129
129
|
elements,
|
|
130
130
|
defaultExpanded = false,
|
|
131
|
+
headerless = false,
|
|
131
132
|
className,
|
|
132
133
|
...rest
|
|
133
134
|
}) {
|
|
134
135
|
const [expanded, setExpanded] = (0, import_react2.useState)(defaultExpanded);
|
|
136
|
+
const open = headerless || expanded;
|
|
135
137
|
const count = mismatchCount ?? elements.reduce((sum, el) => sum + el.properties.length, 0);
|
|
136
|
-
const classes = [
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
const classes = [
|
|
139
|
+
"fds-diff-section",
|
|
140
|
+
headerless && "fds-diff-section--flat",
|
|
141
|
+
className
|
|
142
|
+
].filter(Boolean).join(" ");
|
|
143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
className: classes,
|
|
147
|
+
"data-expanded": open ? "true" : void 0,
|
|
148
|
+
"data-flat": headerless ? "true" : void 0,
|
|
149
|
+
...rest,
|
|
150
|
+
children: [
|
|
151
|
+
!headerless && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
152
|
+
"button",
|
|
153
|
+
{
|
|
154
|
+
type: "button",
|
|
155
|
+
className: "fds-diff-section__header",
|
|
156
|
+
"aria-expanded": expanded,
|
|
157
|
+
onClick: () => setExpanded((v) => !v),
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "fds-diff-section__head-left", children: [
|
|
160
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Chevron2, { open: expanded }),
|
|
161
|
+
number != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__number", children: number }),
|
|
162
|
+
name != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__name", children: name })
|
|
163
|
+
] }),
|
|
164
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__count", children: plural(count, "mismatch", "mismatches") })
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "fds-diff-section__body", children: elements.map((el, ei) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ElementRow, { element: el }, `${el.name}-${ei}`)) })
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
function ElementRow({ element }) {
|
|
174
|
+
const hasDetail = element.detail != null;
|
|
175
|
+
const [open, setOpen] = (0, import_react2.useState)(element.defaultOpen ?? false);
|
|
176
|
+
const lines = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
177
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fds-diff-section__element-head-inner", children: [
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__element-name", children: element.name }),
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__element-count", children: plural(element.properties.length, "property", "properties") }),
|
|
180
|
+
hasDetail && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Chevron2, { open, className: "fds-diff-section__element-caret" })
|
|
181
|
+
] }),
|
|
182
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "fds-diff-section__lines", children: element.properties.map((line, li) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fds-diff-section__line", children: [
|
|
183
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__prop", children: line.property }),
|
|
184
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "fds-diff-section__delta", children: [
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__live", children: line.live }),
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Arrow, {}),
|
|
187
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__design", children: line.design })
|
|
188
|
+
] })
|
|
189
|
+
] }, `${line.property}-${li}`)) })
|
|
190
|
+
] });
|
|
191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fds-diff-section__element", "data-open": hasDetail && open ? "true" : void 0, children: [
|
|
192
|
+
hasDetail ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
139
193
|
"button",
|
|
140
194
|
{
|
|
141
195
|
type: "button",
|
|
142
|
-
className: "fds-diff-
|
|
143
|
-
"aria-expanded":
|
|
144
|
-
onClick: () =>
|
|
145
|
-
children:
|
|
146
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "fds-diff-section__head-left", children: [
|
|
147
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Chevron2, { open: expanded }),
|
|
148
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__number", children: number }),
|
|
149
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__name", children: name })
|
|
150
|
-
] }),
|
|
151
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__count", children: plural(count, "mismatch", "mismatches") })
|
|
152
|
-
]
|
|
196
|
+
className: "fds-diff-section__element-head fds-diff-section__element-head--button",
|
|
197
|
+
"aria-expanded": open,
|
|
198
|
+
onClick: () => setOpen((v) => !v),
|
|
199
|
+
children: lines
|
|
153
200
|
}
|
|
154
|
-
),
|
|
155
|
-
|
|
156
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fds-diff-section__element-head", children: [
|
|
157
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__element-name", children: el.name }),
|
|
158
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__element-count", children: plural(el.properties.length, "property", "properties") })
|
|
159
|
-
] }),
|
|
160
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "fds-diff-section__lines", children: el.properties.map((line, li) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fds-diff-section__line", children: [
|
|
161
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__prop", children: line.property }),
|
|
162
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "fds-diff-section__delta", children: [
|
|
163
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__live", children: line.live }),
|
|
164
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Arrow, {}),
|
|
165
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fds-diff-section__design", children: line.design })
|
|
166
|
-
] })
|
|
167
|
-
] }, `${line.property}-${li}`)) })
|
|
168
|
-
] }, `${el.name}-${ei}`)) })
|
|
201
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "fds-diff-section__element-head", children: lines }),
|
|
202
|
+
hasDetail && open && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "fds-diff-section__detail", children: element.detail })
|
|
169
203
|
] });
|
|
170
204
|
}
|
|
171
|
-
function Chevron2({ open }) {
|
|
172
|
-
|
|
173
|
-
"
|
|
205
|
+
function Chevron2({ open, className }) {
|
|
206
|
+
const classes = [
|
|
207
|
+
"fds-diff-section__chevron",
|
|
208
|
+
open && "fds-diff-section__chevron--open",
|
|
209
|
+
className
|
|
210
|
+
].filter(Boolean).join(" ");
|
|
211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", className: classes, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
212
|
+
"path",
|
|
174
213
|
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
"aria-hidden": "true",
|
|
181
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
182
|
-
"path",
|
|
183
|
-
{
|
|
184
|
-
d: "M4.5 3 8 6l-3.5 3",
|
|
185
|
-
stroke: "currentColor",
|
|
186
|
-
strokeWidth: "1.3",
|
|
187
|
-
strokeLinecap: "round",
|
|
188
|
-
strokeLinejoin: "round"
|
|
189
|
-
}
|
|
190
|
-
)
|
|
214
|
+
d: "M4.5 3 8 6l-3.5 3",
|
|
215
|
+
stroke: "currentColor",
|
|
216
|
+
strokeWidth: "1.3",
|
|
217
|
+
strokeLinecap: "round",
|
|
218
|
+
strokeLinejoin: "round"
|
|
191
219
|
}
|
|
192
|
-
);
|
|
220
|
+
) });
|
|
193
221
|
}
|
|
194
222
|
function Arrow() {
|
|
195
223
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
package/dist/index.css
CHANGED
|
@@ -310,14 +310,45 @@
|
|
|
310
310
|
.fds-diff-section__element {
|
|
311
311
|
display: flex;
|
|
312
312
|
flex-direction: column;
|
|
313
|
+
}
|
|
314
|
+
.fds-diff-section__element-head {
|
|
315
|
+
display: flex;
|
|
316
|
+
flex-direction: column;
|
|
313
317
|
gap: 14px;
|
|
318
|
+
width: 100%;
|
|
314
319
|
padding: 6px var(--spacing-5) 6px var(--spacing-6);
|
|
315
320
|
}
|
|
316
|
-
.fds-diff-section__element-head {
|
|
321
|
+
.fds-diff-section__element-head--button {
|
|
322
|
+
border: 0;
|
|
323
|
+
background: none;
|
|
324
|
+
font: inherit;
|
|
325
|
+
color: inherit;
|
|
326
|
+
text-align: left;
|
|
327
|
+
cursor: pointer;
|
|
328
|
+
transition: background var(--duration-quick, 150ms) ease;
|
|
329
|
+
}
|
|
330
|
+
.fds-diff-section__element-head--button:hover {
|
|
331
|
+
background: var(--color-surface-hover);
|
|
332
|
+
}
|
|
333
|
+
.fds-diff-section__element-head-inner {
|
|
317
334
|
display: flex;
|
|
318
335
|
align-items: center;
|
|
319
336
|
gap: var(--spacing-2);
|
|
320
337
|
}
|
|
338
|
+
.fds-diff-section__element-caret {
|
|
339
|
+
margin-left: auto;
|
|
340
|
+
flex-shrink: 0;
|
|
341
|
+
color: var(--color-text-muted);
|
|
342
|
+
}
|
|
343
|
+
.fds-diff-section__detail {
|
|
344
|
+
padding: 0 var(--spacing-5) var(--spacing-3) var(--spacing-6);
|
|
345
|
+
}
|
|
346
|
+
.fds-diff-section--flat .fds-diff-section__body {
|
|
347
|
+
gap: 0;
|
|
348
|
+
}
|
|
349
|
+
.fds-diff-section--flat .fds-diff-section__element + .fds-diff-section__element {
|
|
350
|
+
border-top: 1px solid var(--color-border-light);
|
|
351
|
+
}
|
|
321
352
|
.fds-diff-section__element-name {
|
|
322
353
|
font-weight: var(--font-weight-medium);
|
|
323
354
|
font-size: 14px;
|
package/dist/index.d.cts
CHANGED
|
@@ -74,12 +74,22 @@ interface DiffElement {
|
|
|
74
74
|
name: string;
|
|
75
75
|
/** Property mismatches for this element. */
|
|
76
76
|
properties: DiffPropertyLine[];
|
|
77
|
+
/**
|
|
78
|
+
* Optional drill-down content. When provided, the element row becomes a
|
|
79
|
+
* toggle: clicking it reveals this node beneath the property deltas. Use it
|
|
80
|
+
* to host a richer detail view (copy actions, triage, verdicts) while the
|
|
81
|
+
* mono deltas stay as the at-a-glance summary. Presentational — the caller
|
|
82
|
+
* owns whatever lives inside.
|
|
83
|
+
*/
|
|
84
|
+
detail?: ReactNode;
|
|
85
|
+
/** When the element has `detail`, render it open on first paint. @default false */
|
|
86
|
+
defaultOpen?: boolean;
|
|
77
87
|
}
|
|
78
88
|
interface DiffSectionProps extends HTMLAttributes<HTMLDivElement> {
|
|
79
|
-
/** Ordinal shown before the name, e.g. "01".
|
|
80
|
-
number
|
|
81
|
-
/** Section name, e.g. "Nav". */
|
|
82
|
-
name
|
|
89
|
+
/** Ordinal shown before the name, e.g. "01". Omitted in `headerless` mode. */
|
|
90
|
+
number?: string;
|
|
91
|
+
/** Section name, e.g. "Nav". Omitted in `headerless` mode. */
|
|
92
|
+
name?: string;
|
|
83
93
|
/**
|
|
84
94
|
* Count shown on the right of the header. Defaults to the total number of
|
|
85
95
|
* property lines across all elements.
|
|
@@ -87,17 +97,30 @@ interface DiffSectionProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
87
97
|
mismatchCount?: number;
|
|
88
98
|
/** Elements in this section, each with its own property mismatches. */
|
|
89
99
|
elements: DiffElement[];
|
|
90
|
-
/** Render expanded on first paint. @default false */
|
|
100
|
+
/** Render expanded on first paint. Ignored in `headerless` mode. @default false */
|
|
91
101
|
defaultExpanded?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Drop the numbered, collapsible section header and render the element list
|
|
104
|
+
* directly — a flat drawer with no section grouping. `number`/`name`/
|
|
105
|
+
* `mismatchCount` are ignored. @default false
|
|
106
|
+
*/
|
|
107
|
+
headerless?: boolean;
|
|
92
108
|
}
|
|
93
109
|
/**
|
|
94
|
-
* Fidel design-system DiffSection —
|
|
95
|
-
*
|
|
96
|
-
*
|
|
110
|
+
* Fidel design-system DiffSection — the mismatch drawer's section.
|
|
111
|
+
*
|
|
112
|
+
* Two shapes:
|
|
113
|
+
* - Grouped (default): a numbered, collapsible header (`01 Nav · 2
|
|
114
|
+
* mismatches`) over its elements.
|
|
115
|
+
* - `headerless`: just the element list, for a flat drawer with no section
|
|
116
|
+
* grouping.
|
|
117
|
+
*
|
|
118
|
+
* Each element lists its property deltas as `live → design` mono rows, and may
|
|
119
|
+
* carry a `detail` node that expands beneath the deltas as a drill-down.
|
|
97
120
|
*
|
|
98
121
|
* Presentational only — no diff taxonomy. Framing is Live → Design (founder
|
|
99
122
|
* decision 2026-04-24): each delta reads `live → design`.
|
|
100
123
|
*/
|
|
101
|
-
declare function DiffSection({ number, name, mismatchCount, elements, defaultExpanded, className, ...rest }: DiffSectionProps): react.JSX.Element;
|
|
124
|
+
declare function DiffSection({ number, name, mismatchCount, elements, defaultExpanded, headerless, className, ...rest }: DiffSectionProps): react.JSX.Element;
|
|
102
125
|
|
|
103
126
|
export { Button, type ButtonProps, type ButtonSize, type ButtonVariant, type DiffElement, type DiffPropertyLine, DiffSection, type DiffSectionProps, MismatchCard, type MismatchCardProps, type MismatchProperty };
|
package/dist/index.d.ts
CHANGED
|
@@ -74,12 +74,22 @@ interface DiffElement {
|
|
|
74
74
|
name: string;
|
|
75
75
|
/** Property mismatches for this element. */
|
|
76
76
|
properties: DiffPropertyLine[];
|
|
77
|
+
/**
|
|
78
|
+
* Optional drill-down content. When provided, the element row becomes a
|
|
79
|
+
* toggle: clicking it reveals this node beneath the property deltas. Use it
|
|
80
|
+
* to host a richer detail view (copy actions, triage, verdicts) while the
|
|
81
|
+
* mono deltas stay as the at-a-glance summary. Presentational — the caller
|
|
82
|
+
* owns whatever lives inside.
|
|
83
|
+
*/
|
|
84
|
+
detail?: ReactNode;
|
|
85
|
+
/** When the element has `detail`, render it open on first paint. @default false */
|
|
86
|
+
defaultOpen?: boolean;
|
|
77
87
|
}
|
|
78
88
|
interface DiffSectionProps extends HTMLAttributes<HTMLDivElement> {
|
|
79
|
-
/** Ordinal shown before the name, e.g. "01".
|
|
80
|
-
number
|
|
81
|
-
/** Section name, e.g. "Nav". */
|
|
82
|
-
name
|
|
89
|
+
/** Ordinal shown before the name, e.g. "01". Omitted in `headerless` mode. */
|
|
90
|
+
number?: string;
|
|
91
|
+
/** Section name, e.g. "Nav". Omitted in `headerless` mode. */
|
|
92
|
+
name?: string;
|
|
83
93
|
/**
|
|
84
94
|
* Count shown on the right of the header. Defaults to the total number of
|
|
85
95
|
* property lines across all elements.
|
|
@@ -87,17 +97,30 @@ interface DiffSectionProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
87
97
|
mismatchCount?: number;
|
|
88
98
|
/** Elements in this section, each with its own property mismatches. */
|
|
89
99
|
elements: DiffElement[];
|
|
90
|
-
/** Render expanded on first paint. @default false */
|
|
100
|
+
/** Render expanded on first paint. Ignored in `headerless` mode. @default false */
|
|
91
101
|
defaultExpanded?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Drop the numbered, collapsible section header and render the element list
|
|
104
|
+
* directly — a flat drawer with no section grouping. `number`/`name`/
|
|
105
|
+
* `mismatchCount` are ignored. @default false
|
|
106
|
+
*/
|
|
107
|
+
headerless?: boolean;
|
|
92
108
|
}
|
|
93
109
|
/**
|
|
94
|
-
* Fidel design-system DiffSection —
|
|
95
|
-
*
|
|
96
|
-
*
|
|
110
|
+
* Fidel design-system DiffSection — the mismatch drawer's section.
|
|
111
|
+
*
|
|
112
|
+
* Two shapes:
|
|
113
|
+
* - Grouped (default): a numbered, collapsible header (`01 Nav · 2
|
|
114
|
+
* mismatches`) over its elements.
|
|
115
|
+
* - `headerless`: just the element list, for a flat drawer with no section
|
|
116
|
+
* grouping.
|
|
117
|
+
*
|
|
118
|
+
* Each element lists its property deltas as `live → design` mono rows, and may
|
|
119
|
+
* carry a `detail` node that expands beneath the deltas as a drill-down.
|
|
97
120
|
*
|
|
98
121
|
* Presentational only — no diff taxonomy. Framing is Live → Design (founder
|
|
99
122
|
* decision 2026-04-24): each delta reads `live → design`.
|
|
100
123
|
*/
|
|
101
|
-
declare function DiffSection({ number, name, mismatchCount, elements, defaultExpanded, className, ...rest }: DiffSectionProps): react.JSX.Element;
|
|
124
|
+
declare function DiffSection({ number, name, mismatchCount, elements, defaultExpanded, headerless, className, ...rest }: DiffSectionProps): react.JSX.Element;
|
|
102
125
|
|
|
103
126
|
export { Button, type ButtonProps, type ButtonSize, type ButtonVariant, type DiffElement, type DiffPropertyLine, DiffSection, type DiffSectionProps, MismatchCard, type MismatchCardProps, type MismatchProperty };
|
package/dist/index.js
CHANGED
|
@@ -90,7 +90,7 @@ function Chevron({ direction }) {
|
|
|
90
90
|
|
|
91
91
|
// src/components/DiffSection/DiffSection.tsx
|
|
92
92
|
import { useState as useState2 } from "react";
|
|
93
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
93
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
94
94
|
function plural(n, one, many) {
|
|
95
95
|
return `${n} ${n === 1 ? one : many}`;
|
|
96
96
|
}
|
|
@@ -100,68 +100,96 @@ function DiffSection({
|
|
|
100
100
|
mismatchCount,
|
|
101
101
|
elements,
|
|
102
102
|
defaultExpanded = false,
|
|
103
|
+
headerless = false,
|
|
103
104
|
className,
|
|
104
105
|
...rest
|
|
105
106
|
}) {
|
|
106
107
|
const [expanded, setExpanded] = useState2(defaultExpanded);
|
|
108
|
+
const open = headerless || expanded;
|
|
107
109
|
const count = mismatchCount ?? elements.reduce((sum, el) => sum + el.properties.length, 0);
|
|
108
|
-
const classes = [
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
const classes = [
|
|
111
|
+
"fds-diff-section",
|
|
112
|
+
headerless && "fds-diff-section--flat",
|
|
113
|
+
className
|
|
114
|
+
].filter(Boolean).join(" ");
|
|
115
|
+
return /* @__PURE__ */ jsxs3(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
className: classes,
|
|
119
|
+
"data-expanded": open ? "true" : void 0,
|
|
120
|
+
"data-flat": headerless ? "true" : void 0,
|
|
121
|
+
...rest,
|
|
122
|
+
children: [
|
|
123
|
+
!headerless && /* @__PURE__ */ jsxs3(
|
|
124
|
+
"button",
|
|
125
|
+
{
|
|
126
|
+
type: "button",
|
|
127
|
+
className: "fds-diff-section__header",
|
|
128
|
+
"aria-expanded": expanded,
|
|
129
|
+
onClick: () => setExpanded((v) => !v),
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsxs3("span", { className: "fds-diff-section__head-left", children: [
|
|
132
|
+
/* @__PURE__ */ jsx3(Chevron2, { open: expanded }),
|
|
133
|
+
number != null && /* @__PURE__ */ jsx3("span", { className: "fds-diff-section__number", children: number }),
|
|
134
|
+
name != null && /* @__PURE__ */ jsx3("span", { className: "fds-diff-section__name", children: name })
|
|
135
|
+
] }),
|
|
136
|
+
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__count", children: plural(count, "mismatch", "mismatches") })
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
open && /* @__PURE__ */ jsx3("div", { className: "fds-diff-section__body", children: elements.map((el, ei) => /* @__PURE__ */ jsx3(ElementRow, { element: el }, `${el.name}-${ei}`)) })
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
function ElementRow({ element }) {
|
|
146
|
+
const hasDetail = element.detail != null;
|
|
147
|
+
const [open, setOpen] = useState2(element.defaultOpen ?? false);
|
|
148
|
+
const lines = /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
149
|
+
/* @__PURE__ */ jsxs3("div", { className: "fds-diff-section__element-head-inner", children: [
|
|
150
|
+
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__element-name", children: element.name }),
|
|
151
|
+
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__element-count", children: plural(element.properties.length, "property", "properties") }),
|
|
152
|
+
hasDetail && /* @__PURE__ */ jsx3(Chevron2, { open, className: "fds-diff-section__element-caret" })
|
|
153
|
+
] }),
|
|
154
|
+
/* @__PURE__ */ jsx3("div", { className: "fds-diff-section__lines", children: element.properties.map((line, li) => /* @__PURE__ */ jsxs3("div", { className: "fds-diff-section__line", children: [
|
|
155
|
+
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__prop", children: line.property }),
|
|
156
|
+
/* @__PURE__ */ jsxs3("span", { className: "fds-diff-section__delta", children: [
|
|
157
|
+
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__live", children: line.live }),
|
|
158
|
+
/* @__PURE__ */ jsx3(Arrow, {}),
|
|
159
|
+
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__design", children: line.design })
|
|
160
|
+
] })
|
|
161
|
+
] }, `${line.property}-${li}`)) })
|
|
162
|
+
] });
|
|
163
|
+
return /* @__PURE__ */ jsxs3("div", { className: "fds-diff-section__element", "data-open": hasDetail && open ? "true" : void 0, children: [
|
|
164
|
+
hasDetail ? /* @__PURE__ */ jsx3(
|
|
111
165
|
"button",
|
|
112
166
|
{
|
|
113
167
|
type: "button",
|
|
114
|
-
className: "fds-diff-
|
|
115
|
-
"aria-expanded":
|
|
116
|
-
onClick: () =>
|
|
117
|
-
children:
|
|
118
|
-
/* @__PURE__ */ jsxs3("span", { className: "fds-diff-section__head-left", children: [
|
|
119
|
-
/* @__PURE__ */ jsx3(Chevron2, { open: expanded }),
|
|
120
|
-
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__number", children: number }),
|
|
121
|
-
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__name", children: name })
|
|
122
|
-
] }),
|
|
123
|
-
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__count", children: plural(count, "mismatch", "mismatches") })
|
|
124
|
-
]
|
|
168
|
+
className: "fds-diff-section__element-head fds-diff-section__element-head--button",
|
|
169
|
+
"aria-expanded": open,
|
|
170
|
+
onClick: () => setOpen((v) => !v),
|
|
171
|
+
children: lines
|
|
125
172
|
}
|
|
126
|
-
),
|
|
127
|
-
|
|
128
|
-
/* @__PURE__ */ jsxs3("div", { className: "fds-diff-section__element-head", children: [
|
|
129
|
-
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__element-name", children: el.name }),
|
|
130
|
-
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__element-count", children: plural(el.properties.length, "property", "properties") })
|
|
131
|
-
] }),
|
|
132
|
-
/* @__PURE__ */ jsx3("div", { className: "fds-diff-section__lines", children: el.properties.map((line, li) => /* @__PURE__ */ jsxs3("div", { className: "fds-diff-section__line", children: [
|
|
133
|
-
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__prop", children: line.property }),
|
|
134
|
-
/* @__PURE__ */ jsxs3("span", { className: "fds-diff-section__delta", children: [
|
|
135
|
-
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__live", children: line.live }),
|
|
136
|
-
/* @__PURE__ */ jsx3(Arrow, {}),
|
|
137
|
-
/* @__PURE__ */ jsx3("span", { className: "fds-diff-section__design", children: line.design })
|
|
138
|
-
] })
|
|
139
|
-
] }, `${line.property}-${li}`)) })
|
|
140
|
-
] }, `${el.name}-${ei}`)) })
|
|
173
|
+
) : /* @__PURE__ */ jsx3("div", { className: "fds-diff-section__element-head", children: lines }),
|
|
174
|
+
hasDetail && open && /* @__PURE__ */ jsx3("div", { className: "fds-diff-section__detail", children: element.detail })
|
|
141
175
|
] });
|
|
142
176
|
}
|
|
143
|
-
function Chevron2({ open }) {
|
|
144
|
-
|
|
145
|
-
"
|
|
177
|
+
function Chevron2({ open, className }) {
|
|
178
|
+
const classes = [
|
|
179
|
+
"fds-diff-section__chevron",
|
|
180
|
+
open && "fds-diff-section__chevron--open",
|
|
181
|
+
className
|
|
182
|
+
].filter(Boolean).join(" ");
|
|
183
|
+
return /* @__PURE__ */ jsx3("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", className: classes, children: /* @__PURE__ */ jsx3(
|
|
184
|
+
"path",
|
|
146
185
|
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
"aria-hidden": "true",
|
|
153
|
-
children: /* @__PURE__ */ jsx3(
|
|
154
|
-
"path",
|
|
155
|
-
{
|
|
156
|
-
d: "M4.5 3 8 6l-3.5 3",
|
|
157
|
-
stroke: "currentColor",
|
|
158
|
-
strokeWidth: "1.3",
|
|
159
|
-
strokeLinecap: "round",
|
|
160
|
-
strokeLinejoin: "round"
|
|
161
|
-
}
|
|
162
|
-
)
|
|
186
|
+
d: "M4.5 3 8 6l-3.5 3",
|
|
187
|
+
stroke: "currentColor",
|
|
188
|
+
strokeWidth: "1.3",
|
|
189
|
+
strokeLinecap: "round",
|
|
190
|
+
strokeLinejoin: "round"
|
|
163
191
|
}
|
|
164
|
-
);
|
|
192
|
+
) });
|
|
165
193
|
}
|
|
166
194
|
function Arrow() {
|
|
167
195
|
return /* @__PURE__ */ jsx3(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usefidel/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Fidel brand design tokens + React component library — DTCG token source of truth, generated per-surface CSS + Tailwind-v4 parser-compatibility output, and on-brand React components (Button, MismatchCard, DiffSection).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|