@chekinapp/ui 0.0.43 → 0.0.45

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.cjs CHANGED
@@ -156,7 +156,6 @@ __export(index_exports, {
156
156
  InputOTPGroup: () => InputOTPGroup,
157
157
  InputOTPSeparator: () => InputOTPSeparator,
158
158
  InputOTPSlot: () => InputOTPSlot,
159
- LABEL_PLACEMENT: () => LABEL_PLACEMENT,
160
159
  Label: () => Label,
161
160
  LargeModal: () => LargeModal,
162
161
  LearnMoreButton: () => LearnMoreButton,
@@ -1109,10 +1108,10 @@ var Button = React4.forwardRef(
1109
1108
  disabled: isDisabled,
1110
1109
  className: classNames,
1111
1110
  ...props,
1112
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
1111
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1113
1112
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, {}),
1114
1113
  showLoadingLabel ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: loadingText || t("please_wait") }) : null
1115
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "inline-flex items-center gap-2", children })
1114
+ ] }) : children
1116
1115
  }
1117
1116
  );
1118
1117
  }
@@ -9270,6 +9269,16 @@ var getValueArray2 = (value) => {
9270
9269
  }
9271
9270
  return [];
9272
9271
  };
9272
+ function getToggleContent(label, disabled, readOnly, active) {
9273
+ if ((0, import_react66.isValidElement)(label)) {
9274
+ return (0, import_react66.cloneElement)(label, {
9275
+ disabled,
9276
+ readOnly,
9277
+ active
9278
+ });
9279
+ }
9280
+ return label;
9281
+ }
9273
9282
  function TogglesInternal({
9274
9283
  className,
9275
9284
  groupClassName,
@@ -9286,6 +9295,7 @@ function TogglesInternal({
9286
9295
  readOnly,
9287
9296
  minSelected = 0,
9288
9297
  disabledItems,
9298
+ readonlyItems,
9289
9299
  label,
9290
9300
  multiple = true
9291
9301
  }, ref) {
@@ -9351,19 +9361,21 @@ function TogglesInternal({
9351
9361
  return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { ref, className, children: [
9352
9362
  label && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: "mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: "select-none text-base font-normal text-[var(--chekin-color-brand-navy)]", children: label }) }),
9353
9363
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(ToggleGroup, { className: groupClassName, ...toggleGroupProps, children: options.map((option, index) => {
9354
- const isSelected = getValueArray2(value).includes(option.value);
9364
+ const isSelected = Boolean(
9365
+ getValueArray2(value).find((selectedValue) => selectedValue === option.value)
9366
+ );
9355
9367
  const isDisabled = disabled || disabledItems?.includes(option.value) || option.disabled;
9356
9368
  const isMinSelected = getValueArray2(value).length <= minSelected;
9357
- const isItemReadOnly = readOnly || isMinSelected && isSelected;
9369
+ const isItemReadOnly = readOnly || isMinSelected && isSelected || readonlyItems?.includes(option.value);
9358
9370
  return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
9359
9371
  ToggleGroupItem,
9360
9372
  {
9361
9373
  value: String(option.value),
9362
9374
  disabled: isDisabled || isItemReadOnly || loading,
9363
9375
  onClick: handleItemClick(option),
9364
- children: option.label
9376
+ children: getToggleContent(option.label, isDisabled, isItemReadOnly, isSelected)
9365
9377
  },
9366
- `${option.value}-${index}`
9378
+ index
9367
9379
  );
9368
9380
  }) })
9369
9381
  ] });
@@ -9644,13 +9656,6 @@ var Textarea = (0, import_react67.forwardRef)(
9644
9656
  );
9645
9657
  Textarea.displayName = "Textarea";
9646
9658
 
9647
- // src/three-dots-loader/constants.ts
9648
- var LABEL_PLACEMENT = /* @__PURE__ */ ((LABEL_PLACEMENT2) => {
9649
- LABEL_PLACEMENT2[LABEL_PLACEMENT2["right"] = 0] = "right";
9650
- LABEL_PLACEMENT2[LABEL_PLACEMENT2["left"] = 1] = "left";
9651
- return LABEL_PLACEMENT2;
9652
- })(LABEL_PLACEMENT || {});
9653
-
9654
9659
  // src/three-dots-loader/ThreeDotsLoader.tsx
9655
9660
  var import_jsx_runtime124 = require("react/jsx-runtime");
9656
9661
  function Dots({
@@ -9696,7 +9701,7 @@ function ThreeDotsLoader({
9696
9701
  color = "#E3E3E3FF",
9697
9702
  label = "",
9698
9703
  className,
9699
- labelPlacement = 0 /* right */
9704
+ labelPlacement = "right"
9700
9705
  }) {
9701
9706
  const dots = /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Dots, { color, height, width });
9702
9707
  if (label) {
@@ -9707,7 +9712,7 @@ function ThreeDotsLoader({
9707
9712
  "flex items-center justify-center gap-x-[13px] [&>div]:text-sm [&>div]:font-bold [&>div]:uppercase [&>div]:text-[#9696b9] [&>div]:opacity-50",
9708
9713
  className
9709
9714
  ),
9710
- children: labelPlacement === 0 /* right */ ? /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
9715
+ children: labelPlacement === "right" ? /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
9711
9716
  dots,
9712
9717
  /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { children: label })
9713
9718
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
@@ -13120,7 +13125,6 @@ function getNextEnabledIndex(options, startIndex, step) {
13120
13125
  InputOTPGroup,
13121
13126
  InputOTPSeparator,
13122
13127
  InputOTPSlot,
13123
- LABEL_PLACEMENT,
13124
13128
  Label,
13125
13129
  LargeModal,
13126
13130
  LearnMoreButton,