@chekinapp/ui 0.0.42 → 0.0.44

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.d.cts CHANGED
@@ -2349,6 +2349,7 @@ type TogglesProps<T extends string | number, M extends boolean | undefined = und
2349
2349
  loading?: boolean;
2350
2350
  disabled?: boolean;
2351
2351
  disabledItems?: SelectorOption<T>['value'][];
2352
+ readonlyItems?: SelectorOption<T>['value'][];
2352
2353
  readOnly?: boolean;
2353
2354
  label?: string;
2354
2355
  multiple?: M;
@@ -2359,7 +2360,7 @@ type TogglesProps<T extends string | number, M extends boolean | undefined = und
2359
2360
  value?: T;
2360
2361
  onChange?: (value: T, event: MouseEvent<HTMLButtonElement>) => void;
2361
2362
  });
2362
- declare function TogglesInternal<T extends string | number, M extends boolean | undefined = undefined>({ className, groupClassName, loading, disabled, value, options, variant, size, theme, onAnySelectorActive, onClick, onChange, readOnly, minSelected, disabledItems, label, multiple, }: TogglesProps<T, M>, ref: ForwardedRef<HTMLDivElement>): react_jsx_runtime.JSX.Element;
2363
+ declare function TogglesInternal<T extends string | number, M extends boolean | undefined = undefined>({ className, groupClassName, loading, disabled, value, options, variant, size, theme, onAnySelectorActive, onClick, onChange, readOnly, minSelected, disabledItems, readonlyItems, label, multiple, }: TogglesProps<T, M>, ref: ForwardedRef<HTMLDivElement>): react_jsx_runtime.JSX.Element;
2363
2364
  type TogglesForwardType = <T extends string | number, M extends boolean | undefined = true>(props: TogglesProps<T, M> & {
2364
2365
  ref?: ForwardedRef<HTMLDivElement>;
2365
2366
  }) => ReturnType<typeof TogglesInternal>;
package/dist/index.d.ts CHANGED
@@ -2349,6 +2349,7 @@ type TogglesProps<T extends string | number, M extends boolean | undefined = und
2349
2349
  loading?: boolean;
2350
2350
  disabled?: boolean;
2351
2351
  disabledItems?: SelectorOption<T>['value'][];
2352
+ readonlyItems?: SelectorOption<T>['value'][];
2352
2353
  readOnly?: boolean;
2353
2354
  label?: string;
2354
2355
  multiple?: M;
@@ -2359,7 +2360,7 @@ type TogglesProps<T extends string | number, M extends boolean | undefined = und
2359
2360
  value?: T;
2360
2361
  onChange?: (value: T, event: MouseEvent<HTMLButtonElement>) => void;
2361
2362
  });
2362
- declare function TogglesInternal<T extends string | number, M extends boolean | undefined = undefined>({ className, groupClassName, loading, disabled, value, options, variant, size, theme, onAnySelectorActive, onClick, onChange, readOnly, minSelected, disabledItems, label, multiple, }: TogglesProps<T, M>, ref: ForwardedRef<HTMLDivElement>): react_jsx_runtime.JSX.Element;
2363
+ declare function TogglesInternal<T extends string | number, M extends boolean | undefined = undefined>({ className, groupClassName, loading, disabled, value, options, variant, size, theme, onAnySelectorActive, onClick, onChange, readOnly, minSelected, disabledItems, readonlyItems, label, multiple, }: TogglesProps<T, M>, ref: ForwardedRef<HTMLDivElement>): react_jsx_runtime.JSX.Element;
2363
2364
  type TogglesForwardType = <T extends string | number, M extends boolean | undefined = true>(props: TogglesProps<T, M> & {
2364
2365
  ref?: ForwardedRef<HTMLDivElement>;
2365
2366
  }) => ReturnType<typeof TogglesInternal>;
package/dist/index.js CHANGED
@@ -728,7 +728,7 @@ var buttonVariants = cva3(
728
728
  );
729
729
 
730
730
  // src/button/Button.tsx
731
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
731
+ import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
732
732
  var Button = React4.forwardRef(
733
733
  ({
734
734
  className,
@@ -768,10 +768,10 @@ var Button = React4.forwardRef(
768
768
  disabled: isDisabled,
769
769
  className: classNames,
770
770
  ...props,
771
- children: loading ? /* @__PURE__ */ jsxs9("span", { className: "inline-flex items-center gap-1.5", children: [
771
+ children: loading ? /* @__PURE__ */ jsxs9(Fragment3, { children: [
772
772
  /* @__PURE__ */ jsx10(Spinner, {}),
773
773
  showLoadingLabel ? /* @__PURE__ */ jsx10("span", { children: loadingText || t("please_wait") }) : null
774
- ] }) : /* @__PURE__ */ jsx10("span", { className: "inline-flex items-center gap-2", children })
774
+ ] }) : children
775
775
  }
776
776
  );
777
777
  }
@@ -1483,7 +1483,7 @@ function ErrorMessage({ className, children, disabled }) {
1483
1483
  }
1484
1484
 
1485
1485
  // src/checkbox/CheckboxGroup.tsx
1486
- import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
1486
+ import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
1487
1487
  var ScrollAreaWrapper = ({
1488
1488
  children,
1489
1489
  scrollable,
@@ -1538,7 +1538,7 @@ var CheckboxGroup = React9.forwardRef(
1538
1538
  );
1539
1539
  const isAllSelected = selectedAvailableValues.length > 0 && selectedAvailableValues.length === availableOptions.length;
1540
1540
  return /* @__PURE__ */ jsxs15("div", { ref, className: cn("space-y-2", className), ...props, children: [
1541
- showSelectAll && /* @__PURE__ */ jsxs15(Fragment3, { children: [
1541
+ showSelectAll && /* @__PURE__ */ jsxs15(Fragment4, { children: [
1542
1542
  /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
1543
1543
  /* @__PURE__ */ jsx22(
1544
1544
  BaseCheckbox,
@@ -3292,10 +3292,10 @@ var CheckboxDropdownGroup = forwardRef16(
3292
3292
  CheckboxDropdownGroup.displayName = "CheckboxDropdownGroup";
3293
3293
 
3294
3294
  // src/dropdown-menu/CheckboxDropdownMultiGroup.tsx
3295
- import { forwardRef as forwardRef17, Fragment as Fragment4 } from "react";
3295
+ import { forwardRef as forwardRef17, Fragment as Fragment5 } from "react";
3296
3296
  import { jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
3297
3297
  var CheckboxDropdownMultiGroup = forwardRef17(({ groups, className = "", keepOpenOnSelect }, ref) => {
3298
- return /* @__PURE__ */ jsx36("div", { ref, className: cn("space-y-1", className), children: groups.map((group, index) => /* @__PURE__ */ jsxs27(Fragment4, { children: [
3298
+ return /* @__PURE__ */ jsx36("div", { ref, className: cn("space-y-1", className), children: groups.map((group, index) => /* @__PURE__ */ jsxs27(Fragment5, { children: [
3299
3299
  /* @__PURE__ */ jsxs27(DropdownMenuGroup, { children: [
3300
3300
  /* @__PURE__ */ jsx36(DropdownMenuLabel, { children: group.label }),
3301
3301
  group.multiple ? /* @__PURE__ */ jsx36(
@@ -3746,7 +3746,7 @@ import {
3746
3746
  VolumeX,
3747
3747
  X as X2
3748
3748
  } from "lucide-react";
3749
- import { Fragment as Fragment5, jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
3749
+ import { Fragment as Fragment6, jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
3750
3750
  function VideoPlayer({
3751
3751
  src,
3752
3752
  poster,
@@ -3942,7 +3942,7 @@ function VideoPlayer({
3942
3942
  onLoad: () => setIsLoading(false),
3943
3943
  title: title || "Vimeo video player"
3944
3944
  }
3945
- ) : /* @__PURE__ */ jsxs33(Fragment5, { children: [
3945
+ ) : /* @__PURE__ */ jsxs33(Fragment6, { children: [
3946
3946
  /* @__PURE__ */ jsxs33(
3947
3947
  "video",
3948
3948
  {
@@ -4434,7 +4434,7 @@ GridItems.displayName = "GridItems";
4434
4434
 
4435
4435
  // src/help-tooltip/HelpTooltip.tsx
4436
4436
  import { CircleQuestionMark } from "lucide-react";
4437
- import { Fragment as Fragment6, jsx as jsx59, jsxs as jsxs38 } from "react/jsx-runtime";
4437
+ import { Fragment as Fragment7, jsx as jsx59, jsxs as jsxs38 } from "react/jsx-runtime";
4438
4438
  function HelpTooltip({
4439
4439
  content,
4440
4440
  side,
@@ -4453,7 +4453,7 @@ function HelpTooltip({
4453
4453
  className
4454
4454
  );
4455
4455
  const triggerStyle = { width: size, height: size };
4456
- const triggerContent = /* @__PURE__ */ jsxs38(Fragment6, { children: [
4456
+ const triggerContent = /* @__PURE__ */ jsxs38(Fragment7, { children: [
4457
4457
  /* @__PURE__ */ jsx59(CircleQuestionMark, { "aria-hidden": "true", style: { width: size, height: size } }),
4458
4458
  /* @__PURE__ */ jsx59("span", { className: "absolute -left-0.5 -top-0.5 h-5 w-5" })
4459
4459
  ] });
@@ -4482,11 +4482,11 @@ function HelpTooltip({
4482
4482
 
4483
4483
  // src/icon/Icon.tsx
4484
4484
  import { forwardRef as forwardRef26, memo as memo2 } from "react";
4485
- import { Fragment as Fragment7, jsx as jsx60, jsxs as jsxs39 } from "react/jsx-runtime";
4485
+ import { Fragment as Fragment8, jsx as jsx60, jsxs as jsxs39 } from "react/jsx-runtime";
4486
4486
  var MissingIcon = forwardRef26(
4487
4487
  ({ size = 24, className = "", fallback = null, color, ...props }, ref) => {
4488
4488
  if (fallback) {
4489
- return /* @__PURE__ */ jsx60(Fragment7, { children: fallback });
4489
+ return /* @__PURE__ */ jsx60(Fragment8, { children: fallback });
4490
4490
  }
4491
4491
  return /* @__PURE__ */ jsxs39(
4492
4492
  "svg",
@@ -6743,7 +6743,7 @@ function useRadioOptions({ options, defaultValue, onChange }) {
6743
6743
  }
6744
6744
 
6745
6745
  // src/radio/Radio.tsx
6746
- import { Fragment as Fragment8, jsx as jsx86, jsxs as jsxs56 } from "react/jsx-runtime";
6746
+ import { Fragment as Fragment9, jsx as jsx86, jsxs as jsxs56 } from "react/jsx-runtime";
6747
6747
  var Radio = forwardRef37(
6748
6748
  ({ options, value, onChange, error, className = "", disabled = false, renderOption }, ref) => {
6749
6749
  const { selectedValue, handleValueChange } = useRadioOptions({
@@ -6757,7 +6757,7 @@ var Radio = forwardRef37(
6757
6757
  }
6758
6758
  return option.value === selectedValue;
6759
6759
  };
6760
- return /* @__PURE__ */ jsxs56(Fragment8, { children: [
6760
+ return /* @__PURE__ */ jsxs56(Fragment9, { children: [
6761
6761
  /* @__PURE__ */ jsx86(
6762
6762
  RadioGroup2,
6763
6763
  {
@@ -6774,7 +6774,7 @@ var Radio = forwardRef37(
6774
6774
  "flex cursor-pointer items-center gap-2",
6775
6775
  (disabled || option.disabled) && "cursor-default opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
6776
6776
  ),
6777
- children: renderOption ? renderOption({ option, isSelected: getIsSelected(option) }) : /* @__PURE__ */ jsxs56(Fragment8, { children: [
6777
+ children: renderOption ? renderOption({ option, isSelected: getIsSelected(option) }) : /* @__PURE__ */ jsxs56(Fragment9, { children: [
6778
6778
  /* @__PURE__ */ jsx86(
6779
6779
  RadioGroupItem,
6780
6780
  {
@@ -7298,7 +7298,7 @@ function SelectorButton({
7298
7298
  SelectorButton.displayName = "SelectorButton";
7299
7299
 
7300
7300
  // src/selectors/Selectors.tsx
7301
- import { Fragment as Fragment9, jsx as jsx97, jsxs as jsxs64 } from "react/jsx-runtime";
7301
+ import { Fragment as Fragment10, jsx as jsx97, jsxs as jsxs64 } from "react/jsx-runtime";
7302
7302
  var getValueArray = (value) => {
7303
7303
  if (value) {
7304
7304
  return Array.isArray(value) ? value : [value];
@@ -7355,7 +7355,7 @@ function SelectorsInternal({
7355
7355
  useEffect21(() => {
7356
7356
  onAnySelectorActive?.(isAnyActive);
7357
7357
  }, [isAnyActive, onAnySelectorActive]);
7358
- return /* @__PURE__ */ jsxs64(Fragment9, { children: [
7358
+ return /* @__PURE__ */ jsxs64(Fragment10, { children: [
7359
7359
  label && /* @__PURE__ */ jsx97("div", { className: "flex [&_span]:ml-[5px]", children: /* @__PURE__ */ jsx97("div", { className: "label box-border mb-1.5 min-h-5 select-none overflow-x-hidden text-ellipsis whitespace-nowrap text-left text-base font-normal text-[var(--chekin-color-brand-navy)]", children: label }) }),
7360
7360
  /* @__PURE__ */ jsx97(
7361
7361
  "div",
@@ -8952,7 +8952,12 @@ var ToggleGroupItem = React28.forwardRef(({ className, children, variant, size,
8952
8952
  ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
8953
8953
 
8954
8954
  // src/toggle-group/Toggles.tsx
8955
- import { forwardRef as forwardRef45, useEffect as useEffect23 } from "react";
8955
+ import {
8956
+ cloneElement as cloneElement3,
8957
+ forwardRef as forwardRef45,
8958
+ isValidElement as isValidElement3,
8959
+ useEffect as useEffect23
8960
+ } from "react";
8956
8961
  import { jsx as jsx116, jsxs as jsxs77 } from "react/jsx-runtime";
8957
8962
  var getValueArray2 = (value) => {
8958
8963
  if (value) {
@@ -8960,6 +8965,16 @@ var getValueArray2 = (value) => {
8960
8965
  }
8961
8966
  return [];
8962
8967
  };
8968
+ function getToggleContent(label, disabled, readOnly, active) {
8969
+ if (isValidElement3(label)) {
8970
+ return cloneElement3(label, {
8971
+ disabled,
8972
+ readOnly,
8973
+ active
8974
+ });
8975
+ }
8976
+ return label;
8977
+ }
8963
8978
  function TogglesInternal({
8964
8979
  className,
8965
8980
  groupClassName,
@@ -8976,6 +8991,7 @@ function TogglesInternal({
8976
8991
  readOnly,
8977
8992
  minSelected = 0,
8978
8993
  disabledItems,
8994
+ readonlyItems,
8979
8995
  label,
8980
8996
  multiple = true
8981
8997
  }, ref) {
@@ -9041,19 +9057,21 @@ function TogglesInternal({
9041
9057
  return /* @__PURE__ */ jsxs77("div", { ref, className, children: [
9042
9058
  label && /* @__PURE__ */ jsx116("div", { className: "mb-2", children: /* @__PURE__ */ jsx116("div", { className: "select-none text-base font-normal text-[var(--chekin-color-brand-navy)]", children: label }) }),
9043
9059
  /* @__PURE__ */ jsx116(ToggleGroup, { className: groupClassName, ...toggleGroupProps, children: options.map((option, index) => {
9044
- const isSelected = getValueArray2(value).includes(option.value);
9060
+ const isSelected = Boolean(
9061
+ getValueArray2(value).find((selectedValue) => selectedValue === option.value)
9062
+ );
9045
9063
  const isDisabled = disabled || disabledItems?.includes(option.value) || option.disabled;
9046
9064
  const isMinSelected = getValueArray2(value).length <= minSelected;
9047
- const isItemReadOnly = readOnly || isMinSelected && isSelected;
9065
+ const isItemReadOnly = readOnly || isMinSelected && isSelected || readonlyItems?.includes(option.value);
9048
9066
  return /* @__PURE__ */ jsx116(
9049
9067
  ToggleGroupItem,
9050
9068
  {
9051
9069
  value: String(option.value),
9052
9070
  disabled: isDisabled || isItemReadOnly || loading,
9053
9071
  onClick: handleItemClick(option),
9054
- children: option.label
9072
+ children: getToggleContent(option.label, isDisabled, isItemReadOnly, isSelected)
9055
9073
  },
9056
- `${option.value}-${index}`
9074
+ index
9057
9075
  );
9058
9076
  }) })
9059
9077
  ] });
@@ -9342,7 +9360,7 @@ var LABEL_PLACEMENT = /* @__PURE__ */ ((LABEL_PLACEMENT2) => {
9342
9360
  })(LABEL_PLACEMENT || {});
9343
9361
 
9344
9362
  // src/three-dots-loader/ThreeDotsLoader.tsx
9345
- import { Fragment as Fragment10, jsx as jsx122, jsxs as jsxs80 } from "react/jsx-runtime";
9363
+ import { Fragment as Fragment11, jsx as jsx122, jsxs as jsxs80 } from "react/jsx-runtime";
9346
9364
  function Dots({
9347
9365
  height,
9348
9366
  width,
@@ -9397,10 +9415,10 @@ function ThreeDotsLoader({
9397
9415
  "flex items-center justify-center gap-x-[13px] [&>div]:text-sm [&>div]:font-bold [&>div]:uppercase [&>div]:text-[#9696b9] [&>div]:opacity-50",
9398
9416
  className
9399
9417
  ),
9400
- children: labelPlacement === 0 /* right */ ? /* @__PURE__ */ jsxs80(Fragment10, { children: [
9418
+ children: labelPlacement === 0 /* right */ ? /* @__PURE__ */ jsxs80(Fragment11, { children: [
9401
9419
  dots,
9402
9420
  /* @__PURE__ */ jsx122("div", { children: label })
9403
- ] }) : /* @__PURE__ */ jsxs80(Fragment10, { children: [
9421
+ ] }) : /* @__PURE__ */ jsxs80(Fragment11, { children: [
9404
9422
  /* @__PURE__ */ jsx122("div", { children: label }),
9405
9423
  dots
9406
9424
  ] })
@@ -10338,7 +10356,7 @@ function FieldErrorMessage({
10338
10356
  }
10339
10357
 
10340
10358
  // src/field-trigger/FieldTrigger.tsx
10341
- import { Fragment as Fragment11, jsx as jsx129, jsxs as jsxs86 } from "react/jsx-runtime";
10359
+ import { Fragment as Fragment12, jsx as jsx129, jsxs as jsxs86 } from "react/jsx-runtime";
10342
10360
  var FieldTrigger = React32.forwardRef(
10343
10361
  ({
10344
10362
  as = "button",
@@ -10417,7 +10435,7 @@ var FieldTrigger = React32.forwardRef(
10417
10435
  disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : isAirbnbVariant ? "cursor-pointer" : "cursor-text",
10418
10436
  className
10419
10437
  );
10420
- const sharedContent = /* @__PURE__ */ jsxs86(Fragment11, { children: [
10438
+ const sharedContent = /* @__PURE__ */ jsxs86(Fragment12, { children: [
10421
10439
  /* @__PURE__ */ jsxs86(
10422
10440
  "span",
10423
10441
  {