@anker-in/ui 0.1.8 → 0.1.9

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.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { D as DemoRoom, a as DemoRoomProps } from './DemoRoom-Dx3PluHP.mjs';
1
+ export { D as DemoRoom, a as DemoRoomProps } from './DemoRoom-YZ2To7p9.mjs';
2
2
  import React from 'react';
3
3
  export { ThemeProvider, useTheme } from './theme.mjs';
4
4
  import { ClassValue } from 'clsx';
@@ -140,7 +140,7 @@ type TimeslotStatus = 'available' | 'full' | 'disabled';
140
140
  type DemoRoomType = 'flagship' | 'standard' | 'popup';
141
141
  type DemoRoomStatus = 'enabled' | 'disabled';
142
142
  type BookingStatus = 'pending' | 'checked_in' | 'completed' | 'cancelled';
143
- type QuestionType = 'text' | 'email' | 'tel' | 'radio' | 'checkbox' | 'textarea' | 'select';
143
+ type QuestionType = 'text' | 'email' | 'tel' | 'phone' | 'radio' | 'checkbox' | 'textarea' | 'select';
144
144
  interface Timeslot {
145
145
  id: number;
146
146
  start_time: string;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { D as DemoRoom, a as DemoRoomProps } from './DemoRoom-Dx3PluHP.js';
1
+ export { D as DemoRoom, a as DemoRoomProps } from './DemoRoom-YZ2To7p9.js';
2
2
  import React from 'react';
3
3
  export { ThemeProvider, useTheme } from './theme.js';
4
4
  import { ClassValue } from 'clsx';
@@ -140,7 +140,7 @@ type TimeslotStatus = 'available' | 'full' | 'disabled';
140
140
  type DemoRoomType = 'flagship' | 'standard' | 'popup';
141
141
  type DemoRoomStatus = 'enabled' | 'disabled';
142
142
  type BookingStatus = 'pending' | 'checked_in' | 'completed' | 'cancelled';
143
- type QuestionType = 'text' | 'email' | 'tel' | 'radio' | 'checkbox' | 'textarea' | 'select';
143
+ type QuestionType = 'text' | 'email' | 'tel' | 'phone' | 'radio' | 'checkbox' | 'textarea' | 'select';
144
144
  interface Timeslot {
145
145
  id: number;
146
146
  start_time: string;
package/dist/index.js CHANGED
@@ -358,18 +358,22 @@ var StudioMap = ({
358
358
  validLocations.forEach((location) => {
359
359
  const lat = Number(location.lat);
360
360
  const lng = Number(location.lng);
361
+ const svgIcon = {
362
+ url: `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`
363
+ <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
364
+ <circle cx="24" cy="24" r="22" fill="#00000010"/>
365
+ <circle cx="24" cy="24" r="10" fill="#000000"/>
366
+ <circle cx="24" cy="24" r="5" fill="#3ADB67"/>
367
+ </svg>
368
+ `)}`,
369
+ scaledSize: { width: 48, height: 48 },
370
+ anchor: { x: 24, y: 24 }
371
+ };
361
372
  const marker = new google.maps.Marker({
362
373
  position: { lat, lng },
363
374
  map: googleMapRef.current,
364
375
  title: location.name,
365
- icon: {
366
- path: google.maps.SymbolPath.CIRCLE,
367
- scale: 10,
368
- fillColor: "#000000",
369
- fillOpacity: 1,
370
- strokeColor: "#ffffff",
371
- strokeWeight: 2
372
- }
376
+ icon: svgIcon
373
377
  });
374
378
  marker.addListener("click", () => {
375
379
  setSelectedLocation(location);
@@ -1081,6 +1085,7 @@ var defaultPageData = {
1081
1085
  title: "Find a Studio Near You",
1082
1086
  loadingText: "Loading demo rooms...",
1083
1087
  errorTitle: "Failed to load demo rooms",
1088
+ machine: "eufymake E1",
1084
1089
  locationFilter: {
1085
1090
  allLocations: "All Locations",
1086
1091
  clear: "Clear",
@@ -1351,7 +1356,7 @@ var RoomsList = ({
1351
1356
  }
1352
1357
  ),
1353
1358
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex text-[#767880] cursor-not-allowed", children: [
1354
- "eufymake E1",
1359
+ mergedPageData.machine,
1355
1360
  /* @__PURE__ */ jsxRuntime.jsx(
1356
1361
  "svg",
1357
1362
  {
@@ -1710,6 +1715,7 @@ var QuestionnaireForm = ({
1710
1715
  case "text":
1711
1716
  case "email":
1712
1717
  case "tel":
1718
+ case "phone":
1713
1719
  return /* @__PURE__ */ jsxRuntime.jsx(
1714
1720
  "input",
1715
1721
  {
@@ -1904,10 +1910,12 @@ var DateTimePicker = ({
1904
1910
  }) => {
1905
1911
  const { token } = antd.theme.useToken();
1906
1912
  const [selectMonth, setSelectMonth] = React2.useState("");
1907
- const [selectedDate, setSelectedDate] = React2.useState(dayjs__default.default());
1913
+ const [selectedDate, setSelectedDate] = React2.useState(null);
1914
+ const [calendarValue, setCalendarValue] = React2.useState(dayjs__default.default());
1908
1915
  const [selectedTimeslotId, setSelectedTimeslotId] = React2.useState(
1909
1916
  null
1910
1917
  );
1918
+ const [isInitialized, setIsInitialized] = React2.useState(false);
1911
1919
  const {
1912
1920
  createBooking,
1913
1921
  loading: bookingLoading,
@@ -1926,8 +1934,9 @@ var DateTimePicker = ({
1926
1934
  locale,
1927
1935
  { enabled: !!demoRoomCode && !!demoRoom?.questionnaire_id }
1928
1936
  );
1929
- const startDate = selectedDate.startOf("month").format("YYYY-MM-DD");
1930
- const endDate = selectedDate.endOf("month").format("YYYY-MM-DD");
1937
+ const currentDate = selectedDate || dayjs__default.default();
1938
+ const startDate = currentDate.startOf("month").format("YYYY-MM-DD");
1939
+ const endDate = currentDate.endOf("month").format("YYYY-MM-DD");
1931
1940
  const {
1932
1941
  data: timeslotsData,
1933
1942
  loading: timeslotsLoading,
@@ -1943,30 +1952,59 @@ var DateTimePicker = ({
1943
1952
  { enabled: !!demoRoomCode }
1944
1953
  );
1945
1954
  const dayTimeslots = React2.useMemo(() => {
1946
- if (!timeslotsData?.timeslots) return [];
1955
+ if (!timeslotsData?.timeslots || !selectedDate) return [];
1947
1956
  const selectedDateStr = selectedDate.format("YYYY-MM-DD");
1948
1957
  return timeslotsData.timeslots.filter((slot) => {
1949
1958
  const slotDate = dayjs__default.default(slot.start_time).format("YYYY-MM-DD");
1950
1959
  return slotDate === selectedDateStr;
1951
1960
  });
1952
1961
  }, [timeslotsData, selectedDate]);
1962
+ const availableDates = React2.useMemo(() => {
1963
+ if (!timeslotsData?.timeslots) return /* @__PURE__ */ new Set();
1964
+ const dates = /* @__PURE__ */ new Set();
1965
+ timeslotsData.timeslots.forEach((slot) => {
1966
+ if (slot.status === "available") {
1967
+ const dateStr = dayjs__default.default(slot.start_time).format("YYYY-MM-DD");
1968
+ dates.add(dateStr);
1969
+ }
1970
+ });
1971
+ return dates;
1972
+ }, [timeslotsData]);
1973
+ React2.useEffect(() => {
1974
+ if (!timeslotsData?.timeslots || isInitialized) return;
1975
+ const now = dayjs__default.default();
1976
+ const availableTimeslots = timeslotsData.timeslots.filter(
1977
+ (slot) => slot.status === "available" && dayjs__default.default(slot.start_time).isAfter(now)
1978
+ );
1979
+ if (availableTimeslots.length > 0) {
1980
+ const sortedSlots = [...availableTimeslots].sort(
1981
+ (a, b) => dayjs__default.default(a.start_time).unix() - dayjs__default.default(b.start_time).unix()
1982
+ );
1983
+ const nearestSlot = sortedSlots[0];
1984
+ const nearestDate = dayjs__default.default(nearestSlot.start_time);
1985
+ setSelectedDate(nearestDate);
1986
+ setCalendarValue(nearestDate);
1987
+ setSelectedTimeslotId(nearestSlot.id);
1988
+ setIsInitialized(true);
1989
+ } else if (!selectedDate) {
1990
+ setSelectedDate(now);
1991
+ setCalendarValue(now);
1992
+ setIsInitialized(true);
1993
+ }
1994
+ }, [timeslotsData, isInitialized, selectedDate]);
1953
1995
  const formatTimeslot = (slot) => {
1954
1996
  const start = dayjs__default.default(slot.start_time).format("h:mm A");
1955
1997
  const end = dayjs__default.default(slot.end_time).format("h:mm A");
1956
1998
  return `${start} - ${end}`;
1957
1999
  };
1958
- const onPanelChange = (value, mode) => {
1959
- console.log(value.format("YYYY-MM-DD"), mode);
1960
- };
1961
2000
  const wrapperStyle = {
1962
- width: 824,
1963
2001
  background: "#fff",
1964
2002
  border: `1px solid ${token.colorBorderSecondary}`,
1965
2003
  borderRadius: token.borderRadiusLG
1966
2004
  };
1967
2005
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1968
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[48px] py-[64px] font-bold text-center", children: pageData.scheduleYourVisit }),
1969
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4", children: [
2006
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[48px] l:text-[32px] py-[64px] l:py-[24px] font-bold text-center", children: pageData.scheduleYourVisit }),
2007
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4 l:flex-col", children: [
1970
2008
  /* @__PURE__ */ jsxRuntime.jsx(
1971
2009
  antd.ConfigProvider,
1972
2010
  {
@@ -1982,34 +2020,74 @@ var DateTimePicker = ({
1982
2020
  }
1983
2021
  }
1984
2022
  },
1985
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: wrapperStyle, className: "calendar-custom-cell", children: [
2023
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: wrapperStyle, className: "calendar-custom-cell w-[calc(824/1920*100vw)] min-l:max-w-[824px] l:w-full", children: [
1986
2024
  /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1987
2025
  .calendar-custom-cell .ant-picker-cell {
1988
2026
  padding: 6px !important;
2027
+ text-align: center !important;
2028
+ }
2029
+ .calendar-custom-cell .ant-picker-cell .ant-picker-cell-inner {
2030
+ margin: 0 auto !important;
1989
2031
  }
1990
2032
  .calendar-custom-cell .ant-picker-cell-inner {
1991
- width: 100px !important;
1992
- height: 100px !important;
2033
+ width: 38px !important;
2034
+ height: 38px !important;
1993
2035
  display: flex !important;
1994
2036
  align-items: center !important;
1995
2037
  justify-content: center !important;
1996
- border-radius: 20px !important;
2038
+ border-radius: 8px !important;
1997
2039
  border: 1px solid #E4E5E6 !important;
2040
+ aspect-ratio: 1 / 1 !important;
2041
+ }
2042
+ @media (min-width: 1024px) and (max-width: 1919px) {
2043
+ .calendar-custom-cell .ant-picker-cell-inner {
2044
+ width: 54px !important;
2045
+ height: 54px !important;
2046
+ border-radius: 12px !important;
2047
+ }
2048
+ .calendar-custom-cell .ant-picker-calendar-date-value {
2049
+ line-height: 54px !important;
2050
+ }
2051
+ }
2052
+ @media (min-width: 1920px) {
2053
+ .calendar-custom-cell .ant-picker-cell-inner {
2054
+ width: 100px !important;
2055
+ height: 100px !important;
2056
+ border-radius: 20px !important;
2057
+ }
2058
+ .calendar-custom-cell .ant-picker-calendar-date-value {
2059
+ line-height: 100px !important;
2060
+ }
1998
2061
  }
1999
- .calendar-custom-cell .ant-picker-cell-selected .ant-picker-cell-inner {
2062
+ .calendar-custom-cell .ant-picker-cell-selected .ant-picker-cell-inner,
2063
+ .calendar-custom-cell .ant-picker-cell-selected:not(.ant-picker-cell-disabled) .ant-picker-cell-inner {
2000
2064
  background-color: #3ADB67 !important;
2001
2065
  color: white !important;
2002
2066
  border-color: #3ADB67 !important;
2003
2067
  }
2068
+ .calendar-custom-cell .ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner {
2069
+ background-color: #3ADB67 !important;
2070
+ color: white !important;
2071
+ }
2004
2072
  .calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
2005
2073
  border-color: #3ADB67 !important;
2006
- border-radius: 20px !important;
2074
+ border-radius: 8px !important;
2075
+ }
2076
+ @media (min-width: 1024px) and (max-width: 1919px) {
2077
+ .calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
2078
+ border-radius: 12px !important;
2079
+ }
2080
+ }
2081
+ @media (min-width: 1920px) {
2082
+ .calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
2083
+ border-radius: 20px !important;
2084
+ }
2007
2085
  }
2008
2086
  .calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner::before {
2009
2087
  display: none !important;
2010
2088
  }
2011
2089
  .calendar-custom-cell .ant-picker-calendar-date-value {
2012
- line-height: 100px !important;
2090
+ line-height: 38px !important;
2013
2091
  }
2014
2092
  .calendar-custom-cell .ant-picker-content {
2015
2093
  width: 100% !important;
@@ -2017,13 +2095,62 @@ var DateTimePicker = ({
2017
2095
  .calendar-custom-cell .ant-picker-content thead tr th {
2018
2096
  line-height: 48px !important;
2019
2097
  }
2098
+ .calendar-custom-cell .ant-picker-cell-disabled .ant-picker-cell-inner {
2099
+ background-color: #F5F5F5 !important;
2100
+ color: #BDBDBD !important;
2101
+ border-color: #E4E5E6 !important;
2102
+ cursor: not-allowed !important;
2103
+ box-shadow: none !important;
2104
+ }
2105
+ .calendar-custom-cell .ant-picker-cell-disabled:hover .ant-picker-cell-inner {
2106
+ background-color: #F5F5F5 !important;
2107
+ border-color: #E4E5E6 !important;
2108
+ box-shadow: none !important;
2109
+ }
2110
+ .calendar-custom-cell .ant-picker-cell-disabled::before {
2111
+ display: none !important;
2112
+ }
2113
+ .calendar-custom-cell .ant-picker-cell-disabled::after {
2114
+ display: none !important;
2115
+ }
2020
2116
  ` }),
2021
2117
  /* @__PURE__ */ jsxRuntime.jsx(
2022
2118
  antd.Calendar,
2023
2119
  {
2024
2120
  fullscreen: false,
2025
- value: selectedDate,
2026
- onChange: (date) => setSelectedDate(date),
2121
+ value: calendarValue,
2122
+ onSelect: (date) => {
2123
+ setSelectedDate(date);
2124
+ setCalendarValue(date);
2125
+ },
2126
+ onPanelChange: (date) => {
2127
+ setCalendarValue(date);
2128
+ },
2129
+ disabledDate: (current) => {
2130
+ if (!current) return false;
2131
+ if (current.isSame(dayjs__default.default(), "day")) return false;
2132
+ if (current.isBefore(dayjs__default.default(), "day")) return true;
2133
+ const dateStr = current.format("YYYY-MM-DD");
2134
+ return !availableDates.has(dateStr);
2135
+ },
2136
+ fullCellRender: (date) => {
2137
+ const isSelected = selectedDate && date.isSame(selectedDate, "day");
2138
+ const isToday = date.isSame(dayjs__default.default(), "day");
2139
+ const dateStr = date.format("YYYY-MM-DD");
2140
+ const isDisabled = !isToday && (date.isBefore(dayjs__default.default(), "day") || !availableDates.has(dateStr));
2141
+ return /* @__PURE__ */ jsxRuntime.jsx(
2142
+ "div",
2143
+ {
2144
+ className: `ant-picker-cell-inner ${isSelected ? "ant-picker-cell-inner-selected" : ""} ${isToday ? "ant-picker-cell-inner-today" : ""}`,
2145
+ style: {
2146
+ backgroundColor: isSelected ? "#3ADB67" : void 0,
2147
+ color: isSelected ? "white" : isDisabled ? "#BDBDBD" : void 0,
2148
+ borderColor: isSelected ? "#3ADB67" : isToday ? "#3ADB67" : void 0
2149
+ },
2150
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ant-picker-calendar-date-value", children: date.date() })
2151
+ }
2152
+ );
2153
+ },
2027
2154
  headerRender: ({ value, onChange }) => {
2028
2155
  const year = value.year();
2029
2156
  const month = value.month();
@@ -2141,8 +2268,7 @@ var DateTimePicker = ({
2141
2268
  )
2142
2269
  ] })
2143
2270
  ] });
2144
- },
2145
- onPanelChange
2271
+ }
2146
2272
  }
2147
2273
  )
2148
2274
  ] })
@@ -2156,10 +2282,16 @@ var DateTimePicker = ({
2156
2282
  "button",
2157
2283
  {
2158
2284
  onClick: () => {
2159
- const newDate = selectedDate.subtract(1, "day");
2160
- setSelectedDate(newDate);
2285
+ if (selectedDate) {
2286
+ const newDate = selectedDate.subtract(1, "day");
2287
+ if (!newDate.isBefore(dayjs__default.default(), "day")) {
2288
+ setSelectedDate(newDate);
2289
+ setCalendarValue(newDate);
2290
+ }
2291
+ }
2161
2292
  },
2162
- className: "w-10 h-10 flex items-center justify-center hover:bg-gray-100 rounded-lg transition-colors",
2293
+ disabled: !selectedDate || selectedDate.isSame(dayjs__default.default(), "day") || selectedDate.isBefore(dayjs__default.default(), "day"),
2294
+ className: "w-10 h-10 flex items-center justify-center hover:bg-gray-100 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
2163
2295
  children: /* @__PURE__ */ jsxRuntime.jsx(
2164
2296
  "svg",
2165
2297
  {
@@ -2184,10 +2316,14 @@ var DateTimePicker = ({
2184
2316
  "button",
2185
2317
  {
2186
2318
  onClick: () => {
2187
- const newDate = selectedDate.add(1, "day");
2188
- setSelectedDate(newDate);
2319
+ if (selectedDate) {
2320
+ const newDate = selectedDate.add(1, "day");
2321
+ setSelectedDate(newDate);
2322
+ setCalendarValue(newDate);
2323
+ }
2189
2324
  },
2190
- className: "w-10 h-10 flex items-center justify-center hover:bg-gray-100 rounded-lg transition-colors",
2325
+ disabled: !selectedDate,
2326
+ className: "w-10 h-10 flex items-center justify-center hover:bg-gray-100 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
2191
2327
  children: /* @__PURE__ */ jsxRuntime.jsx(
2192
2328
  "svg",
2193
2329
  {
@@ -2365,12 +2501,9 @@ var DemoRoomDetail = ({
2365
2501
  data: demoRoom,
2366
2502
  loading,
2367
2503
  error
2368
- } = useDemoRoom(
2369
- apiClient,
2370
- demoRoomCode || "",
2371
- locale,
2372
- { enabled: !!apiClient && !!demoRoomCode }
2373
- );
2504
+ } = useDemoRoom(apiClient, demoRoomCode || "", locale, {
2505
+ enabled: !!apiClient && !!demoRoomCode
2506
+ });
2374
2507
  const title = demoRoom?.name || titleProp || "Design District Demo Room";
2375
2508
  const descriptions = demoRoom?.description ? [demoRoom.description] : descriptionsProp || defaultDescriptions;
2376
2509
  const devices = demoRoom?.description || devicesProp || "eufyMake E1, eufyMake M5";
@@ -2399,8 +2532,8 @@ var DemoRoomDetail = ({
2399
2532
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm mt-2", children: error.message })
2400
2533
  ] }) });
2401
2534
  }
2402
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-8 items-start", children: [
2403
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
2535
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-8 l:flex l:flex-col items-start", children: [
2536
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6 py-[24px]", children: [
2404
2537
  /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-[40px] font-bold text-gray-900 leading-tight", children: title }),
2405
2538
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: descriptions.map((desc, index) => /* @__PURE__ */ jsxRuntime.jsx(
2406
2539
  "p",
@@ -2527,7 +2660,7 @@ var DemoRoomDetail = ({
2527
2660
  ] })
2528
2661
  ] })
2529
2662
  ] }),
2530
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative h-[400px] rounded-2xl overflow-hidden", children: images.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
2663
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative l:w-full h-[400px] rounded-2xl overflow-hidden", children: images.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
2531
2664
  react.Swiper,
2532
2665
  {
2533
2666
  ...swiperVersion === "11+" && Navigation && Pagination && Autoplay ? { modules: [Navigation, Pagination, Autoplay] } : {},