use-wc 1.0.0-pre.47 → 1.0.0-pre.48

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.
@@ -1492,12 +1492,32 @@
1492
1492
  },
1493
1493
  "attribute": "label"
1494
1494
  },
1495
+ {
1496
+ "kind": "field",
1497
+ "name": "inlinealign",
1498
+ "type": {
1499
+ "text": "\"start\" | \"end\""
1500
+ },
1501
+ "default": "\"start\"",
1502
+ "description": "Aligns the menu along the inline axis relative to the trigger. Applies to top-level\nmenus; nested submenus are always positioned to the side of their parent trigger.\n\n- `start`: the menu's inline-start edge aligns with the trigger's inline-start edge\n- `end`: the menu's inline-end edge aligns with the trigger's inline-end edge",
1503
+ "attribute": "inlinealign",
1504
+ "reflects": true
1505
+ },
1495
1506
  {
1496
1507
  "kind": "method",
1497
1508
  "name": "getId"
1498
1509
  }
1499
1510
  ],
1500
1511
  "attributes": [
1512
+ {
1513
+ "description": "Aligns the menu along the inline axis relative to the trigger. Applies to top-level\nmenus; nested submenus are always positioned to the side of their parent trigger.\n\n- `start`: the menu's inline-start edge aligns with the trigger's inline-start edge\n- `end`: the menu's inline-end edge aligns with the trigger's inline-end edge",
1514
+ "name": "inlinealign",
1515
+ "type": {
1516
+ "text": "\"start\" | \"end\""
1517
+ },
1518
+ "default": "\"start\"",
1519
+ "fieldName": "inlinealign"
1520
+ },
1501
1521
  {
1502
1522
  "name": "disabled",
1503
1523
  "fieldName": "disabled"
@@ -714,10 +714,13 @@
714
714
  height: unset;
715
715
  position-anchor: --use-popover-trigger;
716
716
  position: fixed;
717
- position-area: bottom span-right;
717
+ position-area: block-end span-inline-end;
718
718
  min-block-size: var(--min-size);
719
719
  max-block-size: min(100% - var(--usewc-layout-popover-menu-anchor-offset), var(--max-size));
720
- position-try: flip-block;
720
+ position-try:
721
+ flip-block,
722
+ flip-inline,
723
+ flip-inline flip-block;
721
724
  margin-block: var(--usewc-layout-popover-menu-anchor-offset);
722
725
  overflow: auto;
723
726
  border: var(--usewc-layout-popover-menu-border) var(--usewc-effect-popover-menu-border-style)
@@ -732,6 +735,10 @@
732
735
  }
733
736
  }
734
737
 
738
+ use-dropdown[inlinealign="end"]::part(menu) {
739
+ position-area: block-end span-inline-start;
740
+ }
741
+
735
742
  use-option,
736
743
  use-dropdown :is([role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]),
737
744
  use-dropdown use-dropdown::part(trigger) {
@@ -814,6 +821,12 @@
814
821
  }
815
822
 
816
823
  use-dropdown use-dropdown::part(menu) {
824
+ /*
825
+ * !important: this must win over use-dropdown[inlinealign="end"]::part(menu) above, which
826
+ * has higher specificity (an attribute selector) than this descendant selector does. Nested
827
+ * submenus always position to the side of their parent trigger, independent of inlinealign.
828
+ */
829
+ position-area: block-end span-inline-end !important;
817
830
  inset-inline-start: calc(anchor(end) + var(--usewc-layout-popover-menu-anchor-offset) * 2);
818
831
  inset-block-start: calc(
819
832
  anchor(start) - var(--usewc-layout-popover-menu-anchor-offset) -
@@ -30,6 +30,11 @@ forwarded to the trigger button so the control still has an accessible name.
30
30
 
31
31
  | Name | Type | Default | Description |
32
32
  | --- | --- | --- | --- |
33
+ | inlinealign | `"start" \| "end"` | `"start"` | Aligns the menu along the inline axis relative to the trigger. Applies to top-level
34
+ menus; nested submenus are always positioned to the side of their parent trigger.
35
+
36
+ - `start`: the menu's inline-start edge aligns with the trigger's inline-start edge
37
+ - `end`: the menu's inline-end edge aligns with the trigger's inline-end edge |
33
38
  | disabled | - | - | - |
34
39
  | label | `string` | - | - |
35
40
 
package/dist/use-wc.d.mts CHANGED
@@ -170,6 +170,9 @@ declare global {
170
170
  * @slot trigger-arrow
171
171
  *
172
172
  * @state open `use-dropdown:state(open)`: The open state of the dropdown.
173
+ * @attr inlinealign `"start" | "end"`: Aligns the menu along the inline axis relative to the
174
+ * trigger. Applies to top-level menus only; nested submenus are always positioned to the side
175
+ * of their parent trigger.
173
176
  */
174
177
  declare class UseDropdown extends LitElement {
175
178
  #private;
@@ -185,6 +188,14 @@ declare class UseDropdown extends LitElement {
185
188
  set disabled(flag: boolean);
186
189
  get disabled(): boolean;
187
190
  label: string;
191
+ /**
192
+ * Aligns the menu along the inline axis relative to the trigger. Applies to top-level
193
+ * menus; nested submenus are always positioned to the side of their parent trigger.
194
+ *
195
+ * - `start`: the menu's inline-start edge aligns with the trigger's inline-start edge
196
+ * - `end`: the menu's inline-end edge aligns with the trigger's inline-end edge
197
+ */
198
+ inlinealign: "start" | "end";
188
199
  constructor();
189
200
  getId(): string;
190
201
  firstUpdated(): void;
package/dist/use-wc.mjs CHANGED
@@ -524,6 +524,7 @@ let UseDropdown = class UseDropdown extends LitElement {
524
524
  this.#itemLabels = [];
525
525
  this.#isNested = this.parentElement?.closest("use-dropdown") != null;
526
526
  this.trigger = null;
527
+ this.inlinealign = "start";
527
528
  this.#id = createId();
528
529
  this.#internals = this.attachInternals();
529
530
  this.#initializeTabbables();
@@ -729,6 +730,10 @@ let UseDropdown = class UseDropdown extends LitElement {
729
730
  };
730
731
  __decorate([property({ type: Boolean })], UseDropdown.prototype, "disabled", null);
731
732
  __decorate([property()], UseDropdown.prototype, "label", void 0);
733
+ __decorate([property({
734
+ type: String,
735
+ reflect: true
736
+ })], UseDropdown.prototype, "inlinealign", void 0);
732
737
  UseDropdown = __decorate([customElement("use-dropdown")], UseDropdown);
733
738
  //#endregion
734
739
  //#region src/elements/use-duration-input/use-duration-input.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "use-wc",
3
- "version": "1.0.0-pre.47",
3
+ "version": "1.0.0-pre.48",
4
4
  "private": false,
5
5
  "homepage": "https://usewc.com",
6
6
  "bugs": "https://github.com/dang-rabbits/use-wc/issues",
@@ -76,6 +76,11 @@
76
76
  "name": "use-dropdown",
77
77
  "description": "When the popover is opened the tabbable elements are found and indexed for\nkeyboard navigation. The first tabbable element is focused when the popover is opened. The\nfollowing selector is used to find tabbable elements:\n\n```css\n:is(\n [role=\"menuitem\"],\n [role=\"menuitemcheckbox\"],\n [role=\"menuitemradio\"],\n use-menu\n):not(:is(\n [disabled],\n [hidden],\n [inert],\n [aria-hidden=\"true\"]\n))\n```\n\nMenu items are not used for navigation, they are intended for related action\nitems that allows a user to manipulate a user interface or content. Read the\nWCAG guidance for more details:\n[https://www.w3.org/WAI/ARIA/apg/patterns/menubar/](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/)\n\nFor an icon-only trigger, omit `label` and set `aria-label` on `use-dropdown` itself — it is\nforwarded to the trigger button so the control still has an accessible name.\n---\n\n\n### **Slots:**\n - **default** - undefined\n- **trigger-content** - undefined\n- **trigger-label** - undefined\n- **trigger-arrow** - undefined",
78
78
  "attributes": [
79
+ {
80
+ "name": "inlinealign",
81
+ "description": "Aligns the menu along the inline axis relative to the trigger. Applies to top-level\nmenus; nested submenus are always positioned to the side of their parent trigger.\n\n- `start`: the menu's inline-start edge aligns with the trigger's inline-start edge\n- `end`: the menu's inline-end edge aligns with the trigger's inline-end edge",
82
+ "values": [{ "name": "start" }, { "name": "end" }]
83
+ },
79
84
  { "name": "disabled", "values": [] },
80
85
  { "name": "label", "values": [] }
81
86
  ],