@filipgutica/ui 0.3.0 → 1.1.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/index.js CHANGED
@@ -1,8 +1,9 @@
1
- import { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, defineComponent as s, inject as c, normalizeStyle as l, openBlock as u, provide as d, renderSlot as f, toDisplayString as p, unref as m, withCtx as h } from "vue";
2
- import { CheckboxIndicator as g, CheckboxRoot as _, DialogClose as v, DialogContent as y, DialogDescription as b, DialogOverlay as x, DialogPortal as S, DialogRoot as C, DialogTitle as w, Primitive as T, ProgressIndicator as E, ProgressRoot as D } from "reka-ui";
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, inject as l, mergeModels as u, mergeProps as d, normalizeStyle as f, openBlock as p, provide as m, ref as h, renderList as g, renderSlot as _, resolveDynamicComponent as v, shallowRef as ee, toDisplayString as y, unref as b, useModel as x, useSlots as S, watch as te, withCtx as C } from "vue";
2
+ import { CheckboxIndicator as w, CheckboxRoot as T, DialogClose as E, DialogContent as D, DialogDescription as O, DialogOverlay as k, DialogPortal as A, DialogRoot as j, DialogTitle as M, Primitive as N, ProgressIndicator as P, ProgressRoot as F, RadioGroupItem as I, RadioGroupRoot as L, SliderRange as R, SliderRoot as z, SliderThumb as B, SliderTrack as V } from "reka-ui";
3
+ import { useTimeoutFn as H } from "@vueuse/core";
3
4
  //#endregion
4
5
  //#region src/components/UiButton.vue
5
- var O = /* @__PURE__ */ s({
6
+ var U = /* @__PURE__ */ c({
6
7
  __name: "UiButton",
7
8
  props: {
8
9
  disabled: {
@@ -13,12 +14,12 @@ var O = /* @__PURE__ */ s({
13
14
  type: Boolean,
14
15
  default: !1
15
16
  },
16
- size: { default: "default" },
17
+ size: { default: "md" },
17
18
  type: { default: "button" },
18
19
  variant: { default: "primary" }
19
20
  },
20
21
  setup(e) {
21
- return (n, r) => (u(), t(m(T), {
22
+ return (t, r) => (p(), n(b(N), {
22
23
  as: "button",
23
24
  class: "fg-button",
24
25
  "data-size": e.size,
@@ -27,7 +28,7 @@ var O = /* @__PURE__ */ s({
27
28
  disabled: e.disabled || e.loading,
28
29
  type: e.type
29
30
  }, {
30
- default: h(() => [f(n.$slots, "default")]),
31
+ default: C(() => [_(t.$slots, "default")]),
31
32
  _: 3
32
33
  }, 8, [
33
34
  "data-size",
@@ -37,34 +38,191 @@ var O = /* @__PURE__ */ s({
37
38
  "type"
38
39
  ]));
39
40
  }
40
- }), k = /* @__PURE__ */ s({
41
+ }), W = { class: "fg-card" }, G = {
42
+ key: 0,
43
+ class: "fg-card__header"
44
+ }, K = {
45
+ key: 1,
46
+ class: "fg-card__actions"
47
+ }, q = {
48
+ key: 1,
49
+ class: "fg-card__body"
50
+ }, J = {
51
+ key: 2,
52
+ class: "fg-card__footer"
53
+ }, Y = /* @__PURE__ */ c({
54
+ __name: "UiCard",
55
+ props: {
56
+ title: { default: () => void 0 },
57
+ titleTag: { default: "h3" }
58
+ },
59
+ setup(e) {
60
+ let t = S();
61
+ return (a, s) => (p(), i("div", W, [
62
+ e.title || t.title || t.actions ? (p(), i("header", G, [e.title || t.title ? (p(), n(v(e.titleTag), {
63
+ key: 0,
64
+ class: "fg-card__title"
65
+ }, {
66
+ default: C(() => [_(a.$slots, "title", {}, () => [o(y(e.title), 1)])]),
67
+ _: 3
68
+ })) : r("", !0), t.actions ? (p(), i("div", K, [_(a.$slots, "actions")])) : r("", !0)])) : r("", !0),
69
+ t.default ? (p(), i("div", q, [_(a.$slots, "default")])) : r("", !0),
70
+ t.footer ? (p(), i("footer", J, [_(a.$slots, "footer")])) : r("", !0)
71
+ ]));
72
+ }
73
+ }), X = ["data-wrap", "data-line-numbers"], Z = { class: "fg-code-block__header" }, ne = { class: "fg-code-block__title" }, re = {
74
+ key: 0,
75
+ class: "fg-code-block__language"
76
+ }, ie = { class: "fg-code-block__actions" }, ae = ["disabled"], oe = ["aria-label"], se = {
77
+ key: 0,
78
+ class: "fg-code-block__number",
79
+ "aria-hidden": "true"
80
+ }, ce = { class: "fg-code-block__text" }, le = {
81
+ class: "fg-code-block__status",
82
+ role: "status"
83
+ }, ue = /* @__PURE__ */ c({
84
+ __name: "UiCodeBlock",
85
+ props: {
86
+ code: {},
87
+ language: { default: "text" },
88
+ title: { default: "" },
89
+ copyable: {
90
+ type: Boolean,
91
+ default: !0
92
+ },
93
+ lineNumbers: {
94
+ type: Boolean,
95
+ default: !1
96
+ },
97
+ wrap: {
98
+ type: Boolean,
99
+ default: !1
100
+ }
101
+ },
102
+ setup(n) {
103
+ let s = ee(), c = h(""), l = t(() => s.value ?? n.code.split("\n").map((e) => [{ content: e }])), u = {
104
+ vue: "vue",
105
+ ts: "typescript",
106
+ typescript: "typescript",
107
+ js: "javascript",
108
+ javascript: "javascript",
109
+ json: "json",
110
+ css: "css",
111
+ html: "html",
112
+ bash: "bash",
113
+ sh: "bash",
114
+ shell: "bash"
115
+ };
116
+ te(() => [n.code, n.language], async ([e, t], n, r) => {
117
+ let i = !1;
118
+ r(() => {
119
+ i = !0;
120
+ }), s.value = void 0, c.value = "";
121
+ let a = t.trim().toLowerCase(), o = Object.hasOwn(u, a) ? u[a] : void 0;
122
+ if (o) try {
123
+ let { highlightCode: t } = await import("./code-highlight-BuTmXL3w.js");
124
+ if (i) return;
125
+ let n = await t({
126
+ code: e,
127
+ language: o
128
+ });
129
+ if (i) return;
130
+ let r = e.split("\n");
131
+ s.value = r.map((e, t) => {
132
+ let r = n[t] ?? [];
133
+ return e.endsWith("\r") ? [...r, { content: "\r" }] : r;
134
+ });
135
+ } catch {
136
+ i || (c.value = "Syntax highlighting unavailable. Showing plain text.");
137
+ }
138
+ }, { immediate: !0 });
139
+ let d = h(!1), { start: m } = H(() => {
140
+ d.value = !1;
141
+ }, 1500, { immediate: !1 }), v = h(!1), b = h(""), x = async () => {
142
+ if (b.value = "", d.value = !1, typeof navigator > "u" || !navigator.clipboard?.writeText) {
143
+ b.value = "Clipboard unavailable. Select the code to copy it.";
144
+ return;
145
+ }
146
+ v.value = !0;
147
+ try {
148
+ await navigator.clipboard.writeText(n.code), d.value = !0, m();
149
+ } catch {
150
+ b.value = "Could not copy. Select the code to copy it.";
151
+ } finally {
152
+ v.value = !1;
153
+ }
154
+ };
155
+ return (t, s) => (p(), i("div", {
156
+ class: "fg-code-block",
157
+ "data-wrap": n.wrap,
158
+ "data-line-numbers": n.lineNumbers
159
+ }, [
160
+ a("div", Z, [
161
+ a("span", ne, y(n.title || n.language), 1),
162
+ n.title ? (p(), i("span", re, y(n.language), 1)) : r("", !0),
163
+ a("div", ie, [_(t.$slots, "actions"), n.copyable ? (p(), i("button", {
164
+ key: 0,
165
+ type: "button",
166
+ class: "fg-code-block__copy",
167
+ disabled: v.value,
168
+ "aria-label": "Copy code",
169
+ onClick: x
170
+ }, [s[0] ||= a("svg", {
171
+ viewBox: "0 0 24 24",
172
+ fill: "none",
173
+ stroke: "currentColor",
174
+ "stroke-width": "1.5",
175
+ "aria-hidden": "true"
176
+ }, [a("rect", {
177
+ x: "8",
178
+ y: "8",
179
+ width: "12",
180
+ height: "13",
181
+ rx: "2"
182
+ }), a("path", { d: "M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3" })], -1), o(" " + y(d.value && !b.value ? "Copied" : "Copy"), 1)], 8, ae)) : r("", !0)])
183
+ ]),
184
+ a("pre", {
185
+ class: "fg-code-block__pre",
186
+ tabindex: "0",
187
+ "aria-label": n.title || `${n.language} code`
188
+ }, [a("code", null, [(p(!0), i(e, null, g(l.value, (t, s) => (p(), i("span", {
189
+ key: s,
190
+ class: "fg-code-block__line"
191
+ }, [n.lineNumbers ? (p(), i("span", se, y(s + 1), 1)) : r("", !0), a("span", ce, [(p(!0), i(e, null, g(t, (e, t) => (p(), i("span", {
192
+ key: t,
193
+ style: f({ color: e.color })
194
+ }, y(e.content), 5))), 128)), o(y(s < l.value.length - 1 ? "\n" : ""), 1)])]))), 128))])], 8, oe),
195
+ a("span", le, y(b.value || (d.value ? "Code copied to clipboard." : c.value)), 1)
196
+ ], 8, X));
197
+ }
198
+ }), de = /* @__PURE__ */ c({
41
199
  __name: "UiAlert",
42
200
  props: { tone: { default: "neutral" } },
43
201
  setup(e) {
44
- return (n, r) => (u(), t(m(T), {
202
+ return (t, r) => (p(), n(b(N), {
45
203
  as: "div",
46
204
  class: "fg-alert",
47
205
  "data-tone": e.tone,
48
206
  role: e.tone === "danger" || e.tone === "error" ? "alert" : "status"
49
207
  }, {
50
- default: h(() => [f(n.$slots, "default")]),
208
+ default: C(() => [_(t.$slots, "default")]),
51
209
  _: 3
52
210
  }, 8, ["data-tone", "role"]));
53
211
  }
54
- }), A = /* @__PURE__ */ s({
212
+ }), fe = /* @__PURE__ */ c({
55
213
  __name: "UiBadge",
56
214
  props: { tone: { default: "neutral" } },
57
215
  setup(e) {
58
- return (n, r) => (u(), t(m(T), {
216
+ return (t, r) => (p(), n(b(N), {
59
217
  as: "span",
60
218
  class: "fg-badge",
61
219
  "data-tone": e.tone
62
220
  }, {
63
- default: h(() => [f(n.$slots, "default")]),
221
+ default: C(() => [_(t.$slots, "default")]),
64
222
  _: 3
65
223
  }, 8, ["data-tone"]));
66
224
  }
67
- }), j = ["data-disabled"], M = { class: "fg-checkbox__label" }, N = /* @__PURE__ */ s({
225
+ }), pe = ["data-size", "data-disabled"], me = { class: "fg-checkbox__label" }, he = /* @__PURE__ */ c({
68
226
  __name: "UiCheckbox",
69
227
  props: {
70
228
  disabled: {
@@ -74,70 +232,72 @@ var O = /* @__PURE__ */ s({
74
232
  modelValue: {
75
233
  type: Boolean,
76
234
  default: !1
77
- }
235
+ },
236
+ size: { default: "md" }
78
237
  },
79
238
  emits: ["update:modelValue"],
80
239
  setup(e, { emit: t }) {
81
- let n = t, s = (e) => {
240
+ let n = t, r = (e) => {
82
241
  n("update:modelValue", e === !0);
83
242
  };
84
- return (t, n) => (u(), r("label", {
243
+ return (t, n) => (p(), i("label", {
85
244
  class: "fg-checkbox",
245
+ "data-size": e.size,
86
246
  "data-disabled": e.disabled ? "true" : void 0
87
- }, [o(m(_), {
247
+ }, [s(b(T), {
88
248
  class: "fg-checkbox__control",
89
249
  disabled: e.disabled,
90
250
  "model-value": e.modelValue,
91
- "onUpdate:modelValue": s
251
+ "onUpdate:modelValue": r
92
252
  }, {
93
- default: h(() => [o(m(g), { class: "fg-checkbox__indicator" }, {
94
- default: h(() => [...n[0] ||= [a("✓", -1)]]),
253
+ default: C(() => [s(b(w), { class: "fg-checkbox__indicator" }, {
254
+ default: C(() => [...n[0] ||= [o("✓", -1)]]),
95
255
  _: 1
96
256
  })]),
97
257
  _: 1
98
- }, 8, ["disabled", "model-value"]), i("span", M, [f(t.$slots, "default")])], 8, j));
258
+ }, 8, ["disabled", "model-value"]), a("span", me, [_(t.$slots, "default")])], 8, pe));
99
259
  }
100
- }), P = { class: "fg-dialog__header" }, F = { class: "fg-dialog__body" }, I = {
260
+ }), ge = { class: "fg-dialog__header" }, _e = { class: "fg-dialog__body" }, ve = {
101
261
  key: 0,
102
262
  class: "fg-dialog__footer"
103
- }, L = /* @__PURE__ */ s({
263
+ }, ye = /* @__PURE__ */ c({
104
264
  __name: "UiDialog",
105
265
  props: {
106
- description: {},
266
+ description: { default: () => void 0 },
107
267
  open: { type: Boolean },
108
268
  title: {}
109
269
  },
110
270
  emits: ["update:open"],
111
- setup(e, { emit: s }) {
112
- let c = s;
113
- return (s, l) => (u(), t(m(C), {
271
+ setup(e, { emit: t }) {
272
+ let c = t;
273
+ return (t, l) => (p(), n(b(j), {
114
274
  open: e.open,
115
275
  "onUpdate:open": l[0] ||= (e) => c("update:open", e)
116
276
  }, {
117
- default: h(() => [o(m(S), null, {
118
- default: h(() => [o(m(x), { class: "fg-dialog__overlay" }), o(m(y), {
277
+ default: C(() => [s(b(A), null, {
278
+ default: C(() => [s(b(k), { class: "fg-dialog__overlay" }), s(b(D), {
119
279
  class: "fg-dialog__content",
120
280
  "aria-modal": "true"
121
281
  }, {
122
- default: h(() => [
123
- i("div", P, [i("div", null, [o(m(w), { class: "fg-dialog__title" }, {
124
- default: h(() => [a(p(e.title), 1)]),
282
+ default: C(() => [
283
+ a("div", ge, [a("div", null, [s(b(M), { class: "fg-dialog__title" }, {
284
+ default: C(() => [o(y(e.title), 1)]),
125
285
  _: 1
126
- }), e.description ? (u(), t(m(b), {
286
+ }), e.description ? (p(), n(b(O), {
127
287
  key: 0,
128
288
  class: "fg-dialog__description"
129
289
  }, {
130
- default: h(() => [a(p(e.description), 1)]),
290
+ default: C(() => [o(y(e.description), 1)]),
131
291
  _: 1
132
- })) : n("", !0)]), o(m(v), {
292
+ })) : r("", !0)]), s(b(E), {
133
293
  class: "fg-dialog__close",
134
294
  "aria-label": "Close dialog"
135
295
  }, {
136
- default: h(() => [...l[1] ||= [a("×", -1)]]),
296
+ default: C(() => [...l[1] ||= [o(" × ", -1)]]),
137
297
  _: 1
138
298
  })]),
139
- i("div", F, [f(s.$slots, "default")]),
140
- s.$slots.footer ? (u(), r("div", I, [f(s.$slots, "footer")])) : n("", !0)
299
+ a("div", _e, [_(t.$slots, "default")]),
300
+ t.$slots.footer ? (p(), i("div", ve, [_(t.$slots, "footer")])) : r("", !0)
141
301
  ]),
142
302
  _: 3
143
303
  })]),
@@ -146,74 +306,76 @@ var O = /* @__PURE__ */ s({
146
306
  _: 3
147
307
  }, 8, ["open"]));
148
308
  }
149
- }), R = Symbol("UiFieldContext"), z = ["data-invalid"], B = ["for"], V = ["id"], H = ["id"], U = /* @__PURE__ */ s({
309
+ }), Q = Symbol("UiFieldContext"), be = ["data-invalid"], $ = ["for"], xe = ["id"], Se = ["id"], Ce = /* @__PURE__ */ c({
150
310
  __name: "UiField",
151
311
  props: {
152
312
  controlId: {},
153
- description: {},
154
- error: {},
313
+ description: { default: () => void 0 },
314
+ error: { default: () => void 0 },
155
315
  label: {}
156
316
  },
157
- setup(t) {
158
- let a = t, o = e(() => a.description && !a.error ? `${a.controlId}-description` : void 0), s = e(() => a.error ? `${a.controlId}-error` : void 0), c = e(() => !!a.error);
159
- return d(R, {
160
- controlId: e(() => a.controlId),
161
- descriptionId: o,
162
- errorId: s,
163
- invalid: c
164
- }), (e, a) => (u(), r("div", {
317
+ setup(e) {
318
+ let n = t(() => e.description && !e.error ? `${e.controlId}-description` : void 0), o = t(() => e.error ? `${e.controlId}-error` : void 0), s = t(() => !!e.error);
319
+ return m(Q, {
320
+ controlId: t(() => e.controlId),
321
+ descriptionId: n,
322
+ errorId: o,
323
+ invalid: s
324
+ }), (t, s) => (p(), i("div", {
165
325
  class: "fg-field",
166
- "data-invalid": t.error ? "true" : void 0
326
+ "data-invalid": e.error ? "true" : void 0
167
327
  }, [
168
- i("label", {
328
+ a("label", {
169
329
  class: "fg-field__label",
170
- for: t.controlId
171
- }, p(t.label), 9, B),
172
- f(e.$slots, "default", {
173
- descriptionId: o.value,
174
- errorId: s.value
330
+ for: e.controlId
331
+ }, y(e.label), 9, $),
332
+ _(t.$slots, "default", {
333
+ descriptionId: n.value,
334
+ errorId: o.value
175
335
  }),
176
- t.description && !t.error ? (u(), r("p", {
336
+ e.description && !e.error ? (p(), i("p", {
177
337
  key: 0,
178
- id: o.value,
338
+ id: n.value,
179
339
  class: "fg-field__description",
180
340
  "data-field-description": ""
181
- }, p(t.description), 9, V)) : n("", !0),
182
- t.error ? (u(), r("p", {
341
+ }, y(e.description), 9, xe)) : r("", !0),
342
+ e.error ? (p(), i("p", {
183
343
  key: 1,
184
- id: s.value,
344
+ id: o.value,
185
345
  class: "fg-field__error",
186
346
  "data-field-error": ""
187
- }, p(t.error), 9, H)) : n("", !0)
188
- ], 8, z));
347
+ }, y(e.error), 9, Se)) : r("", !0)
348
+ ], 8, be));
189
349
  }
190
- }), W = /* @__PURE__ */ s({
350
+ }), we = /* @__PURE__ */ c({
191
351
  __name: "UiInput",
192
352
  props: {
193
353
  disabled: {
194
354
  type: Boolean,
195
355
  default: !1
196
356
  },
197
- id: {},
357
+ id: { default: () => void 0 },
198
358
  invalid: {
199
359
  type: Boolean,
200
360
  default: !1
201
361
  },
202
362
  modelValue: { default: "" },
363
+ size: { default: "md" },
203
364
  type: { default: "text" }
204
365
  },
205
366
  emits: ["update:modelValue"],
206
- setup(e, { emit: n }) {
207
- let r = c(R, void 0), i = n, a = (e) => {
367
+ setup(e, { emit: t }) {
368
+ let r = l(Q, void 0), i = t, a = (e) => {
208
369
  e.currentTarget instanceof HTMLInputElement && i("update:modelValue", e.currentTarget.value);
209
370
  };
210
- return (n, i) => (u(), t(m(T), {
371
+ return (t, i) => (p(), n(b(N), {
372
+ id: b(r)?.controlId.value ?? e.id,
211
373
  as: "input",
212
374
  class: "fg-input",
213
- id: e.id ?? m(r)?.controlId.value,
214
- "aria-describedby": m(r)?.descriptionId.value,
215
- "aria-errormessage": m(r)?.errorId.value,
216
- "aria-invalid": e.invalid || m(r)?.invalid.value ? "true" : void 0,
375
+ "aria-describedby": b(r)?.descriptionId.value,
376
+ "aria-errormessage": b(r)?.errorId.value,
377
+ "aria-invalid": e.invalid || b(r)?.invalid.value ? "true" : void 0,
378
+ "data-size": e.size,
217
379
  disabled: e.disabled,
218
380
  type: e.type,
219
381
  value: e.modelValue,
@@ -223,29 +385,36 @@ var O = /* @__PURE__ */ s({
223
385
  "aria-describedby",
224
386
  "aria-errormessage",
225
387
  "aria-invalid",
388
+ "data-size",
226
389
  "disabled",
227
390
  "type",
228
391
  "value"
229
392
  ]));
230
393
  }
231
- }), G = /* @__PURE__ */ s({
394
+ }), Te = 100, Ee = /* @__PURE__ */ c({
232
395
  __name: "UiProgress",
233
396
  props: {
234
397
  label: {},
235
398
  max: {},
236
399
  value: {}
237
400
  },
238
- setup(n) {
239
- let r = n, i = e(() => r.value === null || r.max <= 0 ? 0 : Math.min(100, Math.max(0, r.value / r.max * 100)));
240
- return (e, r) => (u(), t(m(D), {
401
+ setup(e) {
402
+ let r = t(() => {
403
+ let t = Number.isFinite(e.max) && e.max > 0 ? e.max : Te;
404
+ return {
405
+ max: t,
406
+ value: e.value === null || !Number.isFinite(e.value) ? null : Math.min(t, Math.max(0, e.value))
407
+ };
408
+ }), i = t(() => r.value.value === null ? 0 : r.value.value / r.value.max * 100);
409
+ return (t, a) => (p(), n(b(F), {
241
410
  class: "fg-progress",
242
- "aria-label": n.label,
243
- max: n.max,
244
- "model-value": n.value
411
+ "aria-label": e.label,
412
+ max: r.value.max,
413
+ "model-value": r.value.value
245
414
  }, {
246
- default: h(() => [o(m(E), {
415
+ default: C(() => [s(b(P), {
247
416
  class: "fg-progress__indicator",
248
- style: l({ transform: `translateX(-${100 - i.value}%)` })
417
+ style: f({ transform: `translateX(-${100 - i.value}%)` })
249
418
  }, null, 8, ["style"])]),
250
419
  _: 1
251
420
  }, 8, [
@@ -254,63 +423,207 @@ var O = /* @__PURE__ */ s({
254
423
  "model-value"
255
424
  ]));
256
425
  }
257
- }), K = /* @__PURE__ */ s({
426
+ }), De = { class: "fg-radio-card__content" }, Oe = /* @__PURE__ */ c({
427
+ __name: "UiRadioCard",
428
+ props: {
429
+ disabled: {
430
+ type: Boolean,
431
+ default: !1
432
+ },
433
+ value: {}
434
+ },
435
+ setup(e) {
436
+ return (t, r) => (p(), n(b(I), {
437
+ class: "fg-radio-card",
438
+ disabled: e.disabled,
439
+ value: e.value
440
+ }, {
441
+ default: C(() => [r[0] ||= a("span", {
442
+ class: "fg-radio-card__indicator",
443
+ "aria-hidden": "true"
444
+ }, null, -1), a("span", De, [_(t.$slots, "default")])]),
445
+ _: 3
446
+ }, 8, ["disabled", "value"]));
447
+ }
448
+ }), ke = /* @__PURE__ */ c({
449
+ __name: "UiRadioCardGroup",
450
+ props: /*@__PURE__*/ u({
451
+ disabled: {
452
+ type: Boolean,
453
+ default: !1
454
+ },
455
+ loop: {
456
+ type: Boolean,
457
+ default: !0
458
+ },
459
+ orientation: { default: () => void 0 }
460
+ }, {
461
+ modelValue: { required: !0 },
462
+ modelModifiers: {}
463
+ }),
464
+ emits: ["update:modelValue"],
465
+ setup(e) {
466
+ let t = x(e, "modelValue"), r = (t) => {
467
+ if (t.altKey || t.ctrlKey || t.metaKey || t.shiftKey) return;
468
+ let n = t.currentTarget, r = t.target;
469
+ if (!(n instanceof HTMLElement) || !(r instanceof HTMLElement)) return;
470
+ let i = t.key === "ArrowLeft" || t.key === "ArrowRight", a = t.key === "ArrowUp" || t.key === "ArrowDown";
471
+ if (!i && !a && t.key !== "Home" && t.key !== "End" || e.orientation === "horizontal" && a || e.orientation === "vertical" && i) return;
472
+ let o = [...n.querySelectorAll("[role=\"radio\"]")].filter((e) => !e.hasAttribute("data-disabled") && e.getAttribute("aria-disabled") !== "true"), s = o.indexOf(r);
473
+ if (s < 0 || o.length === 0) return;
474
+ let c = getComputedStyle(n).direction === "rtl", l = t.key === "ArrowUp" || t.key === "ArrowLeft" && !c || t.key === "ArrowRight" && c, u = t.key === "Home" ? 0 : t.key === "End" ? o.length - 1 : s + (l ? -1 : 1);
475
+ if (u < 0 || u >= o.length) {
476
+ if (!e.loop) return;
477
+ u = (u + o.length) % o.length;
478
+ }
479
+ let d = o[u];
480
+ !d || d === r || (t.preventDefault(), d.focus(), d.click());
481
+ };
482
+ return (i, a) => (p(), n(b(L), d({
483
+ modelValue: t.value,
484
+ "onUpdate:modelValue": a[0] ||= (e) => t.value = e,
485
+ class: "fg-radio-card-group",
486
+ disabled: e.disabled,
487
+ loop: e.loop
488
+ }, e.orientation === void 0 ? {} : { orientation: e.orientation }, { onKeydown: r }), {
489
+ default: C(() => [_(i.$slots, "default")]),
490
+ _: 3
491
+ }, 16, [
492
+ "modelValue",
493
+ "disabled",
494
+ "loop"
495
+ ]));
496
+ }
497
+ }), Ae = /* @__PURE__ */ c({
258
498
  __name: "UiSelect",
259
499
  props: {
260
500
  disabled: {
261
501
  type: Boolean,
262
502
  default: !1
263
503
  },
264
- id: {},
504
+ id: { default: () => void 0 },
265
505
  invalid: {
266
506
  type: Boolean,
267
507
  default: !1
268
508
  },
269
- modelValue: { default: "" }
509
+ modelValue: { default: "" },
510
+ size: { default: "md" }
270
511
  },
271
512
  emits: ["update:modelValue"],
272
- setup(e, { emit: n }) {
273
- let r = c(R, void 0), i = n, a = (e) => {
513
+ setup(e, { emit: t }) {
514
+ let r = l(Q, void 0), i = t, a = (e) => {
274
515
  e.currentTarget instanceof HTMLSelectElement && i("update:modelValue", e.currentTarget.value);
275
516
  };
276
- return (n, i) => (u(), t(m(T), {
517
+ return (t, i) => (p(), n(b(N), {
518
+ id: b(r)?.controlId.value ?? e.id,
277
519
  as: "select",
278
520
  class: "fg-select",
279
- id: e.id ?? m(r)?.controlId.value,
280
- "aria-describedby": m(r)?.descriptionId.value,
281
- "aria-errormessage": m(r)?.errorId.value,
282
- "aria-invalid": e.invalid || m(r)?.invalid.value ? "true" : void 0,
521
+ "aria-describedby": b(r)?.descriptionId.value,
522
+ "aria-errormessage": b(r)?.errorId.value,
523
+ "aria-invalid": e.invalid || b(r)?.invalid.value ? "true" : void 0,
524
+ "data-size": e.size,
283
525
  disabled: e.disabled,
284
526
  value: e.modelValue,
285
527
  onChange: a
286
528
  }, {
287
- default: h(() => [f(n.$slots, "default")]),
529
+ default: C(() => [_(t.$slots, "default")]),
288
530
  _: 3
289
531
  }, 8, [
290
532
  "id",
291
533
  "aria-describedby",
292
534
  "aria-errormessage",
293
535
  "aria-invalid",
536
+ "data-size",
294
537
  "disabled",
295
538
  "value"
296
539
  ]));
297
540
  }
298
- }), q = /* @__PURE__ */ s({
541
+ }), je = /* @__PURE__ */ c({
542
+ __name: "UiSlider",
543
+ props: {
544
+ disabled: {
545
+ type: Boolean,
546
+ default: !1
547
+ },
548
+ id: { default: () => void 0 },
549
+ label: {},
550
+ max: { default: 100 },
551
+ min: { default: 0 },
552
+ modelValue: { default: () => void 0 },
553
+ size: { default: "md" },
554
+ step: { default: 1 }
555
+ },
556
+ emits: ["update:modelValue"],
557
+ setup(e, { emit: r }) {
558
+ let i = l(Q, void 0), a = t(() => {
559
+ let t = Number.isFinite(e.min) ? e.min : 0;
560
+ return {
561
+ max: Number.isFinite(e.max) && e.max > t ? e.max : t + 100,
562
+ min: t,
563
+ step: Number.isFinite(e.step) && e.step > 0 ? e.step : 1
564
+ };
565
+ }), o = r, c = t({
566
+ get: () => {
567
+ let t = e.modelValue !== void 0 && Number.isFinite(e.modelValue) ? e.modelValue : a.value.min;
568
+ return [Math.min(a.value.max, Math.max(a.value.min, t))];
569
+ },
570
+ set: ([e]) => {
571
+ e !== void 0 && o("update:modelValue", e);
572
+ }
573
+ });
574
+ return (t, r) => (p(), n(b(z), {
575
+ modelValue: c.value,
576
+ "onUpdate:modelValue": r[0] ||= (e) => c.value = e,
577
+ class: "fg-slider",
578
+ "data-size": e.size,
579
+ disabled: e.disabled,
580
+ max: a.value.max,
581
+ min: a.value.min,
582
+ step: a.value.step
583
+ }, {
584
+ default: C(() => [s(b(V), { class: "fg-slider__track" }, {
585
+ default: C(() => [s(b(R), { class: "fg-slider__range" })]),
586
+ _: 1
587
+ }), s(b(B), {
588
+ id: b(i)?.controlId.value ?? e.id,
589
+ class: "fg-slider__thumb",
590
+ "aria-describedby": b(i)?.descriptionId.value,
591
+ "aria-errormessage": b(i)?.errorId.value,
592
+ "aria-invalid": b(i)?.invalid.value ? "true" : void 0,
593
+ "aria-label": e.label
594
+ }, null, 8, [
595
+ "id",
596
+ "aria-describedby",
597
+ "aria-errormessage",
598
+ "aria-invalid",
599
+ "aria-label"
600
+ ])]),
601
+ _: 1
602
+ }, 8, [
603
+ "modelValue",
604
+ "data-size",
605
+ "disabled",
606
+ "max",
607
+ "min",
608
+ "step"
609
+ ]));
610
+ }
611
+ }), Me = /* @__PURE__ */ c({
299
612
  __name: "UiSurface",
300
613
  props: {
301
614
  as: { default: "section" },
302
615
  padding: { default: "default" }
303
616
  },
304
617
  setup(e) {
305
- return (n, r) => (u(), t(m(T), {
618
+ return (t, r) => (p(), n(b(N), {
306
619
  as: e.as,
307
620
  class: "fg-surface",
308
621
  "data-padding": e.padding
309
622
  }, {
310
- default: h(() => [f(n.$slots, "default")]),
623
+ default: C(() => [_(t.$slots, "default")]),
311
624
  _: 3
312
625
  }, 8, ["as", "data-padding"]));
313
626
  }
314
627
  });
315
628
  //#endregion
316
- export { k as UiAlert, A as UiBadge, O as UiButton, N as UiCheckbox, L as UiDialog, U as UiField, W as UiInput, G as UiProgress, K as UiSelect, q as UiSurface };
629
+ export { de as UiAlert, fe as UiBadge, U as UiButton, Y as UiCard, he as UiCheckbox, ue as UiCodeBlock, ye as UiDialog, Ce as UiField, we as UiInput, Ee as UiProgress, Oe as UiRadioCard, ke as UiRadioCardGroup, Ae as UiSelect, je as UiSlider, Me as UiSurface };