@vertz/ui-primitives 0.2.9 → 0.2.11

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.
Files changed (2) hide show
  1. package/dist/index.js +44 -184
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -223,7 +223,7 @@ var Accordion = {
223
223
  }
224
224
  };
225
225
  // src/alert-dialog/alert-dialog.tsx
226
- import { __element, __on } from "@vertz/ui/internals";
226
+ import { __attr, __element, __on } from "@vertz/ui/internals";
227
227
  import { signal as signal2 } from "@vertz/ui";
228
228
 
229
229
  // src/utils/focus.ts
@@ -326,26 +326,10 @@ function AlertDialogRoot(options = {}) {
326
326
  const trigger = (() => {
327
327
  const __el0 = __element("button");
328
328
  __el0.setAttribute("type", "button");
329
- {
330
- const __v = ids.triggerId;
331
- if (__v != null && __v !== false)
332
- __el0.setAttribute("id", __v === true ? "" : __v);
333
- }
334
- {
335
- const __v = ids.contentId;
336
- if (__v != null && __v !== false)
337
- __el0.setAttribute("aria-controls", __v === true ? "" : __v);
338
- }
339
- {
340
- const __v = defaultOpen ? "true" : "false";
341
- if (__v != null && __v !== false)
342
- __el0.setAttribute("aria-expanded", __v === true ? "" : __v);
343
- }
344
- {
345
- const __v = defaultOpen ? "open" : "closed";
346
- if (__v != null && __v !== false)
347
- __el0.setAttribute("data-state", __v === true ? "" : __v);
348
- }
329
+ __attr(__el0, "id", () => ids.triggerId);
330
+ __attr(__el0, "aria-controls", () => ids.contentId);
331
+ __attr(__el0, "aria-expanded", () => defaultOpen ? "true" : "false");
332
+ __attr(__el0, "data-state", () => defaultOpen ? "open" : "closed");
349
333
  __on(__el0, "click", () => {
350
334
  if (!state.open.peek())
351
335
  show();
@@ -355,75 +339,31 @@ function AlertDialogRoot(options = {}) {
355
339
  const overlay = (() => {
356
340
  const __el1 = __element("div");
357
341
  __el1.setAttribute("data-alertdialog-overlay", "");
358
- {
359
- const __v = defaultOpen ? "false" : "true";
360
- if (__v != null && __v !== false)
361
- __el1.setAttribute("aria-hidden", __v === true ? "" : __v);
362
- }
363
- {
364
- const __v = defaultOpen ? "open" : "closed";
365
- if (__v != null && __v !== false)
366
- __el1.setAttribute("data-state", __v === true ? "" : __v);
367
- }
368
- {
369
- const __v = defaultOpen ? "" : "display: none";
370
- if (__v != null && __v !== false)
371
- __el1.setAttribute("style", __v === true ? "" : __v);
372
- }
342
+ __attr(__el1, "aria-hidden", () => defaultOpen ? "false" : "true");
343
+ __attr(__el1, "data-state", () => defaultOpen ? "open" : "closed");
344
+ __attr(__el1, "style", () => defaultOpen ? "" : "display: none");
373
345
  return __el1;
374
346
  })();
375
347
  const content = (() => {
376
348
  const __el2 = __element("div");
377
349
  __el2.setAttribute("role", "alertdialog");
378
- {
379
- const __v = ids.contentId;
380
- if (__v != null && __v !== false)
381
- __el2.setAttribute("id", __v === true ? "" : __v);
382
- }
350
+ __attr(__el2, "id", () => ids.contentId);
383
351
  __el2.setAttribute("aria-modal", "true");
384
- {
385
- const __v = titleId;
386
- if (__v != null && __v !== false)
387
- __el2.setAttribute("aria-labelledby", __v === true ? "" : __v);
388
- }
389
- {
390
- const __v = descriptionId;
391
- if (__v != null && __v !== false)
392
- __el2.setAttribute("aria-describedby", __v === true ? "" : __v);
393
- }
394
- {
395
- const __v = defaultOpen ? "false" : "true";
396
- if (__v != null && __v !== false)
397
- __el2.setAttribute("aria-hidden", __v === true ? "" : __v);
398
- }
399
- {
400
- const __v = defaultOpen ? "open" : "closed";
401
- if (__v != null && __v !== false)
402
- __el2.setAttribute("data-state", __v === true ? "" : __v);
403
- }
404
- {
405
- const __v = defaultOpen ? "" : "display: none";
406
- if (__v != null && __v !== false)
407
- __el2.setAttribute("style", __v === true ? "" : __v);
408
- }
352
+ __attr(__el2, "aria-labelledby", () => titleId);
353
+ __attr(__el2, "aria-describedby", () => descriptionId);
354
+ __attr(__el2, "aria-hidden", () => defaultOpen ? "false" : "true");
355
+ __attr(__el2, "data-state", () => defaultOpen ? "open" : "closed");
356
+ __attr(__el2, "style", () => defaultOpen ? "" : "display: none");
409
357
  return __el2;
410
358
  })();
411
359
  const title = (() => {
412
360
  const __el3 = __element("h2");
413
- {
414
- const __v = titleId;
415
- if (__v != null && __v !== false)
416
- __el3.setAttribute("id", __v === true ? "" : __v);
417
- }
361
+ __attr(__el3, "id", () => titleId);
418
362
  return __el3;
419
363
  })();
420
364
  const description = (() => {
421
365
  const __el4 = __element("p");
422
- {
423
- const __v = descriptionId;
424
- if (__v != null && __v !== false)
425
- __el4.setAttribute("id", __v === true ? "" : __v);
426
- }
366
+ __attr(__el4, "id", () => descriptionId);
427
367
  return __el4;
428
368
  })();
429
369
  const cancel = (() => {
@@ -452,22 +392,14 @@ var AlertDialog = {
452
392
  Root: AlertDialogRoot
453
393
  };
454
394
  // src/badge/badge.tsx
455
- import { __element as __element2 } from "@vertz/ui/internals";
395
+ import { __attr as __attr2, __element as __element2 } from "@vertz/ui/internals";
456
396
  function BadgeRoot(options = {}) {
457
397
  const { variant = "default" } = options;
458
398
  const badge = (() => {
459
399
  const __el0 = __element2("span");
460
- {
461
- const __v = uniqueId("badge");
462
- if (__v != null && __v !== false)
463
- __el0.setAttribute("id", __v === true ? "" : __v);
464
- }
400
+ __attr2(__el0, "id", () => uniqueId("badge"));
465
401
  __el0.setAttribute("data-slot", "badge");
466
- {
467
- const __v = variant;
468
- if (__v != null && __v !== false)
469
- __el0.setAttribute("data-variant", __v === true ? "" : __v);
470
- }
402
+ __attr2(__el0, "data-variant", () => variant);
471
403
  return __el0;
472
404
  })();
473
405
  return { badge };
@@ -3031,7 +2963,7 @@ var Select = {
3031
2963
  }
3032
2964
  };
3033
2965
  // src/sheet/sheet.tsx
3034
- import { __element as __element3, __on as __on2 } from "@vertz/ui/internals";
2966
+ import { __attr as __attr3, __element as __element3, __on as __on2 } from "@vertz/ui/internals";
3035
2967
  import { signal as signal23 } from "@vertz/ui";
3036
2968
  function SheetRoot(options = {}) {
3037
2969
  const { side = "right", defaultOpen = false, onOpenChange } = options;
@@ -3086,26 +3018,10 @@ function SheetRoot(options = {}) {
3086
3018
  const trigger = (() => {
3087
3019
  const __el0 = __element3("button");
3088
3020
  __el0.setAttribute("type", "button");
3089
- {
3090
- const __v = ids.triggerId;
3091
- if (__v != null && __v !== false)
3092
- __el0.setAttribute("id", __v === true ? "" : __v);
3093
- }
3094
- {
3095
- const __v = ids.contentId;
3096
- if (__v != null && __v !== false)
3097
- __el0.setAttribute("aria-controls", __v === true ? "" : __v);
3098
- }
3099
- {
3100
- const __v = defaultOpen ? "true" : "false";
3101
- if (__v != null && __v !== false)
3102
- __el0.setAttribute("aria-expanded", __v === true ? "" : __v);
3103
- }
3104
- {
3105
- const __v = defaultOpen ? "open" : "closed";
3106
- if (__v != null && __v !== false)
3107
- __el0.setAttribute("data-state", __v === true ? "" : __v);
3108
- }
3021
+ __attr3(__el0, "id", () => ids.triggerId);
3022
+ __attr3(__el0, "aria-controls", () => ids.contentId);
3023
+ __attr3(__el0, "aria-expanded", () => defaultOpen ? "true" : "false");
3024
+ __attr3(__el0, "data-state", () => defaultOpen ? "open" : "closed");
3109
3025
  __on2(__el0, "click", () => {
3110
3026
  state.open.peek() ? hide() : show();
3111
3027
  });
@@ -3114,21 +3030,9 @@ function SheetRoot(options = {}) {
3114
3030
  const overlay = (() => {
3115
3031
  const __el1 = __element3("div");
3116
3032
  __el1.setAttribute("data-sheet-overlay", "");
3117
- {
3118
- const __v = defaultOpen ? "false" : "true";
3119
- if (__v != null && __v !== false)
3120
- __el1.setAttribute("aria-hidden", __v === true ? "" : __v);
3121
- }
3122
- {
3123
- const __v = defaultOpen ? "open" : "closed";
3124
- if (__v != null && __v !== false)
3125
- __el1.setAttribute("data-state", __v === true ? "" : __v);
3126
- }
3127
- {
3128
- const __v = defaultOpen ? "" : "display: none";
3129
- if (__v != null && __v !== false)
3130
- __el1.setAttribute("style", __v === true ? "" : __v);
3131
- }
3033
+ __attr3(__el1, "aria-hidden", () => defaultOpen ? "false" : "true");
3034
+ __attr3(__el1, "data-state", () => defaultOpen ? "open" : "closed");
3035
+ __attr3(__el1, "style", () => defaultOpen ? "" : "display: none");
3132
3036
  __on2(__el1, "click", () => hide());
3133
3037
  return __el1;
3134
3038
  })();
@@ -3136,31 +3040,11 @@ function SheetRoot(options = {}) {
3136
3040
  const __el2 = __element3("div");
3137
3041
  __el2.setAttribute("role", "dialog");
3138
3042
  __el2.setAttribute("aria-modal", "true");
3139
- {
3140
- const __v = ids.contentId;
3141
- if (__v != null && __v !== false)
3142
- __el2.setAttribute("id", __v === true ? "" : __v);
3143
- }
3144
- {
3145
- const __v = side;
3146
- if (__v != null && __v !== false)
3147
- __el2.setAttribute("data-side", __v === true ? "" : __v);
3148
- }
3149
- {
3150
- const __v = defaultOpen ? "false" : "true";
3151
- if (__v != null && __v !== false)
3152
- __el2.setAttribute("aria-hidden", __v === true ? "" : __v);
3153
- }
3154
- {
3155
- const __v = defaultOpen ? "open" : "closed";
3156
- if (__v != null && __v !== false)
3157
- __el2.setAttribute("data-state", __v === true ? "" : __v);
3158
- }
3159
- {
3160
- const __v = defaultOpen ? "" : "display: none";
3161
- if (__v != null && __v !== false)
3162
- __el2.setAttribute("style", __v === true ? "" : __v);
3163
- }
3043
+ __attr3(__el2, "id", () => ids.contentId);
3044
+ __attr3(__el2, "data-side", () => side);
3045
+ __attr3(__el2, "aria-hidden", () => defaultOpen ? "false" : "true");
3046
+ __attr3(__el2, "data-state", () => defaultOpen ? "open" : "closed");
3047
+ __attr3(__el2, "style", () => defaultOpen ? "" : "display: none");
3164
3048
  __on2(__el2, "keydown", (event) => {
3165
3049
  if (isKey(event, Keys.Escape)) {
3166
3050
  event.preventDefault();
@@ -3287,7 +3171,7 @@ var Slider = {
3287
3171
  };
3288
3172
  // src/switch/switch.tsx
3289
3173
  import { signal as signal25 } from "@vertz/ui";
3290
- import { __attr, __element as __element4, __on as __on3 } from "@vertz/ui/internals";
3174
+ import { __attr as __attr4, __element as __element4, __on as __on3 } from "@vertz/ui/internals";
3291
3175
  function SwitchRoot(options = {}) {
3292
3176
  const { defaultChecked = false, disabled = false, onCheckedChange } = options;
3293
3177
  const checked = signal25(defaultChecked);
@@ -3302,23 +3186,11 @@ function SwitchRoot(options = {}) {
3302
3186
  __el0.setAttribute("data-v-id", "SwitchRoot");
3303
3187
  __el0.setAttribute("type", "button");
3304
3188
  __el0.setAttribute("role", "switch");
3305
- {
3306
- const __v = uniqueId("switch");
3307
- if (__v != null && __v !== false)
3308
- __el0.setAttribute("id", __v === true ? "" : __v);
3309
- }
3310
- __attr(__el0, "aria-checked", () => checked.value ? "true" : "false");
3311
- __attr(__el0, "data-state", () => checked.value ? "checked" : "unchecked");
3312
- {
3313
- const __v = disabled;
3314
- if (__v != null && __v !== false)
3315
- __el0.setAttribute("disabled", __v === true ? "" : __v);
3316
- }
3317
- {
3318
- const __v = disabled ? "true" : undefined;
3319
- if (__v != null && __v !== false)
3320
- __el0.setAttribute("aria-disabled", __v === true ? "" : __v);
3321
- }
3189
+ __attr4(__el0, "id", () => uniqueId("switch"));
3190
+ __attr4(__el0, "aria-checked", () => checked.value ? "true" : "false");
3191
+ __attr4(__el0, "data-state", () => checked.value ? "checked" : "unchecked");
3192
+ __attr4(__el0, "disabled", () => disabled);
3193
+ __attr4(__el0, "aria-disabled", () => disabled ? "true" : undefined);
3322
3194
  __on3(__el0, "click", toggle);
3323
3195
  __on3(__el0, "keydown", (e) => {
3324
3196
  if (isKey(e, Keys.Space)) {
@@ -3458,7 +3330,7 @@ var Toast = {
3458
3330
  };
3459
3331
  // src/toggle/toggle.tsx
3460
3332
  import { signal as signal28 } from "@vertz/ui";
3461
- import { __attr as __attr2, __element as __element5, __on as __on4 } from "@vertz/ui/internals";
3333
+ import { __attr as __attr5, __element as __element5, __on as __on4 } from "@vertz/ui/internals";
3462
3334
  function ToggleRoot(options = {}) {
3463
3335
  const { defaultPressed = false, disabled = false, onPressedChange } = options;
3464
3336
  const pressed = signal28(defaultPressed);
@@ -3472,23 +3344,11 @@ function ToggleRoot(options = {}) {
3472
3344
  const __el0 = __element5("button");
3473
3345
  __el0.setAttribute("data-v-id", "ToggleRoot");
3474
3346
  __el0.setAttribute("type", "button");
3475
- {
3476
- const __v = uniqueId("toggle");
3477
- if (__v != null && __v !== false)
3478
- __el0.setAttribute("id", __v === true ? "" : __v);
3479
- }
3480
- __attr2(__el0, "aria-pressed", () => pressed.value ? "true" : "false");
3481
- __attr2(__el0, "data-state", () => pressed.value ? "on" : "off");
3482
- {
3483
- const __v = disabled;
3484
- if (__v != null && __v !== false)
3485
- __el0.setAttribute("disabled", __v === true ? "" : __v);
3486
- }
3487
- {
3488
- const __v = disabled ? "true" : undefined;
3489
- if (__v != null && __v !== false)
3490
- __el0.setAttribute("aria-disabled", __v === true ? "" : __v);
3491
- }
3347
+ __attr5(__el0, "id", () => uniqueId("toggle"));
3348
+ __attr5(__el0, "aria-pressed", () => pressed.value ? "true" : "false");
3349
+ __attr5(__el0, "data-state", () => pressed.value ? "on" : "off");
3350
+ __attr5(__el0, "disabled", () => disabled);
3351
+ __attr5(__el0, "aria-disabled", () => disabled ? "true" : undefined);
3492
3352
  __on4(__el0, "click", toggle);
3493
3353
  __on4(__el0, "keydown", (e) => {
3494
3354
  if (isKey(e, Keys.Space)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertz/ui-primitives",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Headless UI primitives for Vertz — Accordion, Dialog, Select, and more",
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@floating-ui/dom": "^1.7.5",
39
- "@vertz/ui": "workspace:^"
39
+ "@vertz/ui": "^0.2.11"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@happy-dom/global-registrator": "^20.7.0",
43
- "@vertz/ui-compiler": "workspace:^",
43
+ "@vertz/ui-compiler": "^0.2.11",
44
44
  "bunup": "^0.16.31",
45
45
  "happy-dom": "^20.7.0",
46
46
  "typescript": "^5.7.0"