@kazee-ds/react 0.10.0 → 0.10.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/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @kazee-ds/react
2
2
 
3
- Workspace additions: full-control Combobox anchoring, bounded popovers, Select-compatible sizing and opt-in focus/nonempty-selection policies. These additions are unpublished; see [Combobox and option-list documentation](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/select-and-combobox.md).
3
+ Unpublished patch **0.10.1** fixes Combobox repeated-focus/toggle text replacement (React) and locks popover width to the control (styles). Verified npm baseline: **0.10.0**. See [release status](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/versions.md).
4
4
 
5
5
  Accessible Kazee React components, including Toast, built on React Aria Components. Requires React/React DOM 19+ and ESM.
6
6
 
7
- Version **0.10.0** 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).
7
+ 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
8
 
9
9
 
10
10
  Version 0.5.3 ignores Toast shortcut events with missing or non-string keys. Normal shortcuts and scoped Escape dismissal remain available.
@@ -14,7 +14,7 @@ Version 0.5.3 ignores Toast shortcut events with missing or non-string keys. Nor
14
14
  Public npm installation requires no read token or login. Preserve the application's package manager and lockfile.
15
15
 
16
16
  ```sh
17
- npm install --save-exact @kazee-ds/react@0.10.0 @kazee-ds/styles@0.10.0
17
+ npm install --save-exact @kazee-ds/react@0.10.1 @kazee-ds/styles@0.10.1
18
18
  ```
19
19
 
20
20
  ## 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(Button$5, {
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) })