sinwan-ui-core 1.0.0 → 1.1.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to this package are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this package uses [Semantic Versioning](https://semver.org/).
4
4
 
5
+ ## [1.1.1]
6
+
7
+ ### Fixed
8
+
9
+ - `ToggleGroupRoot` (`controls`) forwards `aria-*` attributes to its `role="group"` element. Before, an `aria-label` such as "Billing period" was dropped, so screen readers announced an unnamed group. Values stay live when driven by a signal or getter.
10
+
11
+ ## [1.1.0]
12
+
13
+ ### Added
14
+
15
+ - `cazview` palette: `Palette` now accepts `"cazview"` and `ThemeProvider`'s default `palettes` list is `["credit-blue", "jomlaty", "cazview"]`. Pair it with the registry stylesheet, which defines the `html[data-palette="cazview"]` tokens (midnight `#111E2E` text, `#1A73E8` → `#3B52D9` → `#7B2CBF` brand gradient, `#FAFAFA` surface).
16
+
5
17
  ## [1.0.0]
6
18
 
7
19
  Initial release: the headless primitives extracted from `sinwan-ui` 0.1.0, published separately so registry components copied into apps can depend on them.
@@ -5,7 +5,12 @@ import {
5
5
  // src/controls.tsx
6
6
  import { _$createTemplate } from "sinwan/renderer/web";
7
7
  import { unwrap as _$unwrap } from "sinwan/reactivity";
8
- import { cc, inject, provide } from "sinwan/component";
8
+ import {
9
+ cc,
10
+ getRawProps,
11
+ inject,
12
+ provide
13
+ } from "sinwan/component";
9
14
  import { For as For2, Show as Show2 } from "sinwan/control-flow";
10
15
  import { computed, signal } from "sinwan/reactivity";
11
16
  import { jsx } from "sinwan/jsx-runtime";
@@ -121,18 +126,6 @@ var _$tmpl_10 = {
121
126
  ]
122
127
  };
123
128
  var _$tmpl_11 = {
124
- html: '<div data-slot="toggle-group" role="group" style="" data-variant="" data-size="" data-spacing="" data-orientation=""></div>',
125
- slots: [
126
- { path: [], type: "attr", name: "class" },
127
- { path: [], type: "attr", name: "style" },
128
- { path: [], type: "attr", name: "data-variant" },
129
- { path: [], type: "attr", name: "data-size" },
130
- { path: [], type: "attr", name: "data-spacing" },
131
- { path: [], type: "attr", name: "data-orientation" },
132
- { path: [], type: "child" }
133
- ]
134
- };
135
- var _$tmpl_12 = {
136
129
  html: '<button type="button" data-slot="toggle-group-item" data-variant="" data-size="" data-spacing="" data-state="" disabled=""></button>',
137
130
  slots: [
138
131
  { path: [], type: "attr", name: "data-variant" },
@@ -399,6 +392,7 @@ var ToggleRoot2 = cc((props) => {
399
392
  var ToggleGroupKey2 = Symbol("sinwan-ui.toggle-group");
400
393
  var ToggleGroupRoot2 = cc((props) => {
401
394
  const type = () => props.type ?? "single";
395
+ const ariaProps = Object.fromEntries(Object.entries(getRawProps(props)).filter(([key]) => key.startsWith("aria-")));
402
396
  const valueLocal = signal(toValueList(props.defaultValue));
403
397
  const value = "value" in props ? computed(() => toValueList(props.value)) : valueLocal;
404
398
  const set = (next) => {
@@ -419,19 +413,22 @@ var ToggleGroupRoot2 = cc((props) => {
419
413
  props.onValueChange?.(type() === "single" ? next[0] ?? "" : next);
420
414
  }
421
415
  });
422
- return _$createTemplate(_$tmpl_11, [
423
- () => _$unwrap(props).class,
424
- () => _$unwrap(props).style,
425
- () => props["data-variant"],
426
- () => props["data-size"],
427
- () => props["data-spacing"],
428
- () => props["data-orientation"],
429
- () => _$unwrap(props).children
430
- ]);
416
+ return /* @__PURE__ */ jsx("div", {
417
+ "data-slot": "toggle-group",
418
+ role: "group",
419
+ class: () => _$unwrap(props).class,
420
+ style: () => _$unwrap(props).style,
421
+ "data-variant": () => props["data-variant"],
422
+ "data-size": () => props["data-size"],
423
+ "data-spacing": () => props["data-spacing"],
424
+ "data-orientation": () => props["data-orientation"],
425
+ ...ariaProps,
426
+ children: () => _$unwrap(props).children
427
+ });
431
428
  });
432
429
  var ToggleGroupItem2 = cc((props) => {
433
430
  const api = inject(ToggleGroupKey2);
434
- return _$createTemplate(_$tmpl_12, [
431
+ return _$createTemplate(_$tmpl_11, [
435
432
  () => props["data-variant"],
436
433
  () => props["data-size"],
437
434
  () => props["data-spacing"],
@@ -18,7 +18,7 @@ var _$tmpl_0 = {
18
18
  { path: [], type: "child" }
19
19
  ]
20
20
  };
21
- var DEFAULT_PALETTES = ["credit-blue", "jomlaty"];
21
+ var DEFAULT_PALETTES = ["credit-blue", "jomlaty", "cazview"];
22
22
  var ThemeKey2 = Symbol("sinwan-ui.theme");
23
23
  function isTheme(value) {
24
24
  return value === "light" || value === "dark" || value === "system";
@@ -80,9 +80,9 @@ function writeDomPalette(next) {
80
80
  document.documentElement.setAttribute("data-palette", next);
81
81
  }
82
82
  var ThemeProvider2 = cc((props) => {
83
- const allowedPalettes = (props.palettes === undefined ? DEFAULT_PALETTES : props.palettes).length > 0 ? props.palettes === undefined ? DEFAULT_PALETTES : props.palettes : DEFAULT_PALETTES;
83
+ const allowedPalettes = () => (props.palettes === undefined ? DEFAULT_PALETTES : props.palettes).length > 0 ? props.palettes === undefined ? DEFAULT_PALETTES : props.palettes : DEFAULT_PALETTES;
84
84
  const initialTheme = props.forcedTheme ?? readStoredTheme(props.storageKey === undefined ? "sinwan-ui-theme" : props.storageKey, props.defaultTheme === undefined ? "system" : props.defaultTheme);
85
- const initialPalette = props.forcedPalette ?? readStoredPalette(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, props.defaultPalette === undefined ? "credit-blue" : props.defaultPalette, allowedPalettes);
85
+ const initialPalette = props.forcedPalette ?? readStoredPalette(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, props.defaultPalette === undefined ? "credit-blue" : props.defaultPalette, allowedPalettes());
86
86
  const theme = signal(initialTheme);
87
87
  const palette = signal(initialPalette);
88
88
  const resolved = signal(initialTheme === "system" ? getSystemTheme() : initialTheme);
@@ -131,7 +131,7 @@ var ThemeProvider2 = cc((props) => {
131
131
  const setPalette = (value) => {
132
132
  if (props.forcedPalette)
133
133
  return;
134
- if (!allowedPalettes.includes(value))
134
+ if (!allowedPalettes().includes(value))
135
135
  return;
136
136
  try {
137
137
  localStorage.setItem(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, value);
@@ -159,7 +159,7 @@ var ThemeProvider2 = cc((props) => {
159
159
  themes: (props.enableSystem === undefined ? true : props.enableSystem) ? ["light", "dark", "system"] : ["light", "dark"],
160
160
  palette,
161
161
  setPalette,
162
- palettes: allowedPalettes
162
+ palettes: allowedPalettes()
163
163
  });
164
164
  computed(() => resolved.value);
165
165
  computed(() => palette.value);
@@ -117,6 +117,7 @@ export declare const ToggleGroupKey: InjectionKey<{
117
117
  toggle: (v: string) => void;
118
118
  }>;
119
119
  export declare const ToggleGroupRoot: import("sinwan/component").SinwanComponent<{
120
+ [key: `aria-${string}`]: string | boolean | undefined;
120
121
  children?: SinwanNode;
121
122
  type?: "single" | "multiple";
122
123
  value?: string | string[];
package/dist/controls.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  ToggleGroupKey2,
22
22
  ToggleGroupRoot2,
23
23
  ToggleGroupItem2
24
- } from "./chunks/chunk-te52bwb8.js";
24
+ } from "./chunks/chunk-2sw6berz.js";
25
25
  import {
26
26
  Slot2
27
27
  } from "./chunks/chunk-bw9vp0y9.js";
package/dist/index.js CHANGED
@@ -48,7 +48,7 @@ import {
48
48
  ToggleGroupKey2,
49
49
  ToggleGroupRoot2,
50
50
  ToggleGroupItem2
51
- } from "./chunks/chunk-te52bwb8.js";
51
+ } from "./chunks/chunk-2sw6berz.js";
52
52
  import {
53
53
  DirectionKey2,
54
54
  DirectionProvider2,
@@ -89,7 +89,7 @@ import {
89
89
  ThemeProvider2,
90
90
  useTheme2,
91
91
  ThemeToggle2
92
- } from "./chunks/chunk-xaegn57w.js";
92
+ } from "./chunks/chunk-33f19xws.js";
93
93
  export {
94
94
  AccordionContent2 as AccordionContent,
95
95
  AccordionItem2 as AccordionItem,
package/dist/theme.d.ts CHANGED
@@ -2,7 +2,7 @@ import { type InjectionKey, type SinwanNode } from "sinwan/component";
2
2
  import { type Signal } from "sinwan/reactivity";
3
3
  export type Theme = "light" | "dark" | "system";
4
4
  export type ResolvedTheme = "light" | "dark";
5
- export type Palette = "credit-blue" | "jomlaty";
5
+ export type Palette = "credit-blue" | "jomlaty" | "cazview";
6
6
  export type ThemeApi = {
7
7
  theme: Signal<Theme>;
8
8
  resolved: Signal<ResolvedTheme>;
package/dist/theme.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  ThemeProvider2,
4
4
  useTheme2,
5
5
  ThemeToggle2
6
- } from "./chunks/chunk-xaegn57w.js";
6
+ } from "./chunks/chunk-33f19xws.js";
7
7
  export {
8
8
  ThemeKey2 as ThemeKey,
9
9
  ThemeProvider2 as ThemeProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinwan-ui-core",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Headless behaviour primitives for Sinwan UI components: overlays, floating positioning, dismiss layers, controls, slots, theme and direction.",
5
5
  "author": "Mohammed Ben Cheikh",
6
6
  "license": "MIT",
@@ -107,7 +107,7 @@
107
107
  },
108
108
  "devDependencies": {
109
109
  "@types/bun": "latest",
110
- "bun-plugin-sinwan": "1.0.0",
110
+ "bun-plugin-sinwan": "^1.0.1",
111
111
  "happy-dom": "^20.14.5",
112
112
  "sinwan": "^2.0.3",
113
113
  "typescript": "^5.9.3"
@@ -115,4 +115,4 @@
115
115
  "peerDependencies": {
116
116
  "sinwan": ">=2.0.3 <3.0.0"
117
117
  }
118
- }
118
+ }