@dreamtree-org/twreact-ui 1.2.1 → 1.3.1
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/DESIGN.md +118 -0
- package/README.md +231 -44
- package/ai-skills/dreamtree-ui.md +98 -12
- package/dist/ai-schema.json +452 -17
- package/dist/components/blocks/AppShell.d.ts +4 -0
- package/dist/components/blocks/AppShell.d.ts.map +1 -0
- package/dist/components/blocks/ConfirmDialog.d.ts +4 -0
- package/dist/components/blocks/ConfirmDialog.d.ts.map +1 -0
- package/dist/components/blocks/EmptyState.d.ts +4 -0
- package/dist/components/blocks/EmptyState.d.ts.map +1 -0
- package/dist/components/blocks/ErrorState.d.ts +4 -0
- package/dist/components/blocks/ErrorState.d.ts.map +1 -0
- package/dist/components/blocks/LoadingState.d.ts +9 -0
- package/dist/components/blocks/LoadingState.d.ts.map +1 -0
- package/dist/components/blocks/PageHeader.d.ts +4 -0
- package/dist/components/blocks/PageHeader.d.ts.map +1 -0
- package/dist/components/blocks/StatCard.d.ts +4 -0
- package/dist/components/blocks/StatCard.d.ts.map +1 -0
- package/dist/components/blocks/StatusPill.d.ts +5 -0
- package/dist/components/blocks/StatusPill.d.ts.map +1 -0
- package/dist/components/core/Accordion.d.ts.map +1 -1
- package/dist/components/core/Button.d.ts.map +1 -1
- package/dist/components/core/Checkbox.d.ts.map +1 -1
- package/dist/components/core/ColorPicker.d.ts.map +1 -1
- package/dist/components/core/DatePicker.d.ts.map +1 -1
- package/dist/components/core/DateRangePicker.d.ts.map +1 -1
- package/dist/components/core/Form.d.ts.map +1 -1
- package/dist/components/core/Input.d.ts.map +1 -1
- package/dist/components/core/LocationPicker.d.ts.map +1 -1
- package/dist/components/core/Popover.d.ts +4 -0
- package/dist/components/core/Popover.d.ts.map +1 -0
- package/dist/components/core/PriceRangePicker.d.ts.map +1 -1
- package/dist/components/core/ProgressBar.d.ts.map +1 -1
- package/dist/components/core/Radio.d.ts.map +1 -1
- package/dist/components/core/Rate.d.ts.map +1 -1
- package/dist/components/core/Select.d.ts.map +1 -1
- package/dist/components/core/Skeleton.d.ts.map +1 -1
- package/dist/components/core/Slider.d.ts +4 -0
- package/dist/components/core/Slider.d.ts.map +1 -0
- package/dist/components/core/SpeechToText.d.ts.map +1 -1
- package/dist/components/core/Switch.d.ts.map +1 -1
- package/dist/components/core/Table/ActionMenu.d.ts.map +1 -1
- package/dist/components/core/Table/ColumnMenu.d.ts +2 -1
- package/dist/components/core/Table/ColumnMenu.d.ts.map +1 -1
- package/dist/components/core/Table/MobileCard.d.ts +2 -2
- package/dist/components/core/Table/MobileCard.d.ts.map +1 -1
- package/dist/components/core/Table/Table.d.ts.map +1 -1
- package/dist/components/core/Table/TableRow.d.ts +4 -2
- package/dist/components/core/Table/TableRow.d.ts.map +1 -1
- package/dist/components/core/Tabs.d.ts.map +1 -1
- package/dist/components/core/Textarea.d.ts +4 -0
- package/dist/components/core/Textarea.d.ts.map +1 -0
- package/dist/components/core/ThreeDotPopover.d.ts.map +1 -1
- package/dist/components/core/Tooltip.d.ts.map +1 -1
- package/dist/components/feedback/Dialog.d.ts.map +1 -1
- package/dist/components/feedback/Drawer.d.ts +4 -0
- package/dist/components/feedback/Drawer.d.ts.map +1 -0
- package/dist/components/feedback/Toast.d.ts +14 -5
- package/dist/components/feedback/Toast.d.ts.map +1 -1
- package/dist/components/feedback/Tour.d.ts +4 -0
- package/dist/components/feedback/Tour.d.ts.map +1 -0
- package/dist/components/feedback/TourSpotlight.d.ts +9 -0
- package/dist/components/feedback/TourSpotlight.d.ts.map +1 -0
- package/dist/components/navigation/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/navigation/FootNav.d.ts.map +1 -1
- package/dist/components/navigation/Navbar.d.ts.map +1 -1
- package/dist/components/navigation/Sidebar.d.ts +8 -2
- package/dist/components/navigation/Sidebar.d.ts.map +1 -1
- package/dist/components/utility/Badge.d.ts.map +1 -1
- package/dist/components/utility/FileUpload.d.ts.map +1 -1
- package/dist/components/utility/Sortable.d.ts +4 -0
- package/dist/components/utility/Sortable.d.ts.map +1 -0
- package/dist/esm/_vendor/object-assign/index.js +99 -0
- package/dist/esm/_vendor/prop-types/_vendor/react-is/cjs/react-is.development.js +190 -0
- package/dist/esm/_vendor/prop-types/_vendor/react-is/cjs/react-is.production.min.js +26 -0
- package/dist/esm/_vendor/prop-types/_vendor/react-is/index.js +19 -0
- package/dist/esm/_vendor/prop-types/checkPropTypes.js +115 -0
- package/dist/esm/_vendor/prop-types/factoryWithThrowingShims.js +74 -0
- package/dist/esm/_vendor/prop-types/factoryWithTypeCheckers.js +625 -0
- package/dist/esm/_vendor/prop-types/index.js +30 -0
- package/dist/esm/_vendor/prop-types/lib/ReactPropTypesSecret.js +21 -0
- package/dist/esm/_vendor/prop-types/lib/has.js +11 -0
- package/dist/esm/_virtual/_commonjsHelpers.js +5 -0
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +329 -0
- package/dist/esm/_virtual/index.js +3 -0
- package/dist/esm/_virtual/index2.js +3 -0
- package/dist/esm/_virtual/react-is.development.js +3 -0
- package/dist/esm/_virtual/react-is.production.min.js +3 -0
- package/dist/esm/components/blocks/AppShell.js +205 -0
- package/dist/esm/components/blocks/ConfirmDialog.js +57 -0
- package/dist/esm/components/blocks/EmptyState.js +44 -0
- package/dist/esm/components/blocks/ErrorState.js +53 -0
- package/dist/esm/components/blocks/LoadingState.js +134 -0
- package/dist/esm/components/blocks/PageHeader.js +51 -0
- package/dist/esm/components/blocks/StatCard.js +79 -0
- package/dist/esm/components/blocks/StatusPill.js +55 -0
- package/dist/esm/components/core/Accordion.js +260 -0
- package/dist/esm/components/core/Button.js +59 -0
- package/dist/esm/components/core/Checkbox.js +188 -0
- package/dist/esm/components/core/ColorPicker.js +348 -0
- package/dist/esm/components/core/DatePicker.js +436 -0
- package/dist/esm/components/core/DateRangePicker.js +494 -0
- package/dist/esm/components/core/Form.js +522 -0
- package/dist/esm/components/core/Input.js +179 -0
- package/dist/esm/components/core/Loader.js +141 -0
- package/dist/esm/components/core/LocationPicker.js +161 -0
- package/dist/esm/components/core/Popover.js +171 -0
- package/dist/esm/components/core/PriceRangePicker.js +376 -0
- package/dist/esm/components/core/ProgressBar.js +152 -0
- package/dist/esm/components/core/Radio.js +156 -0
- package/dist/esm/components/core/Rate.js +197 -0
- package/dist/esm/components/core/RoundedTag.js +118 -0
- package/dist/esm/components/core/Select.js +857 -0
- package/dist/esm/components/core/Skeleton.js +100 -0
- package/dist/esm/components/core/Slider.js +134 -0
- package/dist/esm/components/core/SpeechToText.js +226 -0
- package/dist/esm/components/core/Switch.js +207 -0
- package/dist/esm/components/core/Table/ActionMenu.js +251 -0
- package/dist/esm/components/core/Table/ColumnMenu.js +55 -0
- package/dist/esm/components/core/Table/FieldInput.js +157 -0
- package/dist/esm/components/core/Table/MobileCard.js +187 -0
- package/dist/esm/components/core/Table/MobileFilters.js +72 -0
- package/dist/esm/components/core/Table/Pagination.js +157 -0
- package/dist/esm/components/core/Table/Table.js +1533 -0
- package/dist/esm/components/core/Table/TableRow.js +254 -0
- package/dist/esm/components/core/Table/constants.js +35 -0
- package/dist/esm/components/core/Table/helpers.js +124 -0
- package/dist/esm/components/core/Table/useClickOutside.js +26 -0
- package/dist/esm/components/core/Tabs.js +289 -0
- package/dist/esm/components/core/TextToSpeech.js +52 -0
- package/dist/esm/components/core/Textarea.js +125 -0
- package/dist/esm/components/core/ThreeDotPopover.js +160 -0
- package/dist/esm/components/core/Tooltip.js +372 -0
- package/dist/esm/components/feedback/Alert.js +96 -0
- package/dist/esm/components/feedback/Dialog.js +200 -0
- package/dist/esm/components/feedback/Drawer.js +171 -0
- package/dist/esm/components/feedback/Toast.js +362 -0
- package/dist/esm/components/feedback/Tour.js +214 -0
- package/dist/esm/components/feedback/TourSpotlight.js +71 -0
- package/dist/esm/components/navigation/Breadcrumbs.js +75 -0
- package/dist/esm/components/navigation/Dropdown.js +53 -0
- package/dist/esm/components/navigation/FootNav.js +51 -0
- package/dist/esm/components/navigation/Navbar.js +437 -0
- package/dist/esm/components/navigation/Sidebar.js +567 -0
- package/dist/esm/components/utility/Avatar.js +89 -0
- package/dist/esm/components/utility/Badge.js +47 -0
- package/dist/esm/components/utility/Card.js +85 -0
- package/dist/esm/components/utility/Carousel.js +97 -0
- package/dist/esm/components/utility/Condition.js +9 -0
- package/dist/esm/components/utility/FileUpload.js +177 -0
- package/dist/esm/components/utility/Pagination.js +111 -0
- package/dist/esm/components/utility/Sortable.js +190 -0
- package/dist/esm/components/utility/Stepper.js +101 -0
- package/dist/esm/hooks/useApi.js +169 -0
- package/dist/esm/hooks/useControllableState.js +32 -0
- package/dist/esm/hooks/useFocusTrap.js +85 -0
- package/dist/esm/hooks/useLatestRef.js +20 -0
- package/dist/esm/hooks/useMixins.js +100 -0
- package/dist/esm/hooks/useScrollLock.js +26 -0
- package/dist/esm/hooks/useSliderValues.js +135 -0
- package/dist/esm/hooks/useSortable.js +188 -0
- package/dist/esm/hooks/useTheme.js +53 -0
- package/dist/esm/hooks/useTourTarget.js +92 -0
- package/dist/esm/index.js +65 -0
- package/dist/esm/store/index.js +26 -0
- package/dist/esm/store/store.js +107 -0
- package/dist/esm/store/storeSlice.js +45 -0
- package/dist/esm/utils/cn.js +11 -0
- package/dist/esm/utils/emitter.js +169 -0
- package/dist/esm/utils/helpers.js +161 -0
- package/dist/esm/utils/position.js +134 -0
- package/dist/hooks/useApi.d.ts +2 -1
- package/dist/hooks/useApi.d.ts.map +1 -1
- package/dist/hooks/useControllableState.d.ts +11 -0
- package/dist/hooks/useControllableState.d.ts.map +1 -0
- package/dist/hooks/useFocusTrap.d.ts +15 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -0
- package/dist/hooks/useLatestRef.d.ts +8 -0
- package/dist/hooks/useLatestRef.d.ts.map +1 -0
- package/dist/hooks/useMixins.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.d.ts +2 -0
- package/dist/hooks/useScrollLock.d.ts.map +1 -0
- package/dist/hooks/useSliderValues.d.ts +43 -0
- package/dist/hooks/useSliderValues.d.ts.map +1 -0
- package/dist/hooks/useSortable.d.ts +32 -0
- package/dist/hooks/useSortable.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useTourTarget.d.ts +15 -0
- package/dist/hooks/useTourTarget.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +55 -39
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +7937 -4659
- package/dist/index.js +7950 -4657
- package/dist/tokens/brands/default.css +1 -0
- package/dist/tokens/brands/default.json +5 -0
- package/dist/tokens/brands/practicepro.css +17 -0
- package/dist/tokens/brands/practicepro.json +27 -0
- package/dist/tokens/tailwind3-preset.cjs +214 -0
- package/dist/tokens/theme.css +193 -0
- package/dist/tokens/tokens.json +373 -0
- package/dist/tokens/vars.css +98 -0
- package/dist/types/blocks.d.ts +109 -0
- package/dist/types/blocks.d.ts.map +1 -0
- package/dist/types/index.d.ts +194 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/position.d.ts +30 -0
- package/dist/utils/position.d.ts.map +1 -0
- package/doc/README.md +26 -1
- package/mcp/catalog.snapshot.json +1643 -549
- package/package.json +24 -6
- package/tokens/brands/default.json +5 -0
- package/tokens/brands/practicepro.json +27 -0
- package/tokens/lib.cjs +128 -0
- package/tokens/tokens.json +133 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { forwardRef, useRef, useId, useState, useLayoutEffect, useEffect } from 'react';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
|
+
import { X } from 'lucide-react';
|
|
7
|
+
import Button from '../core/Button.js';
|
|
8
|
+
import { cn } from '../../utils/cn.js';
|
|
9
|
+
import { computePosition, setRefs } from '../../utils/position.js';
|
|
10
|
+
import { useFocusTrap } from '../../hooks/useFocusTrap.js';
|
|
11
|
+
import { useScrollLock } from '../../hooks/useScrollLock.js';
|
|
12
|
+
import { useTourTarget } from '../../hooks/useTourTarget.js';
|
|
13
|
+
import TourSpotlight from './TourSpotlight.js';
|
|
14
|
+
|
|
15
|
+
var _excluded = ["open", "steps", "onClose", "onFinish", "step", "defaultStep", "onStepChange", "labels", "targetTimeout", "spotlightPadding", "className"];
|
|
16
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
17
|
+
var DEFAULT_LABELS = {
|
|
18
|
+
next: "Next",
|
|
19
|
+
back: "Back",
|
|
20
|
+
skip: "Skip",
|
|
21
|
+
finish: "Finish",
|
|
22
|
+
close: "Close tour",
|
|
23
|
+
progress: function progress(current, total) {
|
|
24
|
+
return "Step ".concat(current, " of ").concat(total);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var Tour = /*#__PURE__*/forwardRef(function (_ref, _ref2) {
|
|
28
|
+
var _ref$open = _ref.open,
|
|
29
|
+
open = _ref$open === void 0 ? false : _ref$open,
|
|
30
|
+
_ref$steps = _ref.steps,
|
|
31
|
+
steps = _ref$steps === void 0 ? [] : _ref$steps,
|
|
32
|
+
onClose = _ref.onClose,
|
|
33
|
+
onFinish = _ref.onFinish,
|
|
34
|
+
stepProp = _ref.step,
|
|
35
|
+
_ref$defaultStep = _ref.defaultStep,
|
|
36
|
+
defaultStep = _ref$defaultStep === void 0 ? 0 : _ref$defaultStep,
|
|
37
|
+
onStepChange = _ref.onStepChange,
|
|
38
|
+
labels = _ref.labels,
|
|
39
|
+
_ref$targetTimeout = _ref.targetTimeout,
|
|
40
|
+
targetTimeout = _ref$targetTimeout === void 0 ? 3000 : _ref$targetTimeout,
|
|
41
|
+
_ref$spotlightPadding = _ref.spotlightPadding,
|
|
42
|
+
spotlightPadding = _ref$spotlightPadding === void 0 ? 6 : _ref$spotlightPadding,
|
|
43
|
+
className = _ref.className,
|
|
44
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
var cardRef = useRef(null);
|
|
46
|
+
var baseId = useId();
|
|
47
|
+
var text = _objectSpread2(_objectSpread2({}, DEFAULT_LABELS), labels);
|
|
48
|
+
// Each opening is a new session: the uncontrolled step restarts and stale
|
|
49
|
+
// target measurements from the previous run are ignored.
|
|
50
|
+
var _useState = useState({
|
|
51
|
+
open: open,
|
|
52
|
+
count: 0,
|
|
53
|
+
step: defaultStep
|
|
54
|
+
}),
|
|
55
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
56
|
+
session = _useState2[0],
|
|
57
|
+
setSession = _useState2[1];
|
|
58
|
+
if (session.open !== open) setSession({
|
|
59
|
+
open: open,
|
|
60
|
+
count: session.count + (open ? 1 : 0),
|
|
61
|
+
step: defaultStep
|
|
62
|
+
});
|
|
63
|
+
var total = steps.length;
|
|
64
|
+
var rawIndex = stepProp !== null && stepProp !== void 0 ? stepProp : session.step;
|
|
65
|
+
var index = Math.max(0, Math.min(rawIndex, total - 1));
|
|
66
|
+
var current = steps[index];
|
|
67
|
+
var active = open && total > 0;
|
|
68
|
+
var stepKey = "".concat(session.count, ":").concat(index);
|
|
69
|
+
var _useTourTarget = useTourTarget({
|
|
70
|
+
active: active,
|
|
71
|
+
stepKey: stepKey,
|
|
72
|
+
target: (current === null || current === void 0 ? void 0 : current.placement) === "center" ? null : current === null || current === void 0 ? void 0 : current.target,
|
|
73
|
+
timeout: targetTimeout
|
|
74
|
+
}),
|
|
75
|
+
rect = _useTourTarget.rect,
|
|
76
|
+
ready = _useTourTarget.ready;
|
|
77
|
+
var goTo = function goTo(next) {
|
|
78
|
+
if (next < 0 || next >= total || next === index) return;
|
|
79
|
+
if (stepProp === undefined) setSession(function (s) {
|
|
80
|
+
return _objectSpread2(_objectSpread2({}, s), {}, {
|
|
81
|
+
step: next
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
onStepChange === null || onStepChange === void 0 || onStepChange(next, steps[next]);
|
|
85
|
+
};
|
|
86
|
+
var close = function close(reason) {
|
|
87
|
+
return onClose === null || onClose === void 0 ? void 0 : onClose(reason);
|
|
88
|
+
};
|
|
89
|
+
var finish = function finish() {
|
|
90
|
+
onFinish === null || onFinish === void 0 || onFinish();
|
|
91
|
+
close("finish");
|
|
92
|
+
};
|
|
93
|
+
useScrollLock(active);
|
|
94
|
+
useFocusTrap(cardRef, {
|
|
95
|
+
active: active,
|
|
96
|
+
focusKey: stepKey,
|
|
97
|
+
initialFocusRef: cardRef,
|
|
98
|
+
onEscape: function onEscape() {
|
|
99
|
+
return close("escape");
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
useIsomorphicLayoutEffect(function () {
|
|
103
|
+
var card = cardRef.current;
|
|
104
|
+
if (!card) return;
|
|
105
|
+
if (!rect) {
|
|
106
|
+
card.style.top = "";
|
|
107
|
+
card.style.left = "";
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
var size = {
|
|
111
|
+
width: card.offsetWidth,
|
|
112
|
+
height: card.offsetHeight
|
|
113
|
+
};
|
|
114
|
+
var pos = computePosition(rect, size, {
|
|
115
|
+
placement: (current === null || current === void 0 ? void 0 : current.placement) || "bottom",
|
|
116
|
+
offset: spotlightPadding + 10
|
|
117
|
+
});
|
|
118
|
+
card.style.top = "".concat(pos.top, "px");
|
|
119
|
+
card.style.left = "".concat(pos.left, "px");
|
|
120
|
+
}, [rect, ready, index, current === null || current === void 0 ? void 0 : current.placement, spotlightPadding]);
|
|
121
|
+
if (!active || typeof document === "undefined") return null;
|
|
122
|
+
var isFirst = index === 0;
|
|
123
|
+
var isLast = index === total - 1;
|
|
124
|
+
var titleId = "tour-title-".concat(baseId);
|
|
125
|
+
var bodyId = "tour-body-".concat(baseId);
|
|
126
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
127
|
+
var _e$target$closest, _e$target;
|
|
128
|
+
if ((_e$target$closest = (_e$target = e.target).closest) !== null && _e$target$closest !== void 0 && _e$target$closest.call(_e$target, "input, textarea, select, [contenteditable='true']")) return;
|
|
129
|
+
if (e.key === "ArrowRight") goTo(index + 1);else if (e.key === "ArrowLeft") goTo(index - 1);
|
|
130
|
+
};
|
|
131
|
+
return /*#__PURE__*/createPortal(jsxs("div", {
|
|
132
|
+
className: "fixed inset-0 z-50",
|
|
133
|
+
"data-testid": "tour-overlay",
|
|
134
|
+
children: [jsx(TourSpotlight, {
|
|
135
|
+
rect: ready ? rect : null,
|
|
136
|
+
padding: spotlightPadding
|
|
137
|
+
}), jsxs("div", _objectSpread2(_objectSpread2({
|
|
138
|
+
ref: function ref(node) {
|
|
139
|
+
return setRefs(node, cardRef, _ref2);
|
|
140
|
+
},
|
|
141
|
+
role: "dialog",
|
|
142
|
+
"aria-modal": "true",
|
|
143
|
+
"aria-labelledby": current.title ? titleId : undefined,
|
|
144
|
+
"aria-describedby": current.content ? bodyId : undefined,
|
|
145
|
+
tabIndex: -1,
|
|
146
|
+
onKeyDown: handleKeyDown,
|
|
147
|
+
"data-placement": rect ? current.placement || "bottom" : "center",
|
|
148
|
+
className: cn("fixed w-[min(22rem,calc(100vw-2rem))] max-h-[calc(100vh-2rem)] overflow-y-auto rounded-lg border border-gray-200 bg-white text-gray-900 shadow-xl focus:outline-none", "dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100", "transition-opacity duration-200 motion-reduce:transition-none", !rect && "left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2", ready ? "opacity-100" : "pointer-events-none opacity-0", className)
|
|
149
|
+
}, rest), {}, {
|
|
150
|
+
children: [jsxs("div", {
|
|
151
|
+
className: "flex items-start justify-between gap-3 px-4 pt-4",
|
|
152
|
+
children: [jsxs("div", {
|
|
153
|
+
className: "min-w-0",
|
|
154
|
+
children: [jsx("p", {
|
|
155
|
+
className: "text-xs font-medium uppercase tracking-wide text-gray-500 dark:text-gray-400",
|
|
156
|
+
children: text.progress(index + 1, total)
|
|
157
|
+
}), current.title && jsx("h2", {
|
|
158
|
+
id: titleId,
|
|
159
|
+
className: "mt-1 text-base font-semibold",
|
|
160
|
+
children: current.title
|
|
161
|
+
})]
|
|
162
|
+
}), jsx("button", {
|
|
163
|
+
type: "button",
|
|
164
|
+
onClick: function onClick() {
|
|
165
|
+
return close("close");
|
|
166
|
+
},
|
|
167
|
+
"aria-label": text.close,
|
|
168
|
+
className: "rounded-md p-1 text-gray-500 hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus:ring-2 focus:ring-primary-500 dark:text-gray-400 dark:hover:bg-gray-800",
|
|
169
|
+
children: jsx(X, {
|
|
170
|
+
className: "h-4 w-4",
|
|
171
|
+
"aria-hidden": "true"
|
|
172
|
+
})
|
|
173
|
+
})]
|
|
174
|
+
}), current.content && jsx("div", {
|
|
175
|
+
id: bodyId,
|
|
176
|
+
className: "px-4 pt-2 text-sm text-gray-600 dark:text-gray-300",
|
|
177
|
+
children: current.content
|
|
178
|
+
}), jsxs("div", {
|
|
179
|
+
className: "flex items-center justify-between gap-2 px-4 py-4",
|
|
180
|
+
children: [isLast ? jsx("span", {}) : jsx(Button, {
|
|
181
|
+
variant: "ghost",
|
|
182
|
+
size: "sm",
|
|
183
|
+
onClick: function onClick() {
|
|
184
|
+
return close("skip");
|
|
185
|
+
},
|
|
186
|
+
children: text.skip
|
|
187
|
+
}), jsxs("div", {
|
|
188
|
+
className: "flex items-center gap-2",
|
|
189
|
+
children: [!isFirst && jsx(Button, {
|
|
190
|
+
variant: "outline",
|
|
191
|
+
size: "sm",
|
|
192
|
+
onClick: function onClick() {
|
|
193
|
+
return goTo(index - 1);
|
|
194
|
+
},
|
|
195
|
+
children: text.back
|
|
196
|
+
}), isLast ? jsx(Button, {
|
|
197
|
+
size: "sm",
|
|
198
|
+
onClick: finish,
|
|
199
|
+
children: text.finish
|
|
200
|
+
}) : jsx(Button, {
|
|
201
|
+
size: "sm",
|
|
202
|
+
onClick: function onClick() {
|
|
203
|
+
return goTo(index + 1);
|
|
204
|
+
},
|
|
205
|
+
children: text.next
|
|
206
|
+
})]
|
|
207
|
+
})]
|
|
208
|
+
})]
|
|
209
|
+
}))]
|
|
210
|
+
}), document.body);
|
|
211
|
+
});
|
|
212
|
+
Tour.displayName = "Tour";
|
|
213
|
+
|
|
214
|
+
export { Tour as default };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import 'react';
|
|
4
|
+
|
|
5
|
+
// Internal to Tour (not exported). Four dim panels around the target plus a
|
|
6
|
+
// ring, instead of one overlay with a hole: no SVG mask or clip-path support
|
|
7
|
+
// needed, and the panels' geometry can animate with plain transitions.
|
|
8
|
+
var DIM = "absolute bg-black/60 transition-[top,left,width,height] duration-200 motion-reduce:transition-none";
|
|
9
|
+
var TourSpotlight = function TourSpotlight(_ref) {
|
|
10
|
+
var rect = _ref.rect,
|
|
11
|
+
padding = _ref.padding;
|
|
12
|
+
if (!rect) return jsx("div", {
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
className: "absolute inset-0 bg-black/60",
|
|
15
|
+
"data-testid": "tour-backdrop"
|
|
16
|
+
});
|
|
17
|
+
var top = Math.max(0, rect.top - padding);
|
|
18
|
+
var left = Math.max(0, rect.left - padding);
|
|
19
|
+
var bottom = rect.bottom + padding;
|
|
20
|
+
var right = rect.right + padding;
|
|
21
|
+
var height = bottom - top;
|
|
22
|
+
return jsxs("div", {
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
"data-testid": "tour-spotlight",
|
|
25
|
+
children: [jsx("div", {
|
|
26
|
+
className: DIM,
|
|
27
|
+
style: {
|
|
28
|
+
top: 0,
|
|
29
|
+
left: 0,
|
|
30
|
+
right: 0,
|
|
31
|
+
height: top
|
|
32
|
+
}
|
|
33
|
+
}), jsx("div", {
|
|
34
|
+
className: DIM,
|
|
35
|
+
style: {
|
|
36
|
+
top: bottom,
|
|
37
|
+
left: 0,
|
|
38
|
+
right: 0,
|
|
39
|
+
bottom: 0
|
|
40
|
+
}
|
|
41
|
+
}), jsx("div", {
|
|
42
|
+
className: DIM,
|
|
43
|
+
style: {
|
|
44
|
+
top: top,
|
|
45
|
+
left: 0,
|
|
46
|
+
width: left,
|
|
47
|
+
height: height
|
|
48
|
+
}
|
|
49
|
+
}), jsx("div", {
|
|
50
|
+
className: DIM,
|
|
51
|
+
style: {
|
|
52
|
+
top: top,
|
|
53
|
+
left: right,
|
|
54
|
+
right: 0,
|
|
55
|
+
height: height
|
|
56
|
+
}
|
|
57
|
+
}), jsx("div", {
|
|
58
|
+
"data-testid": "tour-ring",
|
|
59
|
+
className: "pointer-events-none absolute rounded-lg ring-2 ring-white ring-offset-0 transition-[top,left,width,height] duration-200 motion-reduce:transition-none dark:ring-primary-400",
|
|
60
|
+
style: {
|
|
61
|
+
top: top,
|
|
62
|
+
left: left,
|
|
63
|
+
width: right - left,
|
|
64
|
+
height: height
|
|
65
|
+
}
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
TourSpotlight.displayName = "TourSpotlight";
|
|
70
|
+
|
|
71
|
+
export { TourSpotlight as default };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, toConsumableArray as _toConsumableArray, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { cn } from '../../utils/cn.js';
|
|
6
|
+
import { ChevronRight, Home } from 'lucide-react';
|
|
7
|
+
|
|
8
|
+
var _excluded = ["items", "separator", "showHome", "homeIcon", "onHomeClick", "className"];
|
|
9
|
+
// Items without an `id` still need a stable, unique React key.
|
|
10
|
+
var itemKey = function itemKey(item, index) {
|
|
11
|
+
var _ref, _item$href;
|
|
12
|
+
return item.id != null ? "id:".concat(item.id) : "idx:".concat(index, ":").concat((_ref = (_item$href = item.href) !== null && _item$href !== void 0 ? _item$href : item.label) !== null && _ref !== void 0 ? _ref : '');
|
|
13
|
+
};
|
|
14
|
+
var Breadcrumbs = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
15
|
+
var _ref2$items = _ref2.items,
|
|
16
|
+
items = _ref2$items === void 0 ? [] : _ref2$items,
|
|
17
|
+
_ref2$separator = _ref2.separator,
|
|
18
|
+
separator = _ref2$separator === void 0 ? jsx(ChevronRight, {
|
|
19
|
+
className: "h-4 w-4"
|
|
20
|
+
}) : _ref2$separator,
|
|
21
|
+
_ref2$showHome = _ref2.showHome,
|
|
22
|
+
showHome = _ref2$showHome === void 0 ? true : _ref2$showHome,
|
|
23
|
+
_ref2$homeIcon = _ref2.homeIcon,
|
|
24
|
+
homeIcon = _ref2$homeIcon === void 0 ? jsx(Home, {
|
|
25
|
+
className: "h-4 w-4"
|
|
26
|
+
}) : _ref2$homeIcon,
|
|
27
|
+
onHomeClick = _ref2.onHomeClick,
|
|
28
|
+
className = _ref2.className,
|
|
29
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
30
|
+
var allItems = showHome ? [{
|
|
31
|
+
id: 'home',
|
|
32
|
+
label: 'Home',
|
|
33
|
+
href: '/',
|
|
34
|
+
icon: homeIcon,
|
|
35
|
+
onClick: onHomeClick
|
|
36
|
+
}].concat(_toConsumableArray(items)) : items;
|
|
37
|
+
return jsx("nav", _objectSpread2(_objectSpread2({
|
|
38
|
+
ref: ref,
|
|
39
|
+
className: cn('flex items-center space-x-1 text-sm', className),
|
|
40
|
+
"aria-label": "Breadcrumb"
|
|
41
|
+
}, props), {}, {
|
|
42
|
+
children: allItems.map(function (item, index) {
|
|
43
|
+
return jsxs(React.Fragment, {
|
|
44
|
+
children: [index > 0 && jsx("span", {
|
|
45
|
+
className: "text-primary-400",
|
|
46
|
+
"aria-hidden": "true",
|
|
47
|
+
children: separator
|
|
48
|
+
}), index === allItems.length - 1 ? jsxs("span", {
|
|
49
|
+
className: "font-medium text-primary-900",
|
|
50
|
+
"aria-current": "page",
|
|
51
|
+
children: [item.icon && jsx("span", {
|
|
52
|
+
className: "mr-1",
|
|
53
|
+
children: item.icon
|
|
54
|
+
}), item.label]
|
|
55
|
+
}) : jsxs("a", {
|
|
56
|
+
href: item.href,
|
|
57
|
+
className: "flex items-center text-primary-500 transition-colors",
|
|
58
|
+
onClick: function onClick(e) {
|
|
59
|
+
if (item.onClick) {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
item.onClick(item);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
children: [item.icon && jsx("span", {
|
|
65
|
+
className: "mr-1",
|
|
66
|
+
children: item.icon
|
|
67
|
+
}), item.label]
|
|
68
|
+
})]
|
|
69
|
+
}, itemKey(item, index));
|
|
70
|
+
})
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
73
|
+
Breadcrumbs.displayName = 'Breadcrumbs';
|
|
74
|
+
|
|
75
|
+
export { Breadcrumbs as default };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useState, useRef, useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
var _excluded = ["trigger", "children", "placement", "className"];
|
|
7
|
+
var Dropdown = function Dropdown(_ref) {
|
|
8
|
+
var trigger = _ref.trigger,
|
|
9
|
+
children = _ref.children,
|
|
10
|
+
_ref$placement = _ref.placement,
|
|
11
|
+
placement = _ref$placement === void 0 ? 'bottom-start' : _ref$placement,
|
|
12
|
+
_ref$className = _ref.className,
|
|
13
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
14
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
var _useState = useState(false),
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
isOpen = _useState2[0],
|
|
18
|
+
setIsOpen = _useState2[1];
|
|
19
|
+
var dropdownRef = useRef(null);
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
22
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
23
|
+
setIsOpen(false);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
27
|
+
return function () {
|
|
28
|
+
return document.removeEventListener('mousedown', handleClickOutside);
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
var placementClasses = {
|
|
32
|
+
'bottom-start': 'top-full left-0 mt-1',
|
|
33
|
+
'bottom-end': 'top-full right-0 mt-1',
|
|
34
|
+
'top-start': 'bottom-full left-0 mb-1',
|
|
35
|
+
'top-end': 'bottom-full right-0 mb-1'
|
|
36
|
+
};
|
|
37
|
+
return jsxs("div", _objectSpread2(_objectSpread2({
|
|
38
|
+
className: "relative inline-block ".concat(className),
|
|
39
|
+
ref: dropdownRef
|
|
40
|
+
}, props), {}, {
|
|
41
|
+
children: [jsx("div", {
|
|
42
|
+
onClick: function onClick() {
|
|
43
|
+
return setIsOpen(!isOpen);
|
|
44
|
+
},
|
|
45
|
+
children: trigger
|
|
46
|
+
}), isOpen && jsx("div", {
|
|
47
|
+
className: "absolute z-50 bg-white border border-gray-200 rounded-md shadow-lg ".concat(placementClasses[placement], " min-w-48"),
|
|
48
|
+
children: children
|
|
49
|
+
})]
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { Dropdown };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { cn } from '../../utils/cn.js';
|
|
6
|
+
|
|
7
|
+
var _excluded = ["items", "className"];
|
|
8
|
+
var hasBadge = function hasBadge(badge) {
|
|
9
|
+
return badge === 0 || Boolean(badge);
|
|
10
|
+
};
|
|
11
|
+
var FootNav = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
12
|
+
var _ref$items = _ref.items,
|
|
13
|
+
items = _ref$items === void 0 ? [] : _ref$items,
|
|
14
|
+
className = _ref.className,
|
|
15
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
return jsx("nav", _objectSpread2(_objectSpread2({
|
|
17
|
+
ref: ref,
|
|
18
|
+
className: cn('fixed bottom-0 left-0 right-0 bg-surface border-t border-line px-2 py-2 md:hidden', className)
|
|
19
|
+
}, props), {}, {
|
|
20
|
+
children: jsx("div", {
|
|
21
|
+
className: "flex items-stretch justify-around gap-1",
|
|
22
|
+
children: items.map(function (item, index) {
|
|
23
|
+
var _item$id;
|
|
24
|
+
return jsxs("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
"aria-current": item.active ? 'page' : undefined,
|
|
27
|
+
className: cn('relative flex min-w-0 flex-1 flex-col items-center gap-1 rounded-md px-1 py-2 text-xs transition-colors', 'focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-1 motion-reduce:transition-none', item.active ? 'bg-primary-50 font-semibold text-primary-700 dark:bg-primary-900/40 dark:text-primary-300' : 'font-medium text-muted hover:bg-gray-100 hover:text-foreground dark:hover:bg-gray-800'),
|
|
28
|
+
onClick: function onClick() {
|
|
29
|
+
var _item$onClick;
|
|
30
|
+
return (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, item);
|
|
31
|
+
},
|
|
32
|
+
children: [jsxs("span", {
|
|
33
|
+
className: "relative inline-flex text-lg",
|
|
34
|
+
"data-slot": "icon",
|
|
35
|
+
children: [item.icon, hasBadge(item.badge) && jsx("span", {
|
|
36
|
+
className: "absolute -top-1.5 left-full -ml-2 flex h-4 min-w-4 items-center justify-center rounded-full bg-error-600 px-1 text-micro font-semibold text-white",
|
|
37
|
+
"data-slot": "badge",
|
|
38
|
+
children: item.badge
|
|
39
|
+
})]
|
|
40
|
+
}), jsx("span", {
|
|
41
|
+
className: "block max-w-full truncate",
|
|
42
|
+
children: item.label
|
|
43
|
+
})]
|
|
44
|
+
}, (_item$id = item.id) !== null && _item$id !== void 0 ? _item$id : index);
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
}));
|
|
48
|
+
});
|
|
49
|
+
FootNav.displayName = 'FootNav';
|
|
50
|
+
|
|
51
|
+
export { FootNav as default };
|