@kazee-ds/react 0.11.0 → 0.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/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @kazee-ds/react
2
2
 
3
- Prepared **0.11.0** adds the `enclosed` Tabs variant (folder tabs) and keeps a nested Tabs independent of its ancestor's variant. Use React **0.11.0** or Vue **0.11.0** with styles **0.12.0**. These versions are unpublished; see [release status](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/versions.md).
3
+ Prepared **0.12.0** adds `popoverAlign`/`popoverProps`/`popoverWidth` to position and size Select/Combobox/DateRangePicker/temporal picker popovers, and fixes several RTL popover-alignment bugs. Use React **0.12.0** or Vue **0.12.0** with styles **0.13.0**. These versions are unpublished; see [release status](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/versions.md).
4
4
 
5
- The prepared styles **0.12.0** bundle tokens **0.8.0**, which add the `cool-gray-300` palette color (`#B0B3C4`), and style the `enclosed` Tabs variant. Tabs root modifiers are scoped with CSS `@scope`, so nested Tabs keep their own variant (Chrome/Edge 118, Safari 17.4, Firefox 146). Published styles **0.11.0** / tokens **0.7.0** added the AA `--ds-color-text-secondary` text role, which remains unchanged.
5
+ The prepared styles **0.13.0** fix the Tabs `pill`/`secondary` active-indicator color, center `enclosed` Tabs actions/extras on the tab labels, and keep a selected chip `ToggleButton` readable on hover/press; it bundles tokens **0.8.0** unchanged. Published styles **0.11.0** / tokens **0.7.0** added the AA `--ds-color-text-secondary` text role, which remains unchanged.
6
6
  Accessible Kazee React components, including Toast, built on React Aria Components. Requires React/React DOM 19+ and ESM.
7
7
 
8
8
  Version **0.10.1** adds Combobox sizing, focus/search and nonempty-selection policies, full-control popovers, and compact and compound Dialog header/footer dividers and builds on controlled selectable Card actions, Avatar/AvatarGroup, expanded Badge, sized/icon Switch, interactive/compact Card, dense controls, input clearing and composable date/time families. Existing compact APIs remain supported. Verify registry availability before installing; use matching local packed artifacts for checkout testing. See [component expansion](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/component-expansion.md) and [release status](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/versions.md).
@@ -15,7 +15,7 @@ Version 0.5.3 ignores Toast shortcut events with missing or non-string keys. Nor
15
15
  After the prepared versions are published and verified, public npm installation requires no read token or login. Until then use matching local packed artifacts. Preserve the application's package manager and lockfile.
16
16
 
17
17
  ```sh
18
- npm install --save-exact @kazee-ds/react@0.11.0 @kazee-ds/styles@0.12.0
18
+ npm install --save-exact @kazee-ds/react@0.12.0 @kazee-ds/styles@0.13.0
19
19
  ```
20
20
 
21
21
  ## Use
package/dist/index.js CHANGED
@@ -222,6 +222,25 @@ function SelectionPopover({ maxHeight, ...props }) {
222
222
  });
223
223
  }
224
224
  //#endregion
225
+ //#region src/popover-position.ts
226
+ var placements = {
227
+ start: "bottom start",
228
+ center: "bottom",
229
+ end: "bottom end"
230
+ };
231
+ /** Merge defaults, the alignment shortcut and the passthrough, ignoring undefined passthrough keys. */
232
+ function popoverPosition({ popoverAlign, popoverProps }, defaults = {}) {
233
+ const result = {
234
+ ...defaults,
235
+ placement: popoverAlign ? placements[popoverAlign] : defaults.placement ?? "bottom start"
236
+ };
237
+ for (const [key, value] of Object.entries(popoverProps ?? {})) if (value !== void 0) result[key] = value;
238
+ return result;
239
+ }
240
+ function popoverWidthClass(width) {
241
+ return `select__popover--${width}-width`;
242
+ }
243
+ //#endregion
225
244
  //#region src/label-context.ts
226
245
  /** Item labels use Text slots rather than introducing native label elements. */
227
246
  var ItemLabelContext = createContext(false);
@@ -724,8 +743,9 @@ function SelectCompact(props) {
724
743
  })]
725
744
  }),
726
745
  /* @__PURE__ */ jsx(SelectionPopover, {
746
+ ...popoverPosition(props),
727
747
  maxHeight: props.maxHeight,
728
- className: partClass("select__popover", props.classNames?.popover),
748
+ className: partClass(`select__popover ${popoverWidthClass(props.popoverWidth ?? "content")}`, props.classNames?.popover),
729
749
  children: /* @__PURE__ */ jsx(ListBox$1, {
730
750
  className: partClass("select__list", props.classNames?.list),
731
751
  children: options.map((option) => /* @__PURE__ */ jsxs(ListBoxItem, {
@@ -4264,7 +4284,8 @@ function CompactCombobox(props) {
4264
4284
  ]
4265
4285
  }),
4266
4286
  /* @__PURE__ */ jsx(ComboboxPopover, {
4267
- className: partClass("select__popover combobox__popover", props.classNames?.popover),
4287
+ ...popoverPosition(props),
4288
+ className: partClass(popoverWidthClass(props.popoverWidth ?? "trigger"), props.classNames?.popover),
4268
4289
  children: /* @__PURE__ */ jsx(ListBox$3, {
4269
4290
  className: partClass("select__list", props.classNames?.list),
4270
4291
  renderEmptyState: () => /* @__PURE__ */ jsx("span", {
@@ -4441,16 +4462,23 @@ function DateRangeIndicator({ className, children, ...props }) {
4441
4462
  }
4442
4463
  function DateRangePopover({ className, children, ...props }) {
4443
4464
  const range = useRange();
4444
- return /* @__PURE__ */ jsx(Popover$1, {
4445
- placement: "bottom start",
4446
- offset: 8,
4465
+ const { locale } = useLocale();
4466
+ return /* @__PURE__ */ jsx(OverlayDirection, {
4447
4467
  dir: range.dir,
4448
- ...props,
4449
- className: partClass("date-range__panel", className),
4450
- children: (state) => /* @__PURE__ */ jsx(Dialog$1, {
4451
- "aria-labelledby": `${range.id}-label`,
4452
- className: "date-range__dialog",
4453
- children: typeof children === "function" ? children(state) : children ?? range.panel
4468
+ children: /* @__PURE__ */ jsx(Popover$1, {
4469
+ placement: "bottom start",
4470
+ offset: 8,
4471
+ dir: range.dir,
4472
+ ...props,
4473
+ className: partClass("date-range__panel", className),
4474
+ children: (state) => /* @__PURE__ */ jsx(I18nProvider, {
4475
+ locale,
4476
+ children: /* @__PURE__ */ jsx(Dialog$1, {
4477
+ "aria-labelledby": `${range.id}-label`,
4478
+ className: "date-range__dialog",
4479
+ children: typeof children === "function" ? children(state) : children ?? range.panel
4480
+ })
4481
+ })
4454
4482
  })
4455
4483
  });
4456
4484
  }
@@ -5284,11 +5312,12 @@ function DateRangePickerRoot(props) {
5284
5312
  })
5285
5313
  ]
5286
5314
  });
5315
+ const rangeLocale = new Intl.Locale(locale, {
5316
+ calendar: "gregory",
5317
+ ...dir ? { script: dir === "rtl" ? "Arab" : "Latn" } : {}
5318
+ }).toString();
5287
5319
  return /* @__PURE__ */ jsx(I18nProvider, {
5288
- locale: new Intl.Locale(locale, {
5289
- calendar: "gregory",
5290
- ...dir ? { script: dir === "rtl" ? "Arab" : "Latn" } : {}
5291
- }).toString(),
5320
+ locale: rangeLocale,
5292
5321
  children: /* @__PURE__ */ jsx(DateRangeCompositionContext.Provider, {
5293
5322
  value: {
5294
5323
  id,
@@ -5387,16 +5416,24 @@ function DateRangePickerRoot(props) {
5387
5416
  children: panel
5388
5417
  })
5389
5418
  })
5390
- }) : /* @__PURE__ */ jsx(Popover$1, {
5391
- className: partClass("date-range__panel", props.classNames?.panel),
5392
- placement: "bottom start",
5393
- offset: 8,
5394
- containerPadding: 16,
5419
+ }) : /* @__PURE__ */ jsx(OverlayDirection, {
5395
5420
  dir,
5396
- children: /* @__PURE__ */ jsx(Dialog$1, {
5397
- className: partClass("date-range__dialog", props.classNames?.dialog),
5398
- "aria-labelledby": `${id}-title`,
5399
- children: panel
5421
+ children: /* @__PURE__ */ jsx(Popover$1, {
5422
+ className: partClass("date-range__panel", props.classNames?.panel),
5423
+ ...popoverPosition(props, {
5424
+ placement: "bottom start",
5425
+ offset: 8,
5426
+ containerPadding: 16
5427
+ }),
5428
+ dir,
5429
+ children: /* @__PURE__ */ jsx(I18nProvider, {
5430
+ locale: rangeLocale,
5431
+ children: /* @__PURE__ */ jsx(Dialog$1, {
5432
+ className: partClass("date-range__dialog", props.classNames?.dialog),
5433
+ "aria-labelledby": `${id}-title`,
5434
+ children: panel
5435
+ })
5436
+ })
5400
5437
  })
5401
5438
  })]
5402
5439
  }),
@@ -7011,12 +7048,28 @@ function TemporalPickerContent({ children, className, ...props }) {
7011
7048
  children: children ?? c.panel
7012
7049
  });
7013
7050
  }
7014
- function TemporalPickerPopover({ children, className, ...props }) {
7051
+ /** Position props set on this part win over the picker's `popoverAlign` / `popoverProps`. */
7052
+ function TemporalPickerPopover({ children, className, placement, offset, crossOffset, shouldFlip, containerPadding, ...props }) {
7015
7053
  const c = usePicker();
7016
- return /* @__PURE__ */ jsx(Popover$1, {
7017
- className: partClass("date-range__panel temporal-picker__panel", className),
7054
+ const position = popoverPosition({
7055
+ popoverAlign: c.options.popoverAlign,
7056
+ popoverProps: {
7057
+ ...c.options.popoverProps,
7058
+ ...Object.fromEntries(Object.entries({
7059
+ placement,
7060
+ offset,
7061
+ crossOffset,
7062
+ shouldFlip,
7063
+ containerPadding
7064
+ }).filter(([, value]) => value !== void 0))
7065
+ }
7066
+ }, {
7018
7067
  placement: "bottom start",
7019
- offset: 8,
7068
+ offset: 8
7069
+ });
7070
+ const popover = /* @__PURE__ */ jsx(Popover$1, {
7071
+ className: partClass("date-range__panel temporal-picker__panel", className),
7072
+ ...position,
7020
7073
  children: /* @__PURE__ */ jsx(Dialog$1, {
7021
7074
  "aria-labelledby": `${c.id}-label`,
7022
7075
  className: "date-range__dialog",
@@ -7026,6 +7079,10 @@ function TemporalPickerPopover({ children, className, ...props }) {
7026
7079
  })
7027
7080
  })
7028
7081
  });
7082
+ return /* @__PURE__ */ jsx(OverlayDirection, {
7083
+ dir: c.options.dir,
7084
+ children: popover
7085
+ });
7029
7086
  }
7030
7087
  function action(type) {
7031
7088
  return function PickerAction({ children, className, onClick, ...props }) {