@cimplify/sdk 0.11.0 → 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/dist/react.js CHANGED
@@ -9,6 +9,9 @@ var tailwindMerge = require('tailwind-merge');
9
9
  var radioGroup = require('@base-ui/react/radio-group');
10
10
  var radio = require('@base-ui/react/radio');
11
11
  var checkbox = require('@base-ui/react/checkbox');
12
+ var field = require('@base-ui/react/field');
13
+ var input = require('@base-ui/react/input');
14
+ var tabs = require('@base-ui/react/tabs');
12
15
 
13
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
17
 
@@ -9172,33 +9175,45 @@ function ProductImageGallery({
9172
9175
  )
9173
9176
  }
9174
9177
  ),
9175
- normalizedImages.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-image-gallery-thumbnails": true, style: { display: "flex", gap: "0.5rem", marginTop: "0.75rem" }, children: normalizedImages.map((image, index) => /* @__PURE__ */ jsxRuntime.jsx(
9176
- "button",
9178
+ normalizedImages.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
9179
+ radioGroup.RadioGroup,
9177
9180
  {
9178
- type: "button",
9179
- onClick: () => setSelectedImage(index),
9180
- "aria-selected": selectedImage === index,
9181
- "data-cimplify-image-gallery-thumb": true,
9182
- "data-selected": selectedImage === index || void 0,
9183
- style: {
9184
- width: "4rem",
9185
- height: "4rem",
9186
- overflow: "hidden",
9187
- padding: 0,
9188
- border: "none",
9189
- cursor: "pointer"
9190
- },
9191
- children: /* @__PURE__ */ jsxRuntime.jsx(
9192
- "img",
9193
- {
9194
- src: image,
9195
- alt: "",
9196
- style: { width: "100%", height: "100%", objectFit: "cover" }
9197
- }
9198
- )
9199
- },
9200
- `${image}-${index}`
9201
- )) })
9181
+ "aria-label": `${productName} image thumbnails`,
9182
+ value: String(selectedImage),
9183
+ onValueChange: (value) => setSelectedImage(Number(value)),
9184
+ "data-cimplify-image-gallery-thumbnails": true,
9185
+ style: { display: "flex", gap: "0.5rem", marginTop: "0.75rem" },
9186
+ children: normalizedImages.map((image, index) => {
9187
+ const isSelected = selectedImage === index;
9188
+ return /* @__PURE__ */ jsxRuntime.jsx(
9189
+ radio.Radio.Root,
9190
+ {
9191
+ value: String(index),
9192
+ render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button" }),
9193
+ "data-cimplify-image-gallery-thumb": true,
9194
+ "data-selected": isSelected || void 0,
9195
+ style: {
9196
+ width: "4rem",
9197
+ height: "4rem",
9198
+ overflow: "hidden",
9199
+ padding: 0,
9200
+ border: "none",
9201
+ cursor: "pointer"
9202
+ },
9203
+ children: /* @__PURE__ */ jsxRuntime.jsx(
9204
+ "img",
9205
+ {
9206
+ src: image,
9207
+ alt: "",
9208
+ style: { width: "100%", height: "100%", objectFit: "cover" }
9209
+ }
9210
+ )
9211
+ },
9212
+ `${image}-${index}`
9213
+ );
9214
+ })
9215
+ }
9216
+ )
9202
9217
  ] });
9203
9218
  }
9204
9219
  function CartLineItemRow({
@@ -9809,6 +9824,26 @@ function ProductGrid({
9809
9824
  )
9810
9825
  ] });
9811
9826
  }
9827
+ var SearchIcon = () => /* @__PURE__ */ jsxRuntime.jsxs(
9828
+ "svg",
9829
+ {
9830
+ xmlns: "http://www.w3.org/2000/svg",
9831
+ width: "16",
9832
+ height: "16",
9833
+ viewBox: "0 0 24 24",
9834
+ fill: "none",
9835
+ stroke: "currentColor",
9836
+ strokeWidth: "2",
9837
+ strokeLinecap: "round",
9838
+ strokeLinejoin: "round",
9839
+ "aria-hidden": "true",
9840
+ "data-cimplify-search-icon": true,
9841
+ children: [
9842
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11", cy: "11", r: "8" }),
9843
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
9844
+ ]
9845
+ }
9846
+ );
9812
9847
  function SearchInput({
9813
9848
  placeholder = "Search products...",
9814
9849
  searchOptions,
@@ -9819,42 +9854,58 @@ function SearchInput({
9819
9854
  classNames
9820
9855
  }) {
9821
9856
  const { results, isLoading, query, setQuery, clear } = useSearch(searchOptions);
9822
- const handleChange = React3.useCallback(
9823
- (e) => {
9824
- setQuery(e.target.value);
9857
+ const handleValueChange = React3.useCallback(
9858
+ (value) => {
9859
+ setQuery(value);
9825
9860
  },
9826
9861
  [setQuery]
9827
9862
  );
9828
9863
  return /* @__PURE__ */ jsxRuntime.jsxs(
9829
- "div",
9864
+ field.Field.Root,
9830
9865
  {
9831
9866
  "data-cimplify-search": true,
9832
9867
  className: cn(className, classNames?.root),
9833
9868
  style: { position: "relative" },
9834
9869
  children: [
9835
- /* @__PURE__ */ jsxRuntime.jsx(
9836
- "input",
9837
- {
9838
- type: "search",
9839
- value: query,
9840
- onChange: handleChange,
9841
- placeholder,
9842
- "data-cimplify-search-input": true,
9843
- className: classNames?.input,
9844
- "aria-label": "Search products"
9845
- }
9846
- ),
9847
- query.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
9848
- "button",
9849
- {
9850
- type: "button",
9851
- onClick: clear,
9852
- "data-cimplify-search-clear": true,
9853
- className: classNames?.clearButton,
9854
- "aria-label": "Clear search",
9855
- children: "\xD7"
9856
- }
9857
- ),
9870
+ /* @__PURE__ */ jsxRuntime.jsx(field.Field.Label, { className: "sr-only", children: "Search products" }),
9871
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", display: "flex", alignItems: "center" }, children: [
9872
+ /* @__PURE__ */ jsxRuntime.jsx(
9873
+ "span",
9874
+ {
9875
+ "data-cimplify-search-icon-wrapper": true,
9876
+ style: {
9877
+ position: "absolute",
9878
+ left: "0.5rem",
9879
+ pointerEvents: "none",
9880
+ display: "flex",
9881
+ alignItems: "center"
9882
+ },
9883
+ children: /* @__PURE__ */ jsxRuntime.jsx(SearchIcon, {})
9884
+ }
9885
+ ),
9886
+ /* @__PURE__ */ jsxRuntime.jsx(
9887
+ input.Input,
9888
+ {
9889
+ type: "search",
9890
+ value: query,
9891
+ onValueChange: handleValueChange,
9892
+ placeholder,
9893
+ "data-cimplify-search-input": true,
9894
+ className: classNames?.input
9895
+ }
9896
+ ),
9897
+ query.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
9898
+ "button",
9899
+ {
9900
+ type: "button",
9901
+ onClick: clear,
9902
+ "data-cimplify-search-clear": true,
9903
+ className: classNames?.clearButton,
9904
+ "aria-label": "Clear search",
9905
+ children: "\xD7"
9906
+ }
9907
+ )
9908
+ ] }),
9858
9909
  showResults && query.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-search-results": true, className: classNames?.results, children: [
9859
9910
  isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-search-loading": true, className: classNames?.loading, "aria-busy": "true", children: "Searching..." }),
9860
9911
  !isLoading && results.length === 0 && query.length >= 2 && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-search-empty": true, className: classNames?.empty, children: "No results found" }),
@@ -9874,6 +9925,7 @@ function SearchInput({
9874
9925
  }
9875
9926
  );
9876
9927
  }
9928
+ var ALL_VALUE = "__all__";
9877
9929
  function CategoryFilter({
9878
9930
  selectedId = null,
9879
9931
  onSelect,
@@ -9883,9 +9935,9 @@ function CategoryFilter({
9883
9935
  classNames
9884
9936
  }) {
9885
9937
  const { categories, isLoading } = useCategories();
9886
- const handleSelect = React3.useCallback(
9887
- (id) => {
9888
- onSelect(id);
9938
+ const handleValueChange = React3.useCallback(
9939
+ (value) => {
9940
+ onSelect(value === ALL_VALUE ? null : String(value));
9889
9941
  },
9890
9942
  [onSelect]
9891
9943
  );
@@ -9899,45 +9951,45 @@ function CategoryFilter({
9899
9951
  }
9900
9952
  );
9901
9953
  }
9902
- return /* @__PURE__ */ jsxRuntime.jsxs(
9903
- "div",
9954
+ return /* @__PURE__ */ jsxRuntime.jsx(
9955
+ tabs.Tabs.Root,
9904
9956
  {
9905
- "data-cimplify-category-filter": true,
9906
- className: cn(className, classNames?.root),
9907
- role: "tablist",
9908
- "aria-label": "Filter by category",
9909
- children: [
9910
- /* @__PURE__ */ jsxRuntime.jsx(
9911
- "button",
9912
- {
9913
- type: "button",
9914
- role: "tab",
9915
- "aria-selected": selectedId === null,
9916
- onClick: () => handleSelect(null),
9917
- "data-cimplify-category-filter-item": true,
9918
- "data-selected": selectedId === null || void 0,
9919
- className: cn(classNames?.item, classNames?.allButton),
9920
- children: allLabel
9921
- }
9922
- ),
9923
- categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs(
9924
- "button",
9925
- {
9926
- type: "button",
9927
- role: "tab",
9928
- "aria-selected": selectedId === category.id,
9929
- onClick: () => handleSelect(category.id),
9930
- "data-cimplify-category-filter-item": true,
9931
- "data-selected": selectedId === category.id || void 0,
9932
- className: classNames?.item,
9933
- children: [
9934
- category.name,
9935
- showCounts && category.product_count != null && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-category-count": true, className: classNames?.count, children: category.product_count })
9936
- ]
9937
- },
9938
- category.id
9939
- ))
9940
- ]
9957
+ value: selectedId ?? ALL_VALUE,
9958
+ onValueChange: handleValueChange,
9959
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
9960
+ tabs.Tabs.List,
9961
+ {
9962
+ "data-cimplify-category-filter": true,
9963
+ "aria-label": "Filter by category",
9964
+ className: cn(className, classNames?.root),
9965
+ children: [
9966
+ /* @__PURE__ */ jsxRuntime.jsx(
9967
+ tabs.Tabs.Tab,
9968
+ {
9969
+ value: ALL_VALUE,
9970
+ "data-cimplify-category-filter-item": true,
9971
+ "data-selected": selectedId === null || void 0,
9972
+ className: cn(classNames?.item, classNames?.allButton),
9973
+ children: allLabel
9974
+ }
9975
+ ),
9976
+ categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs(
9977
+ tabs.Tabs.Tab,
9978
+ {
9979
+ value: category.id,
9980
+ "data-cimplify-category-filter-item": true,
9981
+ "data-selected": selectedId === category.id || void 0,
9982
+ className: classNames?.item,
9983
+ children: [
9984
+ category.name,
9985
+ showCounts && category.product_count != null && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-category-count": true, className: classNames?.count, children: category.product_count })
9986
+ ]
9987
+ },
9988
+ category.id
9989
+ ))
9990
+ ]
9991
+ }
9992
+ )
9941
9993
  }
9942
9994
  );
9943
9995
  }
@@ -9980,50 +10032,74 @@ function DiscountInput({
9980
10032
  [handleApply]
9981
10033
  );
9982
10034
  const isApplied = appliedValidation?.is_eligible === true;
9983
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-discount": true, className: cn(className, classNames?.root), children: [
9984
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-discount-form": true, children: [
9985
- /* @__PURE__ */ jsxRuntime.jsx(
9986
- "input",
9987
- {
9988
- type: "text",
9989
- value: code,
9990
- onChange: (e) => setCode(e.target.value),
9991
- onKeyDown: handleKeyDown,
9992
- placeholder,
9993
- disabled: isApplied,
9994
- "data-cimplify-discount-input": true,
9995
- className: classNames?.input,
9996
- "aria-label": "Discount code"
9997
- }
9998
- ),
9999
- isApplied ? /* @__PURE__ */ jsxRuntime.jsx(
10000
- "button",
10001
- {
10002
- type: "button",
10003
- onClick: handleClear,
10004
- "data-cimplify-discount-clear": true,
10005
- className: classNames?.button,
10006
- children: "Remove"
10007
- }
10008
- ) : /* @__PURE__ */ jsxRuntime.jsx(
10009
- "button",
10010
- {
10011
- type: "button",
10012
- onClick: handleApply,
10013
- disabled: isValidating || code.trim().length === 0,
10014
- "data-cimplify-discount-apply": true,
10015
- className: classNames?.button,
10016
- children: isValidating ? "Checking..." : "Apply"
10017
- }
10018
- )
10019
- ] }),
10020
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-discount-error": true, className: classNames?.error, children: error.message }),
10021
- appliedValidation && !appliedValidation.is_eligible && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-discount-error": true, className: classNames?.error, children: appliedValidation.ineligibility_reason ?? "This code is not valid." }),
10022
- isApplied && appliedValidation.discount_amount && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-discount-success": true, className: classNames?.success, children: [
10023
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount applied" }),
10024
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: appliedValidation.discount_amount, prefix: "-" })
10025
- ] })
10026
- ] });
10035
+ const hasError = !!error || !!appliedValidation && !appliedValidation.is_eligible;
10036
+ const errorMessage = error ? error.message : appliedValidation && !appliedValidation.is_eligible ? appliedValidation.ineligibility_reason ?? "This code is not valid." : void 0;
10037
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10038
+ field.Field.Root,
10039
+ {
10040
+ "data-cimplify-discount": true,
10041
+ invalid: hasError,
10042
+ disabled: isApplied,
10043
+ className: cn(className, classNames?.root),
10044
+ children: [
10045
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-discount-form": true, children: [
10046
+ /* @__PURE__ */ jsxRuntime.jsx(
10047
+ input.Input,
10048
+ {
10049
+ type: "text",
10050
+ value: code,
10051
+ onValueChange: (value) => setCode(value),
10052
+ onKeyDown: handleKeyDown,
10053
+ placeholder,
10054
+ "data-cimplify-discount-input": true,
10055
+ className: classNames?.input,
10056
+ "aria-label": "Discount code"
10057
+ }
10058
+ ),
10059
+ isApplied ? /* @__PURE__ */ jsxRuntime.jsx(
10060
+ "button",
10061
+ {
10062
+ type: "button",
10063
+ onClick: handleClear,
10064
+ "data-cimplify-discount-clear": true,
10065
+ className: classNames?.button,
10066
+ children: "Remove"
10067
+ }
10068
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
10069
+ "button",
10070
+ {
10071
+ type: "button",
10072
+ onClick: handleApply,
10073
+ disabled: isValidating || code.trim().length === 0,
10074
+ "data-cimplify-discount-apply": true,
10075
+ className: classNames?.button,
10076
+ children: isValidating ? "Checking..." : "Apply"
10077
+ }
10078
+ )
10079
+ ] }),
10080
+ hasError && errorMessage && /* @__PURE__ */ jsxRuntime.jsx(
10081
+ field.Field.Error,
10082
+ {
10083
+ match: true,
10084
+ "data-cimplify-discount-error": true,
10085
+ className: classNames?.error,
10086
+ children: errorMessage
10087
+ }
10088
+ ),
10089
+ isApplied && appliedValidation.discount_amount && /* @__PURE__ */ jsxRuntime.jsxs(
10090
+ field.Field.Description,
10091
+ {
10092
+ "data-cimplify-discount-success": true,
10093
+ className: classNames?.success,
10094
+ children: [
10095
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount applied" }),
10096
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: appliedValidation.discount_amount, prefix: "-" })
10097
+ ]
10098
+ }
10099
+ )
10100
+ ]
10101
+ }
10102
+ );
10027
10103
  }
10028
10104
  function CategoryGrid({
10029
10105
  categories: categoriesProp,
@@ -10470,6 +10546,9 @@ function formatTime(timeStr) {
10470
10546
  }
10471
10547
  return timeStr;
10472
10548
  }
10549
+ function slotToValue(slot) {
10550
+ return `${slot.start_time}|${slot.end_time}`;
10551
+ }
10473
10552
  function SlotPicker({
10474
10553
  slots: slotsProp,
10475
10554
  serviceId,
@@ -10514,29 +10593,49 @@ function SlotPicker({
10514
10593
  );
10515
10594
  }
10516
10595
  const groups = groupByTimeOfDay ? groupSlots(slots) : [{ label: "", slots }];
10517
- return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-slot-picker": true, className: cn(className, classNames?.root), children: groups.map((group) => /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-slot-group": true, className: classNames?.group, children: [
10518
- group.label && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-slot-group-label": true, className: classNames?.groupLabel, children: group.label }),
10519
- group.slots.map((slot) => {
10520
- const isSelected = selectedSlot?.start_time === slot.start_time && selectedSlot?.end_time === slot.end_time;
10521
- return /* @__PURE__ */ jsxRuntime.jsxs(
10522
- "button",
10523
- {
10524
- type: "button",
10525
- disabled: !slot.is_available,
10526
- onClick: () => slot.is_available && onSlotSelect?.(slot),
10527
- "data-cimplify-slot": true,
10528
- "data-selected": isSelected || void 0,
10529
- "data-unavailable": !slot.is_available || void 0,
10530
- className: classNames?.slot,
10531
- children: [
10532
- /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-slot-time": true, className: classNames?.slotTime, children: formatTime(slot.start_time) }),
10533
- showPrice && slot.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-slot-price": true, className: classNames?.slotPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: slot.price }) })
10534
- ]
10535
- },
10536
- `${slot.start_time}-${slot.end_time}`
10537
- );
10538
- })
10539
- ] }, group.label || "all")) });
10596
+ const slotsByValue = /* @__PURE__ */ new Map();
10597
+ for (const slot of slots) {
10598
+ slotsByValue.set(slotToValue(slot), slot);
10599
+ }
10600
+ const selectedValue = selectedSlot ? slotToValue(selectedSlot) : "";
10601
+ return /* @__PURE__ */ jsxRuntime.jsx(
10602
+ radioGroup.RadioGroup,
10603
+ {
10604
+ "data-cimplify-slot-picker": true,
10605
+ className: cn(className, classNames?.root),
10606
+ value: selectedValue,
10607
+ onValueChange: (value) => {
10608
+ const slot = slotsByValue.get(value);
10609
+ if (slot?.is_available) {
10610
+ onSlotSelect?.(slot);
10611
+ }
10612
+ },
10613
+ children: groups.map((group) => /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-slot-group": true, className: classNames?.group, children: [
10614
+ group.label && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-slot-group-label": true, className: classNames?.groupLabel, children: group.label }),
10615
+ group.slots.map((slot) => {
10616
+ const value = slotToValue(slot);
10617
+ const isSelected = selectedSlot?.start_time === slot.start_time && selectedSlot?.end_time === slot.end_time;
10618
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10619
+ radio.Radio.Root,
10620
+ {
10621
+ value,
10622
+ disabled: !slot.is_available,
10623
+ render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button" }),
10624
+ "data-cimplify-slot": true,
10625
+ "data-selected": isSelected || void 0,
10626
+ "data-unavailable": !slot.is_available || void 0,
10627
+ className: classNames?.slot,
10628
+ children: [
10629
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-slot-time": true, className: classNames?.slotTime, children: formatTime(slot.start_time) }),
10630
+ showPrice && slot.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-slot-price": true, className: classNames?.slotPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: slot.price }) })
10631
+ ]
10632
+ },
10633
+ value
10634
+ );
10635
+ })
10636
+ ] }, group.label || "all"))
10637
+ }
10638
+ );
10540
10639
  }
10541
10640
  function formatDate(dateStr) {
10542
10641
  const date = /* @__PURE__ */ new Date(dateStr + "T00:00:00");
@@ -10599,8 +10698,10 @@ function DateSlotPicker({
10599
10698
  const handleNext = React3.useCallback(() => {
10600
10699
  setOffset((prev) => prev + daysToShow);
10601
10700
  }, [daysToShow]);
10602
- const handleDateSelect = React3.useCallback((date) => {
10603
- setSelectedDate(date);
10701
+ const handleDateChange = React3.useCallback((value) => {
10702
+ if (typeof value === "string") {
10703
+ setSelectedDate(value);
10704
+ }
10604
10705
  }, []);
10605
10706
  const handleSlotSelect = React3.useCallback(
10606
10707
  (slot) => {
@@ -10608,72 +10709,79 @@ function DateSlotPicker({
10608
10709
  },
10609
10710
  [onSlotSelect, selectedDate]
10610
10711
  );
10611
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-date-slot-picker": true, className: cn(className, classNames?.root), children: [
10612
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-date-nav": true, className: classNames?.nav, children: [
10613
- /* @__PURE__ */ jsxRuntime.jsx(
10614
- "button",
10615
- {
10616
- type: "button",
10617
- onClick: handlePrev,
10618
- disabled: offset === 0,
10619
- "data-cimplify-date-nav-prev": true,
10620
- className: classNames?.navButton,
10621
- children: "\u2190"
10622
- }
10623
- ),
10624
- /* @__PURE__ */ jsxRuntime.jsx(
10625
- "button",
10626
- {
10627
- type: "button",
10628
- onClick: handleNext,
10629
- "data-cimplify-date-nav-next": true,
10630
- className: classNames?.navButton,
10631
- children: "\u2192"
10632
- }
10633
- )
10634
- ] }),
10635
- /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-date-strip": true, className: classNames?.dateStrip, role: "tablist", children: dateRange.dates.map((date) => {
10636
- const dayInfo = availabilityMap.get(date);
10637
- const hasAvailability = dayInfo?.has_availability !== false;
10638
- const isSelected = selectedDate === date;
10639
- return /* @__PURE__ */ jsxRuntime.jsx(
10640
- "button",
10641
- {
10642
- type: "button",
10643
- role: "tab",
10644
- "aria-selected": isSelected,
10645
- onClick: () => handleDateSelect(date),
10646
- "data-cimplify-date-button": true,
10647
- "data-selected": isSelected || void 0,
10648
- "data-available": hasAvailability || void 0,
10649
- "data-fully-booked": !hasAvailability || void 0,
10650
- className: classNames?.dateButton,
10651
- children: formatDate(date)
10652
- },
10653
- date
10654
- );
10655
- }) }),
10656
- availabilityLoading && /* @__PURE__ */ jsxRuntime.jsx(
10657
- "div",
10658
- {
10659
- "data-cimplify-date-slot-loading": true,
10660
- "aria-busy": "true",
10661
- className: classNames?.loading
10662
- }
10663
- ),
10664
- /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-date-slots": true, className: classNames?.slots, children: /* @__PURE__ */ jsxRuntime.jsx(
10665
- SlotPicker,
10666
- {
10667
- serviceId,
10668
- date: selectedDate,
10669
- participantCount,
10670
- selectedSlot,
10671
- onSlotSelect: handleSlotSelect,
10672
- showPrice
10673
- }
10674
- ) })
10675
- ] });
10712
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10713
+ tabs.Tabs.Root,
10714
+ {
10715
+ value: selectedDate,
10716
+ onValueChange: handleDateChange,
10717
+ "data-cimplify-date-slot-picker": true,
10718
+ className: cn(className, classNames?.root),
10719
+ children: [
10720
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-date-nav": true, className: classNames?.nav, children: [
10721
+ /* @__PURE__ */ jsxRuntime.jsx(
10722
+ "button",
10723
+ {
10724
+ type: "button",
10725
+ onClick: handlePrev,
10726
+ disabled: offset === 0,
10727
+ "data-cimplify-date-nav-prev": true,
10728
+ className: classNames?.navButton,
10729
+ children: "\u2190"
10730
+ }
10731
+ ),
10732
+ /* @__PURE__ */ jsxRuntime.jsx(
10733
+ "button",
10734
+ {
10735
+ type: "button",
10736
+ onClick: handleNext,
10737
+ "data-cimplify-date-nav-next": true,
10738
+ className: classNames?.navButton,
10739
+ children: "\u2192"
10740
+ }
10741
+ )
10742
+ ] }),
10743
+ /* @__PURE__ */ jsxRuntime.jsx(tabs.Tabs.List, { "data-cimplify-date-strip": true, className: classNames?.dateStrip, children: dateRange.dates.map((date) => {
10744
+ const dayInfo = availabilityMap.get(date);
10745
+ const hasAvailability = dayInfo?.has_availability !== false;
10746
+ const isSelected = selectedDate === date;
10747
+ return /* @__PURE__ */ jsxRuntime.jsx(
10748
+ tabs.Tabs.Tab,
10749
+ {
10750
+ value: date,
10751
+ "data-cimplify-date-button": true,
10752
+ "data-selected": isSelected || void 0,
10753
+ "data-available": hasAvailability || void 0,
10754
+ "data-fully-booked": !hasAvailability || void 0,
10755
+ className: classNames?.dateButton,
10756
+ children: formatDate(date)
10757
+ },
10758
+ date
10759
+ );
10760
+ }) }),
10761
+ availabilityLoading && /* @__PURE__ */ jsxRuntime.jsx(
10762
+ "div",
10763
+ {
10764
+ "data-cimplify-date-slot-loading": true,
10765
+ "aria-busy": "true",
10766
+ className: classNames?.loading
10767
+ }
10768
+ ),
10769
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-date-slots": true, className: classNames?.slots, children: /* @__PURE__ */ jsxRuntime.jsx(
10770
+ SlotPicker,
10771
+ {
10772
+ serviceId,
10773
+ date: selectedDate,
10774
+ participantCount,
10775
+ selectedSlot,
10776
+ onSlotSelect: handleSlotSelect,
10777
+ showPrice
10778
+ }
10779
+ ) })
10780
+ ]
10781
+ }
10782
+ );
10676
10783
  }
10784
+ var ANY_VALUE = "__any__";
10677
10785
  function StaffPicker({
10678
10786
  staff,
10679
10787
  selectedStaffId,
@@ -10683,44 +10791,56 @@ function StaffPicker({
10683
10791
  className,
10684
10792
  classNames
10685
10793
  }) {
10686
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-staff-picker": true, className: cn(className, classNames?.root), children: [
10687
- showAnyOption && /* @__PURE__ */ jsxRuntime.jsx(
10688
- "button",
10689
- {
10690
- type: "button",
10691
- onClick: () => onStaffSelect?.(null),
10692
- "data-cimplify-staff-option": true,
10693
- "data-selected": selectedStaffId === null || void 0,
10694
- "data-any": true,
10695
- className: classNames?.option,
10696
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-staff-name": true, className: classNames?.name, children: anyLabel })
10697
- }
10698
- ),
10699
- staff.map((member) => /* @__PURE__ */ jsxRuntime.jsxs(
10700
- "button",
10701
- {
10702
- type: "button",
10703
- onClick: () => onStaffSelect?.(member.id),
10704
- "data-cimplify-staff-option": true,
10705
- "data-selected": selectedStaffId === member.id || void 0,
10706
- className: classNames?.option,
10707
- children: [
10708
- member.avatar_url && /* @__PURE__ */ jsxRuntime.jsx(
10709
- "img",
10710
- {
10711
- src: member.avatar_url,
10712
- alt: member.name,
10713
- "data-cimplify-staff-avatar": true,
10714
- className: classNames?.avatar
10715
- }
10716
- ),
10717
- /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-staff-name": true, className: classNames?.name, children: member.name }),
10718
- member.bio && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-staff-bio": true, className: classNames?.bio, children: member.bio })
10719
- ]
10794
+ const groupValue = selectedStaffId === null ? ANY_VALUE : selectedStaffId ?? "";
10795
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10796
+ radioGroup.RadioGroup,
10797
+ {
10798
+ "data-cimplify-staff-picker": true,
10799
+ className: cn(className, classNames?.root),
10800
+ value: groupValue,
10801
+ onValueChange: (value) => {
10802
+ onStaffSelect?.(value === ANY_VALUE ? null : value);
10720
10803
  },
10721
- member.id
10722
- ))
10723
- ] });
10804
+ children: [
10805
+ showAnyOption && /* @__PURE__ */ jsxRuntime.jsx(
10806
+ radio.Radio.Root,
10807
+ {
10808
+ value: ANY_VALUE,
10809
+ render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button" }),
10810
+ "data-cimplify-staff-option": true,
10811
+ "data-selected": selectedStaffId === null || void 0,
10812
+ "data-any": true,
10813
+ className: classNames?.option,
10814
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-staff-name": true, className: classNames?.name, children: anyLabel })
10815
+ }
10816
+ ),
10817
+ staff.map((member) => /* @__PURE__ */ jsxRuntime.jsxs(
10818
+ radio.Radio.Root,
10819
+ {
10820
+ value: member.id,
10821
+ render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button" }),
10822
+ "data-cimplify-staff-option": true,
10823
+ "data-selected": selectedStaffId === member.id || void 0,
10824
+ className: classNames?.option,
10825
+ children: [
10826
+ member.avatar_url && /* @__PURE__ */ jsxRuntime.jsx(
10827
+ "img",
10828
+ {
10829
+ src: member.avatar_url,
10830
+ alt: member.name,
10831
+ "data-cimplify-staff-avatar": true,
10832
+ className: classNames?.avatar
10833
+ }
10834
+ ),
10835
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-staff-name": true, className: classNames?.name, children: member.name }),
10836
+ member.bio && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-staff-bio": true, className: classNames?.bio, children: member.bio })
10837
+ ]
10838
+ },
10839
+ member.id
10840
+ ))
10841
+ ]
10842
+ }
10843
+ );
10724
10844
  }
10725
10845
  var STATUS_LABELS3 = {
10726
10846
  pending: "Pending",
@@ -11392,10 +11512,10 @@ function OrderDetailPage({
11392
11512
  ] });
11393
11513
  }
11394
11514
  var STATUS_FILTERS = [
11395
- { label: "All", value: void 0 },
11396
- { label: "Active", value: "confirmed" },
11397
- { label: "Completed", value: "completed" },
11398
- { label: "Cancelled", value: "cancelled" }
11515
+ { label: "All", value: void 0, tabValue: "all" },
11516
+ { label: "Active", value: "confirmed", tabValue: "confirmed" },
11517
+ { label: "Completed", value: "completed", tabValue: "completed" },
11518
+ { label: "Cancelled", value: "cancelled", tabValue: "cancelled" }
11399
11519
  ];
11400
11520
  function OrderHistoryPage({
11401
11521
  title = "Order History",
@@ -11409,6 +11529,10 @@ function OrderHistoryPage({
11409
11529
  }) {
11410
11530
  const [statusFilter, setStatusFilter] = React3.useState(void 0);
11411
11531
  const [selectedOrder, setSelectedOrder] = React3.useState(null);
11532
+ const handleTabChange = React3.useCallback((value) => {
11533
+ const filter = STATUS_FILTERS.find((f) => f.tabValue === value);
11534
+ setStatusFilter(filter?.value);
11535
+ }, []);
11412
11536
  const handleOrderClick = React3.useCallback(
11413
11537
  (order) => {
11414
11538
  if (onOrderNavigate) {
@@ -11422,6 +11546,7 @@ function OrderHistoryPage({
11422
11546
  const handleBack = React3.useCallback(() => {
11423
11547
  setSelectedOrder(null);
11424
11548
  }, []);
11549
+ const activeTabValue = STATUS_FILTERS.find((f) => f.value === statusFilter)?.tabValue ?? "all";
11425
11550
  if (selectedOrder && !onOrderNavigate) {
11426
11551
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-order-history-page": true, className: cn(className, classNames?.root), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-history-detail": true, className: classNames?.detail, children: [
11427
11552
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -11439,20 +11564,17 @@ function OrderHistoryPage({
11439
11564
  }
11440
11565
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-history-page": true, className: cn(className, classNames?.root), children: [
11441
11566
  /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-order-history-header": true, className: classNames?.header, children: /* @__PURE__ */ jsxRuntime.jsx("h1", { "data-cimplify-order-history-title": true, className: classNames?.title, children: title }) }),
11442
- showFilters && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-order-history-filters": true, className: classNames?.filters, role: "tablist", children: STATUS_FILTERS.map((filter) => /* @__PURE__ */ jsxRuntime.jsx(
11443
- "button",
11567
+ showFilters && /* @__PURE__ */ jsxRuntime.jsx(tabs.Tabs.Root, { value: activeTabValue, onValueChange: handleTabChange, children: /* @__PURE__ */ jsxRuntime.jsx(tabs.Tabs.List, { "data-cimplify-order-history-filters": true, className: classNames?.filters, children: STATUS_FILTERS.map((filter) => /* @__PURE__ */ jsxRuntime.jsx(
11568
+ tabs.Tabs.Tab,
11444
11569
  {
11445
- type: "button",
11446
- role: "tab",
11447
- "aria-selected": statusFilter === filter.value,
11448
- onClick: () => setStatusFilter(filter.value),
11570
+ value: filter.tabValue,
11449
11571
  "data-cimplify-order-filter": true,
11450
11572
  "data-selected": statusFilter === filter.value || void 0,
11451
11573
  className: classNames?.filterButton,
11452
11574
  children: filter.label
11453
11575
  },
11454
- filter.label
11455
- )) }),
11576
+ filter.tabValue
11577
+ )) }) }),
11456
11578
  /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-order-history-list": true, className: classNames?.list, children: /* @__PURE__ */ jsxRuntime.jsx(
11457
11579
  OrderHistory,
11458
11580
  {
@@ -11480,7 +11602,7 @@ function SearchPage({
11480
11602
  /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-search-page-header": true, className: classNames?.header, children: /* @__PURE__ */ jsxRuntime.jsx("h1", { "data-cimplify-search-page-title": true, className: classNames?.title, children: title }) }),
11481
11603
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-search-page-input": true, className: classNames?.inputContainer, children: [
11482
11604
  /* @__PURE__ */ jsxRuntime.jsx(
11483
- "input",
11605
+ input.Input,
11484
11606
  {
11485
11607
  type: "search",
11486
11608
  value: query,
@@ -11822,20 +11944,24 @@ function BookingsPage({
11822
11944
  }
11823
11945
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-bookings-page": true, className: cn(className, classNames?.root), children: [
11824
11946
  /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-bookings-header": true, className: classNames?.header, children: /* @__PURE__ */ jsxRuntime.jsx("h1", { "data-cimplify-bookings-title": true, className: classNames?.title, children: title }) }),
11825
- showFilters && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-bookings-filters": true, className: classNames?.filters, role: "tablist", children: BOOKING_FILTERS.map((f) => /* @__PURE__ */ jsxRuntime.jsx(
11826
- "button",
11947
+ showFilters && /* @__PURE__ */ jsxRuntime.jsx(
11948
+ tabs.Tabs.Root,
11827
11949
  {
11828
- type: "button",
11829
- role: "tab",
11830
- "aria-selected": filter === f.value,
11831
- onClick: () => setFilter(f.value),
11832
- "data-cimplify-booking-filter": true,
11833
- "data-selected": filter === f.value || void 0,
11834
- className: classNames?.filterButton,
11835
- children: f.label
11836
- },
11837
- f.value
11838
- )) }),
11950
+ value: filter,
11951
+ onValueChange: (value) => setFilter(value),
11952
+ children: /* @__PURE__ */ jsxRuntime.jsx(tabs.Tabs.List, { "data-cimplify-bookings-filters": true, className: classNames?.filters, children: BOOKING_FILTERS.map((f) => /* @__PURE__ */ jsxRuntime.jsx(
11953
+ tabs.Tabs.Tab,
11954
+ {
11955
+ value: f.value,
11956
+ "data-cimplify-booking-filter": true,
11957
+ "data-selected": filter === f.value || void 0,
11958
+ className: classNames?.filterButton,
11959
+ children: f.label
11960
+ },
11961
+ f.value
11962
+ )) })
11963
+ }
11964
+ ),
11839
11965
  /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-bookings-list": true, className: classNames?.list, children: /* @__PURE__ */ jsxRuntime.jsx(
11840
11966
  BookingList,
11841
11967
  {