@iris-ui-kit/react 0.3.1 → 0.3.2

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/dist/index.cjs CHANGED
@@ -3935,7 +3935,7 @@ function IrisCarousel({
3935
3935
  {
3936
3936
  "data-iris-carousel": "",
3937
3937
  role: "group",
3938
- "aria-roledescription": "carousel",
3938
+ "aria-roledescription": t("carousel.roleDescription"),
3939
3939
  "aria-label": ariaLabel ?? t("carousel.label"),
3940
3940
  tabIndex: 0,
3941
3941
  className,
@@ -3971,7 +3971,7 @@ function IrisCarousel({
3971
3971
  "data-iris-carousel-slide": "",
3972
3972
  "data-active": i === current ? "true" : void 0,
3973
3973
  role: "group",
3974
- "aria-roledescription": "slide",
3974
+ "aria-roledescription": t("carousel.slideRoleDescription"),
3975
3975
  "aria-label": t("carousel.slide", { index: i + 1, total: count }),
3976
3976
  "aria-hidden": i !== current ? "true" : void 0,
3977
3977
  style: { flex: "0 0 100%", width: "100%", minWidth: 0 },
@@ -14755,7 +14755,8 @@ function ColumnResizeHandle({
14755
14755
  maxWidth,
14756
14756
  onResize,
14757
14757
  onAutoFit,
14758
- widthHint = false
14758
+ widthHint = false,
14759
+ t
14759
14760
  }) {
14760
14761
  const ref = React132__namespace.useRef(null);
14761
14762
  const startRef = React132__namespace.useRef(0);
@@ -14781,7 +14782,7 @@ function ColumnResizeHandle({
14781
14782
  ref,
14782
14783
  role: "separator",
14783
14784
  "aria-orientation": "vertical",
14784
- "aria-label": `Resize ${label}`,
14785
+ "aria-label": t("table.resizeColumn", { column: label }),
14785
14786
  tabIndex: 0,
14786
14787
  "data-iris-table-resize-handle": "",
14787
14788
  "data-column-key": colKey,
@@ -14843,7 +14844,8 @@ function PinnedDragHandle({
14843
14844
  colKey,
14844
14845
  label,
14845
14846
  resolve: resolve4,
14846
- commit
14847
+ commit,
14848
+ t
14847
14849
  }) {
14848
14850
  const ref = React132__namespace.useRef(null);
14849
14851
  const [dx, setDx] = React132__namespace.useState(0);
@@ -14863,7 +14865,7 @@ function PinnedDragHandle({
14863
14865
  ref,
14864
14866
  role: "separator",
14865
14867
  "aria-orientation": "vertical",
14866
- "aria-label": `Adjust pinned column count at ${label}`,
14868
+ "aria-label": t("table.resizePinned", { column: label }),
14867
14869
  tabIndex: 0,
14868
14870
  "data-iris-pinned-drag-handle": "",
14869
14871
  "data-column-key": colKey,
@@ -15167,6 +15169,12 @@ function useTableColumns(options) {
15167
15169
  () => core.applyColumnOrder(detectedColumns, options.columnOrder),
15168
15170
  [detectedColumns, options.columnOrder]
15169
15171
  );
15172
+ const visibilitySignature2 = JSON.stringify(
15173
+ Object.keys(options.columnVisibility ?? {}).map((key) => [
15174
+ key,
15175
+ options.columnVisibility?.[key]
15176
+ ])
15177
+ );
15170
15178
  const displayColumns = React132__namespace.useMemo(() => {
15171
15179
  let cols = orderedColumns;
15172
15180
  cols = core.applyColumnVisibility(cols, options.columnVisibility);
@@ -15174,7 +15182,7 @@ function useTableColumns(options) {
15174
15182
  cols = cols.filter((col) => col.visibleMethod ? col.visibleMethod() !== false : true);
15175
15183
  }
15176
15184
  return cols;
15177
- }, [orderedColumns, options.columnVisibility]);
15185
+ }, [orderedColumns, visibilitySignature2]);
15178
15186
  const responsiveLeadingWidth = (options.rowDrag ? DRAG_COL_WIDTH : 0) + (options.showRowNumbers ? SEQ_COL_WIDTH : 0) + (hasDetail ? EXPAND_COL_WIDTH : 0) + (options.selectable !== "none" ? SELECTION_COL_WIDTH : 0);
15179
15187
  const responsiveResult = React132__namespace.useMemo(() => {
15180
15188
  if (!options.responsive) return { columns: displayColumns, overflow: false };
@@ -16475,7 +16483,10 @@ function FlatTableHeader(props) {
16475
16483
  "span",
16476
16484
  {
16477
16485
  "data-iris-header-stats": "",
16478
- "aria-label": `count ${headerStatsByKey[col.key].count}, average ${headerStatsByKey[col.key].average.toFixed(2)}`,
16486
+ "aria-label": t("table.headerStats", {
16487
+ count: String(headerStatsByKey[col.key].count),
16488
+ average: headerStatsByKey[col.key].average.toFixed(2)
16489
+ }),
16479
16490
  style: {
16480
16491
  marginInlineStart: "var(--iris-space-xxs, 4px)",
16481
16492
  fontSize: "var(--iris-font-size-xs, 12px)",
@@ -16483,7 +16494,10 @@ function FlatTableHeader(props) {
16483
16494
  fontWeight: 400,
16484
16495
  whiteSpace: "nowrap"
16485
16496
  },
16486
- children: `n=${headerStatsByKey[col.key].count} \xB7 avg=${headerStatsByKey[col.key].average.toFixed(2)}`
16497
+ children: t("table.headerStatsShort", {
16498
+ count: String(headerStatsByKey[col.key].count),
16499
+ average: headerStatsByKey[col.key].average.toFixed(2)
16500
+ })
16487
16501
  }
16488
16502
  ) : null,
16489
16503
  showCellRefs ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -16541,7 +16555,8 @@ function FlatTableHeader(props) {
16541
16555
  colKey: col.key,
16542
16556
  label: col.title,
16543
16557
  resolve: resolvePinnedCount,
16544
- commit: commitPinnedCount
16558
+ commit: commitPinnedCount,
16559
+ t
16545
16560
  }
16546
16561
  ) : null,
16547
16562
  resizableColumns && !(pinnedBoundaryCol && pinnedBoundaryCol.key === col.key) ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -16554,6 +16569,7 @@ function FlatTableHeader(props) {
16554
16569
  maxWidth: col.maxWidth ?? Infinity,
16555
16570
  onResize: setColumnWidth,
16556
16571
  widthHint,
16572
+ t,
16557
16573
  onAutoFit: autoResizeColumns ? () => onAutoFitColumn?.(col) : void 0
16558
16574
  }
16559
16575
  ) : null
@@ -16767,7 +16783,10 @@ function GroupedTableHeader(props) {
16767
16783
  "span",
16768
16784
  {
16769
16785
  "data-iris-header-stats": "",
16770
- "aria-label": `count ${headerStatsByKey[col.key].count}, average ${headerStatsByKey[col.key].average.toFixed(2)}`,
16786
+ "aria-label": t("table.headerStats", {
16787
+ count: String(headerStatsByKey[col.key].count),
16788
+ average: headerStatsByKey[col.key].average.toFixed(2)
16789
+ }),
16771
16790
  style: {
16772
16791
  marginInlineStart: "var(--iris-space-xxs, 4px)",
16773
16792
  fontSize: "var(--iris-font-size-xs, 12px)",
@@ -16775,7 +16794,10 @@ function GroupedTableHeader(props) {
16775
16794
  fontWeight: 400,
16776
16795
  whiteSpace: "nowrap"
16777
16796
  },
16778
- children: `n=${headerStatsByKey[col.key].count} \xB7 avg=${headerStatsByKey[col.key].average.toFixed(2)}`
16797
+ children: t("table.headerStatsShort", {
16798
+ count: String(headerStatsByKey[col.key].count),
16799
+ average: headerStatsByKey[col.key].average.toFixed(2)
16800
+ })
16779
16801
  }
16780
16802
  ) : null,
16781
16803
  showCellRefs && isLeaf ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -16833,7 +16855,8 @@ function GroupedTableHeader(props) {
16833
16855
  colKey: col.key,
16834
16856
  label: col.title,
16835
16857
  resolve: resolvePinnedCount,
16836
- commit: commitPinnedCount
16858
+ commit: commitPinnedCount,
16859
+ t
16837
16860
  }
16838
16861
  ) : null
16839
16862
  ]
@@ -17669,7 +17692,7 @@ function TableViews({
17669
17692
  {
17670
17693
  "data-iris-table-views": "",
17671
17694
  value: saveOpen ? SAVE_ITEM_VALUE : activeKey ?? "",
17672
- "aria-label": t("table.views.placeholder"),
17695
+ "aria-label": t("table.views.label"),
17673
17696
  onChange: (e) => {
17674
17697
  const v = e.target.value;
17675
17698
  if (v === SAVE_ITEM_VALUE) {
@@ -18495,18 +18518,19 @@ function IrisTable({
18495
18518
  ...row,
18496
18519
  children
18497
18520
  });
18498
- const { rows: liveData, model: rowsModel } = useGridRows(
18521
+ const { rows: liveDataSnapshot, model: rowsModel } = useGridRows(
18499
18522
  gridCore,
18500
18523
  legacyRows.initialRows,
18501
18524
  {
18502
18525
  ...legacyRows.options,
18503
- // Keep the legacy no-`keepSource` seed identity while the core feature
18504
- // defaults to defensive ownership for standalone consumers.
18526
+ // keepSource copies the seed; without it, preserve the legacy adapter
18527
+ // contract by reading Core's source-reference state during render.
18505
18528
  cloneDefaultRows: keepSource === true,
18506
18529
  getChildren: getSubRows !== void 0 || lazyLoad !== void 0 ? readRowChildren : void 0,
18507
18530
  setChildren: writeLazyChildren
18508
18531
  }
18509
18532
  );
18533
+ const liveData = keepSource ? liveDataSnapshot : rowsModel.get();
18510
18534
  const { pagination, setPage, setPageSize } = useTablePagination(
18511
18535
  gridCore,
18512
18536
  proxy ? proxyState : null,
@@ -24949,6 +24973,7 @@ function TreeNodeView({
24949
24973
  selectNode,
24950
24974
  toggleExpand
24951
24975
  }) {
24976
+ const { t } = useI18n();
24952
24977
  const { node, depth, hasChildren } = flatNode;
24953
24978
  const isExpanded = expanded.has(node.id);
24954
24979
  const isSelected = selected.has(node.id);
@@ -24996,7 +25021,7 @@ function TreeNodeView({
24996
25021
  "button",
24997
25022
  {
24998
25023
  type: "button",
24999
- "aria-label": isExpanded ? "Collapse" : "Expand",
25024
+ "aria-label": isExpanded ? t("treeSelect.collapse") : t("treeSelect.expand"),
25000
25025
  "data-iris-tree-toggle": "",
25001
25026
  onClick: (event) => {
25002
25027
  event.stopPropagation();
@@ -29088,7 +29113,7 @@ function IrisNavMenu({
29088
29113
  "data-branch": branch ? "true" : void 0,
29089
29114
  disabled: node.disabled,
29090
29115
  title: node.title,
29091
- "aria-label": branch ? `${node.title} (section)` : node.title,
29116
+ "aria-label": branch ? t("admin.section", { title: node.title }) : node.title,
29092
29117
  "aria-current": active && !branch ? "page" : void 0,
29093
29118
  style: itemStyle({
29094
29119
  depth: 0,
@@ -29520,7 +29545,7 @@ function IrisAdminTabs({
29520
29545
  /* @__PURE__ */ jsxRuntime.jsx(IrisDropdownItem, { onSelect: () => nav.closeRight(activeKey), children: translate("admin.closeRight") }),
29521
29546
  /* @__PURE__ */ jsxRuntime.jsx(IrisDropdownItem, { onSelect: () => nav.closeOthers(activeKey), children: translate("admin.closeOthers") }),
29522
29547
  /* @__PURE__ */ jsxRuntime.jsx(IrisDropdownItem, { onSelect: () => nav.closeAll(), children: translate("admin.closeAll") })
29523
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(IrisDropdownItem, { disabled: true, children: "No active tab" }) })
29548
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(IrisDropdownItem, { disabled: true, children: translate("admin.noActiveTab") }) })
29524
29549
  ] })
29525
29550
  ]
29526
29551
  }
@@ -29581,7 +29606,7 @@ function IrisAdminLayout({
29581
29606
  defaultCollapsed = false,
29582
29607
  onCollapsedChange,
29583
29608
  mode = "sidebar",
29584
- appTitle = "Iris Admin",
29609
+ appTitle,
29585
29610
  tabs,
29586
29611
  showTabs = true,
29587
29612
  showBreadcrumb = true,
@@ -29599,6 +29624,7 @@ function IrisAdminLayout({
29599
29624
  children
29600
29625
  }) {
29601
29626
  const { t } = useI18n();
29627
+ const resolvedAppTitle = appTitle ?? t("admin.title");
29602
29628
  const {
29603
29629
  activeKey: currentActive,
29604
29630
  navigate,
@@ -29655,7 +29681,7 @@ function IrisAdminLayout({
29655
29681
  children: /* @__PURE__ */ jsxRuntime.jsx(IrisIcon, { name: "menu", size: 18 })
29656
29682
  }
29657
29683
  ),
29658
- state.collapsed ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { children: appTitle })
29684
+ state.collapsed ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { children: resolvedAppTitle })
29659
29685
  ]
29660
29686
  }
29661
29687
  );
@@ -29873,11 +29899,11 @@ function useAdminPreferences(preferences, hydrate = true) {
29873
29899
  };
29874
29900
  }
29875
29901
  function IrisLoginTemplate({
29876
- title = "Sign in",
29902
+ title,
29877
29903
  description = "",
29878
29904
  showRemember = true,
29879
29905
  error = "",
29880
- submitLabel = "Sign in",
29906
+ submitLabel,
29881
29907
  loading = false,
29882
29908
  header,
29883
29909
  forgot,
@@ -29886,6 +29912,9 @@ function IrisLoginTemplate({
29886
29912
  style,
29887
29913
  className
29888
29914
  }) {
29915
+ const { t } = useI18n();
29916
+ const resolvedTitle = title ?? t("login.title");
29917
+ const resolvedSubmitLabel = submitLabel ?? t("login.submit");
29889
29918
  const [email, setEmail] = React132__namespace.useState("");
29890
29919
  const [password, setPassword] = React132__namespace.useState("");
29891
29920
  const [remember, setRemember] = React132__namespace.useState(false);
@@ -29930,7 +29959,7 @@ function IrisLoginTemplate({
29930
29959
  fontSize: "var(--iris-font-size-2xl, 20px)",
29931
29960
  fontWeight: 700
29932
29961
  },
29933
- children: title
29962
+ children: resolvedTitle
29934
29963
  }
29935
29964
  ),
29936
29965
  description ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -29946,23 +29975,23 @@ function IrisLoginTemplate({
29946
29975
  ) : null
29947
29976
  ] }),
29948
29977
  error ? /* @__PURE__ */ jsxRuntime.jsx(IrisAlert, { tone: "danger", title: error }) : null,
29949
- /* @__PURE__ */ jsxRuntime.jsx(IrisFormField, { label: "Email", required: true, children: /* @__PURE__ */ jsxRuntime.jsx(
29978
+ /* @__PURE__ */ jsxRuntime.jsx(IrisFormField, { label: t("login.email"), required: true, children: /* @__PURE__ */ jsxRuntime.jsx(
29950
29979
  IrisInput,
29951
29980
  {
29952
29981
  type: "email",
29953
29982
  value: email,
29954
29983
  onChange: (e) => setEmail(e.target.value),
29955
- placeholder: "you@example.com",
29984
+ placeholder: t("login.emailPlaceholder"),
29956
29985
  disabled: loading,
29957
29986
  autoComplete: "email"
29958
29987
  }
29959
29988
  ) }),
29960
- /* @__PURE__ */ jsxRuntime.jsx(IrisFormField, { label: "Password", required: true, children: /* @__PURE__ */ jsxRuntime.jsx(
29989
+ /* @__PURE__ */ jsxRuntime.jsx(IrisFormField, { label: t("login.password"), required: true, children: /* @__PURE__ */ jsxRuntime.jsx(
29961
29990
  IrisPasswordInput,
29962
29991
  {
29963
29992
  value: password,
29964
29993
  onChange: (e) => setPassword(e.target.value),
29965
- placeholder: "Enter your password",
29994
+ placeholder: t("login.passwordPlaceholder"),
29966
29995
  disabled: loading,
29967
29996
  autoComplete: "current-password"
29968
29997
  }
@@ -29982,16 +30011,16 @@ function IrisLoginTemplate({
29982
30011
  checked: remember,
29983
30012
  onChange: (next) => setRemember(next),
29984
30013
  disabled: loading,
29985
- children: "Remember me"
30014
+ children: t("login.remember")
29986
30015
  }
29987
30016
  ),
29988
30017
  forgot ?? null
29989
30018
  ]
29990
30019
  }
29991
30020
  ) : null,
29992
- /* @__PURE__ */ jsxRuntime.jsx(IrisButton, { type: "submit", variant: "solid", loading, style: { width: "100%" }, children: submitLabel }),
30021
+ /* @__PURE__ */ jsxRuntime.jsx(IrisButton, { type: "submit", variant: "solid", loading, style: { width: "100%" }, children: resolvedSubmitLabel }),
29993
30022
  footer ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
29994
- /* @__PURE__ */ jsxRuntime.jsx(IrisDivider, { spacing: "md", label: "or" }),
30023
+ /* @__PURE__ */ jsxRuntime.jsx(IrisDivider, { spacing: "md", label: t("login.footerDivider") }),
29995
30024
  footer
29996
30025
  ] }) : null
29997
30026
  ] })
@@ -30001,7 +30030,7 @@ function IrisLoginTemplate({
30001
30030
  );
30002
30031
  }
30003
30032
  function IrisDashboardTemplate({
30004
- title = "Dashboard",
30033
+ title,
30005
30034
  sidebarTitle = "",
30006
30035
  nav = [],
30007
30036
  activeId = "",
@@ -30016,6 +30045,8 @@ function IrisDashboardTemplate({
30016
30045
  style,
30017
30046
  className
30018
30047
  }) {
30048
+ const { t } = useI18n();
30049
+ const resolvedTitle = title ?? t("dashboard.title");
30019
30050
  const [collapsed, setCollapsed] = React132__namespace.useState(defaultCollapsed);
30020
30051
  const handleCollapsed = (next) => {
30021
30052
  setCollapsed(next);
@@ -30060,7 +30091,7 @@ function IrisDashboardTemplate({
30060
30091
  /* @__PURE__ */ jsxRuntime.jsx(
30061
30092
  "nav",
30062
30093
  {
30063
- "aria-label": "Primary",
30094
+ "aria-label": t("dashboard.primaryNavigation"),
30064
30095
  style: {
30065
30096
  display: "flex",
30066
30097
  flexDirection: "column",
@@ -30129,7 +30160,7 @@ function IrisDashboardTemplate({
30129
30160
  fontSize: "var(--iris-font-size-lg, 16px)",
30130
30161
  fontWeight: 600
30131
30162
  },
30132
- children: title
30163
+ children: resolvedTitle
30133
30164
  }
30134
30165
  ),
30135
30166
  children: children ?? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 20 }, children: /* @__PURE__ */ jsxRuntime.jsx(IrisDashboardGrid, { columns: 12, gap: 16, children: cards.map((card) => /* @__PURE__ */ jsxRuntime.jsxs(