@vertz/ui-primitives 0.2.11 → 0.2.13

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 +180 -40
  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 { __attr, __element, __on } from "@vertz/ui/internals";
226
+ import { __element, __on } from "@vertz/ui/internals";
227
227
  import { signal as signal2 } from "@vertz/ui";
228
228
 
229
229
  // src/utils/focus.ts
@@ -326,10 +326,26 @@ function AlertDialogRoot(options = {}) {
326
326
  const trigger = (() => {
327
327
  const __el0 = __element("button");
328
328
  __el0.setAttribute("type", "button");
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");
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
+ }
333
349
  __on(__el0, "click", () => {
334
350
  if (!state.open.peek())
335
351
  show();
@@ -339,31 +355,75 @@ function AlertDialogRoot(options = {}) {
339
355
  const overlay = (() => {
340
356
  const __el1 = __element("div");
341
357
  __el1.setAttribute("data-alertdialog-overlay", "");
342
- __attr(__el1, "aria-hidden", () => defaultOpen ? "false" : "true");
343
- __attr(__el1, "data-state", () => defaultOpen ? "open" : "closed");
344
- __attr(__el1, "style", () => defaultOpen ? "" : "display: none");
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
+ }
345
373
  return __el1;
346
374
  })();
347
375
  const content = (() => {
348
376
  const __el2 = __element("div");
349
377
  __el2.setAttribute("role", "alertdialog");
350
- __attr(__el2, "id", () => ids.contentId);
378
+ {
379
+ const __v = ids.contentId;
380
+ if (__v != null && __v !== false)
381
+ __el2.setAttribute("id", __v === true ? "" : __v);
382
+ }
351
383
  __el2.setAttribute("aria-modal", "true");
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");
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
+ }
357
409
  return __el2;
358
410
  })();
359
411
  const title = (() => {
360
412
  const __el3 = __element("h2");
361
- __attr(__el3, "id", () => titleId);
413
+ {
414
+ const __v = titleId;
415
+ if (__v != null && __v !== false)
416
+ __el3.setAttribute("id", __v === true ? "" : __v);
417
+ }
362
418
  return __el3;
363
419
  })();
364
420
  const description = (() => {
365
421
  const __el4 = __element("p");
366
- __attr(__el4, "id", () => descriptionId);
422
+ {
423
+ const __v = descriptionId;
424
+ if (__v != null && __v !== false)
425
+ __el4.setAttribute("id", __v === true ? "" : __v);
426
+ }
367
427
  return __el4;
368
428
  })();
369
429
  const cancel = (() => {
@@ -392,14 +452,22 @@ var AlertDialog = {
392
452
  Root: AlertDialogRoot
393
453
  };
394
454
  // src/badge/badge.tsx
395
- import { __attr as __attr2, __element as __element2 } from "@vertz/ui/internals";
455
+ import { __element as __element2 } from "@vertz/ui/internals";
396
456
  function BadgeRoot(options = {}) {
397
457
  const { variant = "default" } = options;
398
458
  const badge = (() => {
399
459
  const __el0 = __element2("span");
400
- __attr2(__el0, "id", () => uniqueId("badge"));
460
+ {
461
+ const __v = uniqueId("badge");
462
+ if (__v != null && __v !== false)
463
+ __el0.setAttribute("id", __v === true ? "" : __v);
464
+ }
401
465
  __el0.setAttribute("data-slot", "badge");
402
- __attr2(__el0, "data-variant", () => variant);
466
+ {
467
+ const __v = variant;
468
+ if (__v != null && __v !== false)
469
+ __el0.setAttribute("data-variant", __v === true ? "" : __v);
470
+ }
403
471
  return __el0;
404
472
  })();
405
473
  return { badge };
@@ -2963,7 +3031,7 @@ var Select = {
2963
3031
  }
2964
3032
  };
2965
3033
  // src/sheet/sheet.tsx
2966
- import { __attr as __attr3, __element as __element3, __on as __on2 } from "@vertz/ui/internals";
3034
+ import { __element as __element3, __on as __on2 } from "@vertz/ui/internals";
2967
3035
  import { signal as signal23 } from "@vertz/ui";
2968
3036
  function SheetRoot(options = {}) {
2969
3037
  const { side = "right", defaultOpen = false, onOpenChange } = options;
@@ -3018,10 +3086,26 @@ function SheetRoot(options = {}) {
3018
3086
  const trigger = (() => {
3019
3087
  const __el0 = __element3("button");
3020
3088
  __el0.setAttribute("type", "button");
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");
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
+ }
3025
3109
  __on2(__el0, "click", () => {
3026
3110
  state.open.peek() ? hide() : show();
3027
3111
  });
@@ -3030,9 +3114,21 @@ function SheetRoot(options = {}) {
3030
3114
  const overlay = (() => {
3031
3115
  const __el1 = __element3("div");
3032
3116
  __el1.setAttribute("data-sheet-overlay", "");
3033
- __attr3(__el1, "aria-hidden", () => defaultOpen ? "false" : "true");
3034
- __attr3(__el1, "data-state", () => defaultOpen ? "open" : "closed");
3035
- __attr3(__el1, "style", () => defaultOpen ? "" : "display: none");
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
+ }
3036
3132
  __on2(__el1, "click", () => hide());
3037
3133
  return __el1;
3038
3134
  })();
@@ -3040,11 +3136,31 @@ function SheetRoot(options = {}) {
3040
3136
  const __el2 = __element3("div");
3041
3137
  __el2.setAttribute("role", "dialog");
3042
3138
  __el2.setAttribute("aria-modal", "true");
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");
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
+ }
3048
3164
  __on2(__el2, "keydown", (event) => {
3049
3165
  if (isKey(event, Keys.Escape)) {
3050
3166
  event.preventDefault();
@@ -3174,7 +3290,7 @@ import { signal as signal25 } from "@vertz/ui";
3174
3290
  import { __attr as __attr4, __element as __element4, __on as __on3 } from "@vertz/ui/internals";
3175
3291
  function SwitchRoot(options = {}) {
3176
3292
  const { defaultChecked = false, disabled = false, onCheckedChange } = options;
3177
- const checked = signal25(defaultChecked);
3293
+ const checked = signal25(defaultChecked, "checked");
3178
3294
  function toggle() {
3179
3295
  if (disabled)
3180
3296
  return;
@@ -3186,11 +3302,23 @@ function SwitchRoot(options = {}) {
3186
3302
  __el0.setAttribute("data-v-id", "SwitchRoot");
3187
3303
  __el0.setAttribute("type", "button");
3188
3304
  __el0.setAttribute("role", "switch");
3189
- __attr4(__el0, "id", () => uniqueId("switch"));
3305
+ {
3306
+ const __v = uniqueId("switch");
3307
+ if (__v != null && __v !== false)
3308
+ __el0.setAttribute("id", __v === true ? "" : __v);
3309
+ }
3190
3310
  __attr4(__el0, "aria-checked", () => checked.value ? "true" : "false");
3191
3311
  __attr4(__el0, "data-state", () => checked.value ? "checked" : "unchecked");
3192
- __attr4(__el0, "disabled", () => disabled);
3193
- __attr4(__el0, "aria-disabled", () => disabled ? "true" : undefined);
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
+ }
3194
3322
  __on3(__el0, "click", toggle);
3195
3323
  __on3(__el0, "keydown", (e) => {
3196
3324
  if (isKey(e, Keys.Space)) {
@@ -3333,7 +3461,7 @@ import { signal as signal28 } from "@vertz/ui";
3333
3461
  import { __attr as __attr5, __element as __element5, __on as __on4 } from "@vertz/ui/internals";
3334
3462
  function ToggleRoot(options = {}) {
3335
3463
  const { defaultPressed = false, disabled = false, onPressedChange } = options;
3336
- const pressed = signal28(defaultPressed);
3464
+ const pressed = signal28(defaultPressed, "pressed");
3337
3465
  function toggle() {
3338
3466
  if (disabled)
3339
3467
  return;
@@ -3344,11 +3472,23 @@ function ToggleRoot(options = {}) {
3344
3472
  const __el0 = __element5("button");
3345
3473
  __el0.setAttribute("data-v-id", "ToggleRoot");
3346
3474
  __el0.setAttribute("type", "button");
3347
- __attr5(__el0, "id", () => uniqueId("toggle"));
3475
+ {
3476
+ const __v = uniqueId("toggle");
3477
+ if (__v != null && __v !== false)
3478
+ __el0.setAttribute("id", __v === true ? "" : __v);
3479
+ }
3348
3480
  __attr5(__el0, "aria-pressed", () => pressed.value ? "true" : "false");
3349
3481
  __attr5(__el0, "data-state", () => pressed.value ? "on" : "off");
3350
- __attr5(__el0, "disabled", () => disabled);
3351
- __attr5(__el0, "aria-disabled", () => disabled ? "true" : undefined);
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
+ }
3352
3492
  __on4(__el0, "click", toggle);
3353
3493
  __on4(__el0, "keydown", (e) => {
3354
3494
  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.11",
3
+ "version": "0.2.13",
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": "^0.2.11"
39
+ "@vertz/ui": "^0.2.12"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@happy-dom/global-registrator": "^20.7.0",
43
- "@vertz/ui-compiler": "^0.2.11",
43
+ "@vertz/ui-compiler": "^0.2.12",
44
44
  "bunup": "^0.16.31",
45
45
  "happy-dom": "^20.7.0",
46
46
  "typescript": "^5.7.0"