@cahyo-dimas/freeday 1.11.2 → 1.12.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  Semua perubahan penting dicatat di sini. Format longgar mengikuti
4
4
  [Keep a Changelog](https://keepachangelog.com/); tiap versi = git tag.
5
5
 
6
+ ## [1.12.0] — 2026-07-29
7
+ ### Added
8
+ - **Chart colour overrides can now name a categorical palette slot (#36).** `data-fdy-colors` (and the
9
+ `<FdyChart colors>` prop) previously resolved every name through the semantic tier
10
+ (`var(--color-<name>)`), so an override could only reach `primary`/`info`/`accent`/… — never the
11
+ validated categorical palette `--chart-1..8`. An app that needs stable *per-category* colours (rather
12
+ than per-array-index) had to override, and overriding then dropped each series onto the nearest
13
+ semantic hue — e.g. a three-way split landing on three neighbouring blues: contrast-passing but
14
+ unreadable as a comparison. `colorVar` now maps a name of the form `chart-1`..`chart-8` to
15
+ `var(--chart-N)`, so an override can pin a series to the validated palette
16
+ (`colors={['chart-1','chart-2','chart-3']}`). Backward compatible — no semantic token name starts
17
+ with `chart-`, so semantic overrides are unchanged; the single-series `data-fdy-color` / `color`
18
+ accepts the `chart-N` form too. Verified in-browser: explicit `chart-1..3` now render the exact
19
+ fixed-order palette (blue/orange/green) and equal the default, while `success,warning,danger` still
20
+ resolve to their semantic tokens. (`--chart-1..8` are public tokens in `dist/freeday.tokens.css`, so
21
+ matching swatches/bars elsewhere can reference `var(--chart-N)` directly — no adapter export needed.)
22
+
6
23
  ## [1.11.2] — 2026-07-28
7
24
  ### Fixed
8
25
  - **A filter bar docked in a table toolbar no longer loses its alignment (#35).** `.fdy-filterbar`
package/README.id.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > **Lebih banyak _free day_ buat dev — UI kit-nya sudah siap pakai.**
6
6
 
7
7
  [![Live docs](https://img.shields.io/badge/docs-live-2050d8?style=flat-square)](https://cahyo-dimas.github.io/freeday-ui-kit/)
8
- [![Release](https://img.shields.io/badge/release-v1.11.2-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v1.11.2)
8
+ [![Release](https://img.shields.io/badge/release-v1.12.0-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v1.12.0)
9
9
 
10
10
  UI KIT yang token-driven & framework-agnostic — satu sumber kebenaran untuk warna, tipografi,
11
11
  spasi, dan komponen. Blueprint: `docs/superpowers/specs/2026-07-21-freeday-ui-kit-design.md`.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > **More free days for devs — the UI kit is ready to use.**
6
6
 
7
7
  [![Live docs](https://img.shields.io/badge/docs-live-2050d8?style=flat-square)](https://cahyo-dimas.github.io/freeday-ui-kit/)
8
- [![Release](https://img.shields.io/badge/release-v1.11.2-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v1.11.2)
8
+ [![Release](https://img.shields.io/badge/release-v1.12.0-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v1.12.0)
9
9
 
10
10
  A token-driven, framework-agnostic UI kit — one source of truth for color, typography,
11
11
  spacing, and components. Blueprint: `docs/superpowers/specs/2026-07-21-freeday-ui-kit-design.md`.
@@ -14,6 +14,11 @@ export interface FdyChartProps {
14
14
  format?: 'number' | 'percent' | 'currency';
15
15
  stacked?: boolean;
16
16
  legend?: 'auto' | 'always' | 'none';
17
+ /**
18
+ * Per-series colour override. Each entry is a semantic token name (primary/accent/success/
19
+ * warning/danger/info) OR a categorical slot 'chart-1'..'chart-8' to pin a series to the
20
+ * validated palette. Omit to use the default fixed-order chart palette.
21
+ */
17
22
  colors?: ReadonlyArray<string>;
18
23
  color?: string;
19
24
  center?: string | number;
@@ -26,6 +26,11 @@ const props = defineProps<{
26
26
  format?: 'number' | 'percent' | 'currency';
27
27
  stacked?: boolean;
28
28
  legend?: 'auto' | 'always' | 'none';
29
+ /**
30
+ * Per-series colour override. Each entry is a semantic token name (primary/accent/success/
31
+ * warning/danger/info) OR a categorical slot 'chart-1'..'chart-8' to pin a series to the
32
+ * validated palette. Omit to use the default fixed-order chart palette.
33
+ */
29
34
  colors?: ReadonlyArray<string>;
30
35
  color?: string;
31
36
  center?: string | number;
@@ -6,7 +6,9 @@
6
6
  * Single-series colour (sparkline / simple bar / single line) via data-fdy-color references a
7
7
  * semantic token by name (primary, accent, success, warning, danger, info). Multi-series
8
8
  * defaults draw from the validated categorical --chart-1..8 palette in fixed order (never
9
- * cycled, 8-series cap); pass data-fdy-colors to override with semantic names instead.
9
+ * cycled, 8-series cap); pass data-fdy-colors to override a name is a semantic token
10
+ * (var(--color-<name>)) OR a slot "chart-1".."chart-8" (var(--chart-N)) to pin a series to the
11
+ * validated palette. Both data-fdy-color and data-fdy-colors accept the chart-N form.
10
12
  * Cartesian charts (line/area, multi-series/stacked bar) draw themed axes from --chart-grid /
11
13
  * --chart-tick and format ticks + tooltips via data-fdy-format (number|percent|currency).
12
14
  * Charts are an enhancement — put a table/text fallback inside the element and it will be
@@ -28,7 +30,14 @@
28
30
  // Categorical chart palette: 8 validated fixed-order slots (--chart-1..8). Series index i
29
31
  // (0-based) -> slot i+1; series beyond the 8-slot cap reuse --chart-8 (never cycled).
30
32
  function chartSlotVar(i) { return 'var(--chart-' + (i < 8 ? i + 1 : 8) + ')'; }
31
- function colorVar(name) { return 'var(--color-' + (name || 'primary') + ')'; }
33
+ // Resolve a colour name to a CSS var(). A semantic name (primary/accent/success/warning/
34
+ // danger/info) reaches --color-<name>; a slot name "chart-1".."chart-8" reaches the validated
35
+ // categorical token --chart-N instead, so a data-fdy-colors override can pin a series to the
36
+ // palette (stable per category) rather than being forced onto the nearest semantic hue.
37
+ function colorVar(name) {
38
+ name = name || 'primary';
39
+ return name.indexOf('chart-') === 0 ? 'var(--' + name + ')' : 'var(--color-' + name + ')';
40
+ }
32
41
 
33
42
  function nums(el, attr) {
34
43
  var v = el.getAttribute(attr);
package/dist/freeday.js CHANGED
@@ -779,7 +779,9 @@
779
779
  * Single-series colour (sparkline / simple bar / single line) via data-fdy-color references a
780
780
  * semantic token by name (primary, accent, success, warning, danger, info). Multi-series
781
781
  * defaults draw from the validated categorical --chart-1..8 palette in fixed order (never
782
- * cycled, 8-series cap); pass data-fdy-colors to override with semantic names instead.
782
+ * cycled, 8-series cap); pass data-fdy-colors to override a name is a semantic token
783
+ * (var(--color-<name>)) OR a slot "chart-1".."chart-8" (var(--chart-N)) to pin a series to the
784
+ * validated palette. Both data-fdy-color and data-fdy-colors accept the chart-N form.
783
785
  * Cartesian charts (line/area, multi-series/stacked bar) draw themed axes from --chart-grid /
784
786
  * --chart-tick and format ticks + tooltips via data-fdy-format (number|percent|currency).
785
787
  * Charts are an enhancement — put a table/text fallback inside the element and it will be
@@ -801,7 +803,14 @@
801
803
  // Categorical chart palette: 8 validated fixed-order slots (--chart-1..8). Series index i
802
804
  // (0-based) -> slot i+1; series beyond the 8-slot cap reuse --chart-8 (never cycled).
803
805
  function chartSlotVar(i) { return 'var(--chart-' + (i < 8 ? i + 1 : 8) + ')'; }
804
- function colorVar(name) { return 'var(--color-' + (name || 'primary') + ')'; }
806
+ // Resolve a colour name to a CSS var(). A semantic name (primary/accent/success/warning/
807
+ // danger/info) reaches --color-<name>; a slot name "chart-1".."chart-8" reaches the validated
808
+ // categorical token --chart-N instead, so a data-fdy-colors override can pin a series to the
809
+ // palette (stable per category) rather than being forced onto the nearest semantic hue.
810
+ function colorVar(name) {
811
+ name = name || 'primary';
812
+ return name.indexOf('chart-') === 0 ? 'var(--' + name + ')' : 'var(--color-' + name + ')';
813
+ }
805
814
 
806
815
  function nums(el, attr) {
807
816
  var v = el.getAttribute(attr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cahyo-dimas/freeday",
3
- "version": "1.11.2",
3
+ "version": "1.12.0",
4
4
  "description": "Freeday — token-driven, framework-agnostic UI KIT (design source-of-truth).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -6,7 +6,9 @@
6
6
  * Single-series colour (sparkline / simple bar / single line) via data-fdy-color references a
7
7
  * semantic token by name (primary, accent, success, warning, danger, info). Multi-series
8
8
  * defaults draw from the validated categorical --chart-1..8 palette in fixed order (never
9
- * cycled, 8-series cap); pass data-fdy-colors to override with semantic names instead.
9
+ * cycled, 8-series cap); pass data-fdy-colors to override a name is a semantic token
10
+ * (var(--color-<name>)) OR a slot "chart-1".."chart-8" (var(--chart-N)) to pin a series to the
11
+ * validated palette. Both data-fdy-color and data-fdy-colors accept the chart-N form.
10
12
  * Cartesian charts (line/area, multi-series/stacked bar) draw themed axes from --chart-grid /
11
13
  * --chart-tick and format ticks + tooltips via data-fdy-format (number|percent|currency).
12
14
  * Charts are an enhancement — put a table/text fallback inside the element and it will be
@@ -28,7 +30,14 @@
28
30
  // Categorical chart palette: 8 validated fixed-order slots (--chart-1..8). Series index i
29
31
  // (0-based) -> slot i+1; series beyond the 8-slot cap reuse --chart-8 (never cycled).
30
32
  function chartSlotVar(i) { return 'var(--chart-' + (i < 8 ? i + 1 : 8) + ')'; }
31
- function colorVar(name) { return 'var(--color-' + (name || 'primary') + ')'; }
33
+ // Resolve a colour name to a CSS var(). A semantic name (primary/accent/success/warning/
34
+ // danger/info) reaches --color-<name>; a slot name "chart-1".."chart-8" reaches the validated
35
+ // categorical token --chart-N instead, so a data-fdy-colors override can pin a series to the
36
+ // palette (stable per category) rather than being forced onto the nearest semantic hue.
37
+ function colorVar(name) {
38
+ name = name || 'primary';
39
+ return name.indexOf('chart-') === 0 ? 'var(--' + name + ')' : 'var(--color-' + name + ')';
40
+ }
32
41
 
33
42
  function nums(el, attr) {
34
43
  var v = el.getAttribute(attr);