@r2digisolutions/components 0.14.2 → 0.14.4

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.
@@ -51,6 +51,21 @@
51
51
  );
52
52
  }
53
53
 
54
+ function bindTrigger() {
55
+ const el = getTriggerEl();
56
+ if (!el || el === rootEl) return;
57
+ el.setAttribute('aria-haspopup', 'dialog');
58
+ el.setAttribute('aria-controls', panelId);
59
+ el.setAttribute('aria-expanded', open ? 'true' : 'false');
60
+ if (strategy !== 'fixed') {
61
+ el.removeAttribute('popovertarget');
62
+ el.removeAttribute('popovertargetaction');
63
+ return;
64
+ }
65
+ el.setAttribute('popovertarget', panelId);
66
+ el.setAttribute('popovertargetaction', 'toggle');
67
+ }
68
+
54
69
  function positionPanel() {
55
70
  if (!panelEl || strategy !== 'fixed') return;
56
71
  if (!panelEl.matches(':popover-open')) return;
@@ -151,6 +166,8 @@
151
166
  $effect(() => {
152
167
  open;
153
168
  strategy;
169
+ rootEl;
170
+ bindTrigger();
154
171
  queueMicrotask(() => {
155
172
  syncNative();
156
173
  if (open) {
@@ -160,6 +177,15 @@
160
177
  });
161
178
  });
162
179
 
180
+ $effect(() => {
181
+ if (strategy === 'fixed') return;
182
+ const el = getTriggerEl();
183
+ if (!el) return;
184
+ const onClick = () => setOpen(!open);
185
+ el.addEventListener('click', onClick);
186
+ return () => el.removeEventListener('click', onClick);
187
+ });
188
+
163
189
  $effect(() => {
164
190
  if (!open || strategy !== 'fixed') return;
165
191
  const onWin = () => positionPanel();
@@ -12,7 +12,7 @@
12
12
  <div class="flex min-h-40 items-center justify-center">
13
13
  <Popover bind:open placement={props.placement ?? 'bottom'}>
14
14
  {#snippet trigger()}
15
- <Button size="sm" variant="secondary" onclick={() => (open = !open)}>
15
+ <Button size="sm" variant="secondary" data-popover-trigger>
16
16
  Open popover
17
17
  </Button>
18
18
  {/snippet}
@@ -1079,7 +1079,6 @@
1079
1079
  aria-haspopup="dialog"
1080
1080
  onclick={() => {
1081
1081
  startOpen = false;
1082
- clockOpen = !clockOpen;
1083
1082
  }}
1084
1083
  >
1085
1084
  <span class="text-xs font-semibold tabular-nums text-primary">{clock}</span>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/components",
3
- "version": "0.14.2",
3
+ "version": "0.14.4",
4
4
  "private": false,
5
5
  "description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
6
6
  "license": "MIT",
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "devDependencies": {
68
68
  "@eslint/js": "^10.0.1",
69
- "@lucide/svelte": "^1.34.0",
69
+ "@lucide/svelte": "^1.35.0",
70
70
  "@playwright/test": "^1.62.1",
71
71
  "@storybook/addon-a11y": "^10.5.10",
72
72
  "@storybook/addon-docs": "^10.5.10",
@@ -79,9 +79,9 @@
79
79
  "@sveltejs/package": "^2.5.8",
80
80
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
81
81
  "@tailwindcss/vite": "^4.3.3",
82
- "@types/node": "^26.3.0",
82
+ "@types/node": "^26.4.0",
83
83
  "@vitest/browser-playwright": "^4.1.11",
84
- "bumpp": "~12.2.1",
84
+ "bumpp": "~12.2.2",
85
85
  "eslint": "^10.9.1",
86
86
  "eslint-config-prettier": "^10.1.8",
87
87
  "eslint-plugin-svelte": "^3.23.0",