@filipgutica/ui 1.2.0 → 1.3.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.
@@ -5,6 +5,7 @@ export interface UiCodeBlockProps {
5
5
  copyable?: boolean;
6
6
  lineNumbers?: boolean;
7
7
  wrap?: boolean;
8
+ variant?: 'default' | 'compact';
8
9
  }
9
10
  type __VLS_Slots = {
10
11
  actions?(): unknown;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
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, onMounted as p, onUnmounted as m, openBlock as h, provide as g, readonly as _, ref as v, renderList as y, renderSlot as b, resolveDynamicComponent as x, shallowRef as ee, toDisplayString as S, unref as C, useId as te, useModel as w, useSlots as T, watch as E, withCtx as D } from "vue";
2
- import { CheckboxIndicator as O, CheckboxRoot as ne, DialogClose as k, DialogContent as A, DialogDescription as j, DialogOverlay as M, DialogPortal as N, DialogRoot as P, DialogTitle as F, DialogTrigger as I, Primitive as L, ProgressIndicator as R, ProgressRoot as z, RadioGroupItem as B, RadioGroupRoot as V, SliderRange as H, SliderRoot as U, SliderThumb as W, SliderTrack as G } 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, onMounted as p, onUnmounted as m, openBlock as h, provide as g, readonly as _, ref as v, renderList as y, renderSlot as b, resolveDynamicComponent as x, shallowRef as S, toDisplayString as C, unref as w, useId as T, useModel as E, useSlots as ee, watch as te, withCtx as D } from "vue";
2
+ import { CheckboxIndicator as O, CheckboxRoot as k, DialogClose as A, DialogContent as j, DialogDescription as ne, DialogOverlay as M, DialogPortal as N, DialogRoot as P, DialogTitle as F, DialogTrigger as I, Primitive as L, ProgressIndicator as R, ProgressRoot as z, RadioGroupItem as B, RadioGroupRoot as V, SliderRange as H, SliderRoot as U, SliderThumb as W, SliderTrack as G } from "reka-ui";
3
3
  import { useTimeoutFn as K } from "@vueuse/core";
4
4
  //#endregion
5
5
  //#region src/components/UiButton.vue
@@ -19,7 +19,7 @@ var q = /* @__PURE__ */ c({
19
19
  variant: { default: "primary" }
20
20
  },
21
21
  setup(e) {
22
- return (t, r) => (h(), n(C(L), {
22
+ return (t, r) => (h(), n(w(L), {
23
23
  as: "button",
24
24
  class: "fg-button",
25
25
  "data-size": e.size,
@@ -57,30 +57,46 @@ var q = /* @__PURE__ */ c({
57
57
  titleTag: { default: "h3" }
58
58
  },
59
59
  setup(e) {
60
- let t = T();
60
+ let t = ee();
61
61
  return (a, s) => (h(), i("div", J, [
62
62
  e.title || t.title || t.actions ? (h(), i("header", Y, [e.title || t.title ? (h(), n(x(e.titleTag), {
63
63
  key: 0,
64
64
  class: "fg-card__title"
65
65
  }, {
66
- default: D(() => [b(a.$slots, "title", {}, () => [o(S(e.title), 1)])]),
66
+ default: D(() => [b(a.$slots, "title", {}, () => [o(C(e.title), 1)])]),
67
67
  _: 3
68
68
  })) : r("", !0), t.actions ? (h(), i("div", X, [b(a.$slots, "actions")])) : r("", !0)])) : r("", !0),
69
69
  t.default ? (h(), i("div", Z, [b(a.$slots, "default")])) : r("", !0),
70
70
  t.footer ? (h(), i("footer", re, [b(a.$slots, "footer")])) : r("", !0)
71
71
  ]));
72
72
  }
73
- }), ae = ["data-wrap", "data-line-numbers"], oe = { class: "fg-code-block__header" }, se = { class: "fg-code-block__title" }, ce = {
73
+ }), ae = [
74
+ "data-wrap",
75
+ "data-line-numbers",
76
+ "data-variant"
77
+ ], oe = {
74
78
  key: 0,
79
+ class: "fg-code-block__header"
80
+ }, se = {
81
+ key: 0,
82
+ class: "fg-code-block__title"
83
+ }, ce = {
84
+ key: 1,
75
85
  class: "fg-code-block__language"
76
- }, le = { class: "fg-code-block__actions" }, ue = ["disabled"], de = ["aria-label"], fe = {
86
+ }, le = { class: "fg-code-block__actions" }, ue = ["disabled", "title"], de = {
87
+ viewBox: "0 0 24 24",
88
+ fill: "none",
89
+ stroke: "currentColor",
90
+ "stroke-width": "1.5",
91
+ "aria-hidden": "true"
92
+ }, fe = {
93
+ key: 0,
94
+ d: "m5 12 4 4L19 6"
95
+ }, pe = { key: 0 }, me = ["aria-label"], he = {
77
96
  key: 0,
78
97
  class: "fg-code-block__number",
79
98
  "aria-hidden": "true"
80
- }, pe = { class: "fg-code-block__text" }, me = {
81
- class: "fg-code-block__status",
82
- role: "status"
83
- }, he = /* @__PURE__ */ c({
99
+ }, ge = { class: "fg-code-block__text" }, _e = ["data-state"], ve = /* @__PURE__ */ c({
84
100
  __name: "UiCodeBlock",
85
101
  props: {
86
102
  code: {},
@@ -97,10 +113,11 @@ var q = /* @__PURE__ */ c({
97
113
  wrap: {
98
114
  type: Boolean,
99
115
  default: !1
100
- }
116
+ },
117
+ variant: { default: "default" }
101
118
  },
102
119
  setup(n) {
103
- let s = ee(), c = v(""), l = t(() => s.value ?? n.code.split("\n").map((e) => [{ content: e }])), u = {
120
+ let s = S(), c = v(""), l = t(() => s.value ?? n.code.split("\n").map((e) => [{ content: e }])), u = {
104
121
  vue: "vue",
105
122
  ts: "typescript",
106
123
  typescript: "typescript",
@@ -113,7 +130,7 @@ var q = /* @__PURE__ */ c({
113
130
  sh: "bash",
114
131
  shell: "bash"
115
132
  };
116
- E(() => [n.code, n.language], async ([e, t], n, r) => {
133
+ te(() => [n.code, n.language], async ([e, t], n, r) => {
117
134
  let i = !1;
118
135
  r(() => {
119
136
  i = !0;
@@ -138,7 +155,7 @@ var q = /* @__PURE__ */ c({
138
155
  }, { immediate: !0 });
139
156
  let d = v(!1), { start: p } = K(() => {
140
157
  d.value = !1;
141
- }, 1500, { immediate: !1 }), m = v(!1), g = v(""), _ = async () => {
158
+ }, 1500, { immediate: !1 }), m = v(!1), g = v(""), _ = t(() => d.value && !g.value), x = t(() => n.variant === "compact" && _.value && !c.value), w = t(() => g.value ? g.value : n.variant === "compact" && c.value ? d.value ? `Code copied to clipboard. ${c.value}` : c.value : d.value ? "Code copied to clipboard." : c.value), T = async () => {
142
159
  if (g.value = "", d.value = !1, typeof navigator > "u" || !navigator.clipboard?.writeText) {
143
160
  g.value = "Clipboard unavailable. Select the code to copy it.";
144
161
  return;
@@ -155,32 +172,28 @@ var q = /* @__PURE__ */ c({
155
172
  return (t, s) => (h(), i("div", {
156
173
  class: "fg-code-block",
157
174
  "data-wrap": n.wrap,
158
- "data-line-numbers": n.lineNumbers
175
+ "data-line-numbers": n.lineNumbers,
176
+ "data-variant": n.variant
159
177
  }, [
160
- a("div", oe, [
161
- a("span", se, S(n.title || n.language), 1),
162
- n.title ? (h(), i("span", ce, S(n.language), 1)) : r("", !0),
178
+ n.variant === "default" || n.copyable || t.$slots.actions ? (h(), i("div", oe, [
179
+ n.variant === "default" ? (h(), i("span", se, C(n.title || n.language), 1)) : r("", !0),
180
+ n.title && n.variant === "default" ? (h(), i("span", ce, C(n.language), 1)) : r("", !0),
163
181
  a("div", le, [b(t.$slots, "actions"), n.copyable ? (h(), i("button", {
164
182
  key: 0,
165
183
  type: "button",
166
184
  class: "fg-code-block__copy",
167
185
  disabled: m.value,
168
186
  "aria-label": "Copy code",
169
- onClick: _
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", {
187
+ title: n.variant === "compact" ? _.value ? "Copied" : "Copy code" : void 0,
188
+ onClick: T
189
+ }, [(h(), i("svg", de, [n.variant === "compact" && _.value ? (h(), i("path", fe)) : (h(), i(e, { key: 1 }, [s[0] ||= a("rect", {
177
190
  x: "8",
178
191
  y: "8",
179
192
  width: "12",
180
193
  height: "13",
181
194
  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(" " + S(d.value && !g.value ? "Copied" : "Copy"), 1)], 8, ue)) : r("", !0)])
183
- ]),
195
+ }, null, -1), s[1] ||= a("path", { d: "M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3" }, null, -1)], 64))])), n.variant === "default" ? (h(), i("span", pe, C(_.value ? "Copied" : "Copy"), 1)) : r("", !0)], 8, ue)) : r("", !0)])
196
+ ])) : r("", !0),
184
197
  a("pre", {
185
198
  class: "fg-code-block__pre",
186
199
  tabindex: "0",
@@ -188,18 +201,22 @@ var q = /* @__PURE__ */ c({
188
201
  }, [a("code", null, [(h(!0), i(e, null, y(l.value, (t, s) => (h(), i("span", {
189
202
  key: s,
190
203
  class: "fg-code-block__line"
191
- }, [n.lineNumbers ? (h(), i("span", fe, S(s + 1), 1)) : r("", !0), a("span", pe, [(h(!0), i(e, null, y(t, (e, t) => (h(), i("span", {
204
+ }, [n.lineNumbers ? (h(), i("span", he, C(s + 1), 1)) : r("", !0), a("span", ge, [(h(!0), i(e, null, y(t, (e, t) => (h(), i("span", {
192
205
  key: t,
193
206
  style: f({ color: e.color })
194
- }, S(e.content), 5))), 128)), o(S(s < l.value.length - 1 ? "\n" : ""), 1)])]))), 128))])], 8, de),
195
- a("span", me, S(g.value || (d.value ? "Code copied to clipboard." : c.value)), 1)
207
+ }, C(e.content), 5))), 128)), o(C(s < l.value.length - 1 ? "\n" : ""), 1)])]))), 128))])], 8, me),
208
+ a("span", {
209
+ class: "fg-code-block__status",
210
+ role: "status",
211
+ "data-state": x.value ? "success" : void 0
212
+ }, C(w.value), 9, _e)
196
213
  ], 8, ae));
197
214
  }
198
- }), ge = /* @__PURE__ */ c({
215
+ }), ye = /* @__PURE__ */ c({
199
216
  __name: "UiAlert",
200
217
  props: { tone: { default: "neutral" } },
201
218
  setup(e) {
202
- return (t, r) => (h(), n(C(L), {
219
+ return (t, r) => (h(), n(w(L), {
203
220
  as: "div",
204
221
  class: "fg-alert",
205
222
  "data-tone": e.tone,
@@ -209,11 +226,11 @@ var q = /* @__PURE__ */ c({
209
226
  _: 3
210
227
  }, 8, ["data-tone", "role"]));
211
228
  }
212
- }), _e = /* @__PURE__ */ c({
229
+ }), be = /* @__PURE__ */ c({
213
230
  __name: "UiBadge",
214
231
  props: { tone: { default: "neutral" } },
215
232
  setup(e) {
216
- return (t, r) => (h(), n(C(L), {
233
+ return (t, r) => (h(), n(w(L), {
217
234
  as: "span",
218
235
  class: "fg-badge",
219
236
  "data-tone": e.tone
@@ -222,7 +239,7 @@ var q = /* @__PURE__ */ c({
222
239
  _: 3
223
240
  }, 8, ["data-tone"]));
224
241
  }
225
- }), ve = ["data-size", "data-disabled"], ye = { class: "fg-checkbox__label" }, be = /* @__PURE__ */ c({
242
+ }), xe = ["data-size", "data-disabled"], Se = { class: "fg-checkbox__label" }, Ce = /* @__PURE__ */ c({
226
243
  __name: "UiCheckbox",
227
244
  props: {
228
245
  disabled: {
@@ -244,23 +261,23 @@ var q = /* @__PURE__ */ c({
244
261
  class: "fg-checkbox",
245
262
  "data-size": e.size,
246
263
  "data-disabled": e.disabled ? "true" : void 0
247
- }, [s(C(ne), {
264
+ }, [s(w(k), {
248
265
  class: "fg-checkbox__control",
249
266
  disabled: e.disabled,
250
267
  "model-value": e.modelValue,
251
268
  "onUpdate:modelValue": r
252
269
  }, {
253
- default: D(() => [s(C(O), { class: "fg-checkbox__indicator" }, {
270
+ default: D(() => [s(w(O), { class: "fg-checkbox__indicator" }, {
254
271
  default: D(() => [...n[0] ||= [o("✓", -1)]]),
255
272
  _: 1
256
273
  })]),
257
274
  _: 1
258
- }, 8, ["disabled", "model-value"]), a("span", ye, [b(t.$slots, "default")])], 8, ve));
275
+ }, 8, ["disabled", "model-value"]), a("span", Se, [b(t.$slots, "default")])], 8, xe));
259
276
  }
260
- }), xe = { class: "fg-dialog__header" }, Se = { class: "fg-dialog__body" }, Ce = {
277
+ }), we = { class: "fg-dialog__header" }, Te = { class: "fg-dialog__body" }, Ee = {
261
278
  key: 0,
262
279
  class: "fg-dialog__footer"
263
- }, we = /* @__PURE__ */ c({
280
+ }, De = /* @__PURE__ */ c({
264
281
  inheritAttrs: !1,
265
282
  __name: "UiDialog",
266
283
  props: {
@@ -271,34 +288,34 @@ var q = /* @__PURE__ */ c({
271
288
  emits: ["update:open"],
272
289
  setup(e, { emit: t }) {
273
290
  let c = t;
274
- return (t, l) => (h(), n(C(P), {
291
+ return (t, l) => (h(), n(w(P), {
275
292
  open: e.open,
276
293
  "onUpdate:open": l[0] ||= (e) => c("update:open", e)
277
294
  }, {
278
- default: D(() => [s(C(N), null, {
279
- default: D(() => [s(C(M), { class: "fg-dialog__overlay" }), s(C(A), d({
295
+ default: D(() => [s(w(N), null, {
296
+ default: D(() => [s(w(M), { class: "fg-dialog__overlay" }), s(w(j), d({
280
297
  class: "fg-dialog__content",
281
298
  "aria-modal": "true"
282
299
  }, t.$attrs), {
283
300
  default: D(() => [
284
- a("div", xe, [a("div", null, [s(C(F), { class: "fg-dialog__title" }, {
285
- default: D(() => [o(S(e.title), 1)]),
301
+ a("div", we, [a("div", null, [s(w(F), { class: "fg-dialog__title" }, {
302
+ default: D(() => [o(C(e.title), 1)]),
286
303
  _: 1
287
- }), e.description ? (h(), n(C(j), {
304
+ }), e.description ? (h(), n(w(ne), {
288
305
  key: 0,
289
306
  class: "fg-dialog__description"
290
307
  }, {
291
- default: D(() => [o(S(e.description), 1)]),
308
+ default: D(() => [o(C(e.description), 1)]),
292
309
  _: 1
293
- })) : r("", !0)]), s(C(k), {
310
+ })) : r("", !0)]), s(w(A), {
294
311
  class: "fg-dialog__close",
295
312
  "aria-label": "Close dialog"
296
313
  }, {
297
314
  default: D(() => [...l[1] ||= [o(" × ", -1)]]),
298
315
  _: 1
299
316
  })]),
300
- a("div", Se, [b(t.$slots, "default")]),
301
- t.$slots.footer ? (h(), i("div", Ce, [b(t.$slots, "footer")])) : r("", !0)
317
+ a("div", Te, [b(t.$slots, "default")]),
318
+ t.$slots.footer ? (h(), i("div", Ee, [b(t.$slots, "footer")])) : r("", !0)
302
319
  ]),
303
320
  _: 3
304
321
  }, 16)]),
@@ -307,7 +324,7 @@ var q = /* @__PURE__ */ c({
307
324
  _: 3
308
325
  }, 8, ["open"]));
309
326
  }
310
- }), Te = { class: "fg-drawer__header" }, Ee = { class: "fg-drawer__body" }, De = /* @__PURE__ */ c({
327
+ }), Oe = { class: "fg-drawer__header" }, ke = { class: "fg-drawer__body" }, Ae = /* @__PURE__ */ c({
311
328
  inheritAttrs: !1,
312
329
  __name: "UiDrawer",
313
330
  props: {
@@ -317,32 +334,32 @@ var q = /* @__PURE__ */ c({
317
334
  emits: ["update:open", "closeAutoFocus"],
318
335
  setup(e, { emit: t }) {
319
336
  let i = t;
320
- return (t, c) => (h(), n(C(P), {
337
+ return (t, c) => (h(), n(w(P), {
321
338
  open: e.open,
322
339
  "onUpdate:open": c[1] ||= (e) => i("update:open", e)
323
340
  }, {
324
- default: D(() => [t.$slots.trigger ? (h(), n(C(I), {
341
+ default: D(() => [t.$slots.trigger ? (h(), n(w(I), {
325
342
  key: 0,
326
343
  "as-child": ""
327
344
  }, {
328
345
  default: D(() => [b(t.$slots, "trigger")]),
329
346
  _: 3
330
- })) : r("", !0), s(C(N), null, {
331
- default: D(() => [s(C(M), { class: "fg-drawer__overlay" }), s(C(A), d({
347
+ })) : r("", !0), s(w(N), null, {
348
+ default: D(() => [s(w(M), { class: "fg-drawer__overlay" }), s(w(j), d({
332
349
  class: "fg-drawer__content",
333
350
  "aria-modal": "true",
334
351
  "aria-describedby": void 0
335
352
  }, t.$attrs, { onCloseAutoFocus: c[0] ||= (e) => i("closeAutoFocus", e) }), {
336
- default: D(() => [a("div", Te, [s(C(F), { class: "fg-drawer__title" }, {
337
- default: D(() => [o(S(e.title), 1)]),
353
+ default: D(() => [a("div", Oe, [s(w(F), { class: "fg-drawer__title" }, {
354
+ default: D(() => [o(C(e.title), 1)]),
338
355
  _: 1
339
- }), s(C(k), {
356
+ }), s(w(A), {
340
357
  class: "fg-drawer__close",
341
358
  "aria-label": "Close drawer"
342
359
  }, {
343
360
  default: D(() => [...c[2] ||= [o(" × ", -1)]]),
344
361
  _: 1
345
- })]), a("div", Ee, [b(t.$slots, "default")])]),
362
+ })]), a("div", ke, [b(t.$slots, "default")])]),
346
363
  _: 3
347
364
  }, 16)]),
348
365
  _: 3
@@ -350,7 +367,7 @@ var q = /* @__PURE__ */ c({
350
367
  _: 3
351
368
  }, 8, ["open"]));
352
369
  }
353
- }), Q = Symbol("UiFieldContext"), Oe = ["data-invalid"], ke = ["for"], Ae = ["id"], je = ["id"], Me = /* @__PURE__ */ c({
370
+ }), Q = Symbol("UiFieldContext"), je = ["data-invalid"], Me = ["for"], Ne = ["id"], Pe = ["id"], Fe = /* @__PURE__ */ c({
354
371
  __name: "UiField",
355
372
  props: {
356
373
  controlId: {},
@@ -372,7 +389,7 @@ var q = /* @__PURE__ */ c({
372
389
  a("label", {
373
390
  class: "fg-field__label",
374
391
  for: e.controlId
375
- }, S(e.label), 9, ke),
392
+ }, C(e.label), 9, Me),
376
393
  b(t.$slots, "default", {
377
394
  descriptionId: n.value,
378
395
  errorId: o.value
@@ -382,16 +399,16 @@ var q = /* @__PURE__ */ c({
382
399
  id: n.value,
383
400
  class: "fg-field__description",
384
401
  "data-field-description": ""
385
- }, S(e.description), 9, Ae)) : r("", !0),
402
+ }, C(e.description), 9, Ne)) : r("", !0),
386
403
  e.error ? (h(), i("p", {
387
404
  key: 1,
388
405
  id: o.value,
389
406
  class: "fg-field__error",
390
407
  "data-field-error": ""
391
- }, S(e.error), 9, je)) : r("", !0)
392
- ], 8, Oe));
408
+ }, C(e.error), 9, Pe)) : r("", !0)
409
+ ], 8, je));
393
410
  }
394
- }), Ne = /* @__PURE__ */ c({
411
+ }), Ie = /* @__PURE__ */ c({
395
412
  __name: "UiInput",
396
413
  props: {
397
414
  disabled: {
@@ -412,13 +429,13 @@ var q = /* @__PURE__ */ c({
412
429
  let r = l(Q, void 0), i = t, a = (e) => {
413
430
  e.currentTarget instanceof HTMLInputElement && i("update:modelValue", e.currentTarget.value);
414
431
  };
415
- return (t, i) => (h(), n(C(L), {
416
- id: C(r)?.controlId.value ?? e.id,
432
+ return (t, i) => (h(), n(w(L), {
433
+ id: w(r)?.controlId.value ?? e.id,
417
434
  as: "input",
418
435
  class: "fg-input",
419
- "aria-describedby": C(r)?.descriptionId.value,
420
- "aria-errormessage": C(r)?.errorId.value,
421
- "aria-invalid": e.invalid || C(r)?.invalid.value ? "true" : void 0,
436
+ "aria-describedby": w(r)?.descriptionId.value,
437
+ "aria-errormessage": w(r)?.errorId.value,
438
+ "aria-invalid": e.invalid || w(r)?.invalid.value ? "true" : void 0,
422
439
  "data-size": e.size,
423
440
  disabled: e.disabled,
424
441
  type: e.type,
@@ -435,7 +452,7 @@ var q = /* @__PURE__ */ c({
435
452
  "value"
436
453
  ]));
437
454
  }
438
- }), Pe = 100, $ = /* @__PURE__ */ c({
455
+ }), Le = 100, Re = /* @__PURE__ */ c({
439
456
  __name: "UiProgress",
440
457
  props: {
441
458
  label: {},
@@ -444,19 +461,19 @@ var q = /* @__PURE__ */ c({
444
461
  },
445
462
  setup(e) {
446
463
  let r = t(() => {
447
- let t = Number.isFinite(e.max) && e.max > 0 ? e.max : Pe;
464
+ let t = Number.isFinite(e.max) && e.max > 0 ? e.max : Le;
448
465
  return {
449
466
  max: t,
450
467
  value: e.value === null || !Number.isFinite(e.value) ? null : Math.min(t, Math.max(0, e.value))
451
468
  };
452
469
  }), i = t(() => r.value.value === null ? 0 : r.value.value / r.value.max * 100);
453
- return (t, a) => (h(), n(C(z), {
470
+ return (t, a) => (h(), n(w(z), {
454
471
  class: "fg-progress",
455
472
  "aria-label": e.label,
456
473
  max: r.value.max,
457
474
  "model-value": r.value.value
458
475
  }, {
459
- default: D(() => [s(C(R), {
476
+ default: D(() => [s(w(R), {
460
477
  class: "fg-progress__indicator",
461
478
  style: f({ transform: `translateX(-${100 - i.value}%)` })
462
479
  }, null, 8, ["style"])]),
@@ -467,7 +484,7 @@ var q = /* @__PURE__ */ c({
467
484
  "model-value"
468
485
  ]));
469
486
  }
470
- }), Fe = { class: "fg-radio-card__content" }, Ie = /* @__PURE__ */ c({
487
+ }), ze = { class: "fg-radio-card__content" }, Be = /* @__PURE__ */ c({
471
488
  __name: "UiRadioCard",
472
489
  props: {
473
490
  disabled: {
@@ -477,7 +494,7 @@ var q = /* @__PURE__ */ c({
477
494
  value: {}
478
495
  },
479
496
  setup(e) {
480
- return (t, r) => (h(), n(C(B), {
497
+ return (t, r) => (h(), n(w(B), {
481
498
  class: "fg-radio-card",
482
499
  disabled: e.disabled,
483
500
  value: e.value
@@ -485,11 +502,11 @@ var q = /* @__PURE__ */ c({
485
502
  default: D(() => [r[0] ||= a("span", {
486
503
  class: "fg-radio-card__indicator",
487
504
  "aria-hidden": "true"
488
- }, null, -1), a("span", Fe, [b(t.$slots, "default")])]),
505
+ }, null, -1), a("span", ze, [b(t.$slots, "default")])]),
489
506
  _: 3
490
507
  }, 8, ["disabled", "value"]));
491
508
  }
492
- }), Le = /* @__PURE__ */ c({
509
+ }), Ve = /* @__PURE__ */ c({
493
510
  __name: "UiRadioCardGroup",
494
511
  props: /*@__PURE__*/ u({
495
512
  disabled: {
@@ -507,7 +524,7 @@ var q = /* @__PURE__ */ c({
507
524
  }),
508
525
  emits: ["update:modelValue"],
509
526
  setup(e) {
510
- let t = w(e, "modelValue"), r = (t) => {
527
+ let t = E(e, "modelValue"), r = (t) => {
511
528
  if (t.altKey || t.ctrlKey || t.metaKey || t.shiftKey) return;
512
529
  let n = t.currentTarget, r = t.target;
513
530
  if (!(n instanceof HTMLElement) || !(r instanceof HTMLElement)) return;
@@ -523,7 +540,7 @@ var q = /* @__PURE__ */ c({
523
540
  let d = o[u];
524
541
  !d || d === r || (t.preventDefault(), d.focus(), d.click());
525
542
  };
526
- return (i, a) => (h(), n(C(V), d({
543
+ return (i, a) => (h(), n(w(V), d({
527
544
  modelValue: t.value,
528
545
  "onUpdate:modelValue": a[0] ||= (e) => t.value = e,
529
546
  class: "fg-radio-card-group",
@@ -538,7 +555,7 @@ var q = /* @__PURE__ */ c({
538
555
  "loop"
539
556
  ]));
540
557
  }
541
- }), Re = /* @__PURE__ */ c({
558
+ }), $ = /* @__PURE__ */ c({
542
559
  __name: "UiSelect",
543
560
  props: {
544
561
  disabled: {
@@ -558,13 +575,13 @@ var q = /* @__PURE__ */ c({
558
575
  let r = l(Q, void 0), i = t, a = (e) => {
559
576
  e.currentTarget instanceof HTMLSelectElement && i("update:modelValue", e.currentTarget.value);
560
577
  };
561
- return (t, i) => (h(), n(C(L), {
562
- id: C(r)?.controlId.value ?? e.id,
578
+ return (t, i) => (h(), n(w(L), {
579
+ id: w(r)?.controlId.value ?? e.id,
563
580
  as: "select",
564
581
  class: "fg-select",
565
- "aria-describedby": C(r)?.descriptionId.value,
566
- "aria-errormessage": C(r)?.errorId.value,
567
- "aria-invalid": e.invalid || C(r)?.invalid.value ? "true" : void 0,
582
+ "aria-describedby": w(r)?.descriptionId.value,
583
+ "aria-errormessage": w(r)?.errorId.value,
584
+ "aria-invalid": e.invalid || w(r)?.invalid.value ? "true" : void 0,
568
585
  "data-size": e.size,
569
586
  disabled: e.disabled,
570
587
  value: e.modelValue,
@@ -582,7 +599,7 @@ var q = /* @__PURE__ */ c({
582
599
  "value"
583
600
  ]));
584
601
  }
585
- }), ze = /* @__PURE__ */ c({
602
+ }), He = /* @__PURE__ */ c({
586
603
  __name: "UiSlider",
587
604
  props: {
588
605
  disabled: {
@@ -615,7 +632,7 @@ var q = /* @__PURE__ */ c({
615
632
  e !== void 0 && o("update:modelValue", e);
616
633
  }
617
634
  });
618
- return (t, r) => (h(), n(C(U), {
635
+ return (t, r) => (h(), n(w(U), {
619
636
  modelValue: c.value,
620
637
  "onUpdate:modelValue": r[0] ||= (e) => c.value = e,
621
638
  class: "fg-slider",
@@ -625,15 +642,15 @@ var q = /* @__PURE__ */ c({
625
642
  min: a.value.min,
626
643
  step: a.value.step
627
644
  }, {
628
- default: D(() => [s(C(G), { class: "fg-slider__track" }, {
629
- default: D(() => [s(C(H), { class: "fg-slider__range" })]),
645
+ default: D(() => [s(w(G), { class: "fg-slider__track" }, {
646
+ default: D(() => [s(w(H), { class: "fg-slider__range" })]),
630
647
  _: 1
631
- }), s(C(W), {
632
- id: C(i)?.controlId.value ?? e.id,
648
+ }), s(w(W), {
649
+ id: w(i)?.controlId.value ?? e.id,
633
650
  class: "fg-slider__thumb",
634
- "aria-describedby": C(i)?.descriptionId.value,
635
- "aria-errormessage": C(i)?.errorId.value,
636
- "aria-invalid": C(i)?.invalid.value ? "true" : void 0,
651
+ "aria-describedby": w(i)?.descriptionId.value,
652
+ "aria-errormessage": w(i)?.errorId.value,
653
+ "aria-invalid": w(i)?.invalid.value ? "true" : void 0,
637
654
  "aria-label": e.label
638
655
  }, null, 8, [
639
656
  "id",
@@ -652,20 +669,20 @@ var q = /* @__PURE__ */ c({
652
669
  "step"
653
670
  ]));
654
671
  }
655
- }), Be = { class: "fg-tabs" }, Ve = ["aria-label"], He = [
672
+ }), Ue = { class: "fg-tabs" }, We = ["aria-label"], Ge = [
656
673
  "id",
657
674
  "aria-controls",
658
675
  "aria-selected",
659
676
  "tabindex",
660
677
  "onClick",
661
678
  "onFocus"
662
- ], Ue = [
679
+ ], Ke = [
663
680
  "id",
664
681
  "role",
665
682
  "aria-labelledby",
666
683
  "hidden",
667
684
  "tabindex"
668
- ], We = ["id", "hidden"], Ge = /* @__PURE__ */ c({
685
+ ], qe = ["id", "hidden"], Je = /* @__PURE__ */ c({
669
686
  __name: "UiTabs",
670
687
  props: {
671
688
  items: {},
@@ -674,7 +691,7 @@ var q = /* @__PURE__ */ c({
674
691
  },
675
692
  emits: ["update:modelValue"],
676
693
  setup(n, { emit: o }) {
677
- let s = o, c = te(), l = v(!1), u = t(() => n.items.some((e) => e.value === n.modelValue) ? n.modelValue : n.items[0]?.value), d = (e) => `${c}-tab-${encodeURIComponent(e)}`, f = (e) => `${c}-panel-${encodeURIComponent(e)}`, m = (e) => `${c}-heading-${encodeURIComponent(e)}`;
694
+ let s = o, c = T(), l = v(!1), u = t(() => n.items.some((e) => e.value === n.modelValue) ? n.modelValue : n.items[0]?.value), d = (e) => `${c}-tab-${encodeURIComponent(e)}`, f = (e) => `${c}-panel-${encodeURIComponent(e)}`, m = (e) => `${c}-heading-${encodeURIComponent(e)}`;
678
695
  p(() => {
679
696
  l.value = !0;
680
697
  });
@@ -694,7 +711,7 @@ var q = /* @__PURE__ */ c({
694
711
  let a = getComputedStyle(t).direction === "rtl", o = e.key === (a ? "ArrowRight" : "ArrowLeft"), s = r[e.key === "Home" ? 0 : e.key === "End" ? r.length - 1 : (i + (o ? -1 : 1) + r.length) % r.length];
695
712
  s && (e.preventDefault(), s.focus());
696
713
  };
697
- return (t, o) => (h(), i("div", Be, [l.value ? (h(), i("div", {
714
+ return (t, o) => (h(), i("div", Ue, [l.value ? (h(), i("div", {
698
715
  key: 0,
699
716
  class: "fg-tabs__list",
700
717
  role: "tablist",
@@ -711,7 +728,7 @@ var q = /* @__PURE__ */ c({
711
728
  tabindex: e.value === u.value ? 0 : -1,
712
729
  onClick: (t) => g(e.value),
713
730
  onFocus: (t) => g(e.value)
714
- }, S(e.label), 41, He))), 128))], 40, Ve)) : r("", !0), (h(!0), i(e, null, y(n.items, (e) => (h(), i("section", {
731
+ }, C(e.label), 41, Ge))), 128))], 40, We)) : r("", !0), (h(!0), i(e, null, y(n.items, (e) => (h(), i("section", {
715
732
  id: f(e.value),
716
733
  key: e.value,
717
734
  class: "fg-tabs__panel",
@@ -723,16 +740,16 @@ var q = /* @__PURE__ */ c({
723
740
  id: m(e.value),
724
741
  class: "fg-tabs__heading",
725
742
  hidden: l.value
726
- }, S(e.label), 9, We), b(t.$slots, "panel", { value: e.value })], 8, Ue))), 128))]));
743
+ }, C(e.label), 9, qe), b(t.$slots, "panel", { value: e.value })], 8, Ke))), 128))]));
727
744
  }
728
- }), Ke = /* @__PURE__ */ c({
745
+ }), Ye = /* @__PURE__ */ c({
729
746
  __name: "UiSurface",
730
747
  props: {
731
748
  as: { default: "section" },
732
749
  padding: { default: "default" }
733
750
  },
734
751
  setup(e) {
735
- return (t, r) => (h(), n(C(L), {
752
+ return (t, r) => (h(), n(w(L), {
736
753
  as: e.as,
737
754
  class: "fg-surface",
738
755
  "data-padding": e.padding
@@ -741,7 +758,7 @@ var q = /* @__PURE__ */ c({
741
758
  _: 3
742
759
  }, 8, ["as", "data-padding"]));
743
760
  }
744
- }), qe = ({ targetIds: e }) => {
761
+ }), Xe = ({ targetIds: e }) => {
745
762
  let t = v(e[0]), n, r, i;
746
763
  return p(() => {
747
764
  let a = e.flatMap((e) => {
@@ -766,4 +783,4 @@ var q = /* @__PURE__ */ c({
766
783
  }), _(t);
767
784
  };
768
785
  //#endregion
769
- export { ge as UiAlert, _e as UiBadge, q as UiButton, ie as UiCard, be as UiCheckbox, he as UiCodeBlock, we as UiDialog, De as UiDrawer, Me as UiField, Ne as UiInput, $ as UiProgress, Ie as UiRadioCard, Le as UiRadioCardGroup, Re as UiSelect, ze as UiSlider, Ke as UiSurface, Ge as UiTabs, qe as useActiveSection };
786
+ export { ye as UiAlert, be as UiBadge, q as UiButton, ie as UiCard, Ce as UiCheckbox, ve as UiCodeBlock, De as UiDialog, Ae as UiDrawer, Fe as UiField, Ie as UiInput, Re as UiProgress, Be as UiRadioCard, Ve as UiRadioCardGroup, $ as UiSelect, He as UiSlider, Ye as UiSurface, Je as UiTabs, Xe as useActiveSection };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filipgutica/ui",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "A compact Vue design system with Tailwind CSS and VS Code theme support",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -61,6 +61,51 @@
61
61
  .fg-code-block[data-wrap="true"] .fg-code-block__text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
62
62
  .fg-code-block__status:empty { display: none; }
63
63
  .fg-code-block__status:not(:empty) { display: block; padding: 0.5rem 0.75rem; font-size: 0.75rem; }
64
+ .fg-code-block[data-variant="compact"] {
65
+ position: relative;
66
+ display: grid;
67
+ grid-template-columns: minmax(0, 1fr) auto;
68
+ align-items: center;
69
+ }
70
+ .fg-code-block[data-variant="compact"] .fg-code-block__header {
71
+ grid-column: 2;
72
+ grid-row: 1;
73
+ min-height: 0;
74
+ padding: var(--space-1);
75
+ border: 0;
76
+ background: transparent;
77
+ }
78
+ .fg-code-block[data-variant="compact"] .fg-code-block__actions {
79
+ gap: var(--space-1);
80
+ margin-left: 0;
81
+ }
82
+ .fg-code-block[data-variant="compact"] .fg-code-block__copy {
83
+ padding: 0;
84
+ border-radius: var(--radius-control);
85
+ }
86
+ .fg-code-block[data-variant="compact"] .fg-code-block__pre {
87
+ grid-column: 1;
88
+ grid-row: 1;
89
+ min-width: 0;
90
+ padding: var(--space-2) var(--space-3);
91
+ }
92
+ .fg-code-block[data-variant="compact"] .fg-code-block__status:not(:empty) {
93
+ grid-column: 1 / -1;
94
+ padding: var(--space-2) var(--space-3);
95
+ font-size: var(--text-sm);
96
+ overflow-wrap: anywhere;
97
+ }
98
+ .fg-code-block[data-variant="compact"] .fg-code-block__status[data-state="success"] {
99
+ position: absolute;
100
+ top: 0;
101
+ left: 0;
102
+ width: 1px;
103
+ height: 1px;
104
+ padding: 0;
105
+ overflow: hidden;
106
+ clip-path: inset(50%);
107
+ white-space: nowrap;
108
+ }
64
109
  .fg-button,
65
110
  .fg-input,
66
111
  .fg-select,