@prokodo/ui 0.0.49 → 0.0.50

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.
Files changed (112) hide show
  1. package/dist/components/accordion/{Accordion.module.scss.js → Accordion.base.module.scss.js} +2 -8
  2. package/dist/components/accordion/Accordion.effects.client.js +16 -0
  3. package/dist/components/accordion/Accordion.effects.module.scss.js +8 -0
  4. package/dist/components/accordion/Accordion.view.js +84 -80
  5. package/dist/components/animated/Animated.module.scss.js +2 -8
  6. package/dist/components/avatar/Avatar.module.scss.js +2 -8
  7. package/dist/components/button/Button.module.scss.js +2 -8
  8. package/dist/components/calendly/Calendly.client.js +98 -22
  9. package/dist/components/calendly/Calendly.server.js +3 -2
  10. package/dist/components/calendly/Calendly.view.js +2 -1
  11. package/dist/components/card/{Card.module.scss.js → Card.base.module.scss.js} +2 -12
  12. package/dist/components/card/Card.effects.client.js +16 -0
  13. package/dist/components/card/Card.effects.module.scss.js +14 -0
  14. package/dist/components/card/Card.view.js +15 -4
  15. package/dist/components/carousel/Carousel.client.js +44 -20
  16. package/dist/components/carousel/Carousel.lazy.js +1 -1
  17. package/dist/components/carousel/Carousel.module.scss.js +2 -8
  18. package/dist/components/chip/Chip.module.scss.js +2 -8
  19. package/dist/components/datePicker/DatePicker.client.js +52 -51
  20. package/dist/components/datePicker/DatePicker.view.js +14 -3
  21. package/dist/components/dialog/Dialog.module.scss.js +2 -8
  22. package/dist/components/drawer/{Drawer.module.scss.js → Drawer.base.module.scss.js} +27 -32
  23. package/dist/components/drawer/Drawer.client.js +19 -2
  24. package/dist/components/drawer/Drawer.effects.client.js +16 -0
  25. package/dist/components/drawer/Drawer.effects.module.scss.js +29 -0
  26. package/dist/components/drawer/Drawer.server.js +0 -1
  27. package/dist/components/drawer/Drawer.view.js +44 -40
  28. package/dist/components/dynamic-list/DynamicList.module.scss.js +2 -8
  29. package/dist/components/form/Form.client.js +131 -54
  30. package/dist/components/form/Form.module.scss.js +2 -8
  31. package/dist/components/form/FormField.module.scss.js +2 -8
  32. package/dist/components/form/FormResponse.module.scss.js +2 -8
  33. package/dist/components/grid/Grid.module.scss.js +2 -8
  34. package/dist/components/grid/GridRow.module.scss.js +2 -8
  35. package/dist/components/headline/{Headline.module.scss.js → Headline.base.module.scss.js} +2 -15
  36. package/dist/components/headline/Headline.effects.client.js +14 -0
  37. package/dist/components/headline/Headline.effects.module.scss.js +13 -0
  38. package/dist/components/headline/Headline.js +28 -18
  39. package/dist/components/icon/Icon.module.scss.js +2 -8
  40. package/dist/components/image/Image.module.scss.js +2 -8
  41. package/dist/components/image-text/ImageText.module.scss.js +2 -8
  42. package/dist/components/input/Input.client.js +12 -1
  43. package/dist/components/input/Input.module.scss.js +3 -8
  44. package/dist/components/input/Input.view.js +10 -2
  45. package/dist/components/inputOTP/InputOTP.js +124 -41
  46. package/dist/components/inputOTP/InputOTP.module.scss.js +2 -8
  47. package/dist/components/label/Label.module.scss.js +2 -8
  48. package/dist/components/link/Link.module.scss.js +2 -8
  49. package/dist/components/list/List.module.scss.js +2 -8
  50. package/dist/components/loading/Loading.client.js +68 -0
  51. package/dist/components/loading/Loading.js +9 -55
  52. package/dist/components/loading/Loading.lazy.js +15 -0
  53. package/dist/components/loading/Loading.server.js +16 -0
  54. package/dist/components/loading/Loading.view.js +124 -0
  55. package/dist/components/lottie/Lottie.module.scss.js +2 -8
  56. package/dist/components/post-item/PostItem.module.scss.js +2 -8
  57. package/dist/components/post-item/PostItemAuthor.module.scss.js +2 -8
  58. package/dist/components/post-teaser/PostTeaser.module.scss.js +2 -8
  59. package/dist/components/post-widget/PostWidget.module.scss.js +2 -8
  60. package/dist/components/post-widget-carousel/PostWidgetCarousel.module.scss.js +2 -8
  61. package/dist/components/progressBar/ProgressBar.module.scss.js +1 -7
  62. package/dist/components/quote/Quote.module.scss.js +2 -8
  63. package/dist/components/rich-text/RichText.client.js +54 -23
  64. package/dist/components/rich-text/RichText.js +1 -1
  65. package/dist/components/rich-text/RichText.lazy.js +1 -1
  66. package/dist/components/rich-text/RichText.module.scss.js +4 -8
  67. package/dist/components/rich-text/RichText.server.js +2 -1
  68. package/dist/components/select/Select.module.scss.js +2 -8
  69. package/dist/components/sidenav/SideNav.module.scss.js +2 -8
  70. package/dist/components/skeleton/{Skeleton.module.scss.js → Skeleton.base.module.scss.js} +2 -8
  71. package/dist/components/skeleton/Skeleton.effects.client.js +16 -0
  72. package/dist/components/skeleton/Skeleton.effects.module.scss.js +7 -0
  73. package/dist/components/skeleton/Skeleton.js +21 -18
  74. package/dist/components/slider/Slider.client.js +70 -30
  75. package/dist/components/slider/Slider.module.scss.js +2 -8
  76. package/dist/components/snackbar/Snackbar.module.scss.js +2 -8
  77. package/dist/components/stepper/Stepper.module.scss.js +2 -8
  78. package/dist/components/switch/Switch.module.scss.js +2 -8
  79. package/dist/components/table/Table.module.scss.js +2 -8
  80. package/dist/components/table/TableCell.module.scss.js +2 -8
  81. package/dist/components/teaser/Teaser.module.scss.js +2 -8
  82. package/dist/constants/project.js +1 -1
  83. package/dist/hooks/useResponsiveValue.js +123 -0
  84. package/dist/tsconfig.build.tsbuildinfo +1 -1
  85. package/dist/types/components/accordion/Accordion.effects.client.d.ts +5 -0
  86. package/dist/types/components/calendly/Calendly.server.d.ts +1 -1
  87. package/dist/types/components/calendly/Calendly.view.d.ts +1 -1
  88. package/dist/types/components/card/Card.effects.client.d.ts +7 -0
  89. package/dist/types/components/carousel/Carousel.d.ts +2 -0
  90. package/dist/types/components/carousel/Carousel.lazy.d.ts +2 -0
  91. package/dist/types/components/carousel/Carousel.model.d.ts +14 -0
  92. package/dist/types/components/datePicker/DatePicker.view.d.ts +3 -5
  93. package/dist/types/components/drawer/Drawer.effects.client.d.ts +5 -0
  94. package/dist/types/components/headline/Headline.effects.client.d.ts +1 -0
  95. package/dist/types/components/input/Input.client.d.ts +1 -1
  96. package/dist/types/components/input/Input.view.d.ts +1 -1
  97. package/dist/types/components/loading/Loading.client.d.ts +4 -0
  98. package/dist/types/components/loading/Loading.d.ts +4 -2
  99. package/dist/types/components/loading/Loading.lazy.d.ts +5 -0
  100. package/dist/types/components/loading/Loading.model.d.ts +16 -1
  101. package/dist/types/components/loading/Loading.server.d.ts +4 -0
  102. package/dist/types/components/loading/Loading.view.d.ts +6 -0
  103. package/dist/types/components/loading/index.d.ts +2 -2
  104. package/dist/types/components/rich-text/RichText.d.ts +1 -1
  105. package/dist/types/components/rich-text/RichText.lazy.d.ts +1 -1
  106. package/dist/types/components/rich-text/RichText.model.d.ts +3 -3
  107. package/dist/types/components/skeleton/Skeleton.effects.client.d.ts +5 -0
  108. package/dist/types/components/slider/Slider.model.d.ts +1 -0
  109. package/dist/types/hooks/useResponsiveValue.d.ts +21 -0
  110. package/dist/ui.css +1078 -1543
  111. package/package.json +1 -1
  112. package/dist/components/loading/Loading.module.scss.js +0 -22
@@ -5,6 +5,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { useRef, useState, Children, useEffect, useCallback, useImperativeHandle } from "react";
6
6
  import { create } from "../../helpers/bem.js";
7
7
  import { isNumber } from "../../helpers/validations.js";
8
+ import { useResponsiveValue } from "../../hooks/useResponsiveValue.js";
8
9
  import styles from "./Carousel.module.scss.js";
9
10
  import { NEXT, PREV, handleTouchStart, handleTouchMove, handleTouchEnd, handleMouseUp, handleMouseDown } from "./Carousel.services.js";
10
11
  import { Button } from "../button/Button.js";
@@ -24,6 +25,8 @@ function CarouselClient(props) {
24
25
  classNameItem,
25
26
  classNameDots,
26
27
  classNameDot,
28
+ classNameDotActive,
29
+ responsive,
27
30
  onKeyDown,
28
31
  onMouseEnter,
29
32
  onMouseLeave,
@@ -35,22 +38,34 @@ function CarouselClient(props) {
35
38
  children,
36
39
  ...rest
37
40
  } = props;
38
- const containerRef = useRef(null);
41
+ const carouselContainerRef = useRef(null);
42
+ const { value: resolvedItemsToShow, ref: containerRef } = useResponsiveValue({
43
+ fallback: (responsive == null ? void 0 : responsive.fallback) ?? itemsToShow,
44
+ breakpoints: responsive == null ? void 0 : responsive.breakpoints,
45
+ valuesByBreakpoint: responsive == null ? void 0 : responsive.valuesByBreakpoint,
46
+ valuesByQueries: responsive == null ? void 0 : responsive.valuesByQueries,
47
+ containerRules: responsive == null ? void 0 : responsive.containerRules
48
+ });
49
+ const effectiveItemsToShow = responsive ? resolvedItemsToShow : itemsToShow;
50
+ const setHostRef = /* @__PURE__ */ __name((el) => {
51
+ carouselContainerRef.current = el;
52
+ containerRef.current = el;
53
+ }, "setHostRef");
39
54
  const touchStartX = useRef(0);
40
55
  const touchEndX = useRef(0);
41
56
  const mouseStartX = useRef(0);
42
57
  const mouseEndX = useRef(0);
43
58
  const [mobileHint, setMobileHint] = useState(true);
44
- const [current, setCurrent] = useState(itemsToShow);
59
+ const [current, setCurrent] = useState(effectiveItemsToShow);
45
60
  const [transitioning, setTrans] = useState(false);
46
61
  const [isPlaying, setPlaying] = useState(Boolean(autoplay));
47
62
  const [mouseActive, setMouse] = useState(false);
48
63
  const childrenArr = Children.toArray(children);
49
64
  const num = childrenArr.length;
50
65
  const items = [
51
- ...childrenArr.slice(-itemsToShow),
66
+ ...childrenArr.slice(-effectiveItemsToShow),
52
67
  ...childrenArr,
53
- ...childrenArr.slice(0, itemsToShow)
68
+ ...childrenArr.slice(0, effectiveItemsToShow)
54
69
  ];
55
70
  useEffect(() => {
56
71
  const id = setTimeout(() => setMobileHint(false), 1500);
@@ -63,26 +78,26 @@ function CarouselClient(props) {
63
78
  const next = dir === NEXT ? current + 1 : current - 1;
64
79
  setCurrent(next);
65
80
  setTimeout(() => {
66
- if (next >= num + itemsToShow) setCurrent(itemsToShow);
67
- else if (next < itemsToShow) setCurrent(num);
81
+ if (next >= num + effectiveItemsToShow) setCurrent(effectiveItemsToShow);
82
+ else if (next < effectiveItemsToShow) setCurrent(num);
68
83
  setTrans(false);
69
84
  }, 300);
70
85
  },
71
- [current, num, itemsToShow, transitioning]
86
+ [current, num, effectiveItemsToShow, transitioning]
72
87
  );
73
88
  const slideTo = useCallback(
74
89
  (i) => {
75
90
  if (transitioning) return;
76
91
  setTrans(true);
77
- const target = i + itemsToShow;
92
+ const target = i + effectiveItemsToShow;
78
93
  setCurrent(target);
79
94
  setTimeout(() => {
80
- if (target >= num + itemsToShow) setCurrent(target - num);
81
- else if (target < itemsToShow) setCurrent(num + target);
95
+ if (target >= num + effectiveItemsToShow) setCurrent(target - num);
96
+ else if (target < effectiveItemsToShow) setCurrent(num + target);
82
97
  setTrans(false);
83
98
  }, 300);
84
99
  },
85
- [itemsToShow, num, transitioning]
100
+ [effectiveItemsToShow, num, transitioning]
86
101
  );
87
102
  useEffect(() => {
88
103
  if (!isNumber(autoplay) || autoplay <= 0) return;
@@ -93,15 +108,18 @@ function CarouselClient(props) {
93
108
  useImperativeHandle(ref, () => ({
94
109
  slidePrev: /* @__PURE__ */ __name(() => slide(PREV), "slidePrev"),
95
110
  slideNext: /* @__PURE__ */ __name(() => slide(NEXT), "slideNext"),
96
- carouselContainer: containerRef.current
111
+ carouselContainer: carouselContainerRef.current
97
112
  }));
98
- const offset = -current * (100 / itemsToShow);
113
+ const getTransformValue = /* @__PURE__ */ __name(() => {
114
+ const offset = -current * (100 / effectiveItemsToShow);
115
+ return `translateX(${offset}%)`;
116
+ }, "getTransformValue");
99
117
  if (num === 0) return /* @__PURE__ */ jsx(Skeleton, { height: "200px", variant: "rectangular", width: "100%" });
100
118
  return /* @__PURE__ */ jsxs(
101
119
  "div",
102
120
  {
103
121
  ...rest,
104
- ref: containerRef,
122
+ ref: setHostRef,
105
123
  role: "button",
106
124
  tabIndex: 0,
107
125
  className: bem(
@@ -111,8 +129,14 @@ function CarouselClient(props) {
111
129
  ),
112
130
  onKeyDown: /* @__PURE__ */ __name((e) => {
113
131
  onKeyDown == null ? void 0 : onKeyDown(e);
114
- if (e.key === "ArrowLeft") slide(PREV);
115
- if (e.key === "ArrowRight") slide(NEXT);
132
+ switch (e.key) {
133
+ case "ArrowLeft":
134
+ slide("PREV");
135
+ break;
136
+ case "ArrowRight":
137
+ slide("NEXT");
138
+ break;
139
+ }
116
140
  }, "onKeyDown"),
117
141
  onMouseDown: /* @__PURE__ */ __name((e) => {
118
142
  onMouseDown == null ? void 0 : onMouseDown(e);
@@ -150,14 +174,14 @@ function CarouselClient(props) {
150
174
  {
151
175
  className: bem("wrapper", void 0, classNameWrapper),
152
176
  style: {
153
- transform: `translateX(${offset}%)`,
177
+ transform: getTransformValue(),
154
178
  transition: transitioning ? "transform 0.3s ease-in-out" : "none"
155
179
  },
156
180
  children: items.map((child, i) => /* @__PURE__ */ jsx(
157
181
  "div",
158
182
  {
159
183
  className: bem("item", void 0, classNameItem),
160
- style: { width: `${100 / itemsToShow}%` },
184
+ style: { width: `${100 / effectiveItemsToShow}%` },
161
185
  children: child
162
186
  },
163
187
  `cl-${i}`
@@ -185,11 +209,11 @@ function CarouselClient(props) {
185
209
  }
186
210
  ),
187
211
  /* @__PURE__ */ jsx("span", { className: bem("dots", void 0, classNameDots), children: childrenArr.map((_, i) => {
188
- const active = i === (current - itemsToShow + num) % num;
212
+ const active = i === (current - effectiveItemsToShow + num) % num;
189
213
  return /* @__PURE__ */ jsx(
190
214
  "button",
191
215
  {
192
- className: bem("dots__dot", { "is-active": active }, classNameDot),
216
+ className: bem("dots__dot", { "is-active": active }, `${classNameDot} ${active ? classNameDotActive ?? "" : ""}`),
193
217
  onClick: /* @__PURE__ */ __name(() => slideTo(i), "onClick"),
194
218
  onKeyDown: /* @__PURE__ */ __name((e) => e.key === "Enter" && slideTo(i), "onKeyDown")
195
219
  },
@@ -8,7 +8,7 @@ const Carousel_lazy = createLazyWrapper({
8
8
  name: "Carousel",
9
9
  Client: CarouselClient,
10
10
  Server: CarouselServer,
11
- hydrateOnVisible: true,
11
+ hydrateOnVisible: false,
12
12
  isInteractive: /* @__PURE__ */ __name(() => true, "isInteractive")
13
13
  });
14
14
  export {
@@ -1,5 +1,3 @@
1
- const gradientMove = "gradientMove";
2
- const fadeInKeyframe = "fadeInKeyframe";
3
1
  const styles = {
4
2
  "prokodo-Carousel": "prokodo-Carousel",
5
3
  "prokodo-Carousel--is-active": "prokodo-Carousel--is-active",
@@ -12,12 +10,8 @@ const styles = {
12
10
  "prokodo-Carousel__button": "prokodo-Carousel__button",
13
11
  "prokodo-Carousel__dots": "prokodo-Carousel__dots",
14
12
  "prokodo-Carousel__dots__dot": "prokodo-Carousel__dots__dot",
15
- "prokodo-Carousel__dots__dot--is-active": "prokodo-Carousel__dots__dot--is-active",
16
- gradientMove,
17
- fadeInKeyframe
13
+ "prokodo-Carousel__dots__dot--is-active": "prokodo-Carousel__dots__dot--is-active"
18
14
  };
19
15
  export {
20
- styles as default,
21
- fadeInKeyframe,
22
- gradientMove
16
+ styles as default
23
17
  };
@@ -1,5 +1,3 @@
1
- const gradientMove = "gradientMove";
2
- const fadeInKeyframe = "fadeInKeyframe";
3
1
  const styles = {
4
2
  "prokodo-Chip": "prokodo-Chip",
5
3
  "prokodo-Chip--is-clickable": "prokodo-Chip--is-clickable",
@@ -27,12 +25,8 @@ const styles = {
27
25
  "prokodo-Chip__delete--success": "prokodo-Chip__delete--success",
28
26
  "prokodo-Chip__delete--error": "prokodo-Chip__delete--error",
29
27
  "prokodo-Chip__delete--white": "prokodo-Chip__delete--white",
30
- "prokodo-Chip__delete--warning": "prokodo-Chip__delete--warning",
31
- gradientMove,
32
- fadeInKeyframe
28
+ "prokodo-Chip__delete--warning": "prokodo-Chip__delete--warning"
33
29
  };
34
30
  export {
35
- styles as default,
36
- fadeInKeyframe,
37
- gradientMove
31
+ styles as default
38
32
  };
@@ -3,16 +3,17 @@ var __defProp = Object.defineProperty;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import dayjs, { isDayjs } from "dayjs";
6
- import { useState, useMemo, useEffect, useCallback } from "react";
7
- import { isNull } from "../../helpers/validations.js";
6
+ import { useMemo, useState, useEffect, useCallback } from "react";
7
+ import { isString, isNull } from "../../helpers/validations.js";
8
8
  import { DatePickerView } from "./DatePicker.view.js";
9
9
  function toDayjs(val) {
10
10
  if (isNull(val)) return null;
11
- if (isDayjs(val)) return val;
11
+ if (isDayjs(val)) return val.isValid() ? val : null;
12
12
  const d = dayjs(val);
13
13
  return d.isValid() ? d : null;
14
14
  }
15
15
  __name(toDayjs, "toDayjs");
16
+ const sameByUnit = /* @__PURE__ */ __name((a, b, unit) => a === null && b === null ? true : a !== null && b !== null && a.isSame(b, unit), "sameByUnit");
16
17
  const DatePickerClient = /* @__PURE__ */ __name(({
17
18
  name,
18
19
  value,
@@ -28,58 +29,59 @@ const DatePickerClient = /* @__PURE__ */ __name(({
28
29
  minuteStep = 1,
29
30
  ...rest
30
31
  }) => {
31
- const [date, setDate] = useState(toDayjs(value));
32
- const [error, setError] = useState(void 0);
32
+ const unit = withTime ? "minute" : "day";
33
33
  const fmt = useMemo(
34
34
  () => format ?? (withTime ? "YYYY-MM-DDTHH:mm" : "YYYY-MM-DD"),
35
35
  [format, withTime]
36
36
  );
37
- const unit = withTime ? "minute" : "day";
37
+ const [date, setDate] = useState(toDayjs(value));
38
+ const [error, setError] = useState(void 0);
38
39
  useEffect(() => {
39
- setDate(toDayjs(value));
40
- setError(void 0);
41
- onValidate == null ? void 0 : onValidate(name, void 0);
42
- }, [value, name, onValidate]);
43
- const emitValue = useCallback(
44
- (e) => {
45
- var _a;
46
- const val = (_a = e == null ? void 0 : e.target) == null ? void 0 : _a.value;
47
- if (!val) {
48
- setDate(null);
49
- setError(void 0);
50
- onValidate == null ? void 0 : onValidate(name, void 0);
51
- onChange == null ? void 0 : onChange(null);
52
- return;
53
- }
54
- const d = dayjs(val, fmt, true);
55
- if (!d.isValid()) {
56
- const msg = withTime ? "Invalid date/time format." : "Invalid date format.";
57
- setError(msg);
58
- onValidate == null ? void 0 : onValidate(name, msg);
59
- onChange == null ? void 0 : onChange(null);
60
- return;
61
- }
62
- if (!isNull(minDate) && d.isBefore(dayjs(minDate), unit)) {
63
- const msg = dayjs(minDate).isSame(dayjs(), unit) ? (translations == null ? void 0 : translations.minDate) ?? (withTime ? "Date/time cannot be in the past." : "Date cannot be in the past.") : (translations == null ? void 0 : translations.minDate) ?? `Must be ≥ ${dayjs(minDate).format(fmt)}`;
64
- setError(msg);
65
- onValidate == null ? void 0 : onValidate(name, msg);
66
- onChange == null ? void 0 : onChange(null);
67
- return;
68
- }
69
- if (!isNull(maxDate) && d.isAfter(dayjs(maxDate), unit)) {
70
- const msg = dayjs(maxDate).isSame(dayjs(), unit) ? (translations == null ? void 0 : translations.maxDate) ?? (withTime ? "Date/time cannot be in the future." : "Date cannot be in the future.") : (translations == null ? void 0 : translations.maxDate) ?? `Must be ≤ ${dayjs(maxDate).format(fmt)}`;
71
- setError(msg);
72
- onValidate == null ? void 0 : onValidate(name, msg);
73
- onChange == null ? void 0 : onChange(null);
74
- return;
75
- }
76
- setDate(d);
77
- setError(void 0);
40
+ const incoming = toDayjs(value);
41
+ if (!sameByUnit(date, incoming, unit)) {
42
+ setDate(incoming);
43
+ if (incoming) setError(void 0);
44
+ }
45
+ }, [value, unit]);
46
+ const emitRaw = useCallback((raw) => {
47
+ if (raw === "") {
48
+ if (date !== null) setDate(null);
49
+ if (isString(error)) setError(void 0);
78
50
  onValidate == null ? void 0 : onValidate(name, void 0);
79
- onChange == null ? void 0 : onChange(d);
80
- },
81
- [fmt, maxDate, minDate, name, onChange, onValidate, translations, withTime, unit]
82
- );
51
+ onChange == null ? void 0 : onChange(null);
52
+ return;
53
+ }
54
+ const parsed = dayjs(raw, fmt, true);
55
+ const year = parsed.isValid() ? parsed.year() : dayjs(raw).year();
56
+ if (!parsed.isValid() || year > 9999 || year < 100) {
57
+ const msg = withTime ? "Invalid date/time format." : "Invalid date format.";
58
+ setError(msg);
59
+ onValidate == null ? void 0 : onValidate(name, msg);
60
+ onChange == null ? void 0 : onChange(null);
61
+ return;
62
+ }
63
+ if (!isNull(minDate) && parsed.isBefore(dayjs(minDate), unit)) {
64
+ const msg = (translations == null ? void 0 : translations.minDate) ?? (dayjs(minDate).isSame(dayjs(), unit) ? withTime ? "Date/time cannot be in the past." : "Date cannot be in the past." : `Must be ≥ ${dayjs(minDate).format(fmt)}`);
65
+ setError(msg);
66
+ onValidate == null ? void 0 : onValidate(name, msg);
67
+ onChange == null ? void 0 : onChange(null);
68
+ return;
69
+ }
70
+ if (!isNull(maxDate) && parsed.isAfter(dayjs(maxDate), unit)) {
71
+ const msg = (translations == null ? void 0 : translations.maxDate) ?? (dayjs(maxDate).isSame(dayjs(), unit) ? withTime ? "Date/time cannot be in the future." : "Date cannot be in the future." : `Must be ≤ ${dayjs(maxDate).format(fmt)}`);
72
+ setError(msg);
73
+ onValidate == null ? void 0 : onValidate(name, msg);
74
+ onChange == null ? void 0 : onChange(null);
75
+ return;
76
+ }
77
+ const snapped = withTime ? parsed.minute(
78
+ Math.round(parsed.minute() / Math.max(1, minuteStep)) * Math.max(1, minuteStep)
79
+ ) : parsed;
80
+ if (!sameByUnit(date, snapped, unit)) setDate(snapped);
81
+ if (isString(error)) setError(void 0);
82
+ onValidate == null ? void 0 : onValidate(name, void 0);
83
+ onChange == null ? void 0 : onChange(snapped);
84
+ }, [date, error, fmt, maxDate, minDate, minuteStep, name, onChange, onValidate, translations, unit, withTime]);
83
85
  return /* @__PURE__ */ jsx(
84
86
  DatePickerView,
85
87
  {
@@ -94,8 +96,7 @@ const DatePickerClient = /* @__PURE__ */ __name(({
94
96
  name,
95
97
  value: date,
96
98
  withTime,
97
- onChange: /* @__PURE__ */ __name((value2) => emitValue(value2), "onChange"),
98
- onValidate
99
+ onChangeInput: emitRaw
99
100
  }
100
101
  );
101
102
  }, "DatePickerClient");
@@ -16,6 +16,8 @@ function DatePickerView({
16
16
  maxDate,
17
17
  withTime = false,
18
18
  minuteStep = 1,
19
+ onChangeInput,
20
+ // <- string-based adapter
19
21
  ...rest
20
22
  }) {
21
23
  const effectiveFormat = format ?? (withTime ? "YYYY-MM-DDTHH:mm" : "YYYY-MM-DD");
@@ -24,11 +26,18 @@ function DatePickerView({
24
26
  const displayValue = !isNull(value) ? dayjs(value).format(effectiveFormat) : "";
25
27
  const min = !isNull(minDate) ? dayjs(minDate).format(htmlMinMaxFormat) : void 0;
26
28
  const max = !isNull(maxDate) ? dayjs(maxDate).format(htmlMinMaxFormat) : void 0;
27
- const step = withTime ? Math.max(1, minuteStep) * 60 : rest == null ? void 0 : rest.step;
29
+ const computedStep = withTime ? Math.max(1, minuteStep) * 60 : void 0;
30
+ const { step: _ignored, ...restWithoutStep } = rest;
31
+ const handleInput = /* @__PURE__ */ __name((e) => {
32
+ onChangeInput == null ? void 0 : onChangeInput(e.currentTarget.value);
33
+ }, "handleInput");
34
+ const handleChange = /* @__PURE__ */ __name((e) => {
35
+ onChangeInput == null ? void 0 : onChangeInput(e.currentTarget.value);
36
+ }, "handleChange");
28
37
  return /* @__PURE__ */ jsx(
29
38
  InputView,
30
39
  {
31
- ...rest,
40
+ ...restWithoutStep,
32
41
  errorText,
33
42
  helperText,
34
43
  isFocused: true,
@@ -39,7 +48,9 @@ function DatePickerView({
39
48
  placeholder,
40
49
  type: inputType,
41
50
  value: displayValue,
42
- ...withTime ? { step } : {}
51
+ onChange: handleChange,
52
+ onInput: handleInput,
53
+ ...withTime && computedStep !== void 0 ? { step: computedStep } : {}
43
54
  }
44
55
  );
45
56
  }
@@ -1,5 +1,3 @@
1
- const gradientMove = "gradientMove";
2
- const fadeInKeyframe = "fadeInKeyframe";
3
1
  const styles = {
4
2
  "prokodo-Dialog": "prokodo-Dialog",
5
3
  "prokodo-Dialog--is-visible": "prokodo-Dialog--is-visible",
@@ -17,12 +15,8 @@ const styles = {
17
15
  "prokodo-Dialog__actions": "prokodo-Dialog__actions",
18
16
  "prokodo-Dialog__backdrop": "prokodo-Dialog__backdrop",
19
17
  "prokodo-Dialog__backdrop--is-visible": "prokodo-Dialog__backdrop--is-visible",
20
- "prokodo-Dialog--fullScreen": "prokodo-Dialog--fullScreen",
21
- gradientMove,
22
- fadeInKeyframe
18
+ "prokodo-Dialog--fullScreen": "prokodo-Dialog--fullScreen"
23
19
  };
24
20
  export {
25
- styles as default,
26
- fadeInKeyframe,
27
- gradientMove
21
+ styles as default
28
22
  };
@@ -1,14 +1,13 @@
1
- const slideInLeft = "slideInLeft";
2
- const slideOutLeft = "slideOutLeft";
3
- const slideInRight = "slideInRight";
4
- const slideOutRight = "slideOutRight";
5
- const slideInTop = "slideInTop";
6
- const slideOutTop = "slideOutTop";
7
- const slideInBottom = "slideInBottom";
8
- const slideOutBottom = "slideOutBottom";
9
- const gradientMove = "gradientMove";
10
- const fadeInKeyframe = "fadeInKeyframe";
1
+ const DrawerSlideInLeft = "DrawerSlideInLeft";
2
+ const DrawerSlideOutLeft = "DrawerSlideOutLeft";
3
+ const DrawerSlideInRight = "DrawerSlideInRight";
4
+ const DrawerSlideOutRight = "DrawerSlideOutRight";
5
+ const DrawerSlideInTop = "DrawerSlideInTop";
6
+ const DrawerSlideOutTop = "DrawerSlideOutTop";
7
+ const DrawerSlideInBottom = "DrawerSlideInBottom";
8
+ const DrawerSlideOutBottom = "DrawerSlideOutBottom";
11
9
  const styles = {
10
+ "prokodo-Drawer": "prokodo-Drawer",
12
11
  "prokodo-Drawer__backdrop": "prokodo-Drawer__backdrop",
13
12
  "prokodo-Drawer__backdrop--open": "prokodo-Drawer__backdrop--open",
14
13
  "prokodo-Drawer__container": "prokodo-Drawer__container",
@@ -16,35 +15,31 @@ const styles = {
16
15
  "prokodo-Drawer__container--fullscreen": "prokodo-Drawer__container--fullscreen",
17
16
  "prokodo-Drawer__container--anchor-left": "prokodo-Drawer__container--anchor-left",
18
17
  "prokodo-Drawer__container--anchor-left--open": "prokodo-Drawer__container--anchor-left--open",
19
- slideInLeft,
20
- slideOutLeft,
18
+ DrawerSlideInLeft,
19
+ DrawerSlideOutLeft,
21
20
  "prokodo-Drawer__container--anchor-right": "prokodo-Drawer__container--anchor-right",
22
21
  "prokodo-Drawer__container--anchor-right--open": "prokodo-Drawer__container--anchor-right--open",
23
- slideInRight,
24
- slideOutRight,
22
+ DrawerSlideInRight,
23
+ DrawerSlideOutRight,
25
24
  "prokodo-Drawer__container--anchor-top": "prokodo-Drawer__container--anchor-top",
26
25
  "prokodo-Drawer__container--anchor-top--open": "prokodo-Drawer__container--anchor-top--open",
27
- slideInTop,
28
- slideOutTop,
26
+ DrawerSlideInTop,
27
+ DrawerSlideOutTop,
29
28
  "prokodo-Drawer__container--anchor-bottom": "prokodo-Drawer__container--anchor-bottom",
30
29
  "prokodo-Drawer__container--anchor-bottom--open": "prokodo-Drawer__container--anchor-bottom--open",
31
- slideInBottom,
32
- slideOutBottom,
30
+ DrawerSlideInBottom,
31
+ DrawerSlideOutBottom,
33
32
  "prokodo-Drawer__header": "prokodo-Drawer__header",
34
- "prokodo-Drawer__content": "prokodo-Drawer__content",
35
- gradientMove,
36
- fadeInKeyframe
33
+ "prokodo-Drawer__content": "prokodo-Drawer__content"
37
34
  };
38
35
  export {
39
- styles as default,
40
- fadeInKeyframe,
41
- gradientMove,
42
- slideInBottom,
43
- slideInLeft,
44
- slideInRight,
45
- slideInTop,
46
- slideOutBottom,
47
- slideOutLeft,
48
- slideOutRight,
49
- slideOutTop
36
+ DrawerSlideInBottom,
37
+ DrawerSlideInLeft,
38
+ DrawerSlideInRight,
39
+ DrawerSlideInTop,
40
+ DrawerSlideOutBottom,
41
+ DrawerSlideOutLeft,
42
+ DrawerSlideOutRight,
43
+ DrawerSlideOutTop,
44
+ styles as default
50
45
  };
@@ -2,13 +2,14 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
4
  import { jsx } from "react/jsx-runtime";
5
- import { forwardRef, useRef, useState, useCallback, useImperativeHandle, useEffect } from "react";
5
+ import { forwardRef, useRef, useState, useCallback, useEffect, useImperativeHandle } from "react";
6
6
  import { DrawerView } from "./Drawer.view.js";
7
7
  function DrawerClient({ open = false, closeOnBackdropClick = true, onChange, ...props }, ref) {
8
8
  const triggerRef = useRef(null);
9
9
  const closeButtonRef = useRef(null);
10
10
  const containerRef = useRef(null);
11
11
  const [isOpen, setIsOpen] = useState(() => open);
12
+ const syncingFromPropRef = useRef(false);
12
13
  const openDrawer = useCallback(() => {
13
14
  triggerRef.current = document.activeElement;
14
15
  setIsOpen(true);
@@ -17,11 +18,27 @@ function DrawerClient({ open = false, closeOnBackdropClick = true, onChange, ...
17
18
  (reason) => {
18
19
  var _a;
19
20
  setIsOpen(false);
20
- onChange == null ? void 0 : onChange({}, reason ?? "backdropClick");
21
+ if (!syncingFromPropRef.current) {
22
+ onChange == null ? void 0 : onChange({}, reason ?? "backdropClick");
23
+ }
21
24
  (_a = triggerRef.current) == null ? void 0 : _a.focus();
22
25
  },
23
26
  [onChange]
24
27
  );
28
+ useEffect(() => {
29
+ var _a;
30
+ syncingFromPropRef.current = true;
31
+ if (open && !isOpen) {
32
+ triggerRef.current = document.activeElement;
33
+ setIsOpen(true);
34
+ } else if (!open && isOpen) {
35
+ setIsOpen(false);
36
+ (_a = triggerRef.current) == null ? void 0 : _a.focus();
37
+ }
38
+ queueMicrotask(() => {
39
+ syncingFromPropRef.current = false;
40
+ });
41
+ }, [open, isOpen]);
25
42
  useImperativeHandle(
26
43
  ref,
27
44
  () => ({
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+ import { useEffect } from "react";
5
+ function DrawerEffectsLoader({ useSlide }) {
6
+ useEffect(() => {
7
+ if (Boolean(useSlide)) {
8
+ void import("./Drawer.effects.module.scss.js");
9
+ }
10
+ }, [useSlide]);
11
+ return null;
12
+ }
13
+ __name(DrawerEffectsLoader, "DrawerEffectsLoader");
14
+ export {
15
+ DrawerEffectsLoader
16
+ };
@@ -0,0 +1,29 @@
1
+ const DrawerSlideInLeft = "DrawerSlideInLeft";
2
+ const DrawerSlideOutLeft = "DrawerSlideOutLeft";
3
+ const DrawerSlideInRight = "DrawerSlideInRight";
4
+ const DrawerSlideOutRight = "DrawerSlideOutRight";
5
+ const DrawerSlideInTop = "DrawerSlideInTop";
6
+ const DrawerSlideOutTop = "DrawerSlideOutTop";
7
+ const DrawerSlideInBottom = "DrawerSlideInBottom";
8
+ const DrawerSlideOutBottom = "DrawerSlideOutBottom";
9
+ const Drawer_effects_module = {
10
+ DrawerSlideInLeft,
11
+ DrawerSlideOutLeft,
12
+ DrawerSlideInRight,
13
+ DrawerSlideOutRight,
14
+ DrawerSlideInTop,
15
+ DrawerSlideOutTop,
16
+ DrawerSlideInBottom,
17
+ DrawerSlideOutBottom
18
+ };
19
+ export {
20
+ DrawerSlideInBottom,
21
+ DrawerSlideInLeft,
22
+ DrawerSlideInRight,
23
+ DrawerSlideInTop,
24
+ DrawerSlideOutBottom,
25
+ DrawerSlideOutLeft,
26
+ DrawerSlideOutRight,
27
+ DrawerSlideOutTop,
28
+ Drawer_effects_module as default
29
+ };
@@ -3,7 +3,6 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { DrawerView } from "./Drawer.view.js";
5
5
  function DrawerServer(props) {
6
- if (Boolean(props == null ? void 0 : props.open)) return null;
7
6
  return /* @__PURE__ */ jsx(DrawerView, { ...props });
8
7
  }
9
8
  __name(DrawerServer, "DrawerServer");