@monimesl/dot-renderer-react 0.1.0-alpha.3 → 0.1.0-alpha.31

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 (267) hide show
  1. package/README.md +43 -1
  2. package/dist/LICENSE-PHOSPHOR +21 -0
  3. package/dist/_virtual/_rolldown/runtime.js +14 -0
  4. package/dist/_virtual/builtin_esm-external-require-react.js +9 -0
  5. package/dist/color.js +94 -0
  6. package/dist/components/amount-input.d.ts +6 -0
  7. package/dist/components/amount-input.js +111 -0
  8. package/dist/components/avatar.d.ts +6 -0
  9. package/dist/components/avatar.js +68 -0
  10. package/dist/components/box.js +56 -0
  11. package/dist/components/button.d.ts +6 -0
  12. package/dist/components/button.js +42 -0
  13. package/dist/components/carousel.d.ts +6 -0
  14. package/dist/components/carousel.js +258 -0
  15. package/dist/components/chip.d.ts +6 -0
  16. package/dist/components/chip.js +41 -0
  17. package/dist/components/code-input.d.ts +6 -0
  18. package/dist/components/code-input.js +96 -0
  19. package/dist/components/detail-row.d.ts +6 -0
  20. package/dist/components/detail-row.js +40 -0
  21. package/dist/components/disclosure.d.ts +6 -0
  22. package/dist/components/disclosure.js +76 -0
  23. package/dist/components/divider.d.ts +6 -0
  24. package/dist/components/divider.js +18 -0
  25. package/dist/components/empty-state.d.ts +6 -0
  26. package/dist/components/empty-state.js +64 -0
  27. package/dist/components/feedback.d.ts +8 -0
  28. package/dist/components/feedback.js +101 -0
  29. package/dist/components/field-box.js +44 -0
  30. package/dist/components/field.js +43 -0
  31. package/dist/components/footer.d.ts +6 -0
  32. package/dist/components/footer.js +25 -0
  33. package/dist/components/grid.d.ts +7 -0
  34. package/dist/components/grid.js +97 -0
  35. package/dist/components/https.js +11 -0
  36. package/dist/components/icon-artwork.js +143 -0
  37. package/dist/components/icon-button.js +28 -0
  38. package/dist/components/icon-svg.js +27 -0
  39. package/dist/components/icon.d.ts +6 -0
  40. package/dist/components/icon.js +25 -0
  41. package/dist/components/image.d.ts +6 -0
  42. package/dist/components/image.js +40 -0
  43. package/dist/components/index.d.ts +38 -0
  44. package/dist/components/index.js +92 -0
  45. package/dist/components/input.d.ts +6 -0
  46. package/dist/components/input.js +108 -0
  47. package/dist/components/link.d.ts +6 -0
  48. package/dist/components/link.js +32 -0
  49. package/dist/components/list.d.ts +7 -0
  50. package/dist/components/list.js +143 -0
  51. package/dist/components/numbers.js +9 -0
  52. package/dist/components/option-place.js +9 -0
  53. package/dist/components/option.d.ts +6 -0
  54. package/dist/components/option.js +44 -0
  55. package/dist/components/padding.d.ts +2 -0
  56. package/dist/components/padding.js +38 -0
  57. package/dist/components/pressable.js +17 -0
  58. package/dist/components/prose-context.js +5 -0
  59. package/dist/components/prose.d.ts +9 -0
  60. package/dist/components/prose.js +67 -0
  61. package/dist/components/qr-code.d.ts +6 -0
  62. package/dist/components/qr-code.js +58 -0
  63. package/dist/components/rich-text.d.ts +6 -0
  64. package/dist/components/rich-text.js +73 -0
  65. package/dist/components/scroll.d.ts +6 -0
  66. package/dist/components/scroll.js +57 -0
  67. package/dist/components/select.d.ts +6 -0
  68. package/dist/components/select.js +93 -0
  69. package/dist/components/sheet.d.ts +8 -0
  70. package/dist/components/sheet.js +106 -0
  71. package/dist/components/skeleton.d.ts +6 -0
  72. package/dist/components/skeleton.js +55 -0
  73. package/dist/components/slider.d.ts +6 -0
  74. package/dist/components/slider.js +57 -0
  75. package/dist/components/spinner.d.ts +6 -0
  76. package/dist/components/spinner.js +48 -0
  77. package/dist/components/stack.d.ts +6 -0
  78. package/dist/components/stack.js +25 -0
  79. package/dist/components/stepper.d.ts +6 -0
  80. package/dist/components/stepper.js +92 -0
  81. package/dist/components/steps.d.ts +7 -0
  82. package/dist/components/steps.js +110 -0
  83. package/dist/components/tabs.d.ts +7 -0
  84. package/dist/components/tabs.js +95 -0
  85. package/dist/components/text-area.d.ts +6 -0
  86. package/dist/components/text-area.js +42 -0
  87. package/dist/components/text.d.ts +6 -0
  88. package/dist/components/text.js +107 -0
  89. package/dist/components/toast.d.ts +6 -0
  90. package/dist/components/toast.js +56 -0
  91. package/dist/components/toggles.d.ts +9 -0
  92. package/dist/components/toggles.js +148 -0
  93. package/dist/components/tokens.js +49 -0
  94. package/dist/components/tones.js +30 -0
  95. package/dist/components/typed-text.js +28 -0
  96. package/dist/components/view.d.ts +6 -0
  97. package/dist/components/view.js +61 -0
  98. package/dist/index.d.ts +43 -48
  99. package/dist/index.js +40 -1335
  100. package/dist/markdown.js +230 -0
  101. package/dist/page-root.d.ts +2 -0
  102. package/dist/page-root.js +20 -0
  103. package/dist/portal.js +8 -0
  104. package/dist/pull-to-refresh.js +120 -0
  105. package/dist/react-host/19.3.0/react-dom.js +3 -0
  106. package/dist/react-host/19.3.0/react-host.js +6 -6
  107. package/dist/renderer.d.ts +17 -0
  108. package/dist/renderer.js +33 -0
  109. package/dist/root.d.ts +10 -0
  110. package/dist/root.js +71 -0
  111. package/dist/styles.css +1 -0
  112. package/dist/theme.d.ts +26 -0
  113. package/dist/theme.js +129 -0
  114. package/dist/types.d.ts +7 -0
  115. package/dist/vendor/@base-ui/react/checkbox/indicator/CheckboxIndicator.js +51 -0
  116. package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRoot.js +265 -0
  117. package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRootContext.js +13 -0
  118. package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRootDataAttributes.js +11 -0
  119. package/dist/vendor/@base-ui/react/checkbox/utils/getCheckboxStateAttributesMapping.js +15 -0
  120. package/dist/vendor/@base-ui/react/checkbox-group/CheckboxGroupContext.js +10 -0
  121. package/dist/vendor/@base-ui/react/dialog/backdrop/DialogBackdrop.js +40 -0
  122. package/dist/vendor/@base-ui/react/dialog/close/DialogClose.js +39 -0
  123. package/dist/vendor/@base-ui/react/dialog/popup/DialogPopup.js +92 -0
  124. package/dist/vendor/@base-ui/react/dialog/popup/DialogPopupCssVars.js +8 -0
  125. package/dist/vendor/@base-ui/react/dialog/popup/DialogPopupDataAttributes.js +7 -0
  126. package/dist/vendor/@base-ui/react/dialog/portal/DialogPortal.js +38 -0
  127. package/dist/vendor/@base-ui/react/dialog/portal/DialogPortalContext.js +13 -0
  128. package/dist/vendor/@base-ui/react/dialog/root/DialogRoot.js +16 -0
  129. package/dist/vendor/@base-ui/react/dialog/root/DialogRootContext.js +13 -0
  130. package/dist/vendor/@base-ui/react/dialog/root/useDialogRoot.js +77 -0
  131. package/dist/vendor/@base-ui/react/dialog/root/useRenderDialogRoot.js +65 -0
  132. package/dist/vendor/@base-ui/react/dialog/store/DialogStore.js +70 -0
  133. package/dist/vendor/@base-ui/react/dialog/title/DialogTitle.js +25 -0
  134. package/dist/vendor/@base-ui/react/dialog/utils/stateAttributesMapping.js +17 -0
  135. package/dist/vendor/@base-ui/react/field/control/FieldControlDataAttributes.js +11 -0
  136. package/dist/vendor/@base-ui/react/field/item/FieldItemContext.js +10 -0
  137. package/dist/vendor/@base-ui/react/field/root/useFieldValidation.js +18 -0
  138. package/dist/vendor/@base-ui/react/fieldset/root/FieldsetRootContext.js +13 -0
  139. package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingFocusManager.js +477 -0
  140. package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingPortal.js +165 -0
  141. package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingRootStore.js +65 -0
  142. package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingTree.js +22 -0
  143. package/dist/vendor/@base-ui/react/floating-ui-react/hooks/useDismiss.js +373 -0
  144. package/dist/vendor/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.js +58 -0
  145. package/dist/vendor/@base-ui/react/floating-ui-react/utils/composite.js +40 -0
  146. package/dist/vendor/@base-ui/react/floating-ui-react/utils/constants.js +5 -0
  147. package/dist/vendor/@base-ui/react/floating-ui-react/utils/createAttribute.js +6 -0
  148. package/dist/vendor/@base-ui/react/floating-ui-react/utils/createEventEmitter.js +18 -0
  149. package/dist/vendor/@base-ui/react/floating-ui-react/utils/element.js +26 -0
  150. package/dist/vendor/@base-ui/react/floating-ui-react/utils/enqueueFocus.js +25 -0
  151. package/dist/vendor/@base-ui/react/floating-ui-react/utils/event.js +25 -0
  152. package/dist/vendor/@base-ui/react/floating-ui-react/utils/markOthers.js +116 -0
  153. package/dist/vendor/@base-ui/react/floating-ui-react/utils/nodes.js +16 -0
  154. package/dist/vendor/@base-ui/react/floating-ui-react/utils/tabbable.js +135 -0
  155. package/dist/vendor/@base-ui/react/internals/TransitionStatusDataAttributes.js +11 -0
  156. package/dist/vendor/@base-ui/react/internals/composite/composite.js +89 -0
  157. package/dist/vendor/@base-ui/react/internals/composite/constants.js +4 -0
  158. package/dist/vendor/@base-ui/react/internals/composite/item/CompositeItem.js +21 -0
  159. package/dist/vendor/@base-ui/react/internals/composite/item/useCompositeItem.js +31 -0
  160. package/dist/vendor/@base-ui/react/internals/composite/list/CompositeList.js +180 -0
  161. package/dist/vendor/@base-ui/react/internals/composite/list/CompositeListContext.js +15 -0
  162. package/dist/vendor/@base-ui/react/internals/composite/list/useCompositeListItem.js +54 -0
  163. package/dist/vendor/@base-ui/react/internals/composite/root/CompositeRoot.js +62 -0
  164. package/dist/vendor/@base-ui/react/internals/composite/root/CompositeRootContext.js +13 -0
  165. package/dist/vendor/@base-ui/react/internals/composite/root/useCompositeRoot.js +170 -0
  166. package/dist/vendor/@base-ui/react/internals/constants.js +18 -0
  167. package/dist/vendor/@base-ui/react/internals/createBaseUIEventDetails.js +40 -0
  168. package/dist/vendor/@base-ui/react/internals/direction-context/DirectionContext.js +10 -0
  169. package/dist/vendor/@base-ui/react/internals/field-constants/constants.js +33 -0
  170. package/dist/vendor/@base-ui/react/internals/field-register-control/useRegisterFieldControl.js +40 -0
  171. package/dist/vendor/@base-ui/react/internals/field-root-context/FieldRootContext.js +45 -0
  172. package/dist/vendor/@base-ui/react/internals/form-context/FormContext.js +18 -0
  173. package/dist/vendor/@base-ui/react/internals/getStateAttributesProps.js +17 -0
  174. package/dist/vendor/@base-ui/react/internals/labelable-provider/LabelableContext.js +24 -0
  175. package/dist/vendor/@base-ui/react/internals/labelable-provider/useAriaLabelledBy.js +35 -0
  176. package/dist/vendor/@base-ui/react/internals/labelable-provider/useLabelableId.js +57 -0
  177. package/dist/vendor/@base-ui/react/internals/reason-parts.js +14 -0
  178. package/dist/vendor/@base-ui/react/internals/serializeValue.js +12 -0
  179. package/dist/vendor/@base-ui/react/internals/stateAttributesMapping.js +11 -0
  180. package/dist/vendor/@base-ui/react/internals/use-button/useButton.js +137 -0
  181. package/dist/vendor/@base-ui/react/internals/useAnimationsFinished.js +94 -0
  182. package/dist/vendor/@base-ui/react/internals/useBaseUiId.js +13 -0
  183. package/dist/vendor/@base-ui/react/internals/useOpenChangeComplete.js +28 -0
  184. package/dist/vendor/@base-ui/react/internals/useRenderElement.js +109 -0
  185. package/dist/vendor/@base-ui/react/internals/useTransitionStatus.js +70 -0
  186. package/dist/vendor/@base-ui/react/internals/useValueChanged.js +15 -0
  187. package/dist/vendor/@base-ui/react/merge-props/mergeProps.js +153 -0
  188. package/dist/vendor/@base-ui/react/radio/indicator/RadioIndicator.js +46 -0
  189. package/dist/vendor/@base-ui/react/radio/root/RadioRoot.js +179 -0
  190. package/dist/vendor/@base-ui/react/radio/root/RadioRootContext.js +13 -0
  191. package/dist/vendor/@base-ui/react/radio/root/RadioRootDataAttributes.js +11 -0
  192. package/dist/vendor/@base-ui/react/radio/utils/stateAttributesMapping.js +14 -0
  193. package/dist/vendor/@base-ui/react/radio-group/RadioGroup.js +170 -0
  194. package/dist/vendor/@base-ui/react/radio-group/RadioGroupContext.js +10 -0
  195. package/dist/vendor/@base-ui/react/switch/root/SwitchRoot.js +170 -0
  196. package/dist/vendor/@base-ui/react/switch/root/SwitchRootContext.js +13 -0
  197. package/dist/vendor/@base-ui/react/switch/root/SwitchRootDataAttributes.js +11 -0
  198. package/dist/vendor/@base-ui/react/switch/stateAttributesMapping.js +12 -0
  199. package/dist/vendor/@base-ui/react/switch/thumb/SwitchThumb.js +25 -0
  200. package/dist/vendor/@base-ui/react/tabs/list/TabsList.js +98 -0
  201. package/dist/vendor/@base-ui/react/tabs/list/TabsListContext.js +13 -0
  202. package/dist/vendor/@base-ui/react/tabs/root/TabsRoot.js +213 -0
  203. package/dist/vendor/@base-ui/react/tabs/root/TabsRootContext.js +16 -0
  204. package/dist/vendor/@base-ui/react/tabs/root/TabsRootDataAttributes.js +8 -0
  205. package/dist/vendor/@base-ui/react/tabs/root/stateAttributesMapping.js +5 -0
  206. package/dist/vendor/@base-ui/react/tabs/tab/TabsTab.js +137 -0
  207. package/dist/vendor/@base-ui/react/utils/CommonPopupDataAttributes.js +24 -0
  208. package/dist/vendor/@base-ui/react/utils/CommonTriggerDataAttributes.js +11 -0
  209. package/dist/vendor/@base-ui/react/utils/FocusGuard.js +32 -0
  210. package/dist/vendor/@base-ui/react/utils/InternalBackdrop.js +30 -0
  211. package/dist/vendor/@base-ui/react/utils/dispatchClickWithModifiers.js +25 -0
  212. package/dist/vendor/@base-ui/react/utils/popupStateMapping.js +22 -0
  213. package/dist/vendor/@base-ui/react/utils/popups/popupStoreUtils.js +247 -0
  214. package/dist/vendor/@base-ui/react/utils/popups/popupTriggerMap.js +96 -0
  215. package/dist/vendor/@base-ui/react/utils/popups/store.js +94 -0
  216. package/dist/vendor/@base-ui/react/utils/resolveClassName.js +13 -0
  217. package/dist/vendor/@base-ui/react/utils/resolveRef.js +11 -0
  218. package/dist/vendor/@base-ui/react/utils/resolveStyle.js +13 -0
  219. package/dist/vendor/@base-ui/react/utils/useFocusableWhenDisabled.js +30 -0
  220. package/dist/vendor/@base-ui/utils/addEventListener.js +12 -0
  221. package/dist/vendor/@base-ui/utils/createLogOnce.js +20 -0
  222. package/dist/vendor/@base-ui/utils/empty.js +6 -0
  223. package/dist/vendor/@base-ui/utils/error.js +5 -0
  224. package/dist/vendor/@base-ui/utils/fastHooks.js +68 -0
  225. package/dist/vendor/@base-ui/utils/formatErrorMessage.js +27 -0
  226. package/dist/vendor/@base-ui/utils/getDefaultFormSubmitter.js +25 -0
  227. package/dist/vendor/@base-ui/utils/getReactElementRef.js +14 -0
  228. package/dist/vendor/@base-ui/utils/inertValue.js +8 -0
  229. package/dist/vendor/@base-ui/utils/isElementDisabled.js +6 -0
  230. package/dist/vendor/@base-ui/utils/mergeCleanups.js +14 -0
  231. package/dist/vendor/@base-ui/utils/mergeObjects.js +11 -0
  232. package/dist/vendor/@base-ui/utils/owner.js +7 -0
  233. package/dist/vendor/@base-ui/utils/platform/engine.js +8 -0
  234. package/dist/vendor/@base-ui/utils/platform/env.js +6 -0
  235. package/dist/vendor/@base-ui/utils/platform/os.js +15 -0
  236. package/dist/vendor/@base-ui/utils/platform/screen-reader.js +9 -0
  237. package/dist/vendor/@base-ui/utils/platform/shared.js +36 -0
  238. package/dist/vendor/@base-ui/utils/reactVersion.js +8 -0
  239. package/dist/vendor/@base-ui/utils/safeReact.js +13 -0
  240. package/dist/vendor/@base-ui/utils/shadowDom.js +26 -0
  241. package/dist/vendor/@base-ui/utils/store/ReactStore.js +181 -0
  242. package/dist/vendor/@base-ui/utils/store/Store.js +102 -0
  243. package/dist/vendor/@base-ui/utils/store/useStore.js +97 -0
  244. package/dist/vendor/@base-ui/utils/useAnimationFrame.js +87 -0
  245. package/dist/vendor/@base-ui/utils/useControlled.js +52 -0
  246. package/dist/vendor/@base-ui/utils/useId.js +32 -0
  247. package/dist/vendor/@base-ui/utils/useIsoLayoutEffect.js +7 -0
  248. package/dist/vendor/@base-ui/utils/useMergedRefs.js +87 -0
  249. package/dist/vendor/@base-ui/utils/useOnMount.js +12 -0
  250. package/dist/vendor/@base-ui/utils/useRefWithInit.js +18 -0
  251. package/dist/vendor/@base-ui/utils/useScrollLock.js +206 -0
  252. package/dist/vendor/@base-ui/utils/useStableCallback.js +38 -0
  253. package/dist/vendor/@base-ui/utils/useTimeout.js +43 -0
  254. package/dist/vendor/@base-ui/utils/useValueAsRef.js +27 -0
  255. package/dist/vendor/@base-ui/utils/visuallyHidden.js +23 -0
  256. package/dist/vendor/@base-ui/utils/warn.js +5 -0
  257. package/dist/vendor/@floating-ui/utils/dist/floating-ui.utils.dom.js +49 -0
  258. package/dist/vendor/uqr/dist/index.js +858 -0
  259. package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +74 -0
  260. package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +77 -0
  261. package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +69 -0
  262. package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +64 -0
  263. package/dist/vendor/use-sync-external-store/shim/index.js +11 -0
  264. package/dist/vendor/use-sync-external-store/shim/with-selector.js +11 -0
  265. package/package.json +15 -9
  266. package/dist/index.d.ts.map +0 -1
  267. package/dist/index.js.map +0 -1
@@ -0,0 +1,258 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { SPACE } from "./tokens.js";
3
+ import { clamp } from "./numbers.js";
4
+ import { paddingStyle } from "./padding.js";
5
+ import { createEvent } from "@monimesl/dot-core";
6
+ import { Children, Fragment, isValidElement, useEffect, useEffectEvent, useRef, useState } from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/carousel.tsx
9
+ const SLIDE_DURATION = 350;
10
+ const SLIDE_EASING = "cubic-bezier(0.22, 0.61, 0.36, 1)";
11
+ const SWIPE_DISTANCE = .2;
12
+ const SWIPE_SPEED = .4;
13
+ const EDGE_RESISTANCE = .3;
14
+ const TAP_SLOP = 6;
15
+ const Carousel$1 = ({ autoplay = false, interval = 4e3, loop = false, indicator = "dots", gap = "none", effect = "slide", index, onChange, children, ...padding }) => {
16
+ const { colors } = useTheme();
17
+ const slides = slidesOf(children);
18
+ const count = slides.length;
19
+ const looping = loop && count > 1;
20
+ const firstPosition = looping ? 1 : 0;
21
+ const lastPosition = looping ? count + 1 : count - 1;
22
+ const [position, setPosition] = useState(() => firstPosition + slideIndex(index ?? 0, count));
23
+ const [animated, setAnimated] = useState(true);
24
+ const [dragOffset, setDragOffset] = useState(0);
25
+ const [dragging, setDragging] = useState(false);
26
+ const [viewportWidth, setViewportWidth] = useState(0);
27
+ const [previousIndex, setPreviousIndex] = useState(index);
28
+ const viewportRef = useRef(null);
29
+ const gestureRef = useRef(null);
30
+ const ignoreNextClick = useRef(false);
31
+ if (index !== previousIndex) {
32
+ setPreviousIndex(index);
33
+ if (index !== void 0) {
34
+ setAnimated(true);
35
+ setPosition(firstPosition + slideIndex(index, count));
36
+ }
37
+ }
38
+ const shownPosition = clamp(position, 0, lastPosition);
39
+ const currentIndex = count === 0 ? 0 : wrapIndex(shownPosition - firstPosition, count);
40
+ const moveTo = (targetPosition) => {
41
+ const nextPosition = clamp(targetPosition, 0, lastPosition);
42
+ setAnimated(true);
43
+ setPosition(nextPosition);
44
+ const nextIndex = wrapIndex(nextPosition - firstPosition, count);
45
+ if (nextIndex !== currentIndex) onChange?.(createEvent("change", { index: nextIndex }));
46
+ };
47
+ const stepBy = (direction) => {
48
+ const beyondEnd = currentIndex + direction < 0 || currentIndex + direction >= count;
49
+ if (!looping && beyondEnd) moveTo(shownPosition);
50
+ else moveTo(shownPosition + direction);
51
+ };
52
+ const advance = useEffectEvent(() => {
53
+ if (!looping && currentIndex === count - 1) moveTo(firstPosition);
54
+ else moveTo(shownPosition + 1);
55
+ });
56
+ useEffect(() => {
57
+ if (!autoplay || count < 2 || dragging) return;
58
+ const timer = setTimeout(advance, interval);
59
+ return () => clearTimeout(timer);
60
+ }, [
61
+ autoplay,
62
+ count,
63
+ dragging,
64
+ interval,
65
+ currentIndex
66
+ ]);
67
+ useEffect(() => {
68
+ const onCopy = position === 0 || position === count + 1;
69
+ if (!looping || !onCopy) return;
70
+ const timer = setTimeout(() => {
71
+ setAnimated(false);
72
+ setPosition(position === 0 ? count : 1);
73
+ }, SLIDE_DURATION);
74
+ return () => clearTimeout(timer);
75
+ }, [
76
+ looping,
77
+ position,
78
+ count
79
+ ]);
80
+ const gestureOf = (event) => {
81
+ const inProgress = gestureRef.current;
82
+ return inProgress?.pointerId === event.pointerId ? inProgress : null;
83
+ };
84
+ const endGesture = () => {
85
+ gestureRef.current = null;
86
+ setDragging(false);
87
+ setDragOffset(0);
88
+ setAnimated(true);
89
+ };
90
+ const onPointerDown = (event) => {
91
+ if (count < 2 || !event.isPrimary) return;
92
+ gestureRef.current = {
93
+ pointerId: event.pointerId,
94
+ startX: event.clientX,
95
+ startY: event.clientY,
96
+ startTime: event.timeStamp,
97
+ swiping: false
98
+ };
99
+ ignoreNextClick.current = false;
100
+ setDragging(true);
101
+ setViewportWidth(viewportRef.current?.clientWidth ?? 0);
102
+ };
103
+ const onPointerMove = (event) => {
104
+ const swipe = gestureOf(event);
105
+ if (!swipe) return;
106
+ const movedX = event.clientX - swipe.startX;
107
+ const movedY = event.clientY - swipe.startY;
108
+ if (!swipe.swiping) {
109
+ if (Math.abs(movedX) < TAP_SLOP && Math.abs(movedY) < TAP_SLOP) return;
110
+ if (Math.abs(movedY) > Math.abs(movedX)) {
111
+ endGesture();
112
+ return;
113
+ }
114
+ swipe.swiping = true;
115
+ ignoreNextClick.current = true;
116
+ event.currentTarget.setPointerCapture?.(event.pointerId);
117
+ setAnimated(false);
118
+ }
119
+ const beforeFirst = currentIndex === 0 && movedX > 0;
120
+ const afterLast = currentIndex === count - 1 && movedX < 0;
121
+ if (!looping && (beforeFirst || afterLast)) setDragOffset(movedX * EDGE_RESISTANCE);
122
+ else setDragOffset(movedX);
123
+ };
124
+ const onPointerUp = (event) => {
125
+ const swipe = gestureOf(event);
126
+ if (!swipe) return;
127
+ endGesture();
128
+ if (!swipe.swiping) return;
129
+ const movedX = event.clientX - swipe.startX;
130
+ const speed = Math.abs(movedX) / Math.max(1, event.timeStamp - swipe.startTime);
131
+ if (Math.abs(movedX) > viewportWidth * SWIPE_DISTANCE || speed > SWIPE_SPEED) stepBy(movedX < 0 ? 1 : -1);
132
+ else moveTo(shownPosition);
133
+ };
134
+ const gapWidth = SPACE[gap];
135
+ const transition = animated ? `transform ${SLIDE_DURATION}ms ${SLIDE_EASING}` : "none";
136
+ let draggedSlides = 0;
137
+ if (viewportWidth > 0) draggedSlides = dragOffset / (viewportWidth + gapWidth);
138
+ let track = slides;
139
+ if (looping) track = [
140
+ {
141
+ ...slides[count - 1],
142
+ key: "copy-of-last"
143
+ },
144
+ ...slides,
145
+ {
146
+ ...slides[0],
147
+ key: "copy-of-first"
148
+ }
149
+ ];
150
+ return /* @__PURE__ */ jsxs("div", {
151
+ className: "dot-carousel",
152
+ role: "region",
153
+ "aria-roledescription": "carousel",
154
+ style: {
155
+ display: "flex",
156
+ flexDirection: "column",
157
+ gap: SPACE.medium,
158
+ minWidth: 0,
159
+ ...paddingStyle(padding)
160
+ },
161
+ children: [/* @__PURE__ */ jsx("div", {
162
+ ref: viewportRef,
163
+ onPointerDown,
164
+ onPointerMove,
165
+ onPointerUp,
166
+ onPointerCancel: endGesture,
167
+ onDragStart: (event) => event.preventDefault(),
168
+ onClickCapture: (event) => {
169
+ if (ignoreNextClick.current) {
170
+ ignoreNextClick.current = false;
171
+ event.stopPropagation();
172
+ }
173
+ },
174
+ style: {
175
+ overflow: "hidden",
176
+ touchAction: "pan-y",
177
+ userSelect: dragging ? "none" : void 0
178
+ },
179
+ children: /* @__PURE__ */ jsx("div", {
180
+ style: {
181
+ display: "flex",
182
+ gap: gapWidth,
183
+ transform: `translateX(calc(${-shownPosition} * (100% + ${gapWidth}px) + ${dragOffset}px))`,
184
+ transition
185
+ },
186
+ children: track.map((slide, trackPosition) => {
187
+ const visible = trackPosition === shownPosition;
188
+ const distance = Math.abs(trackPosition - shownPosition + draggedSlides);
189
+ const scale = 1 - Math.min(distance, 1) * .15000000000000002;
190
+ return /* @__PURE__ */ jsx("div", {
191
+ role: "group",
192
+ "aria-roledescription": "slide",
193
+ "aria-label": `${wrapIndex(trackPosition - firstPosition, count) + 1} of ${count}`,
194
+ "aria-hidden": !visible,
195
+ inert: !visible,
196
+ style: {
197
+ display: "grid",
198
+ flex: "0 0 100%",
199
+ minWidth: 0,
200
+ transform: effect === "scale" ? `scale(${scale})` : void 0,
201
+ transition: effect === "scale" ? transition : void 0
202
+ },
203
+ children: slide.node
204
+ }, slide.key);
205
+ })
206
+ })
207
+ }), indicator === "dots" && count > 1 ? /* @__PURE__ */ jsx("div", {
208
+ style: {
209
+ display: "flex",
210
+ justifyContent: "center"
211
+ },
212
+ children: slides.map((slide, dotIndex) => {
213
+ const active = dotIndex === currentIndex;
214
+ return /* @__PURE__ */ jsx("button", {
215
+ type: "button",
216
+ "aria-label": `Slide ${dotIndex + 1} of ${count}`,
217
+ "aria-current": active,
218
+ onClick: () => moveTo(firstPosition + dotIndex),
219
+ style: {
220
+ padding: "6px 3px",
221
+ border: "none",
222
+ background: "none",
223
+ cursor: "pointer"
224
+ },
225
+ children: /* @__PURE__ */ jsx("span", { style: {
226
+ display: "block",
227
+ width: active ? 18 : 6,
228
+ height: 6,
229
+ borderRadius: 3,
230
+ background: active ? colors.primary : colors.subtle,
231
+ transition: "width 0.3s, background 0.3s"
232
+ } })
233
+ }, slide.key);
234
+ })
235
+ }) : null]
236
+ });
237
+ };
238
+ function slidesOf(children, keyPrefix = "") {
239
+ const slides = [];
240
+ for (const child of Children.toArray(children)) {
241
+ if (!isValidElement(child)) continue;
242
+ const key = `${keyPrefix}${String(child.key)}`;
243
+ if (child.type === Fragment) slides.push(...slidesOf(child.props.children, `${key}/`));
244
+ else slides.push({
245
+ key,
246
+ node: child
247
+ });
248
+ }
249
+ return slides;
250
+ }
251
+ function slideIndex(index, count) {
252
+ return clamp(Math.round(index), 0, count - 1);
253
+ }
254
+ function wrapIndex(value, count) {
255
+ return (value % count + count) % count;
256
+ }
257
+ //#endregion
258
+ export { Carousel$1 as Carousel };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { Chip } from "@monimesl/dot-core";
3
+ //#region src/components/chip.d.ts
4
+ declare const Chip$1: ReactComponent<typeof Chip>;
5
+ //#endregion
6
+ export { Chip$1 as Chip };
@@ -0,0 +1,41 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { DISABLED_OPACITY, FONT_SIZE, ICON_SIZE, WEIGHTS } from "./tokens.js";
3
+ import { IconGraphic } from "./icon.js";
4
+ import { createEvent } from "@monimesl/dot-core";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/components/chip.tsx
7
+ const Chip$1 = ({ label, icon, selected = false, disabled, onTap }) => {
8
+ const { colors } = useTheme();
9
+ return /* @__PURE__ */ jsxs("button", {
10
+ type: "button",
11
+ className: "dot-chip",
12
+ "aria-pressed": selected,
13
+ disabled,
14
+ onClick: onTap ? () => onTap(createEvent("tap")) : void 0,
15
+ style: {
16
+ display: "inline-flex",
17
+ alignItems: "center",
18
+ gap: 6,
19
+ flexShrink: 0,
20
+ minHeight: 34,
21
+ padding: "0 14px",
22
+ borderRadius: 17,
23
+ border: `1px solid ${selected ? colors.primary : colors.border}`,
24
+ background: selected ? colors.primary : colors.surface,
25
+ color: selected ? colors.onPrimary : colors.text,
26
+ fontSize: FONT_SIZE.caption,
27
+ fontWeight: WEIGHTS.medium,
28
+ lineHeight: "normal",
29
+ whiteSpace: "nowrap",
30
+ opacity: disabled ? DISABLED_OPACITY : 1,
31
+ cursor: disabled ? "default" : "pointer"
32
+ },
33
+ children: [icon ? /* @__PURE__ */ jsx(IconGraphic, {
34
+ name: icon,
35
+ size: ICON_SIZE.small,
36
+ color: "currentColor"
37
+ }) : null, label]
38
+ });
39
+ };
40
+ //#endregion
41
+ export { Chip$1 as Chip };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { CodeInput } from "@monimesl/dot-core";
3
+ //#region src/components/code-input.d.ts
4
+ declare const CodeInput$1: ReactComponent<typeof CodeInput>;
5
+ //#endregion
6
+ export { CodeInput$1 as CodeInput };
@@ -0,0 +1,96 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { CENTERED, DISABLED_OPACITY, SPACE, WEIGHTS } from "./tokens.js";
3
+ import { Field } from "./field.js";
4
+ import { fieldBorderColor, useFieldNote } from "./field-box.js";
5
+ import { useTypedText } from "./typed-text.js";
6
+ import { wholeCount } from "./numbers.js";
7
+ import { createEvent } from "@monimesl/dot-core";
8
+ import { useState } from "react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ //#region src/components/code-input.tsx
11
+ const CodeInput$1 = ({ value, length = 6, label, hint, error, secure, disabled, onChange, onComplete }) => {
12
+ const { colors, radius } = useTheme();
13
+ const [text, typeText] = useTypedText(value, onChange !== void 0);
14
+ const [focused, setFocused] = useState(false);
15
+ const { noteId, controlAttributes } = useFieldNote(hint, error);
16
+ const count = wholeCount(length);
17
+ const digits = text.slice(0, count);
18
+ const nextBox = Math.min(digits.length, count - 1);
19
+ const boxes = Array.from({ length: count }, (_, index) => {
20
+ const digit = digits[index];
21
+ const borderColor = fieldBorderColor(colors, error, focused && index === nextBox);
22
+ return /* @__PURE__ */ jsx("span", {
23
+ style: {
24
+ ...CENTERED,
25
+ flex: "1 1 0",
26
+ maxWidth: 52,
27
+ height: 52,
28
+ border: `1.5px solid ${borderColor}`,
29
+ borderRadius: radius,
30
+ background: colors.surface,
31
+ fontSize: 22,
32
+ fontWeight: WEIGHTS.bold
33
+ },
34
+ children: digit !== void 0 && secure ? /* @__PURE__ */ jsx("span", {
35
+ "aria-hidden": "true",
36
+ style: {
37
+ width: 12,
38
+ height: 12,
39
+ borderRadius: "50%",
40
+ background: colors.text
41
+ }
42
+ }) : digit
43
+ }, index);
44
+ });
45
+ return /* @__PURE__ */ jsx(Field, {
46
+ label,
47
+ hint,
48
+ error,
49
+ noteId,
50
+ children: /* @__PURE__ */ jsxs("span", {
51
+ className: "dot-code-input",
52
+ style: {
53
+ position: "relative",
54
+ display: "flex",
55
+ gap: SPACE.medium,
56
+ color: colors.text,
57
+ opacity: disabled ? DISABLED_OPACITY : 1
58
+ },
59
+ children: [boxes, /* @__PURE__ */ jsx("input", {
60
+ value: digits,
61
+ inputMode: "numeric",
62
+ autoComplete: "one-time-code",
63
+ maxLength: count,
64
+ disabled,
65
+ ...controlAttributes,
66
+ onFocus: () => setFocused(true),
67
+ onBlur: () => setFocused(false),
68
+ onSelect: (event) => {
69
+ const input = event.currentTarget;
70
+ const end = input.value.length;
71
+ if (input.selectionStart !== end || input.selectionEnd !== end) input.setSelectionRange(end, end);
72
+ },
73
+ onChange: (event) => {
74
+ const typed = event.currentTarget.value.replace(/\D/g, "").slice(0, count);
75
+ if (typed === digits) return;
76
+ typeText(typed);
77
+ onChange?.(createEvent("change", { value: typed }));
78
+ if (typed.length === count) onComplete?.(createEvent("complete", { value: typed }));
79
+ },
80
+ style: {
81
+ position: "absolute",
82
+ inset: 0,
83
+ width: "100%",
84
+ height: "100%",
85
+ padding: 0,
86
+ border: "none",
87
+ opacity: 0,
88
+ fontSize: 16,
89
+ cursor: disabled ? "default" : "text"
90
+ }
91
+ })]
92
+ })
93
+ });
94
+ };
95
+ //#endregion
96
+ export { CodeInput$1 as CodeInput };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { DetailRow } from "@monimesl/dot-core";
3
+ //#region src/components/detail-row.d.ts
4
+ declare const DetailRow$1: ReactComponent<typeof DetailRow>;
5
+ //#endregion
6
+ export { DetailRow$1 as DetailRow };
@@ -0,0 +1,40 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { FONT_SIZE, WEIGHTS } from "./tokens.js";
3
+ import { insets, paddingStyle } from "./padding.js";
4
+ import { toneColor } from "./tones.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/components/detail-row.tsx
7
+ const DetailRow = ({ label, value, tone, weight = "regular", ...padding }) => {
8
+ const { colors } = useTheme();
9
+ return /* @__PURE__ */ jsxs("div", {
10
+ className: "dot-detail-row",
11
+ style: {
12
+ display: "flex",
13
+ alignItems: "baseline",
14
+ justifyContent: "space-between",
15
+ gap: 16,
16
+ ...paddingStyle(padding, insets(6, 0)),
17
+ fontSize: FONT_SIZE.body,
18
+ lineHeight: "normal"
19
+ },
20
+ children: [/* @__PURE__ */ jsx("span", {
21
+ style: {
22
+ flexShrink: 0,
23
+ maxWidth: "50%",
24
+ color: colors.subtle
25
+ },
26
+ children: label
27
+ }), /* @__PURE__ */ jsx("span", {
28
+ style: {
29
+ minWidth: 0,
30
+ textAlign: "end",
31
+ overflowWrap: "anywhere",
32
+ color: toneColor(colors, tone ?? "default"),
33
+ fontWeight: WEIGHTS[weight]
34
+ },
35
+ children: value
36
+ })]
37
+ });
38
+ };
39
+ //#endregion
40
+ export { DetailRow };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { Disclosure } from "@monimesl/dot-core";
3
+ //#region src/components/disclosure.d.ts
4
+ declare const Disclosure$1: ReactComponent<typeof Disclosure>;
5
+ //#endregion
6
+ export { Disclosure$1 as Disclosure };
@@ -0,0 +1,76 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { FONT_SIZE, ICON_SIZE, SPACE, WEIGHTS } from "./tokens.js";
3
+ import { CHEVRON_DOWN_ARTWORK } from "./icon-artwork.js";
4
+ import { IconSvg } from "./icon-svg.js";
5
+ import { createEvent } from "@monimesl/dot-core";
6
+ import { useState } from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/disclosure.tsx
9
+ const Disclosure$1 = ({ title, subtitle, open: startsOpen = false, children, onToggle }) => {
10
+ const { colors } = useTheme();
11
+ const [open, setOpen] = useState(startsOpen);
12
+ return /* @__PURE__ */ jsxs("details", {
13
+ className: "dot-disclosure",
14
+ open,
15
+ onToggle: (event) => {
16
+ const next = event.currentTarget.open;
17
+ if (next !== open) {
18
+ setOpen(next);
19
+ onToggle?.(createEvent("toggle", { open: next }));
20
+ }
21
+ },
22
+ style: { color: colors.text },
23
+ children: [/* @__PURE__ */ jsxs("summary", {
24
+ style: {
25
+ display: "flex",
26
+ alignItems: "center",
27
+ gap: SPACE.medium,
28
+ padding: "12px 0",
29
+ cursor: "pointer"
30
+ },
31
+ children: [/* @__PURE__ */ jsxs("span", {
32
+ style: {
33
+ display: "flex",
34
+ flexDirection: "column",
35
+ gap: 2,
36
+ flex: 1,
37
+ minWidth: 0
38
+ },
39
+ children: [/* @__PURE__ */ jsx("span", {
40
+ style: {
41
+ fontSize: FONT_SIZE.body,
42
+ fontWeight: WEIGHTS.medium
43
+ },
44
+ children: title
45
+ }), subtitle ? /* @__PURE__ */ jsx("span", {
46
+ style: {
47
+ fontSize: FONT_SIZE.caption,
48
+ color: colors.subtle
49
+ },
50
+ children: subtitle
51
+ }) : null]
52
+ }), /* @__PURE__ */ jsx("span", {
53
+ style: {
54
+ display: "flex",
55
+ transform: open ? "rotate(180deg)" : "none",
56
+ transition: "transform 0.2s"
57
+ },
58
+ children: /* @__PURE__ */ jsx(IconSvg, {
59
+ artwork: CHEVRON_DOWN_ARTWORK,
60
+ size: ICON_SIZE.medium,
61
+ color: colors.subtle
62
+ })
63
+ })]
64
+ }), /* @__PURE__ */ jsx("div", {
65
+ style: {
66
+ display: "flex",
67
+ flexDirection: "column",
68
+ gap: SPACE.medium,
69
+ paddingBottom: 12
70
+ },
71
+ children
72
+ })]
73
+ });
74
+ };
75
+ //#endregion
76
+ export { Disclosure$1 as Disclosure };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { Divider } from "@monimesl/dot-core";
3
+ //#region src/components/divider.d.ts
4
+ declare const Divider$1: ReactComponent<typeof Divider>;
5
+ //#endregion
6
+ export { Divider$1 as Divider };
@@ -0,0 +1,18 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/components/divider.tsx
4
+ const Divider = () => {
5
+ const { colors } = useTheme();
6
+ return /* @__PURE__ */ jsx("div", {
7
+ className: "dot-divider",
8
+ role: "separator",
9
+ style: {
10
+ alignSelf: "stretch",
11
+ flexShrink: 0,
12
+ height: 1,
13
+ background: colors.border
14
+ }
15
+ });
16
+ };
17
+ //#endregion
18
+ export { Divider };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { EmptyState } from "@monimesl/dot-core";
3
+ //#region src/components/empty-state.d.ts
4
+ declare const EmptyState$1: ReactComponent<typeof EmptyState>;
5
+ //#endregion
6
+ export { EmptyState$1 as EmptyState };
@@ -0,0 +1,64 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { CENTERED, FONT_SIZE, ICON_SIZE, SPACE, WEIGHTS } from "./tokens.js";
3
+ import { insets, paddingStyle } from "./padding.js";
4
+ import { IconGraphic } from "./icon.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/components/empty-state.tsx
7
+ const EmptyState = ({ icon, title, text, children, ...padding }) => {
8
+ const { colors } = useTheme();
9
+ return /* @__PURE__ */ jsxs("div", {
10
+ className: "dot-empty-state",
11
+ style: {
12
+ display: "flex",
13
+ flexDirection: "column",
14
+ alignItems: "center",
15
+ gap: SPACE.medium,
16
+ ...paddingStyle(padding, insets(32, 16)),
17
+ textAlign: "center",
18
+ color: colors.text
19
+ },
20
+ children: [
21
+ icon ? /* @__PURE__ */ jsx("span", {
22
+ style: {
23
+ ...CENTERED,
24
+ width: 64,
25
+ height: 64,
26
+ borderRadius: "50%",
27
+ background: colors.muted
28
+ },
29
+ children: /* @__PURE__ */ jsx(IconGraphic, {
30
+ name: icon,
31
+ size: ICON_SIZE.large,
32
+ color: colors.subtle
33
+ })
34
+ }) : null,
35
+ title ? /* @__PURE__ */ jsx("span", {
36
+ style: {
37
+ fontSize: 17,
38
+ fontWeight: WEIGHTS.bold,
39
+ lineHeight: "normal"
40
+ },
41
+ children: title
42
+ }) : null,
43
+ text ? /* @__PURE__ */ jsx("span", {
44
+ style: {
45
+ maxWidth: 300,
46
+ fontSize: FONT_SIZE.body,
47
+ lineHeight: "normal",
48
+ color: colors.subtle
49
+ },
50
+ children: text
51
+ }) : null,
52
+ children ? /* @__PURE__ */ jsx("div", {
53
+ style: {
54
+ display: "flex",
55
+ gap: SPACE.medium,
56
+ paddingTop: SPACE.small
57
+ },
58
+ children
59
+ }) : null
60
+ ]
61
+ });
62
+ };
63
+ //#endregion
64
+ export { EmptyState };
@@ -0,0 +1,8 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { Badge, Notice, ProgressBar } from "@monimesl/dot-core";
3
+ //#region src/components/feedback.d.ts
4
+ declare const ProgressBar$1: ReactComponent<typeof ProgressBar>;
5
+ declare const Notice$1: ReactComponent<typeof Notice>;
6
+ declare const Badge$1: ReactComponent<typeof Badge>;
7
+ //#endregion
8
+ export { Badge$1 as Badge, Notice$1 as Notice, ProgressBar$1 as ProgressBar };