@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.mjs CHANGED
@@ -346,18 +346,22 @@ var StudioMap = ({
346
346
  validLocations.forEach((location) => {
347
347
  const lat = Number(location.lat);
348
348
  const lng = Number(location.lng);
349
+ const svgIcon = {
350
+ url: `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`
351
+ <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
352
+ <circle cx="24" cy="24" r="22" fill="#00000010"/>
353
+ <circle cx="24" cy="24" r="10" fill="#000000"/>
354
+ <circle cx="24" cy="24" r="5" fill="#3ADB67"/>
355
+ </svg>
356
+ `)}`,
357
+ scaledSize: { width: 48, height: 48 },
358
+ anchor: { x: 24, y: 24 }
359
+ };
349
360
  const marker = new google.maps.Marker({
350
361
  position: { lat, lng },
351
362
  map: googleMapRef.current,
352
363
  title: location.name,
353
- icon: {
354
- path: google.maps.SymbolPath.CIRCLE,
355
- scale: 10,
356
- fillColor: "#000000",
357
- fillOpacity: 1,
358
- strokeColor: "#ffffff",
359
- strokeWeight: 2
360
- }
364
+ icon: svgIcon
361
365
  });
362
366
  marker.addListener("click", () => {
363
367
  setSelectedLocation(location);
@@ -1069,6 +1073,7 @@ var defaultPageData = {
1069
1073
  title: "Find a Studio Near You",
1070
1074
  loadingText: "Loading demo rooms...",
1071
1075
  errorTitle: "Failed to load demo rooms",
1076
+ machine: "eufymake E1",
1072
1077
  locationFilter: {
1073
1078
  allLocations: "All Locations",
1074
1079
  clear: "Clear",
@@ -1339,7 +1344,7 @@ var RoomsList = ({
1339
1344
  }
1340
1345
  ),
1341
1346
  /* @__PURE__ */ jsxs("div", { className: "flex text-[#767880] cursor-not-allowed", children: [
1342
- "eufymake E1",
1347
+ mergedPageData.machine,
1343
1348
  /* @__PURE__ */ jsx(
1344
1349
  "svg",
1345
1350
  {
@@ -1698,6 +1703,7 @@ var QuestionnaireForm = ({
1698
1703
  case "text":
1699
1704
  case "email":
1700
1705
  case "tel":
1706
+ case "phone":
1701
1707
  return /* @__PURE__ */ jsx(
1702
1708
  "input",
1703
1709
  {
@@ -1892,10 +1898,12 @@ var DateTimePicker = ({
1892
1898
  }) => {
1893
1899
  const { token } = theme.useToken();
1894
1900
  const [selectMonth, setSelectMonth] = useState("");
1895
- const [selectedDate, setSelectedDate] = useState(dayjs());
1901
+ const [selectedDate, setSelectedDate] = useState(null);
1902
+ const [calendarValue, setCalendarValue] = useState(dayjs());
1896
1903
  const [selectedTimeslotId, setSelectedTimeslotId] = useState(
1897
1904
  null
1898
1905
  );
1906
+ const [isInitialized, setIsInitialized] = useState(false);
1899
1907
  const {
1900
1908
  createBooking,
1901
1909
  loading: bookingLoading,
@@ -1914,8 +1922,9 @@ var DateTimePicker = ({
1914
1922
  locale,
1915
1923
  { enabled: !!demoRoomCode && !!demoRoom?.questionnaire_id }
1916
1924
  );
1917
- const startDate = selectedDate.startOf("month").format("YYYY-MM-DD");
1918
- const endDate = selectedDate.endOf("month").format("YYYY-MM-DD");
1925
+ const currentDate = selectedDate || dayjs();
1926
+ const startDate = currentDate.startOf("month").format("YYYY-MM-DD");
1927
+ const endDate = currentDate.endOf("month").format("YYYY-MM-DD");
1919
1928
  const {
1920
1929
  data: timeslotsData,
1921
1930
  loading: timeslotsLoading,
@@ -1931,30 +1940,59 @@ var DateTimePicker = ({
1931
1940
  { enabled: !!demoRoomCode }
1932
1941
  );
1933
1942
  const dayTimeslots = useMemo(() => {
1934
- if (!timeslotsData?.timeslots) return [];
1943
+ if (!timeslotsData?.timeslots || !selectedDate) return [];
1935
1944
  const selectedDateStr = selectedDate.format("YYYY-MM-DD");
1936
1945
  return timeslotsData.timeslots.filter((slot) => {
1937
1946
  const slotDate = dayjs(slot.start_time).format("YYYY-MM-DD");
1938
1947
  return slotDate === selectedDateStr;
1939
1948
  });
1940
1949
  }, [timeslotsData, selectedDate]);
1950
+ const availableDates = useMemo(() => {
1951
+ if (!timeslotsData?.timeslots) return /* @__PURE__ */ new Set();
1952
+ const dates = /* @__PURE__ */ new Set();
1953
+ timeslotsData.timeslots.forEach((slot) => {
1954
+ if (slot.status === "available") {
1955
+ const dateStr = dayjs(slot.start_time).format("YYYY-MM-DD");
1956
+ dates.add(dateStr);
1957
+ }
1958
+ });
1959
+ return dates;
1960
+ }, [timeslotsData]);
1961
+ useEffect(() => {
1962
+ if (!timeslotsData?.timeslots || isInitialized) return;
1963
+ const now = dayjs();
1964
+ const availableTimeslots = timeslotsData.timeslots.filter(
1965
+ (slot) => slot.status === "available" && dayjs(slot.start_time).isAfter(now)
1966
+ );
1967
+ if (availableTimeslots.length > 0) {
1968
+ const sortedSlots = [...availableTimeslots].sort(
1969
+ (a, b) => dayjs(a.start_time).unix() - dayjs(b.start_time).unix()
1970
+ );
1971
+ const nearestSlot = sortedSlots[0];
1972
+ const nearestDate = dayjs(nearestSlot.start_time);
1973
+ setSelectedDate(nearestDate);
1974
+ setCalendarValue(nearestDate);
1975
+ setSelectedTimeslotId(nearestSlot.id);
1976
+ setIsInitialized(true);
1977
+ } else if (!selectedDate) {
1978
+ setSelectedDate(now);
1979
+ setCalendarValue(now);
1980
+ setIsInitialized(true);
1981
+ }
1982
+ }, [timeslotsData, isInitialized, selectedDate]);
1941
1983
  const formatTimeslot = (slot) => {
1942
1984
  const start = dayjs(slot.start_time).format("h:mm A");
1943
1985
  const end = dayjs(slot.end_time).format("h:mm A");
1944
1986
  return `${start} - ${end}`;
1945
1987
  };
1946
- const onPanelChange = (value, mode) => {
1947
- console.log(value.format("YYYY-MM-DD"), mode);
1948
- };
1949
1988
  const wrapperStyle = {
1950
- width: 824,
1951
1989
  background: "#fff",
1952
1990
  border: `1px solid ${token.colorBorderSecondary}`,
1953
1991
  borderRadius: token.borderRadiusLG
1954
1992
  };
1955
1993
  return /* @__PURE__ */ jsxs("div", { children: [
1956
- /* @__PURE__ */ jsx("div", { className: "text-[48px] py-[64px] font-bold text-center", children: pageData.scheduleYourVisit }),
1957
- /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
1994
+ /* @__PURE__ */ jsx("div", { className: "text-[48px] l:text-[32px] py-[64px] l:py-[24px] font-bold text-center", children: pageData.scheduleYourVisit }),
1995
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-4 l:flex-col", children: [
1958
1996
  /* @__PURE__ */ jsx(
1959
1997
  ConfigProvider,
1960
1998
  {
@@ -1970,34 +2008,74 @@ var DateTimePicker = ({
1970
2008
  }
1971
2009
  }
1972
2010
  },
1973
- children: /* @__PURE__ */ jsxs("div", { style: wrapperStyle, className: "calendar-custom-cell", children: [
2011
+ children: /* @__PURE__ */ jsxs("div", { style: wrapperStyle, className: "calendar-custom-cell w-[calc(824/1920*100vw)] min-l:max-w-[824px] l:w-full", children: [
1974
2012
  /* @__PURE__ */ jsx("style", { children: `
1975
2013
  .calendar-custom-cell .ant-picker-cell {
1976
2014
  padding: 6px !important;
2015
+ text-align: center !important;
2016
+ }
2017
+ .calendar-custom-cell .ant-picker-cell .ant-picker-cell-inner {
2018
+ margin: 0 auto !important;
1977
2019
  }
1978
2020
  .calendar-custom-cell .ant-picker-cell-inner {
1979
- width: 100px !important;
1980
- height: 100px !important;
2021
+ width: 38px !important;
2022
+ height: 38px !important;
1981
2023
  display: flex !important;
1982
2024
  align-items: center !important;
1983
2025
  justify-content: center !important;
1984
- border-radius: 20px !important;
2026
+ border-radius: 8px !important;
1985
2027
  border: 1px solid #E4E5E6 !important;
2028
+ aspect-ratio: 1 / 1 !important;
2029
+ }
2030
+ @media (min-width: 1024px) and (max-width: 1919px) {
2031
+ .calendar-custom-cell .ant-picker-cell-inner {
2032
+ width: 54px !important;
2033
+ height: 54px !important;
2034
+ border-radius: 12px !important;
2035
+ }
2036
+ .calendar-custom-cell .ant-picker-calendar-date-value {
2037
+ line-height: 54px !important;
2038
+ }
2039
+ }
2040
+ @media (min-width: 1920px) {
2041
+ .calendar-custom-cell .ant-picker-cell-inner {
2042
+ width: 100px !important;
2043
+ height: 100px !important;
2044
+ border-radius: 20px !important;
2045
+ }
2046
+ .calendar-custom-cell .ant-picker-calendar-date-value {
2047
+ line-height: 100px !important;
2048
+ }
1986
2049
  }
1987
- .calendar-custom-cell .ant-picker-cell-selected .ant-picker-cell-inner {
2050
+ .calendar-custom-cell .ant-picker-cell-selected .ant-picker-cell-inner,
2051
+ .calendar-custom-cell .ant-picker-cell-selected:not(.ant-picker-cell-disabled) .ant-picker-cell-inner {
1988
2052
  background-color: #3ADB67 !important;
1989
2053
  color: white !important;
1990
2054
  border-color: #3ADB67 !important;
1991
2055
  }
2056
+ .calendar-custom-cell .ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner {
2057
+ background-color: #3ADB67 !important;
2058
+ color: white !important;
2059
+ }
1992
2060
  .calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
1993
2061
  border-color: #3ADB67 !important;
1994
- border-radius: 20px !important;
2062
+ border-radius: 8px !important;
2063
+ }
2064
+ @media (min-width: 1024px) and (max-width: 1919px) {
2065
+ .calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
2066
+ border-radius: 12px !important;
2067
+ }
2068
+ }
2069
+ @media (min-width: 1920px) {
2070
+ .calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
2071
+ border-radius: 20px !important;
2072
+ }
1995
2073
  }
1996
2074
  .calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner::before {
1997
2075
  display: none !important;
1998
2076
  }
1999
2077
  .calendar-custom-cell .ant-picker-calendar-date-value {
2000
- line-height: 100px !important;
2078
+ line-height: 38px !important;
2001
2079
  }
2002
2080
  .calendar-custom-cell .ant-picker-content {
2003
2081
  width: 100% !important;
@@ -2005,13 +2083,62 @@ var DateTimePicker = ({
2005
2083
  .calendar-custom-cell .ant-picker-content thead tr th {
2006
2084
  line-height: 48px !important;
2007
2085
  }
2086
+ .calendar-custom-cell .ant-picker-cell-disabled .ant-picker-cell-inner {
2087
+ background-color: #F5F5F5 !important;
2088
+ color: #BDBDBD !important;
2089
+ border-color: #E4E5E6 !important;
2090
+ cursor: not-allowed !important;
2091
+ box-shadow: none !important;
2092
+ }
2093
+ .calendar-custom-cell .ant-picker-cell-disabled:hover .ant-picker-cell-inner {
2094
+ background-color: #F5F5F5 !important;
2095
+ border-color: #E4E5E6 !important;
2096
+ box-shadow: none !important;
2097
+ }
2098
+ .calendar-custom-cell .ant-picker-cell-disabled::before {
2099
+ display: none !important;
2100
+ }
2101
+ .calendar-custom-cell .ant-picker-cell-disabled::after {
2102
+ display: none !important;
2103
+ }
2008
2104
  ` }),
2009
2105
  /* @__PURE__ */ jsx(
2010
2106
  Calendar,
2011
2107
  {
2012
2108
  fullscreen: false,
2013
- value: selectedDate,
2014
- onChange: (date) => setSelectedDate(date),
2109
+ value: calendarValue,
2110
+ onSelect: (date) => {
2111
+ setSelectedDate(date);
2112
+ setCalendarValue(date);
2113
+ },
2114
+ onPanelChange: (date) => {
2115
+ setCalendarValue(date);
2116
+ },
2117
+ disabledDate: (current) => {
2118
+ if (!current) return false;
2119
+ if (current.isSame(dayjs(), "day")) return false;
2120
+ if (current.isBefore(dayjs(), "day")) return true;
2121
+ const dateStr = current.format("YYYY-MM-DD");
2122
+ return !availableDates.has(dateStr);
2123
+ },
2124
+ fullCellRender: (date) => {
2125
+ const isSelected = selectedDate && date.isSame(selectedDate, "day");
2126
+ const isToday = date.isSame(dayjs(), "day");
2127
+ const dateStr = date.format("YYYY-MM-DD");
2128
+ const isDisabled = !isToday && (date.isBefore(dayjs(), "day") || !availableDates.has(dateStr));
2129
+ return /* @__PURE__ */ jsx(
2130
+ "div",
2131
+ {
2132
+ className: `ant-picker-cell-inner ${isSelected ? "ant-picker-cell-inner-selected" : ""} ${isToday ? "ant-picker-cell-inner-today" : ""}`,
2133
+ style: {
2134
+ backgroundColor: isSelected ? "#3ADB67" : void 0,
2135
+ color: isSelected ? "white" : isDisabled ? "#BDBDBD" : void 0,
2136
+ borderColor: isSelected ? "#3ADB67" : isToday ? "#3ADB67" : void 0
2137
+ },
2138
+ children: /* @__PURE__ */ jsx("div", { className: "ant-picker-calendar-date-value", children: date.date() })
2139
+ }
2140
+ );
2141
+ },
2015
2142
  headerRender: ({ value, onChange }) => {
2016
2143
  const year = value.year();
2017
2144
  const month = value.month();
@@ -2129,8 +2256,7 @@ var DateTimePicker = ({
2129
2256
  )
2130
2257
  ] })
2131
2258
  ] });
2132
- },
2133
- onPanelChange
2259
+ }
2134
2260
  }
2135
2261
  )
2136
2262
  ] })
@@ -2144,10 +2270,16 @@ var DateTimePicker = ({
2144
2270
  "button",
2145
2271
  {
2146
2272
  onClick: () => {
2147
- const newDate = selectedDate.subtract(1, "day");
2148
- setSelectedDate(newDate);
2273
+ if (selectedDate) {
2274
+ const newDate = selectedDate.subtract(1, "day");
2275
+ if (!newDate.isBefore(dayjs(), "day")) {
2276
+ setSelectedDate(newDate);
2277
+ setCalendarValue(newDate);
2278
+ }
2279
+ }
2149
2280
  },
2150
- className: "w-10 h-10 flex items-center justify-center hover:bg-gray-100 rounded-lg transition-colors",
2281
+ disabled: !selectedDate || selectedDate.isSame(dayjs(), "day") || selectedDate.isBefore(dayjs(), "day"),
2282
+ 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",
2151
2283
  children: /* @__PURE__ */ jsx(
2152
2284
  "svg",
2153
2285
  {
@@ -2172,10 +2304,14 @@ var DateTimePicker = ({
2172
2304
  "button",
2173
2305
  {
2174
2306
  onClick: () => {
2175
- const newDate = selectedDate.add(1, "day");
2176
- setSelectedDate(newDate);
2307
+ if (selectedDate) {
2308
+ const newDate = selectedDate.add(1, "day");
2309
+ setSelectedDate(newDate);
2310
+ setCalendarValue(newDate);
2311
+ }
2177
2312
  },
2178
- className: "w-10 h-10 flex items-center justify-center hover:bg-gray-100 rounded-lg transition-colors",
2313
+ disabled: !selectedDate,
2314
+ 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",
2179
2315
  children: /* @__PURE__ */ jsx(
2180
2316
  "svg",
2181
2317
  {
@@ -2353,12 +2489,9 @@ var DemoRoomDetail = ({
2353
2489
  data: demoRoom,
2354
2490
  loading,
2355
2491
  error
2356
- } = useDemoRoom(
2357
- apiClient,
2358
- demoRoomCode || "",
2359
- locale,
2360
- { enabled: !!apiClient && !!demoRoomCode }
2361
- );
2492
+ } = useDemoRoom(apiClient, demoRoomCode || "", locale, {
2493
+ enabled: !!apiClient && !!demoRoomCode
2494
+ });
2362
2495
  const title = demoRoom?.name || titleProp || "Design District Demo Room";
2363
2496
  const descriptions = demoRoom?.description ? [demoRoom.description] : descriptionsProp || defaultDescriptions;
2364
2497
  const devices = demoRoom?.description || devicesProp || "eufyMake E1, eufyMake M5";
@@ -2387,8 +2520,8 @@ var DemoRoomDetail = ({
2387
2520
  /* @__PURE__ */ jsx("p", { className: "text-sm mt-2", children: error.message })
2388
2521
  ] }) });
2389
2522
  }
2390
- return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-8 items-start", children: [
2391
- /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
2523
+ return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-8 l:flex l:flex-col items-start", children: [
2524
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6 py-[24px]", children: [
2392
2525
  /* @__PURE__ */ jsx("h1", { className: "text-[40px] font-bold text-gray-900 leading-tight", children: title }),
2393
2526
  /* @__PURE__ */ jsx("div", { className: "space-y-4", children: descriptions.map((desc, index) => /* @__PURE__ */ jsx(
2394
2527
  "p",
@@ -2515,7 +2648,7 @@ var DemoRoomDetail = ({
2515
2648
  ] })
2516
2649
  ] })
2517
2650
  ] }),
2518
- /* @__PURE__ */ jsx("div", { className: "relative h-[400px] rounded-2xl overflow-hidden", children: images.length > 0 ? /* @__PURE__ */ jsx(
2651
+ /* @__PURE__ */ jsx("div", { className: "relative l:w-full h-[400px] rounded-2xl overflow-hidden", children: images.length > 0 ? /* @__PURE__ */ jsx(
2519
2652
  Swiper,
2520
2653
  {
2521
2654
  ...swiperVersion === "11+" && Navigation && Pagination && Autoplay ? { modules: [Navigation, Pagination, Autoplay] } : {},