@kazee-ds/react 0.10.0 → 0.10.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/README.md +5 -4
- package/dist/index.js +40 -55
- package/dist/index.js.map +1 -1
- package/dist/types/date-range-model.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
# @kazee-ds/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Prepared **0.10.2** compacts DateRangePicker: the visible heading, repeated range summary, calendar-side presets and Today shortcut are removed. Period shortcuts belong in a linked Select. Use React **0.10.2** or Vue **0.10.1** with styles **0.10.3**. 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.10.3** bundle tokens **0.6.1**, using `#DBDBDB` for light-theme neutral/default and hover borders. Dark theme and focus/error/selected state colors retain their own roles.
|
|
5
6
|
Accessible Kazee React components, including Toast, built on React Aria Components. Requires React/React DOM 19+ and ESM.
|
|
6
7
|
|
|
7
|
-
Version **0.10.
|
|
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).
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
Version 0.5.3 ignores Toast shortcut events with missing or non-string keys. Normal shortcuts and scoped Escape dismissal remain available.
|
|
11
12
|
|
|
12
13
|
## Install
|
|
13
14
|
|
|
14
|
-
|
|
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.
|
|
15
16
|
|
|
16
17
|
```sh
|
|
17
|
-
npm install --save-exact @kazee-ds/react@0.10.
|
|
18
|
+
npm install --save-exact @kazee-ds/react@0.10.2 @kazee-ds/styles@0.10.3
|
|
18
19
|
```
|
|
19
20
|
|
|
20
21
|
## Use
|
package/dist/index.js
CHANGED
|
@@ -3978,6 +3978,7 @@ function Spinner({ size = "md", color = "current", label, id, className, style,
|
|
|
3978
3978
|
//#endregion
|
|
3979
3979
|
//#region src/combobox-composition.tsx
|
|
3980
3980
|
var ComboboxPolicyContext = createContext({
|
|
3981
|
+
inputRef: { current: null },
|
|
3981
3982
|
disabled: false,
|
|
3982
3983
|
selectOnFocus: false,
|
|
3983
3984
|
disallowEmptySelection: false,
|
|
@@ -3994,10 +3995,12 @@ function useComboState() {
|
|
|
3994
3995
|
function ComboboxComposition({ className, onChange, size = "md", variant = "primary", hideLabel, fullWidth = true, selectOnFocus = false, disallowEmptySelection = false, maxHeight, ...props }) {
|
|
3995
3996
|
const [local, setLocal] = useState(props.defaultValue ?? null);
|
|
3996
3997
|
const resetting = useRef(false);
|
|
3998
|
+
const inputRef = useRef(null);
|
|
3997
3999
|
const resetLocal = useCallback(() => setLocal(props.defaultValue ?? null), [props.defaultValue]);
|
|
3998
4000
|
const value = props.value !== void 0 ? props.value : local;
|
|
3999
4001
|
return /* @__PURE__ */ jsx(ComboboxPolicyContext.Provider, {
|
|
4000
4002
|
value: {
|
|
4003
|
+
inputRef,
|
|
4001
4004
|
disabled: !!props.isDisabled,
|
|
4002
4005
|
selectOnFocus,
|
|
4003
4006
|
disallowEmptySelection,
|
|
@@ -4044,13 +4047,15 @@ function ComboboxInput({ className, ...props }) {
|
|
|
4044
4047
|
const policy = useContext(ComboboxPolicyContext);
|
|
4045
4048
|
const state = useComboState();
|
|
4046
4049
|
const inputRef = useRef(null);
|
|
4050
|
+
const focused = useRef(false);
|
|
4047
4051
|
const selectClick = useRef(false);
|
|
4048
4052
|
const forwardedRef = props.ref;
|
|
4049
4053
|
const captureRef = useCallback((node) => {
|
|
4050
4054
|
inputRef.current = node;
|
|
4055
|
+
policy.inputRef.current = node;
|
|
4051
4056
|
if (typeof forwardedRef === "function") return forwardedRef(node);
|
|
4052
4057
|
if (forwardedRef) forwardedRef.current = node;
|
|
4053
|
-
}, [forwardedRef]);
|
|
4058
|
+
}, [forwardedRef, policy.inputRef]);
|
|
4054
4059
|
useEffect(() => {
|
|
4055
4060
|
const form = inputRef.current?.form;
|
|
4056
4061
|
if (!form || !policy.manageReset || !state) return;
|
|
@@ -4074,8 +4079,14 @@ function ComboboxInput({ className, ...props }) {
|
|
|
4074
4079
|
ref: captureRef,
|
|
4075
4080
|
className: partClass("combobox__input", className),
|
|
4076
4081
|
onFocus: (event) => {
|
|
4082
|
+
const wasFocused = focused.current;
|
|
4083
|
+
focused.current = true;
|
|
4077
4084
|
props.onFocus?.(event);
|
|
4078
|
-
if (policy.selectOnFocus && !policy.disabled) event.currentTarget.select();
|
|
4085
|
+
if (!wasFocused && policy.selectOnFocus && !policy.disabled) event.currentTarget.select();
|
|
4086
|
+
},
|
|
4087
|
+
onBlur: (event) => {
|
|
4088
|
+
focused.current = false;
|
|
4089
|
+
props.onBlur?.(event);
|
|
4079
4090
|
},
|
|
4080
4091
|
onPointerDown: (event) => {
|
|
4081
4092
|
props.onPointerDown?.(event);
|
|
@@ -4095,10 +4106,20 @@ function ComboboxInput({ className, ...props }) {
|
|
|
4095
4106
|
});
|
|
4096
4107
|
}
|
|
4097
4108
|
function ComboboxTrigger({ className, children, ...props }) {
|
|
4109
|
+
const policy = useContext(ComboboxPolicyContext);
|
|
4110
|
+
const state = useComboState();
|
|
4098
4111
|
return /* @__PURE__ */ jsx(Button$5, {
|
|
4099
4112
|
"aria-label": "Buka pilihan",
|
|
4100
4113
|
...props,
|
|
4101
4114
|
className: partClass("combobox__toggle", className),
|
|
4115
|
+
onPressStart: (event) => {
|
|
4116
|
+
props.onPressStart?.(event);
|
|
4117
|
+
if (event.pointerType !== "touch" && !state?.isOpen && policy.selectOnFocus && !policy.disabled) policy.inputRef.current?.select();
|
|
4118
|
+
},
|
|
4119
|
+
onPress: (event) => {
|
|
4120
|
+
props.onPress?.(event);
|
|
4121
|
+
if (event.pointerType === "touch" && !state?.isOpen && policy.selectOnFocus && !policy.disabled) policy.inputRef.current?.select();
|
|
4122
|
+
},
|
|
4102
4123
|
children: children ?? /* @__PURE__ */ jsx(ChevronIcon, { className: "select__icon" })
|
|
4103
4124
|
});
|
|
4104
4125
|
}
|
|
@@ -4230,7 +4251,7 @@ function CompactCombobox(props) {
|
|
|
4230
4251
|
},
|
|
4231
4252
|
children: /* @__PURE__ */ jsx(CloseIcon, { className: partClass("selection__close-icon", props.classNames?.clearIcon) })
|
|
4232
4253
|
}),
|
|
4233
|
-
/* @__PURE__ */ jsx(
|
|
4254
|
+
/* @__PURE__ */ jsx(ComboboxTrigger, {
|
|
4234
4255
|
className: partClass("combobox__toggle", props.classNames?.trigger),
|
|
4235
4256
|
"aria-label": props.toggleLabel ?? "Buka pilihan",
|
|
4236
4257
|
children: /* @__PURE__ */ jsx(ChevronIcon, { className: partClass("select__icon", props.classNames?.indicator) })
|
|
@@ -5148,7 +5169,7 @@ function DateRangePickerRoot(props) {
|
|
|
5148
5169
|
"data-readonly": isReadOnly || void 0,
|
|
5149
5170
|
children: [
|
|
5150
5171
|
/* @__PURE__ */ jsxs("header", {
|
|
5151
|
-
className: partClass("date-range__intro", props.classNames?.intro),
|
|
5172
|
+
className: partClass("date-range__intro temporal__sr-only", props.classNames?.intro),
|
|
5152
5173
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
5153
5174
|
id: `${id}-title`,
|
|
5154
5175
|
className: props.classNames?.title,
|
|
@@ -5159,25 +5180,9 @@ function DateRangePickerRoot(props) {
|
|
|
5159
5180
|
children: pending ? labels.incomplete : rangeText(nullableDraft, locale) || labels.incomplete
|
|
5160
5181
|
})]
|
|
5161
5182
|
}),
|
|
5162
|
-
/* @__PURE__ */
|
|
5183
|
+
/* @__PURE__ */ jsx("div", {
|
|
5163
5184
|
className: partClass("date-range__body", props.classNames?.body),
|
|
5164
|
-
children:
|
|
5165
|
-
className: partClass("date-range__presets", props.classNames?.presets),
|
|
5166
|
-
role: "group",
|
|
5167
|
-
"aria-label": labels.presets,
|
|
5168
|
-
children: presets.map((p) => /* @__PURE__ */ jsx("button", {
|
|
5169
|
-
type: "button",
|
|
5170
|
-
className: partClass("date-range__preset", props.classNames?.preset),
|
|
5171
|
-
disabled: isDisabled || isReadOnly || !!rangeError(p.value, props),
|
|
5172
|
-
"aria-pressed": !pending && draft.start === p.value.start && draft.end === p.value.end,
|
|
5173
|
-
onClick: () => {
|
|
5174
|
-
replaceDraft({ ...p.value });
|
|
5175
|
-
updateDraft({ ...p.value });
|
|
5176
|
-
setFocused(asDate(p.value.start));
|
|
5177
|
-
},
|
|
5178
|
-
children: p.label
|
|
5179
|
-
}, p.id))
|
|
5180
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
5185
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
5181
5186
|
className: partClass("date-range__main", props.classNames?.main),
|
|
5182
5187
|
children: [
|
|
5183
5188
|
showInputs && /* @__PURE__ */ jsx("div", {
|
|
@@ -5249,7 +5254,7 @@ function DateRangePickerRoot(props) {
|
|
|
5249
5254
|
})
|
|
5250
5255
|
})
|
|
5251
5256
|
]
|
|
5252
|
-
})
|
|
5257
|
+
})
|
|
5253
5258
|
}),
|
|
5254
5259
|
props.showActions !== false && /* @__PURE__ */ jsxs("footer", {
|
|
5255
5260
|
className: partClass("date-range__footer", props.classNames?.footer),
|
|
@@ -5259,38 +5264,18 @@ function DateRangePickerRoot(props) {
|
|
|
5259
5264
|
disabled: isDisabled || isReadOnly,
|
|
5260
5265
|
onClick: clearDraft,
|
|
5261
5266
|
children: labels.clear
|
|
5262
|
-
}), /* @__PURE__ */ jsxs("div", { children: [
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
};
|
|
5275
|
-
replaceDraft(next);
|
|
5276
|
-
updateDraft(next);
|
|
5277
|
-
},
|
|
5278
|
-
children: locale.startsWith("id") ? "Hari ini" : "Today"
|
|
5279
|
-
}),
|
|
5280
|
-
/* @__PURE__ */ jsx("button", {
|
|
5281
|
-
type: "button",
|
|
5282
|
-
className: partClass("button button--secondary button--sm", props.classNames?.cancelButton),
|
|
5283
|
-
onClick: () => changeOpen(false),
|
|
5284
|
-
children: labels.cancel
|
|
5285
|
-
}),
|
|
5286
|
-
props.commitMode !== "immediate" && /* @__PURE__ */ jsx("button", {
|
|
5287
|
-
type: "button",
|
|
5288
|
-
className: partClass("button button--primary button--sm", props.classNames?.applyButton),
|
|
5289
|
-
disabled: isDisabled || isReadOnly || !!errorCode,
|
|
5290
|
-
onClick: apply,
|
|
5291
|
-
children: labels.apply
|
|
5292
|
-
})
|
|
5293
|
-
] })]
|
|
5267
|
+
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("button", {
|
|
5268
|
+
type: "button",
|
|
5269
|
+
className: partClass("button button--secondary button--sm", props.classNames?.cancelButton),
|
|
5270
|
+
onClick: () => changeOpen(false),
|
|
5271
|
+
children: labels.cancel
|
|
5272
|
+
}), props.commitMode !== "immediate" && /* @__PURE__ */ jsx("button", {
|
|
5273
|
+
type: "button",
|
|
5274
|
+
className: partClass("button button--primary button--sm", props.classNames?.applyButton),
|
|
5275
|
+
disabled: isDisabled || isReadOnly || !!errorCode,
|
|
5276
|
+
onClick: apply,
|
|
5277
|
+
children: labels.apply
|
|
5278
|
+
})] })]
|
|
5294
5279
|
})
|
|
5295
5280
|
]
|
|
5296
5281
|
});
|