@kazee-ds/react 0.10.3 → 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 +3 -3
- package/dist/index.js +92 -30
- package/dist/index.js.map +1 -1
- package/dist/types/Combobox.d.ts +4 -1
- package/dist/types/DateRangePicker.d.ts +2 -1
- package/dist/types/Select.d.ts +4 -1
- package/dist/types/Tabs.d.ts +2 -1
- package/dist/types/TemporalPicker.d.ts +4 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/popover-position.d.ts +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @kazee-ds/react
|
|
2
2
|
|
|
3
|
-
Prepared **0.
|
|
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.
|
|
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.
|
|
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(
|
|
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, {
|
|
@@ -2324,6 +2344,11 @@ function mountTabsIndicator(container) {
|
|
|
2324
2344
|
}
|
|
2325
2345
|
//#endregion
|
|
2326
2346
|
//#region src/Tabs.tsx
|
|
2347
|
+
function variantClass(variant, orientation) {
|
|
2348
|
+
if (variant === "default") return "tabs--primary";
|
|
2349
|
+
if (variant === "enclosed" && orientation === "vertical") return "tabs--secondary";
|
|
2350
|
+
return `tabs--${variant}`;
|
|
2351
|
+
}
|
|
2327
2352
|
function CompactTabs({ className, style, classNames, label, variant = "primary", size = "md", indicatorShadow = true, orientation = "horizontal", align = "center", fullWidth = false, inset = "default", showSeparators = false, renderIcon, previousLabel = "Tab sebelumnya / Previous tabs", nextLabel = "Tab berikutnya / Next tabs", extras, actions, items, value, defaultValue, onChange, renderPanel, activationMode = "manual", dir, id }) {
|
|
2328
2353
|
const container = useRef(null);
|
|
2329
2354
|
const hasToolbar = !!(extras || actions);
|
|
@@ -2390,7 +2415,7 @@ function CompactTabs({ className, style, classNames, label, variant = "primary",
|
|
|
2390
2415
|
"tabs",
|
|
2391
2416
|
classNames?.root,
|
|
2392
2417
|
className,
|
|
2393
|
-
|
|
2418
|
+
variantClass(variant, orientation),
|
|
2394
2419
|
`tabs--align-${align}`,
|
|
2395
2420
|
fullWidth && "tabs--full-width",
|
|
2396
2421
|
inset === "none" && "tabs--flush",
|
|
@@ -2442,7 +2467,7 @@ function TabsRoot({ className, classNames, value, defaultValue, onChange, varian
|
|
|
2442
2467
|
onSelectionChange: onChange ? (key) => onChange(String(key)) : void 0,
|
|
2443
2468
|
className: [
|
|
2444
2469
|
"tabs",
|
|
2445
|
-
|
|
2470
|
+
variantClass(variant, props.orientation),
|
|
2446
2471
|
`tabs--align-${align}`,
|
|
2447
2472
|
size !== "md" && `tabs--${size}`,
|
|
2448
2473
|
fullWidth && "tabs--full-width",
|
|
@@ -4259,7 +4284,8 @@ function CompactCombobox(props) {
|
|
|
4259
4284
|
]
|
|
4260
4285
|
}),
|
|
4261
4286
|
/* @__PURE__ */ jsx(ComboboxPopover, {
|
|
4262
|
-
|
|
4287
|
+
...popoverPosition(props),
|
|
4288
|
+
className: partClass(popoverWidthClass(props.popoverWidth ?? "trigger"), props.classNames?.popover),
|
|
4263
4289
|
children: /* @__PURE__ */ jsx(ListBox$3, {
|
|
4264
4290
|
className: partClass("select__list", props.classNames?.list),
|
|
4265
4291
|
renderEmptyState: () => /* @__PURE__ */ jsx("span", {
|
|
@@ -4436,16 +4462,23 @@ function DateRangeIndicator({ className, children, ...props }) {
|
|
|
4436
4462
|
}
|
|
4437
4463
|
function DateRangePopover({ className, children, ...props }) {
|
|
4438
4464
|
const range = useRange();
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
offset: 8,
|
|
4465
|
+
const { locale } = useLocale();
|
|
4466
|
+
return /* @__PURE__ */ jsx(OverlayDirection, {
|
|
4442
4467
|
dir: range.dir,
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
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
|
+
})
|
|
4449
4482
|
})
|
|
4450
4483
|
});
|
|
4451
4484
|
}
|
|
@@ -5279,11 +5312,12 @@ function DateRangePickerRoot(props) {
|
|
|
5279
5312
|
})
|
|
5280
5313
|
]
|
|
5281
5314
|
});
|
|
5315
|
+
const rangeLocale = new Intl.Locale(locale, {
|
|
5316
|
+
calendar: "gregory",
|
|
5317
|
+
...dir ? { script: dir === "rtl" ? "Arab" : "Latn" } : {}
|
|
5318
|
+
}).toString();
|
|
5282
5319
|
return /* @__PURE__ */ jsx(I18nProvider, {
|
|
5283
|
-
locale:
|
|
5284
|
-
calendar: "gregory",
|
|
5285
|
-
...dir ? { script: dir === "rtl" ? "Arab" : "Latn" } : {}
|
|
5286
|
-
}).toString(),
|
|
5320
|
+
locale: rangeLocale,
|
|
5287
5321
|
children: /* @__PURE__ */ jsx(DateRangeCompositionContext.Provider, {
|
|
5288
5322
|
value: {
|
|
5289
5323
|
id,
|
|
@@ -5382,16 +5416,24 @@ function DateRangePickerRoot(props) {
|
|
|
5382
5416
|
children: panel
|
|
5383
5417
|
})
|
|
5384
5418
|
})
|
|
5385
|
-
}) : /* @__PURE__ */ jsx(
|
|
5386
|
-
className: partClass("date-range__panel", props.classNames?.panel),
|
|
5387
|
-
placement: "bottom start",
|
|
5388
|
-
offset: 8,
|
|
5389
|
-
containerPadding: 16,
|
|
5419
|
+
}) : /* @__PURE__ */ jsx(OverlayDirection, {
|
|
5390
5420
|
dir,
|
|
5391
|
-
children: /* @__PURE__ */ jsx(
|
|
5392
|
-
className: partClass("date-
|
|
5393
|
-
|
|
5394
|
-
|
|
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
|
+
})
|
|
5395
5437
|
})
|
|
5396
5438
|
})]
|
|
5397
5439
|
}),
|
|
@@ -7006,12 +7048,28 @@ function TemporalPickerContent({ children, className, ...props }) {
|
|
|
7006
7048
|
children: children ?? c.panel
|
|
7007
7049
|
});
|
|
7008
7050
|
}
|
|
7009
|
-
|
|
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 }) {
|
|
7010
7053
|
const c = usePicker();
|
|
7011
|
-
|
|
7012
|
-
|
|
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
|
+
}, {
|
|
7013
7067
|
placement: "bottom start",
|
|
7014
|
-
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,
|
|
7015
7073
|
children: /* @__PURE__ */ jsx(Dialog$1, {
|
|
7016
7074
|
"aria-labelledby": `${c.id}-label`,
|
|
7017
7075
|
className: "date-range__dialog",
|
|
@@ -7021,6 +7079,10 @@ function TemporalPickerPopover({ children, className, ...props }) {
|
|
|
7021
7079
|
})
|
|
7022
7080
|
})
|
|
7023
7081
|
});
|
|
7082
|
+
return /* @__PURE__ */ jsx(OverlayDirection, {
|
|
7083
|
+
dir: c.options.dir,
|
|
7084
|
+
children: popover
|
|
7085
|
+
});
|
|
7024
7086
|
}
|
|
7025
7087
|
function action(type) {
|
|
7026
7088
|
return function PickerAction({ children, className, onClick, ...props }) {
|