@marianmeres/stuic 3.85.0 → 3.86.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.
@@ -131,6 +131,7 @@
131
131
  }: Props = $props();
132
132
 
133
133
  let isOpen = $state(false);
134
+ let triggerEl: HTMLButtonElement | undefined = $state();
134
135
  let hiddenInputEl: HTMLInputElement | undefined = $state();
135
136
  let validation: ValidationResult | undefined = $state();
136
137
  const setValidationResult = (res: ValidationResult) => (validation = res);
@@ -259,12 +260,13 @@
259
260
  <DropdownMenu
260
261
  {items}
261
262
  bind:isOpen
263
+ bind:triggerEl
262
264
  position="bottom-span-right"
263
265
  search={searchConfig}
264
266
  maxHeight="300px"
265
267
  closeOnSelect
266
268
  class="stuic-field-country"
267
- classDropdown={twMerge("w-72 max-w-[calc(100vw-1rem)]", classDropdown)}
269
+ classDropdown={twMerge("stuic-field-country-dropdown", classDropdown)}
268
270
  >
269
271
  {#snippet trigger({ toggle, triggerProps })}
270
272
  <!--
@@ -275,6 +277,7 @@
275
277
  on the trigger and `role="menu"` on the popover keep the menu accessible.
276
278
  -->
277
279
  <button
280
+ bind:this={triggerEl}
278
281
  type="button"
279
282
  class={twMerge(
280
283
  "stuic-field-country-trigger",
@@ -84,6 +84,7 @@ export const COUNTRIES = [
84
84
  { iso: "GP", name: "Guadeloupe", dialCode: "590", flag: "🇬🇵" },
85
85
  { iso: "GU", name: "Guam", dialCode: "1671", flag: "🇬🇺" },
86
86
  { iso: "GT", name: "Guatemala", dialCode: "502", flag: "🇬🇹" },
87
+ { iso: "GG", name: "Guernsey", dialCode: "44", flag: "🇬🇬" },
87
88
  { iso: "GN", name: "Guinea", dialCode: "224", flag: "🇬🇳" },
88
89
  { iso: "GW", name: "Guinea-Bissau", dialCode: "245", flag: "🇬🇼" },
89
90
  { iso: "GY", name: "Guyana", dialCode: "592", flag: "🇬🇾" },
@@ -97,11 +98,13 @@ export const COUNTRIES = [
97
98
  { iso: "IR", name: "Iran", dialCode: "98", flag: "🇮🇷" },
98
99
  { iso: "IQ", name: "Iraq", dialCode: "964", flag: "🇮🇶" },
99
100
  { iso: "IE", name: "Ireland", dialCode: "353", flag: "🇮🇪" },
101
+ { iso: "IM", name: "Isle of Man", dialCode: "44", flag: "🇮🇲" },
100
102
  { iso: "IL", name: "Israel", dialCode: "972", flag: "🇮🇱" },
101
103
  { iso: "IT", name: "Italy", dialCode: "39", flag: "🇮🇹" },
102
104
  { iso: "CI", name: "Ivory Coast", dialCode: "225", flag: "🇨🇮" },
103
105
  { iso: "JM", name: "Jamaica", dialCode: "1876", flag: "🇯🇲" },
104
106
  { iso: "JP", name: "Japan", dialCode: "81", flag: "🇯🇵" },
107
+ { iso: "JE", name: "Jersey", dialCode: "44", flag: "🇯🇪" },
105
108
  { iso: "JO", name: "Jordan", dialCode: "962", flag: "🇯🇴" },
106
109
  { iso: "KZ", name: "Kazakhstan", dialCode: "7", flag: "🇰🇿" },
107
110
  { iso: "KE", name: "Kenya", dialCode: "254", flag: "🇰🇪" },
@@ -642,6 +642,27 @@
642
642
  min-width: 0;
643
643
  }
644
644
 
645
+ /*
646
+ * Suppress the browser's default focus ring on the trigger — InputWrap
647
+ * already shows the ring via `.input-wrap:focus-within`.
648
+ */
649
+ .stuic-field-country-trigger:focus,
650
+ .stuic-field-country-trigger:focus-visible {
651
+ outline: none;
652
+ box-shadow: none;
653
+ }
654
+
655
+ /*
656
+ * Size the popover to the trigger via CSS Anchor Positioning's
657
+ * `anchor-size()`. In browsers without anchor positioning, DropdownMenu
658
+ * already switches to a centered-modal fallback, so this rule simply
659
+ * doesn't apply there. `min-width` keeps very narrow triggers usable.
660
+ */
661
+ .stuic-field-country-dropdown {
662
+ width: anchor-size(width);
663
+ min-width: 12rem;
664
+ }
665
+
645
666
  /*
646
667
  * Reset field-input padding leaking into the popover's search bar
647
668
  * (mirrors the phone-prefix-picker fix — the input itself is correctly
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.85.0",
3
+ "version": "3.86.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && pnpm run prepack",