@jirawatpyk/aura-tokens 4.20.0 → 5.0.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/aura-tailwind.css CHANGED
@@ -1,4 +1,4 @@
1
- /* AURA v4.20.0 — Tailwind v4 theme. GENERATED by scripts/build-tokens.js from tokens.json. Do not edit by hand.
1
+ /* AURA v5.0.1 — Tailwind v4 theme. GENERATED by scripts/build-tokens.js from tokens.json. Do not edit by hand.
2
2
  * @import "tailwindcss";
3
3
  * @import "@jirawatpyk/aura-tokens/tailwind.css";
4
4
  * Gives bg-bg-surface, text-fg-primary, border-border-strong, p-aura-6, rounded-aura-xl, shadow-aura-overlay,
@@ -1,4 +1,4 @@
1
- /* AURA v4.20.0 — Tailwind v4 theme with aura- prefixed names. GENERATED by scripts/build-tokens.js. Do not edit by hand.
1
+ /* AURA v5.0.1 — Tailwind v4 theme with aura- prefixed names. GENERATED by scripts/build-tokens.js. Do not edit by hand.
2
2
  * For apps that already have a Tailwind theme (shadcn): nothing here redefines an existing name.
3
3
  * @layer aura-tokens, theme, base, aura, components, utilities;
4
4
  * @import "tailwindcss";
package/aura.css CHANGED
@@ -1,4 +1,4 @@
1
- /* AURA v4.20.0 — GENERATED by scripts/build-tokens.js from tokens.json. Do not edit by hand. */
1
+ /* AURA v5.0.1 — GENERATED by scripts/build-tokens.js from tokens.json. Do not edit by hand. */
2
2
  /* Fonts: load aura-fonts.css (or the <link> tags in README) separately, so a blocked Google Fonts never breaks this file. */
3
3
 
4
4
  :root, [data-theme="light"] {
@@ -124,7 +124,7 @@ window.Aura = (() => {
124
124
  contrast: () => contrast,
125
125
  createTheme: () => createTheme,
126
126
  formatBytes: () => formatBytes,
127
- formatDate: () => formatDate2,
127
+ formatDate: () => formatDate,
128
128
  iconNames: () => iconNames,
129
129
  parseDate: () => parseDate,
130
130
  parseTime: () => parseTime,
@@ -1714,7 +1714,7 @@ window.Aura = (() => {
1714
1714
  const o = opts || {}, d = fromISO(iso);
1715
1715
  if (!d) return "";
1716
1716
  const f = typeof o.format === "object" ? o.format : PRESETS[o.format || "short"];
1717
- const loc = o.locale || "th";
1717
+ const loc = o.locale || "en";
1718
1718
  return fmt(localeTag(loc, o.calendar || defaultCalendar(loc)), f, d).replace(ERA, "");
1719
1719
  }
1720
1720
  var MONTHS = null;
@@ -1757,32 +1757,19 @@ window.Aura = (() => {
1757
1757
  function todayIn(timeZone) {
1758
1758
  const now = /* @__PURE__ */ new Date();
1759
1759
  if (!timeZone) return toISO(now);
1760
- return new Intl.DateTimeFormat("en-CA", {
1761
- timeZone,
1762
- year: "numeric",
1763
- month: "2-digit",
1764
- day: "2-digit"
1765
- }).format(now);
1766
- }
1767
-
1768
- // src/DatePicker.tsx
1769
- var warnedNoLocale = false;
1770
- function isDev() {
1771
1760
  try {
1772
- return true;
1761
+ return new Intl.DateTimeFormat("en-CA", {
1762
+ timeZone,
1763
+ year: "numeric",
1764
+ month: "2-digit",
1765
+ day: "2-digit"
1766
+ }).format(now);
1773
1767
  } catch (e) {
1774
- return false;
1775
- }
1776
- }
1777
- function formatDate2(iso, opts) {
1778
- if (!warnedNoLocale && !(opts && opts.locale) && isDev()) {
1779
- warnedNoLocale = true;
1780
- console.warn(
1781
- "[AURA] formatDate() was called without a locale. It shows Thai with Buddhist-era years today; in 5.0 it will show English with Gregorian years, like '@jirawatpyk/aura-react/server'. Pass { locale: 'th' } to keep Thai, or use useFormatDate() in components."
1782
- );
1768
+ return toISO(now);
1783
1769
  }
1784
- return formatDate(iso, opts);
1785
1770
  }
1771
+
1772
+ // src/DatePicker.tsx
1786
1773
  function useFormatDate() {
1787
1774
  const ctx = useAuraLocale(), locale = ctx.locale || "en", calendar = ctx.calendar;
1788
1775
  return React17.useCallback(
@@ -1802,7 +1789,7 @@ window.Aura = (() => {
1802
1789
  var Calendar = React17.forwardRef(function Calendar2(props, ref) {
1803
1790
  const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "en", calendar = props.calendar || ctx.calendar || defaultCalendar(locale), tag = localeTag(locale, calendar);
1804
1791
  const weekStart = props.weekStartsOn == null ? locale === "sv" ? 1 : 0 : props.weekStartsOn;
1805
- const todayISO = props.today || todayIn(props.timeZone || ctx.timeZone);
1792
+ const todayISO = (props.today && fromISO(props.today) ? props.today : null) || todayIn(props.timeZone || ctx.timeZone);
1806
1793
  const today = fromISO(todayISO);
1807
1794
  const min = fromISO(props.min === "today" ? todayISO : props.min), max = fromISO(props.max === "today" ? todayISO : props.max);
1808
1795
  const start = fromISO(props.start), end = fromISO(props.end);
@@ -3123,7 +3110,7 @@ window.Aura = (() => {
3123
3110
  };
3124
3111
  let top, left;
3125
3112
  if (side === "top" || side === "bottom") {
3126
- top = side === "top" ? r.top - t.height - gap : r.bottom + gap;
3113
+ top = clampY(side === "top" ? r.top - t.height - gap : r.bottom + gap);
3127
3114
  left = clampX(r.left + r.width / 2 - t.width / 2);
3128
3115
  } else {
3129
3116
  left = side === "left" ? r.left - t.width - gap : r.right + gap;
@@ -3350,6 +3337,12 @@ window.Aura = (() => {
3350
3337
  const measure = !!props.stackBelow || columns.some(function(c) {
3351
3338
  return c.hideBelow != null;
3352
3339
  });
3340
+ const levelShape = (props.stackBelow ? "s" : "") + Math.min(
3341
+ MAX_HIDE_LEVELS,
3342
+ columns.map(hidePx).filter(function(px, i, a) {
3343
+ return px != null && a.indexOf(px) === i;
3344
+ }).length
3345
+ );
3353
3346
  React28.useEffect(
3354
3347
  function() {
3355
3348
  if (!measure || !wrapRef.current || typeof ResizeObserver === "undefined") return;
@@ -3362,14 +3355,14 @@ window.Aura = (() => {
3362
3355
  ro.disconnect();
3363
3356
  };
3364
3357
  },
3365
- [measure]
3358
+ [measure, levelShape]
3366
3359
  );
3367
3360
  const stacked = !!props.stackBelow && boxWidth[0] != null && below(boxWidth[0], props.stackBelow);
3368
3361
  useIsoLayoutEffect(
3369
3362
  function() {
3370
- if (measure && boxWidth[0] == null && wrapRef.current) boxWidth[1](wrapRef.current.getBoundingClientRect().width);
3363
+ if (measure && wrapRef.current) boxWidth[1](wrapRef.current.getBoundingClientRect().width);
3371
3364
  },
3372
- [measure]
3365
+ [measure, levelShape]
3373
3366
  );
3374
3367
  const hideLevels = [];
3375
3368
  columns.forEach(function(c) {
@@ -3630,6 +3623,7 @@ window.Aura = (() => {
3630
3623
  function focusCell(r, c) {
3631
3624
  r = Math.max(0, Math.min(r, nRows));
3632
3625
  c = Math.max(0, Math.min(c, nCols - 1));
3626
+ if (stacked && r === 0 && nRows > 0 && !(selectable && c === 0)) r = 1;
3633
3627
  activeState[1]({ r, c });
3634
3628
  pending.current = { r, c };
3635
3629
  if (virtual && r > 0) {
@@ -4189,7 +4183,9 @@ window.Aura = (() => {
4189
4183
  } else {
4190
4184
  const bodyRows = body = [];
4191
4185
  if (virtual && start > 0)
4192
- bodyRows.push(/* @__PURE__ */ React28.createElement("div", { key: "__top", style: { height: start * ROW_H + "px" }, "aria-hidden": true }));
4186
+ bodyRows.push(
4187
+ /* @__PURE__ */ React28.createElement("div", { key: "__top", className: "aura-table__spacer", style: { height: start * ROW_H + "px" }, "aria-hidden": true })
4188
+ );
4193
4189
  for (let ri = start; ri < end; ri++) {
4194
4190
  (function(r, i) {
4195
4191
  const k = r[rowKey], isSel = !!selSet[k];
@@ -4220,7 +4216,17 @@ window.Aura = (() => {
4220
4216
  })(pageRows[ri], ri);
4221
4217
  }
4222
4218
  if (virtual && end < pageRows.length)
4223
- bodyRows.push(/* @__PURE__ */ React28.createElement("div", { key: "__bot", style: { height: (pageRows.length - end) * ROW_H + "px" }, "aria-hidden": true }));
4219
+ bodyRows.push(
4220
+ /* @__PURE__ */ React28.createElement(
4221
+ "div",
4222
+ {
4223
+ key: "__bot",
4224
+ className: "aura-table__spacer",
4225
+ style: { height: (pageRows.length - end) * ROW_H + "px" },
4226
+ "aria-hidden": true
4227
+ }
4228
+ )
4229
+ );
4224
4230
  }
4225
4231
  let foot = null;
4226
4232
  function pagerButton(dir) {
@@ -4455,7 +4461,7 @@ window.Aura = (() => {
4455
4461
  className: cx("aura-tabs aura-tabs--links", props.className)
4456
4462
  },
4457
4463
  /* @__PURE__ */ React30.createElement("div", { className: "aura-tabs__list" }, items2.map(function(t) {
4458
- const on = current2 && t.id === current2.id;
4464
+ const on = t.id === st[0];
4459
4465
  const inner = [
4460
4466
  t.icon ? /* @__PURE__ */ React30.createElement(Icon, { key: "i", name: t.icon }) : null,
4461
4467
  t.label,
@@ -4468,7 +4474,8 @@ window.Aura = (() => {
4468
4474
  href: t.href,
4469
4475
  className: cx("aura-tab", on && "is-active"),
4470
4476
  "aria-current": on ? "page" : void 0,
4471
- onClick: function() {
4477
+ onClick: function(e) {
4478
+ if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
4472
4479
  st[1](t.id);
4473
4480
  }
4474
4481
  },
@@ -1365,6 +1365,8 @@ button.aura-stepper__step:hover .aura-stepper__label { text-decoration: underlin
1365
1365
  @media (max-width: 767.98px) { :root:has(.aura-bottomnav--below-md) { --aura-bottomnav-offset: calc(var(--aura-bottomnav-height) + env(safe-area-inset-bottom, 0px)); } }
1366
1366
  @media (max-width: 1023.98px) { :root:has(.aura-bottomnav--below-lg) { --aura-bottomnav-offset: calc(var(--aura-bottomnav-height) + env(safe-area-inset-bottom, 0px)); } }
1367
1367
  @media (max-width: 1279.98px) { :root:has(.aura-bottomnav--below-xl) { --aura-bottomnav-offset: calc(var(--aura-bottomnav-height) + env(safe-area-inset-bottom, 0px)); } }
1368
+ /* Toasts clear a BottomNav wherever it shows (phones and tablets). */
1369
+ .aura-toaster:not(.is-top) { bottom: calc(var(--aura-space-6) + var(--aura-bottomnav-offset, 0px)); }
1368
1370
  @media (max-width: 639.98px) { .aura-toaster:not(.is-top) { bottom: calc(var(--aura-space-4) + var(--aura-bottomnav-offset, 0px)); } }
1369
1371
 
1370
1372
  /* ---------- 4.19: ActionBar ---------- */
@@ -1459,7 +1461,8 @@ button.aura-stepper__step:hover .aura-stepper__label { text-decoration: underlin
1459
1461
  margin-bottom: var(--aura-space-1);
1460
1462
  padding: 0; line-height: normal;
1461
1463
  }
1462
- .aura-table__td[data-hide] { display: block; }
1464
+ .aura-table__td[data-hide], .aura-table__head > .aura-table__th[data-hide] { display: block; }
1465
+ .aura-table__spacer { display: none; }
1463
1466
  .aura-table__td[data-label]::before {
1464
1467
  content: attr(data-label); content: attr(data-label) / '';
1465
1468
  display: block; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start;
@@ -171,7 +171,7 @@ export interface DataTableProps {
171
171
  onPinnedColumnsChange?: ((keys: string[]) => void) | undefined;
172
172
  /** `compact` = 40px rows (48px on touch screens). Default: the surrounding density. */
173
173
  density?: "comfortable" | "compact" | undefined;
174
- /** Table width in px below which rows render as stacked cards (phones). Try 640. It follows the table's own width, not the window. Since 4.20 the cards are the same markup as the grid, laid out by a container query, so any width is right before hydration and each row is in the HTML once. */
174
+ /** Table width in px below which rows render as stacked cards (phones). Try 640. It follows the table's own width, not the window. Since 4.20 the cards are the same markup as the grid, laid out by a container query, so any width is right before hydration and each row is in the HTML once. With `height` (virtual rows) the server can only send the first screenful; the rest of the cards arrive on hydration. */
175
175
  stackBelow?: number | undefined;
176
176
  className?: string | undefined;
177
177
  }
@@ -745,7 +745,7 @@ export interface SegmentedControlProps {
745
745
  /** ISO date string, `YYYY-MM-DD` (Gregorian — the era is display only). */
746
746
  export type ISODate = string;
747
747
  export interface DateDisplayOptions {
748
- /** Components: the AuraProvider's locale, else `en`. `formatDate()` (no provider to read): `th` unless given. */
748
+ /** Components: the AuraProvider's locale, else `en`. `formatDate()` (no provider to read): `en` unless given (5.0; `th` before). */
749
749
  locale?: "th" | "en" | "sv" | undefined;
750
750
  /** `buddhist` (พ.ศ.; default for th) or `gregory` (ค.ศ.; default for en and sv). */
751
751
  calendar?: "buddhist" | "gregory" | undefined;
@@ -1227,14 +1227,14 @@ export declare const Combobox: ComboboxComponent;
1227
1227
  export type FormatDateOptions = DateDisplayOptions & {
1228
1228
  format?: "short" | "long" | "numeric" | Intl.DateTimeFormatOptions | undefined;
1229
1229
  };
1230
+ /** Format an ISO date for display: "18 Sept 2026" by default (English, Gregorian — 5.0); `{ locale: 'th' }` gives
1231
+ * "18 ก.ย. 2569" (Buddhist era), `{ locale: 'sv' }` "18 sep. 2026". The same function from the package root and from
1232
+ * `/server`. In components, `useFormatDate()` follows the AuraProvider's locale instead. */
1233
+ export declare function formatDate(iso: ISODate | null | undefined, opts?: FormatDateOptions): string;
1230
1234
  /** Parse typed text: dd/mm/yyyy (Buddhist years ≥ 2400 are converted), d-m-yyyy, d.m.yyyy, yyyy-mm-dd or '18 ก.ย. 2569' / '18 Sep 2026'. */
1231
1235
  export declare function parseDate(text: string | null | undefined): ISODate | null;
1232
1236
  /** Today as an ISO date in an IANA time zone (e.g. `Asia/Bangkok`), or in the runtime's own zone without one. (4.19) */
1233
1237
  export declare function todayIn(timeZone?: string | null): ISODate;
1234
- /** Format an ISO date for display. Without a `locale` it is Thai with Buddhist-era years **until 5.0, which makes it
1235
- * English and Gregorian** like `@jirawatpyk/aura-react/server` and `useFormatDate()`. Pass `{ locale }` (or use
1236
- * `useFormatDate()` in components) so the switch changes nothing for you; a call without one warns once in development. */
1237
- export declare function formatDate(iso: ISODate | null | undefined, opts?: FormatDateOptions): string;
1238
1238
  /** formatDate bound to the nearest AuraProvider: its locale and calendar (English, Gregorian without one).
1239
1239
  * Options you pass still win. Use it in components; plain formatDate() stays for code outside React. */
1240
1240
  export declare function useFormatDate(): (iso: ISODate | null | undefined, opts?: FormatDateOptions) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jirawatpyk/aura-tokens",
3
- "version": "4.20.0",
3
+ "version": "5.0.1",
4
4
  "description": "AURA Design System — tokens (CSS variables, Tailwind preset, Figma variables), theme contrast checks and token lint.",
5
5
  "main": "tailwind.tokens.cjs",
6
6
  "types": "components/index.d.ts",
package/tokens.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.20.0",
2
+ "version": "5.0.1",
3
3
  "meta": {
4
4
  "name": "AURA Design System",
5
5
  "tier": "3-tier",