@webjsdev/ui 0.3.2 → 0.3.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webjsdev/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "An AI-first component library - class-helper functions for visuals, custom elements only where state matters. Source-copied into your repo, you own it. Works with any Tailwind v4 project.",
|
|
6
6
|
"bin": {
|
|
@@ -343,22 +343,24 @@ UiDropdownMenuContent.register('ui-dropdown-menu-content');
|
|
|
343
343
|
export class UiDropdownMenuItem extends WebComponent {
|
|
344
344
|
static properties = {
|
|
345
345
|
variant: { type: String, reflect: true },
|
|
346
|
+
inset: { type: Boolean },
|
|
346
347
|
};
|
|
347
348
|
declare variant: 'default' | 'destructive';
|
|
349
|
+
declare inset: boolean;
|
|
348
350
|
|
|
349
351
|
constructor() {
|
|
350
352
|
super();
|
|
351
353
|
this.variant = 'default';
|
|
354
|
+
this.inset = false;
|
|
352
355
|
}
|
|
353
356
|
|
|
354
357
|
render() {
|
|
355
|
-
const inset = this.hasAttribute('inset');
|
|
356
358
|
return html`<div
|
|
357
359
|
data-slot="dropdown-menu-item"
|
|
358
360
|
role="menuitem"
|
|
359
361
|
tabindex="-1"
|
|
360
362
|
data-variant=${this.variant}
|
|
361
|
-
?data-inset=${inset}
|
|
363
|
+
?data-inset=${this.inset}
|
|
362
364
|
class=${dropdownMenuItemClass()}
|
|
363
365
|
@click=${this._onClick}
|
|
364
366
|
@pointerenter=${this._onPointerEnter}
|
|
@@ -394,11 +396,18 @@ UiDropdownMenuItem.register('ui-dropdown-menu-item');
|
|
|
394
396
|
// --------------------------------------------------------------------------
|
|
395
397
|
|
|
396
398
|
export class UiDropdownMenuLabel extends WebComponent {
|
|
399
|
+
static properties = { inset: { type: Boolean } };
|
|
400
|
+
declare inset: boolean;
|
|
401
|
+
|
|
402
|
+
constructor() {
|
|
403
|
+
super();
|
|
404
|
+
this.inset = false;
|
|
405
|
+
}
|
|
406
|
+
|
|
397
407
|
render() {
|
|
398
|
-
const inset = this.hasAttribute('inset');
|
|
399
408
|
return html`<div
|
|
400
409
|
data-slot="dropdown-menu-label"
|
|
401
|
-
?data-inset=${inset}
|
|
410
|
+
?data-inset=${this.inset}
|
|
402
411
|
class=${dropdownMenuLabelClass()}
|
|
403
412
|
><slot></slot></div>`;
|
|
404
413
|
}
|
|
@@ -540,6 +549,14 @@ export class UiDropdownMenuSub extends WebComponent {
|
|
|
540
549
|
UiDropdownMenuSub.register('ui-dropdown-menu-sub');
|
|
541
550
|
|
|
542
551
|
export class UiDropdownMenuSubTrigger extends WebComponent {
|
|
552
|
+
static properties = { inset: { type: Boolean } };
|
|
553
|
+
declare inset: boolean;
|
|
554
|
+
|
|
555
|
+
constructor() {
|
|
556
|
+
super();
|
|
557
|
+
this.inset = false;
|
|
558
|
+
}
|
|
559
|
+
|
|
543
560
|
// SSR-safe: linkedom doesn't implement closest() on custom elements.
|
|
544
561
|
_sub(): UiDropdownMenuSub | null {
|
|
545
562
|
if (typeof this.closest !== 'function') return null;
|
|
@@ -547,7 +564,6 @@ export class UiDropdownMenuSubTrigger extends WebComponent {
|
|
|
547
564
|
}
|
|
548
565
|
|
|
549
566
|
render() {
|
|
550
|
-
const inset = this.hasAttribute('inset');
|
|
551
567
|
const open = !!this._sub()?.open;
|
|
552
568
|
return html`<div
|
|
553
569
|
data-slot="dropdown-menu-sub-trigger"
|
|
@@ -556,7 +572,7 @@ export class UiDropdownMenuSubTrigger extends WebComponent {
|
|
|
556
572
|
aria-haspopup="menu"
|
|
557
573
|
aria-expanded=${String(open)}
|
|
558
574
|
data-state=${open ? 'open' : 'closed'}
|
|
559
|
-
?data-inset=${inset}
|
|
575
|
+
?data-inset=${this.inset}
|
|
560
576
|
class=${dropdownMenuSubTriggerClass()}
|
|
561
577
|
@click=${this._onClick}
|
|
562
578
|
@pointerenter=${this._onPointerEnter}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* Events:
|
|
34
34
|
* `ui-pressed-change` on <ui-toggle>: `{ detail: { pressed } }` after a click.
|
|
35
35
|
*
|
|
36
|
-
* Keyboard: native button
|
|
36
|
+
* Keyboard: native button. Enter / Space activates (via the inner <button>).
|
|
37
37
|
*
|
|
38
38
|
* Design tokens used: --muted, --muted-foreground, --accent, --accent-foreground,
|
|
39
39
|
* --input, --background, --ring, --destructive.
|