@knpkv/rly 0.4.1 → 0.5.1

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.
@@ -1,543 +0,0 @@
1
- import { r as e, t } from "./PortalProvider-BpgZwSpw.js";
2
- import { c as n, i as r, l as i, n as a, o, r as s, t as c } from "./component-DKy8kjZl.js";
3
- import { Select as l, Tabs as u } from "radix-ui";
4
- import { createElement as d, useId as f } from "react";
5
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
6
- var h = {
7
- root: "rly_Divider-module__root",
8
- horizontal: "rly_Divider-module__horizontal",
9
- vertical: "rly_Divider-module__vertical",
10
- subtle: "rly_Divider-module__subtle",
11
- strong: "rly_Divider-module__strong"
12
- }, g = (e) => a(h, e), _ = s({
13
- orientation: {
14
- horizontal: {
15
- className: g("horizontal"),
16
- purpose: "Separate stacked content",
17
- tokens: ["space-0"]
18
- },
19
- vertical: {
20
- className: g("vertical"),
21
- purpose: "Separate adjacent content",
22
- tokens: ["space-0"]
23
- }
24
- },
25
- strength: {
26
- subtle: {
27
- className: g("subtle"),
28
- purpose: "Quiet structural boundary",
29
- tokens: ["color-border-1"]
30
- },
31
- strong: {
32
- className: g("strong"),
33
- purpose: "Explicit structural boundary",
34
- tokens: ["color-border-2"]
35
- }
36
- }
37
- }), v = s({
38
- orientation: "horizontal",
39
- strength: "subtle"
40
- }), y = ({ className: e, decorative: t = !0, label: n, orientation: i = "horizontal", strength: a = "subtle", ...o }) => {
41
- if (!t && n === void 0) throw Error("Semantic Divider label must contain visible text");
42
- let s = t || n === void 0 ? void 0 : r(n, "Semantic Divider label");
43
- return /* @__PURE__ */ p("div", {
44
- ...o,
45
- "aria-hidden": t ? "true" : void 0,
46
- "aria-label": s,
47
- "aria-orientation": t ? void 0 : i,
48
- className: c(g("root"), _.orientation[i].className, _.strength[a].className, e),
49
- role: t ? "presentation" : "separator"
50
- });
51
- }, b = /* @__PURE__ */ new WeakSet(), x = (e) => (b.add(e), e), S = (e) => b.has(e), C = {
52
- root: "rly_Field-module__root",
53
- label: "rly_Field-module__label",
54
- required: "rly_Field-module__required",
55
- description: "rly_Field-module__description",
56
- error: "rly_Field-module__error",
57
- controlSlot: "rly_Field-module__controlSlot",
58
- control: "rly_Field-module__control",
59
- compact: "rly_Field-module__compact",
60
- defaultSize: "rly_Field-module__defaultSize"
61
- }, w = (e) => a(C, e), T = [
62
- "aria-describedby",
63
- "aria-errormessage",
64
- "aria-invalid",
65
- "aria-labelledby",
66
- "aria-required",
67
- "id",
68
- "required"
69
- ], E = /* @__PURE__ */ new Set([
70
- "button",
71
- "input",
72
- "select",
73
- "textarea"
74
- ]), D = s({ size: {
75
- compact: {
76
- className: w("compact"),
77
- purpose: "Dense form rows",
78
- tokens: ["space-40", "type-meta"]
79
- },
80
- default: {
81
- className: w("defaultSize"),
82
- purpose: "Standard form controls",
83
- tokens: ["space-48", "type-label"]
84
- }
85
- } }), O = s({ size: "default" }), k = ({ children: e, className: t, controlId: a, description: s, error: l, label: u, required: d = !1, size: h = O.size, ...g }) => {
86
- let _ = f(), v = a ?? `rly-field-${_}`, y = `${v}-label`, b = s === void 0 ? void 0 : `${v}-description`, x = l === void 0 ? void 0 : `${v}-error`, C = {
87
- "aria-describedby": [b, x].filter((e) => e !== void 0).join(" ") || void 0,
88
- "aria-errormessage": x,
89
- "aria-invalid": l !== void 0 || void 0,
90
- "aria-labelledby": y,
91
- "aria-required": d ? !0 : void 0,
92
- className: w("control"),
93
- id: v
94
- }, k = d ? {
95
- ...C,
96
- required: !0
97
- } : C, A = e(k), j = A.type;
98
- if (!(i(j) ? E.has(j) : (o(j) || n(j)) && j !== null && S(j))) throw Error("Field children must render one concrete or rly-owned control");
99
- for (let e of T) if (A.props[e] !== k[e]) throw Error(`Field control must apply ${e}`);
100
- if (!A.props.className.split(" ").includes(k.className)) throw Error("Field control must apply className");
101
- return /* @__PURE__ */ m("div", {
102
- ...g,
103
- className: c(w("root"), D.size[h].className, t),
104
- "data-error": l === void 0 ? void 0 : "true",
105
- children: [
106
- /* @__PURE__ */ m("label", {
107
- className: w("label"),
108
- htmlFor: v,
109
- id: y,
110
- children: [r(u, "Field label"), d ? /* @__PURE__ */ p("span", {
111
- className: w("required"),
112
- children: "Required"
113
- }) : null]
114
- }),
115
- s === void 0 ? null : /* @__PURE__ */ p("p", {
116
- className: w("description"),
117
- id: b,
118
- children: r(s, "Field description")
119
- }),
120
- /* @__PURE__ */ p("div", {
121
- className: w("controlSlot"),
122
- children: A
123
- }),
124
- l === void 0 ? null : /* @__PURE__ */ p("p", {
125
- className: w("error"),
126
- id: x,
127
- role: "alert",
128
- children: r(l, "Field error")
129
- })
130
- ]
131
- });
132
- }, A = {
133
- root: "rly_IconButton-module__root",
134
- primary: "rly_IconButton-module__primary",
135
- secondary: "rly_IconButton-module__secondary",
136
- quiet: "rly_IconButton-module__quiet",
137
- compact: "rly_IconButton-module__compact",
138
- defaultSize: "rly_IconButton-module__defaultSize",
139
- principal: "rly_IconButton-module__principal"
140
- }, j = (e) => a(A, e), M = s({
141
- variant: {
142
- primary: {
143
- className: j("primary"),
144
- purpose: "Principal icon action",
145
- tokens: ["color-action-background", "color-action-foreground"]
146
- },
147
- secondary: {
148
- className: j("secondary"),
149
- purpose: "Default icon action",
150
- tokens: ["color-surface-1", "color-border-2"]
151
- },
152
- quiet: {
153
- className: j("quiet"),
154
- purpose: "Low-emphasis icon action",
155
- tokens: ["color-text-1", "color-surface-2"]
156
- }
157
- },
158
- size: {
159
- compact: {
160
- className: j("compact"),
161
- purpose: "Minimum accessible icon target",
162
- tokens: ["space-40", "space-4"]
163
- },
164
- default: {
165
- className: j("defaultSize"),
166
- purpose: "Standard icon target",
167
- tokens: ["space-48"]
168
- },
169
- principal: {
170
- className: j("principal"),
171
- purpose: "Prominent icon target",
172
- tokens: ["space-48", "space-8"]
173
- }
174
- }
175
- }), N = s({
176
- variant: "secondary",
177
- size: "default"
178
- }), P = ({ className: t, disabled: n, icon: i, label: a, loading: o = !1, size: s = "default", type: l, variant: u = "secondary", ...d }) => /* @__PURE__ */ p("button", {
179
- ...d,
180
- "aria-busy": o ? "true" : void 0,
181
- "aria-label": r(a, "IconButton label"),
182
- className: c(j("root"), M.variant[u].className, M.size[s].className, t),
183
- "data-loading": o ? "true" : void 0,
184
- disabled: n || o,
185
- type: l ?? "button",
186
- children: /* @__PURE__ */ p(e, {
187
- decorative: !0,
188
- name: o ? "loader" : i,
189
- size: s === "compact" ? "small" : "default"
190
- })
191
- }), F = {
192
- trigger: "rly_Select-module__trigger",
193
- compact: "rly_Select-module__compact",
194
- defaultSize: "rly_Select-module__defaultSize",
195
- triggerIcon: "rly_Select-module__triggerIcon",
196
- content: "rly_Select-module__content",
197
- viewport: "rly_Select-module__viewport",
198
- item: "rly_Select-module__item",
199
- itemIndicator: "rly_Select-module__itemIndicator",
200
- scrollButton: "rly_Select-module__scrollButton"
201
- }, I = (e) => a(F, e), L = s({ size: {
202
- compact: {
203
- className: I("compact"),
204
- purpose: "Dense form rows",
205
- tokens: ["space-40", "type-meta"]
206
- },
207
- default: {
208
- className: I("defaultSize"),
209
- purpose: "Standard selection control",
210
- tokens: ["space-48", "type-body"]
211
- }
212
- } }), R = s({ size: "default" }), z = (e, t) => {
213
- if (!t && !e.some((e) => !e.disabled)) throw Error("Select options must contain at least one enabled option");
214
- let n = /* @__PURE__ */ new Set();
215
- for (let t of e) {
216
- r(t.label, "Select option label");
217
- let e = r(t.value, "Select option value");
218
- if (n.has(e)) throw Error(`Duplicate Select option value: ${e}`);
219
- n.add(e);
220
- }
221
- }, B = /* @__PURE__ */ x((n) => {
222
- let i = "value" in n, { "aria-describedby": a, "aria-errormessage": o, "aria-invalid": s, "aria-label": u, "aria-labelledby": f, "aria-required": h, autoComplete: g, className: _, defaultOpen: v, defaultValue: y, disabled: b = !1, form: x, id: S, name: C, onBlur: w, onFocus: T, onKeyDown: E, onOpenChange: D, onValueChange: O, open: k, options: A, placeholder: j = "Select an option", ref: M, required: N = !1, size: P = R.size, tabIndex: F, value: B } = n;
223
- z(A, b), r(u ?? f, u === void 0 ? "Select aria-labelledby" : "Select aria-label");
224
- let V = r(j, "Select placeholder"), H = B ?? y;
225
- if (H !== void 0 && !A.some((e) => e.value === H)) throw Error(`Select value does not match an option: ${H}`);
226
- return /* @__PURE__ */ m(l.Root, {
227
- ...g === void 0 ? {} : { autoComplete: g },
228
- ...v === void 0 ? {} : { defaultOpen: v },
229
- ...y === void 0 ? {} : { defaultValue: y },
230
- disabled: b,
231
- ...x === void 0 ? {} : { form: x },
232
- ...C === void 0 ? {} : { name: C },
233
- ...D === void 0 ? {} : { onOpenChange: D },
234
- ...O === void 0 ? {} : { onValueChange: O },
235
- ...k === void 0 ? {} : { open: k },
236
- required: N,
237
- ...i ? { value: B ?? "" } : {},
238
- children: [/* @__PURE__ */ m(l.Trigger, {
239
- "aria-describedby": a,
240
- "aria-errormessage": o,
241
- "aria-invalid": s,
242
- "aria-label": u,
243
- "aria-labelledby": f,
244
- "aria-required": h ?? (N ? !0 : void 0),
245
- className: c(I("trigger"), L.size[P].className, _),
246
- id: S,
247
- onBlur: w,
248
- onFocus: T,
249
- onKeyDown: E,
250
- ref: M,
251
- tabIndex: F,
252
- children: [/* @__PURE__ */ p(l.Value, { placeholder: V }), /* @__PURE__ */ p(l.Icon, {
253
- asChild: !0,
254
- children: /* @__PURE__ */ p("span", {
255
- "aria-hidden": "true",
256
- className: I("triggerIcon"),
257
- children: /* @__PURE__ */ p(e, {
258
- decorative: !0,
259
- name: "chevron-down",
260
- size: "small"
261
- })
262
- })
263
- })]
264
- }), /* @__PURE__ */ p(t, { children: (t) => /* @__PURE__ */ p(l.Portal, {
265
- container: t,
266
- children: /* @__PURE__ */ m(l.Content, {
267
- align: "start",
268
- className: c(I("content"), L.size[P].className),
269
- position: "popper",
270
- sideOffset: 6,
271
- children: [
272
- /* @__PURE__ */ p(l.ScrollUpButton, {
273
- "aria-hidden": "true",
274
- className: I("scrollButton"),
275
- children: /* @__PURE__ */ p(e, {
276
- decorative: !0,
277
- name: "chevron-up",
278
- size: "small"
279
- })
280
- }),
281
- /* @__PURE__ */ p(l.Viewport, {
282
- className: I("viewport"),
283
- children: A.map((t) => /* @__PURE__ */ d(l.Item, {
284
- className: I("item"),
285
- ...t.disabled === void 0 ? {} : { disabled: t.disabled },
286
- key: t.value,
287
- textValue: t.label,
288
- value: t.value
289
- }, /* @__PURE__ */ p(l.ItemText, { children: t.label }), /* @__PURE__ */ p(l.ItemIndicator, {
290
- className: I("itemIndicator"),
291
- children: /* @__PURE__ */ p(e, {
292
- decorative: !0,
293
- name: "check",
294
- size: "small"
295
- })
296
- })))
297
- }),
298
- /* @__PURE__ */ p(l.ScrollDownButton, {
299
- "aria-hidden": "true",
300
- className: I("scrollButton"),
301
- children: /* @__PURE__ */ p(e, {
302
- decorative: !0,
303
- name: "chevron-down",
304
- size: "small"
305
- })
306
- })
307
- ]
308
- })
309
- }) })]
310
- });
311
- }), V = {
312
- root: "rly_Surface-module__root",
313
- tonePrimary: "rly_Surface-module__tonePrimary",
314
- toneSecondary: "rly_Surface-module__toneSecondary",
315
- toneTertiary: "rly_Surface-module__toneTertiary",
316
- shapeCard: "rly_Surface-module__shapeCard",
317
- shapeGrouped: "rly_Surface-module__shapeGrouped",
318
- paddingNone: "rly_Surface-module__paddingNone",
319
- paddingCompact: "rly_Surface-module__paddingCompact",
320
- paddingDefault: "rly_Surface-module__paddingDefault",
321
- paddingSpacious: "rly_Surface-module__paddingSpacious"
322
- }, H = (e) => a(V, e), U = s({
323
- tone: {
324
- primary: {
325
- className: H("tonePrimary"),
326
- purpose: "Primary bordered surface",
327
- tokens: ["color-surface-1", "color-border-1"]
328
- },
329
- secondary: {
330
- className: H("toneSecondary"),
331
- purpose: "Quiet secondary surface",
332
- tokens: ["color-surface-2"]
333
- },
334
- tertiary: {
335
- className: H("toneTertiary"),
336
- purpose: "Inset tertiary surface",
337
- tokens: ["color-surface-3"]
338
- }
339
- },
340
- form: {
341
- card: {
342
- className: H("shapeCard"),
343
- purpose: "Standard card geometry",
344
- tokens: ["radius-control"]
345
- },
346
- grouped: {
347
- className: H("shapeGrouped"),
348
- purpose: "Grouped content geometry",
349
- tokens: ["radius-group"]
350
- }
351
- },
352
- padding: {
353
- none: {
354
- className: H("paddingNone"),
355
- purpose: "Caller-owned internal layout",
356
- tokens: ["space-0"]
357
- },
358
- compact: {
359
- className: H("paddingCompact"),
360
- purpose: "Dense supporting content",
361
- tokens: ["space-16"]
362
- },
363
- default: {
364
- className: H("paddingDefault"),
365
- purpose: "Standard content",
366
- tokens: ["space-24"]
367
- },
368
- spacious: {
369
- className: H("paddingSpacious"),
370
- purpose: "Prominent grouped content",
371
- tokens: ["space-32"]
372
- }
373
- }
374
- }), W = s({
375
- tone: "primary",
376
- form: "card",
377
- padding: "default"
378
- }), G = ({ as: e, children: t, className: n, form: r = "card", padding: i = "default", ref: a, tone: o = "primary", ...s }) => d(e ?? "div", {
379
- ...s,
380
- className: c(H("root"), U.tone[o].className, U.form[r].className, U.padding[i].className, n),
381
- ref: a
382
- }, t), K = {
383
- root: "rly_Tabs-module__root",
384
- list: "rly_Tabs-module__list",
385
- trigger: "rly_Tabs-module__trigger",
386
- defaultSize: "rly_Tabs-module__defaultSize",
387
- large: "rly_Tabs-module__large",
388
- panel: "rly_Tabs-module__panel"
389
- }, q = (e) => a(K, e), J = s({ size: {
390
- default: {
391
- className: q("defaultSize"),
392
- purpose: "Standard section navigation",
393
- tokens: [
394
- "type-label",
395
- "space-40",
396
- "space-4"
397
- ]
398
- },
399
- large: {
400
- className: q("large"),
401
- purpose: "Prominent page-level navigation",
402
- tokens: ["type-body", "space-48"]
403
- }
404
- } }), Y = s({ size: "default" }), X = (e) => {
405
- if (e.length === 0) throw Error("Tabs items must contain at least one enabled tab");
406
- let t = /* @__PURE__ */ new Set(), n;
407
- for (let i of e) {
408
- let e = r(i.value, "Tab value");
409
- if (r(i.label, `Tab label for ${e}`), t.has(e)) throw Error(`Tabs item values must be unique: ${e}`);
410
- t.add(e), !i.disabled && n === void 0 && (n = i);
411
- }
412
- if (n === void 0) throw Error("Tabs items must contain at least one enabled tab");
413
- return n;
414
- }, ee = ({ "aria-label": e, className: t, defaultValue: n, direction: i, items: a, onValueChange: o, size: s = "default", value: l, ...d }) => {
415
- let f = r(e, "Tabs aria-label"), h = X(a), g = l ?? n ?? h.value, _ = a.find((e) => e.value === g);
416
- if (_ === void 0 || _.disabled) throw Error(`Tabs selected value must identify an enabled tab: ${g}`);
417
- let v = l === void 0 ? o === void 0 ? { defaultValue: g } : {
418
- defaultValue: g,
419
- onValueChange: o
420
- } : {
421
- onValueChange: o,
422
- value: l
423
- }, y = i === void 0 ? {} : { dir: i };
424
- return /* @__PURE__ */ m(u.Root, {
425
- ...d,
426
- ...v,
427
- ...y,
428
- activationMode: "automatic",
429
- className: c(q("root"), J.size[s].className, t),
430
- orientation: "horizontal",
431
- children: [/* @__PURE__ */ p(u.List, {
432
- "aria-label": f,
433
- className: q("list"),
434
- loop: !0,
435
- children: a.map((e) => /* @__PURE__ */ p(u.Trigger, {
436
- className: q("trigger"),
437
- disabled: e.disabled,
438
- value: e.value,
439
- children: e.label
440
- }, e.value))
441
- }), a.map((e) => /* @__PURE__ */ p(u.Content, {
442
- className: q("panel"),
443
- value: e.value,
444
- children: e.content
445
- }, e.value))]
446
- });
447
- }, te = {
448
- root: "rly_Text-module__root",
449
- verdict: "rly_Text-module__verdict",
450
- pageTitle: "rly_Text-module__pageTitle",
451
- sectionTitle: "rly_Text-module__sectionTitle",
452
- cardTitle: "rly_Text-module__cardTitle",
453
- bodyLarge: "rly_Text-module__bodyLarge",
454
- body: "rly_Text-module__body",
455
- label: "rly_Text-module__label",
456
- meta: "rly_Text-module__meta",
457
- code: "rly_Text-module__code",
458
- tonePrimary: "rly_Text-module__tonePrimary",
459
- toneSecondary: "rly_Text-module__toneSecondary",
460
- toneTertiary: "rly_Text-module__toneTertiary",
461
- toneInherit: "rly_Text-module__toneInherit"
462
- }, Z = (e) => a(te, e), Q = s({
463
- variant: {
464
- verdict: {
465
- className: Z("verdict"),
466
- purpose: "One restrained verdict thesis",
467
- tokens: ["type-verdict"]
468
- },
469
- "page-title": {
470
- className: Z("pageTitle"),
471
- purpose: "Primary page title",
472
- tokens: ["type-page-title"]
473
- },
474
- "section-title": {
475
- className: Z("sectionTitle"),
476
- purpose: "Section heading",
477
- tokens: ["type-section-title"]
478
- },
479
- "card-title": {
480
- className: Z("cardTitle"),
481
- purpose: "Card or panel heading",
482
- tokens: ["type-card-title"]
483
- },
484
- "body-large": {
485
- className: Z("bodyLarge"),
486
- purpose: "Leading explanatory copy",
487
- tokens: ["type-body-large"]
488
- },
489
- body: {
490
- className: Z("body"),
491
- purpose: "Default interface copy",
492
- tokens: ["type-body"]
493
- },
494
- label: {
495
- className: Z("label"),
496
- purpose: "Control and metadata labels",
497
- tokens: ["type-label"]
498
- },
499
- meta: {
500
- className: Z("meta"),
501
- purpose: "Supporting metadata",
502
- tokens: ["type-meta"]
503
- },
504
- code: {
505
- className: Z("code"),
506
- purpose: "Code and tabular data",
507
- tokens: ["type-code"]
508
- }
509
- },
510
- tone: {
511
- primary: {
512
- className: Z("tonePrimary"),
513
- purpose: "Primary readable text",
514
- tokens: ["color-text-1"]
515
- },
516
- secondary: {
517
- className: Z("toneSecondary"),
518
- purpose: "Supporting text",
519
- tokens: ["color-text-2"]
520
- },
521
- tertiary: {
522
- className: Z("toneTertiary"),
523
- purpose: "Restricted tertiary text",
524
- tokens: ["color-text-3"]
525
- },
526
- inherit: {
527
- className: Z("toneInherit"),
528
- purpose: "Inherit semantic context",
529
- tokens: []
530
- }
531
- }
532
- }), $ = s({
533
- variant: "body",
534
- tone: "primary"
535
- }), ne = (e) => e === "code" ? "code" : e === "verdict" ? "p" : e === "label" || e === "meta" ? "span" : "p", re = ({ as: e, children: t, className: n, ref: r, tone: i = $.tone, variant: a = $.variant, ...o }) => d(e ?? ne(a), {
536
- ...o,
537
- className: c(Z("root"), Q.variant[a].className, Q.tone[i].className, n),
538
- ref: r
539
- }, t);
540
- //#endregion
541
- export { O as _, J as a, v as b, U as c, L as d, B as f, k as g, M as h, Y as i, G as l, N as m, Q as n, ee as o, P as p, re as r, W as s, $ as t, R as u, D as v, _ as x, y };
542
-
543
- //# sourceMappingURL=primitives-CW89TsFB.js.map