@heymantle/litho 0.0.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/LICENSE +21 -0
- package/README.md +90 -0
- package/dist/cjs/components/ActionList.js +267 -0
- package/dist/cjs/components/AnnouncementBar.js +73 -0
- package/dist/cjs/components/AppProvider.js +245 -0
- package/dist/cjs/components/Autocomplete.js +351 -0
- package/dist/cjs/components/Badge.js +234 -0
- package/dist/cjs/components/Banner.js +264 -0
- package/dist/cjs/components/Box.js +247 -0
- package/dist/cjs/components/Button.js +1018 -0
- package/dist/cjs/components/ButtonGroup.js +196 -0
- package/dist/cjs/components/Card.js +593 -0
- package/dist/cjs/components/Checkbox.js +175 -0
- package/dist/cjs/components/ChoiceList.js +160 -0
- package/dist/cjs/components/Collapsible.js +42 -0
- package/dist/cjs/components/ColorField.js +159 -0
- package/dist/cjs/components/ContextualSaveBar.js +53 -0
- package/dist/cjs/components/DatePicker.js +547 -0
- package/dist/cjs/components/Divider.js +50 -0
- package/dist/cjs/components/DropZone.js +547 -0
- package/dist/cjs/components/EmptyState.js +111 -0
- package/dist/cjs/components/Filters.js +874 -0
- package/dist/cjs/components/FooterHelp.js +48 -0
- package/dist/cjs/components/Form.js +44 -0
- package/dist/cjs/components/Frame.js +386 -0
- package/dist/cjs/components/FrameSaveBar.js +239 -0
- package/dist/cjs/components/Grid.js +151 -0
- package/dist/cjs/components/HorizontalStack.js +180 -0
- package/dist/cjs/components/Icon.js +346 -0
- package/dist/cjs/components/Image.js +191 -0
- package/dist/cjs/components/InlineError.js +57 -0
- package/dist/cjs/components/Label.js +78 -0
- package/dist/cjs/components/Layout.js +228 -0
- package/dist/cjs/components/LayoutSection.js +133 -0
- package/dist/cjs/components/Link.js +128 -0
- package/dist/cjs/components/List.js +69 -0
- package/dist/cjs/components/Listbox.js +211 -0
- package/dist/cjs/components/Loading.js +103 -0
- package/dist/cjs/components/Modal.js +449 -0
- package/dist/cjs/components/Navigation.js +331 -0
- package/dist/cjs/components/Page.js +529 -0
- package/dist/cjs/components/Pagination.js +109 -0
- package/dist/cjs/components/Pane.js +128 -0
- package/dist/cjs/components/Popover.js +365 -0
- package/dist/cjs/components/PopoverManager.js +34 -0
- package/dist/cjs/components/ProgressBar.js +124 -0
- package/dist/cjs/components/RadioButton.js +172 -0
- package/dist/cjs/components/RadioButtonCard.js +193 -0
- package/dist/cjs/components/RangeSlider.js +235 -0
- package/dist/cjs/components/ResourceList.js +105 -0
- package/dist/cjs/components/Select.js +300 -0
- package/dist/cjs/components/SkeletonText.js +130 -0
- package/dist/cjs/components/Spinner.js +72 -0
- package/dist/cjs/components/Table.js +1184 -0
- package/dist/cjs/components/Tabs.js +421 -0
- package/dist/cjs/components/Tag.js +165 -0
- package/dist/cjs/components/Text.js +274 -0
- package/dist/cjs/components/TextField.js +584 -0
- package/dist/cjs/components/Thumbnail.js +73 -0
- package/dist/cjs/components/TimePicker.js +23 -0
- package/dist/cjs/components/Tip.js +220 -0
- package/dist/cjs/components/Tooltip.js +431 -0
- package/dist/cjs/components/TopBar.js +210 -0
- package/dist/cjs/components/VerticalStack.js +161 -0
- package/dist/cjs/index.js +308 -0
- package/dist/cjs/styles/Table.js +591 -0
- package/dist/cjs/utilities/dates.js +339 -0
- package/dist/cjs/utilities/useIndexResourceState.js +175 -0
- package/dist/cjs/utilities/useMounted.js +67 -0
- package/dist/cjs/utilities/useTableScrollState.js +142 -0
- package/dist/esm/components/ActionList.js +216 -0
- package/dist/esm/components/AnnouncementBar.js +63 -0
- package/dist/esm/components/AppProvider.js +185 -0
- package/dist/esm/components/Autocomplete.js +300 -0
- package/dist/esm/components/Badge.js +225 -0
- package/dist/esm/components/Banner.js +254 -0
- package/dist/esm/components/Box.js +238 -0
- package/dist/esm/components/Button.js +967 -0
- package/dist/esm/components/ButtonGroup.js +137 -0
- package/dist/esm/components/Card.js +537 -0
- package/dist/esm/components/Checkbox.js +165 -0
- package/dist/esm/components/ChoiceList.js +145 -0
- package/dist/esm/components/Collapsible.js +32 -0
- package/dist/esm/components/ColorField.js +149 -0
- package/dist/esm/components/ContextualSaveBar.js +43 -0
- package/dist/esm/components/DatePicker.js +532 -0
- package/dist/esm/components/Divider.js +41 -0
- package/dist/esm/components/DropZone.js +537 -0
- package/dist/esm/components/EmptyState.js +101 -0
- package/dist/esm/components/Filters.js +823 -0
- package/dist/esm/components/FooterHelp.js +38 -0
- package/dist/esm/components/Form.js +35 -0
- package/dist/esm/components/Frame.js +376 -0
- package/dist/esm/components/FrameSaveBar.js +229 -0
- package/dist/esm/components/Grid.js +142 -0
- package/dist/esm/components/HorizontalStack.js +171 -0
- package/dist/esm/components/Icon.js +296 -0
- package/dist/esm/components/Image.js +141 -0
- package/dist/esm/components/InlineError.js +43 -0
- package/dist/esm/components/Label.js +63 -0
- package/dist/esm/components/Layout.js +164 -0
- package/dist/esm/components/LayoutSection.js +82 -0
- package/dist/esm/components/Link.js +119 -0
- package/dist/esm/components/List.js +61 -0
- package/dist/esm/components/Listbox.js +201 -0
- package/dist/esm/components/Loading.js +93 -0
- package/dist/esm/components/Modal.js +390 -0
- package/dist/esm/components/Navigation.js +321 -0
- package/dist/esm/components/Page.js +473 -0
- package/dist/esm/components/Pagination.js +99 -0
- package/dist/esm/components/Pane.js +118 -0
- package/dist/esm/components/Popover.js +350 -0
- package/dist/esm/components/PopoverManager.js +24 -0
- package/dist/esm/components/ProgressBar.js +114 -0
- package/dist/esm/components/RadioButton.js +157 -0
- package/dist/esm/components/RadioButtonCard.js +178 -0
- package/dist/esm/components/RangeSlider.js +225 -0
- package/dist/esm/components/ResourceList.js +95 -0
- package/dist/esm/components/Select.js +285 -0
- package/dist/esm/components/SkeletonText.js +120 -0
- package/dist/esm/components/Spinner.js +63 -0
- package/dist/esm/components/Table.js +1129 -0
- package/dist/esm/components/Tabs.js +366 -0
- package/dist/esm/components/Tag.js +151 -0
- package/dist/esm/components/Text.js +265 -0
- package/dist/esm/components/TextField.js +533 -0
- package/dist/esm/components/Thumbnail.js +63 -0
- package/dist/esm/components/TimePicker.js +13 -0
- package/dist/esm/components/Tip.js +169 -0
- package/dist/esm/components/Tooltip.js +380 -0
- package/dist/esm/components/TopBar.js +200 -0
- package/dist/esm/components/VerticalStack.js +152 -0
- package/dist/esm/index.js +61 -0
- package/dist/esm/styles/Table.js +581 -0
- package/dist/esm/utilities/dates.js +289 -0
- package/dist/esm/utilities/useIndexResourceState.js +158 -0
- package/dist/esm/utilities/useMounted.js +57 -0
- package/dist/esm/utilities/useTableScrollState.js +132 -0
- package/index.css +1137 -0
- package/package.json +53 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return _default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
13
|
+
var _react = require("react");
|
|
14
|
+
var _AppProvider = require("../components/AppProvider");
|
|
15
|
+
var _tailwindvariants = require("tailwind-variants");
|
|
16
|
+
var _index = require("../index");
|
|
17
|
+
var _polarisicons = require("@shopify/polaris-icons");
|
|
18
|
+
function _array_like_to_array(arr, len) {
|
|
19
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
20
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
21
|
+
return arr2;
|
|
22
|
+
}
|
|
23
|
+
function _array_with_holes(arr) {
|
|
24
|
+
if (Array.isArray(arr)) return arr;
|
|
25
|
+
}
|
|
26
|
+
function _iterable_to_array_limit(arr, i) {
|
|
27
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
28
|
+
if (_i == null) return;
|
|
29
|
+
var _arr = [];
|
|
30
|
+
var _n = true;
|
|
31
|
+
var _d = false;
|
|
32
|
+
var _s, _e;
|
|
33
|
+
try {
|
|
34
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
35
|
+
_arr.push(_s.value);
|
|
36
|
+
if (i && _arr.length === i) break;
|
|
37
|
+
}
|
|
38
|
+
} catch (err) {
|
|
39
|
+
_d = true;
|
|
40
|
+
_e = err;
|
|
41
|
+
} finally{
|
|
42
|
+
try {
|
|
43
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
44
|
+
} finally{
|
|
45
|
+
if (_d) throw _e;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return _arr;
|
|
49
|
+
}
|
|
50
|
+
function _non_iterable_rest() {
|
|
51
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
52
|
+
}
|
|
53
|
+
function _sliced_to_array(arr, i) {
|
|
54
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
55
|
+
}
|
|
56
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
57
|
+
if (!o) return;
|
|
58
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
59
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
60
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
61
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
62
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
63
|
+
}
|
|
64
|
+
var styles = (0, _tailwindvariants.tv)({
|
|
65
|
+
base: "Litho-FrameSaveBar fixed top-[var(--litho-header-offset)] right-0 left-0 h-[var(--litho-header-height)] px-4 @md:px-5 flex items-center gap-2 bg-surface-alternate dark:bg-brand transition-opacity transition-transform duration-300 transform",
|
|
66
|
+
variants: {
|
|
67
|
+
visible: {
|
|
68
|
+
true: "opacity-100 pointer-events-auto",
|
|
69
|
+
false: "opacity-0 pointer-events-none"
|
|
70
|
+
},
|
|
71
|
+
tucked: {
|
|
72
|
+
true: "-translate-y-full",
|
|
73
|
+
false: "translate-y-0"
|
|
74
|
+
},
|
|
75
|
+
paneIsOpen: {
|
|
76
|
+
true: "right-[var(--litho-pane-width)]",
|
|
77
|
+
false: "right-0"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
defaultVariants: {
|
|
81
|
+
visible: false,
|
|
82
|
+
tucked: false,
|
|
83
|
+
paneIsOpen: false
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
var toggleStyles = (0, _tailwindvariants.tv)({
|
|
87
|
+
base: "Litho-FrameSaveBar__Toggle hidden @md:block bg-surface-alternate dark:bg-brand rounded-b-md fixed -translate-x-1/2 top-0 transition-transform duration-300 transform",
|
|
88
|
+
variants: {
|
|
89
|
+
tucked: {
|
|
90
|
+
true: "translate-y-0",
|
|
91
|
+
false: "-translate-y-full"
|
|
92
|
+
},
|
|
93
|
+
paneIsOpen: {
|
|
94
|
+
true: "left-[calc(50%-var(--litho-pane-width)/2)]",
|
|
95
|
+
false: "left-1/2"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
defaultVariants: {
|
|
99
|
+
tucked: false,
|
|
100
|
+
paneIsOpen: false
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* FrameSaveBar component sisplays a save bar at the top of the screen with contextual save and discard actions.
|
|
105
|
+
* @param {Object} props.logo - Logo configuration.
|
|
106
|
+
* @returns {JSX.Element} The rendered FrameSaveBar component
|
|
107
|
+
*/ function FrameSaveBar(param) {
|
|
108
|
+
var logo = param.logo;
|
|
109
|
+
var darkMode = (0, _react.useContext)(_AppProvider.DarkModeContext).darkMode;
|
|
110
|
+
var paneIsOpen = (0, _react.useContext)(_AppProvider.FrameContext).paneIsOpen;
|
|
111
|
+
var _useContext = (0, _react.useContext)(_AppProvider.FormContext), showGlobalContextualSaveBar = _useContext.showGlobalContextualSaveBar, message = _useContext.message, saveAction = _useContext.saveAction, discardAction = _useContext.discardAction;
|
|
112
|
+
var _useState = _sliced_to_array((0, _react.useState)(false), 2), visible = _useState[0], setVisible = _useState[1];
|
|
113
|
+
var _useState1 = _sliced_to_array((0, _react.useState)(false), 2), show = _useState1[0], setShow = _useState1[1];
|
|
114
|
+
var _useState2 = _sliced_to_array((0, _react.useState)(false), 2), tucked = _useState2[0], setTucked = _useState2[1];
|
|
115
|
+
(0, _react.useEffect)(function() {
|
|
116
|
+
if (showGlobalContextualSaveBar) {
|
|
117
|
+
setVisible(true);
|
|
118
|
+
var timer = setTimeout(function() {
|
|
119
|
+
return setShow(true);
|
|
120
|
+
}, 10);
|
|
121
|
+
return function() {
|
|
122
|
+
return clearTimeout(timer);
|
|
123
|
+
};
|
|
124
|
+
} else {
|
|
125
|
+
setShow(false);
|
|
126
|
+
var timer1 = setTimeout(function() {
|
|
127
|
+
return setVisible(false);
|
|
128
|
+
}, 300);
|
|
129
|
+
return function() {
|
|
130
|
+
return clearTimeout(timer1);
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}, [
|
|
134
|
+
showGlobalContextualSaveBar
|
|
135
|
+
]);
|
|
136
|
+
var logoSource = darkMode ? logo.source : logo.darkSource;
|
|
137
|
+
if (!visible) return null;
|
|
138
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
139
|
+
children: [
|
|
140
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
141
|
+
className: toggleStyles({
|
|
142
|
+
tucked: tucked,
|
|
143
|
+
paneIsOpen: paneIsOpen
|
|
144
|
+
}),
|
|
145
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Tooltip, {
|
|
146
|
+
content: "Show save bar",
|
|
147
|
+
position: "below",
|
|
148
|
+
alignment: "center",
|
|
149
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
150
|
+
className: "cursor-pointer w-8 h-8 flex items-center justify-center",
|
|
151
|
+
onClick: function() {
|
|
152
|
+
return setTucked(false);
|
|
153
|
+
},
|
|
154
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Icon, {
|
|
155
|
+
source: _polarisicons.ChevronDownMinor,
|
|
156
|
+
color: "FrameSaveBar"
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
}),
|
|
161
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
162
|
+
className: styles({
|
|
163
|
+
visible: show,
|
|
164
|
+
tucked: tucked,
|
|
165
|
+
paneIsOpen: paneIsOpen
|
|
166
|
+
}),
|
|
167
|
+
children: [
|
|
168
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
169
|
+
className: "hidden @md:block py-1 px-0.5 w-51.5",
|
|
170
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("img", {
|
|
171
|
+
src: logoSource,
|
|
172
|
+
alt: logo.accessibilityLabel,
|
|
173
|
+
style: (logo === null || logo === void 0 ? void 0 : logo.width) ? {
|
|
174
|
+
width: logo.width
|
|
175
|
+
} : undefined
|
|
176
|
+
})
|
|
177
|
+
}),
|
|
178
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
179
|
+
className: "flex-1 flex items-center justify-between gap-2",
|
|
180
|
+
children: [
|
|
181
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
182
|
+
className: "flex items-center gap-2 min-w-0",
|
|
183
|
+
children: [
|
|
184
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Text, {
|
|
185
|
+
variant: "headingMd",
|
|
186
|
+
color: "FrameSaveBar",
|
|
187
|
+
truncate: true,
|
|
188
|
+
children: message
|
|
189
|
+
}),
|
|
190
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
191
|
+
className: "hidden @md:block",
|
|
192
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Tooltip, {
|
|
193
|
+
content: "Hide save bar",
|
|
194
|
+
position: "below",
|
|
195
|
+
alignment: "center",
|
|
196
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
197
|
+
className: "cursor-pointer w-8 h-8 flex items-center justify-center hover:bg-tint-1 active:bg-tint-2 rounded-md",
|
|
198
|
+
onClick: function() {
|
|
199
|
+
return setTucked(true);
|
|
200
|
+
},
|
|
201
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Icon, {
|
|
202
|
+
source: _polarisicons.ChevronUpMinor,
|
|
203
|
+
color: "FrameSaveBar"
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
})
|
|
208
|
+
]
|
|
209
|
+
}),
|
|
210
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
211
|
+
className: "flex items-center gap-2",
|
|
212
|
+
children: [
|
|
213
|
+
discardAction && /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Button, {
|
|
214
|
+
primary: true,
|
|
215
|
+
onClick: discardAction.onAction,
|
|
216
|
+
loading: discardAction.loading,
|
|
217
|
+
accessibilityLabel: discardAction.accessibilityLabel,
|
|
218
|
+
disabled: discardAction.disabled,
|
|
219
|
+
className: discardAction.loading || discardAction.disabled ? "border-transparent!" : undefined,
|
|
220
|
+
children: discardAction.content
|
|
221
|
+
}),
|
|
222
|
+
saveAction && /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Button, {
|
|
223
|
+
highlight: true,
|
|
224
|
+
onClick: saveAction.onAction,
|
|
225
|
+
loading: saveAction.loading,
|
|
226
|
+
accessibilityLabel: saveAction.accessibilityLabel,
|
|
227
|
+
disabled: saveAction.disabled,
|
|
228
|
+
children: saveAction.content
|
|
229
|
+
})
|
|
230
|
+
]
|
|
231
|
+
})
|
|
232
|
+
]
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
})
|
|
236
|
+
]
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
var _default = FrameSaveBar;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
var _tailwindvariants = require("tailwind-variants");
|
|
13
|
+
function _array_like_to_array(arr, len) {
|
|
14
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
15
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
16
|
+
return arr2;
|
|
17
|
+
}
|
|
18
|
+
function _array_with_holes(arr) {
|
|
19
|
+
if (Array.isArray(arr)) return arr;
|
|
20
|
+
}
|
|
21
|
+
function _iterable_to_array_limit(arr, i) {
|
|
22
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
23
|
+
if (_i == null) return;
|
|
24
|
+
var _arr = [];
|
|
25
|
+
var _n = true;
|
|
26
|
+
var _d = false;
|
|
27
|
+
var _s, _e;
|
|
28
|
+
try {
|
|
29
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
30
|
+
_arr.push(_s.value);
|
|
31
|
+
if (i && _arr.length === i) break;
|
|
32
|
+
}
|
|
33
|
+
} catch (err) {
|
|
34
|
+
_d = true;
|
|
35
|
+
_e = err;
|
|
36
|
+
} finally{
|
|
37
|
+
try {
|
|
38
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
39
|
+
} finally{
|
|
40
|
+
if (_d) throw _e;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return _arr;
|
|
44
|
+
}
|
|
45
|
+
function _non_iterable_rest() {
|
|
46
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
47
|
+
}
|
|
48
|
+
function _sliced_to_array(arr, i) {
|
|
49
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
50
|
+
}
|
|
51
|
+
function _type_of(obj) {
|
|
52
|
+
"@swc/helpers - typeof";
|
|
53
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
54
|
+
}
|
|
55
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
56
|
+
if (!o) return;
|
|
57
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
58
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
59
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
60
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
61
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
62
|
+
}
|
|
63
|
+
var styles = (0, _tailwindvariants.tv)({
|
|
64
|
+
base: "Litho-Grid grid",
|
|
65
|
+
variants: {
|
|
66
|
+
justify: {
|
|
67
|
+
stretch: "justify-stretch",
|
|
68
|
+
start: "justify-start",
|
|
69
|
+
end: "justify-end",
|
|
70
|
+
center: "justify-center"
|
|
71
|
+
},
|
|
72
|
+
align: {
|
|
73
|
+
stretch: "items-stretch",
|
|
74
|
+
start: "items-start",
|
|
75
|
+
end: "items-end",
|
|
76
|
+
center: "items-center"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: {
|
|
80
|
+
justify: "stretch",
|
|
81
|
+
align: "stretch"
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* Tailwind-based Grid component with customizable columns, gaps, alignment, and justification.
|
|
86
|
+
*
|
|
87
|
+
* @param {object} [props={}] - Props for the Grid component.
|
|
88
|
+
* @param {React.ReactNode} [props.children] - Content to render inside the Grid.
|
|
89
|
+
* @param {number|object} [props.columns] - Defines the number of columns in the grid. Can be a single number or an object with breakpoints as keys.
|
|
90
|
+
* @param {number|object} [props.gap] - Defines the gap between grid items. Can be a single number or an object with breakpoints as keys.
|
|
91
|
+
* @param {"stretch"|"start"|"end"|"center"} [props.justify="stretch"] - Horizontal alignment of the grid items.
|
|
92
|
+
* @param {"stretch"|"start"|"end"|"center"} [props.align="stretch"] - Vertical alignment of the grid items.
|
|
93
|
+
* @param {string} [props.className] - Additional class names to apply to the grid.
|
|
94
|
+
* @returns {JSX.Element} A div element representing the grid container.
|
|
95
|
+
*/ function Grid() {
|
|
96
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
97
|
+
var children = props.children, columns = props.columns, gap = props.gap, _props_justify = props.justify, justify = _props_justify === void 0 ? "stretch" : _props_justify, _props_align = props.align, align = _props_align === void 0 ? "stretch" : _props_align, className = props.className;
|
|
98
|
+
var columnClasses;
|
|
99
|
+
var gapClasses;
|
|
100
|
+
if ((typeof columns === "undefined" ? "undefined" : _type_of(columns)) === "object") {
|
|
101
|
+
columnClasses = Object.entries(columns).map(function(param) {
|
|
102
|
+
var _param = _sliced_to_array(param, 2), breakpoint = _param[0], count = _param[1];
|
|
103
|
+
return breakpoint === "default" || breakpoint === "xs" ? "grid-cols-".concat(count) : "@".concat(breakpoint, ":grid-cols-").concat(count);
|
|
104
|
+
}).join(" ");
|
|
105
|
+
} else {
|
|
106
|
+
columnClasses = "grid-cols-".concat(columns);
|
|
107
|
+
}
|
|
108
|
+
if ((typeof gap === "undefined" ? "undefined" : _type_of(gap)) === "object") {
|
|
109
|
+
gapClasses = Object.entries(gap).map(function(param) {
|
|
110
|
+
var _param = _sliced_to_array(param, 2), breakpoint = _param[0], count = _param[1];
|
|
111
|
+
return breakpoint === "default" || breakpoint === "xs" ? "gap-".concat(count) : "@".concat(breakpoint, ":gap-").concat(count);
|
|
112
|
+
}).join(" ");
|
|
113
|
+
} else {
|
|
114
|
+
gapClasses = "gap-".concat(gap);
|
|
115
|
+
}
|
|
116
|
+
var classes = styles({
|
|
117
|
+
align: align,
|
|
118
|
+
justify: justify
|
|
119
|
+
});
|
|
120
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
121
|
+
className: "".concat(classes, " ").concat(columnClasses, " ").concat(gapClasses).concat(className ? " ".concat(className) : ""),
|
|
122
|
+
children: children
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Cell component for the Grid, allowing column span customization.
|
|
127
|
+
*
|
|
128
|
+
* @param {object} [props={}] - Props for the Cell component.
|
|
129
|
+
* @param {number|object} [props.columnSpan] - Defines the column span for the cell. Can be a single number or an object with breakpoints as keys.
|
|
130
|
+
* @param {React.ReactNode} [props.children] - Content to render inside the cell.
|
|
131
|
+
* @param {string} [props.className] - Additional class names to apply to the cell.
|
|
132
|
+
* @returns {JSX.Element} A div element representing a grid cell.
|
|
133
|
+
*/ function Cell() {
|
|
134
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
135
|
+
var columnSpan = props.columnSpan, children = props.children, className = props.className;
|
|
136
|
+
var columnSpanClasses;
|
|
137
|
+
if ((typeof columnSpan === "undefined" ? "undefined" : _type_of(columnSpan)) === "object") {
|
|
138
|
+
columnSpanClasses = Object.entries(columnSpan).map(function(param) {
|
|
139
|
+
var _param = _sliced_to_array(param, 2), breakpoint = _param[0], count = _param[1];
|
|
140
|
+
return breakpoint === "default" || breakpoint === "xs" ? "col-span-".concat(count) : "@".concat(breakpoint, ":col-span-").concat(count);
|
|
141
|
+
}).join(" ");
|
|
142
|
+
} else {
|
|
143
|
+
columnSpanClasses = "col-span-".concat(columnSpan);
|
|
144
|
+
}
|
|
145
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
146
|
+
className: "Litho-Grid-Cell ".concat(columnSpanClasses).concat(className ? " ".concat(className) : ""),
|
|
147
|
+
children: children
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
Grid.Cell = Cell;
|
|
151
|
+
var _default = Grid;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
var _tailwindvariants = require("tailwind-variants");
|
|
13
|
+
function _define_property(obj, key, value) {
|
|
14
|
+
if (key in obj) {
|
|
15
|
+
Object.defineProperty(obj, key, {
|
|
16
|
+
value: value,
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
obj[key] = value;
|
|
23
|
+
}
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
function _object_spread(target) {
|
|
27
|
+
for(var i = 1; i < arguments.length; i++){
|
|
28
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
29
|
+
var ownKeys = Object.keys(source);
|
|
30
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
31
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
32
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
ownKeys.forEach(function(key) {
|
|
36
|
+
_define_property(target, key, source[key]);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return target;
|
|
40
|
+
}
|
|
41
|
+
function ownKeys(object, enumerableOnly) {
|
|
42
|
+
var keys = Object.keys(object);
|
|
43
|
+
if (Object.getOwnPropertySymbols) {
|
|
44
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
45
|
+
if (enumerableOnly) {
|
|
46
|
+
symbols = symbols.filter(function(sym) {
|
|
47
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
keys.push.apply(keys, symbols);
|
|
51
|
+
}
|
|
52
|
+
return keys;
|
|
53
|
+
}
|
|
54
|
+
function _object_spread_props(target, source) {
|
|
55
|
+
source = source != null ? source : {};
|
|
56
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
57
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
58
|
+
} else {
|
|
59
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
60
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return target;
|
|
64
|
+
}
|
|
65
|
+
function _object_without_properties(source, excluded) {
|
|
66
|
+
if (source == null) return {};
|
|
67
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
68
|
+
var key, i;
|
|
69
|
+
if (Object.getOwnPropertySymbols) {
|
|
70
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
71
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
72
|
+
key = sourceSymbolKeys[i];
|
|
73
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
74
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
75
|
+
target[key] = source[key];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return target;
|
|
79
|
+
}
|
|
80
|
+
function _object_without_properties_loose(source, excluded) {
|
|
81
|
+
if (source == null) return {};
|
|
82
|
+
var target = {};
|
|
83
|
+
var sourceKeys = Object.keys(source);
|
|
84
|
+
var key, i;
|
|
85
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
86
|
+
key = sourceKeys[i];
|
|
87
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
88
|
+
target[key] = source[key];
|
|
89
|
+
}
|
|
90
|
+
return target;
|
|
91
|
+
}
|
|
92
|
+
var styles = (0, _tailwindvariants.tv)({
|
|
93
|
+
base: "Litho-HorizontalStack flex flex-row",
|
|
94
|
+
variants: {
|
|
95
|
+
gap: {
|
|
96
|
+
none: "",
|
|
97
|
+
"0": "gap-0",
|
|
98
|
+
"px": "gap-px",
|
|
99
|
+
"0.5": "gap-0.5",
|
|
100
|
+
"1": "gap-1",
|
|
101
|
+
"2": "gap-2",
|
|
102
|
+
"3": "gap-3",
|
|
103
|
+
"4": "gap-4",
|
|
104
|
+
"6": "gap-6",
|
|
105
|
+
"8": "gap-8",
|
|
106
|
+
"10": "gap-10"
|
|
107
|
+
},
|
|
108
|
+
align: {
|
|
109
|
+
start: "justify-start",
|
|
110
|
+
center: "justify-center",
|
|
111
|
+
end: "justify-end",
|
|
112
|
+
"space-between": "justify-between",
|
|
113
|
+
"space-evenly": "justify-evenly",
|
|
114
|
+
"space-around": "justify-around"
|
|
115
|
+
},
|
|
116
|
+
blockAlign: {
|
|
117
|
+
start: "items-start",
|
|
118
|
+
center: "items-center",
|
|
119
|
+
end: "items-end"
|
|
120
|
+
},
|
|
121
|
+
wrap: {
|
|
122
|
+
true: "flex-wrap",
|
|
123
|
+
false: "flex-nowrap"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
defaultVariants: {
|
|
127
|
+
align: "start",
|
|
128
|
+
blockAlign: "start"
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
/**
|
|
132
|
+
* HorizontalStack Component
|
|
133
|
+
*
|
|
134
|
+
* A flexible horizontal stack component with customizable spacing, alignment, and wrapping.
|
|
135
|
+
*
|
|
136
|
+
* @param {Object} [props={}] - Component props.
|
|
137
|
+
* @param {string} [props.as='div'] - The HTML element to render. Defaults to `div`.
|
|
138
|
+
* @param {React.ReactNode} [props.children] - Child elements to render inside the stack.
|
|
139
|
+
* @param {string} [props.gap] - Spacing between children. Options: 'none', '0', 'px', '0.5', '1', '2', '3', '4', '6', '8', '10'.
|
|
140
|
+
* @param {string} [props.id] - Optional ID for the component.
|
|
141
|
+
* @param {string} [props.className] - Additional custom class names to apply to the component.
|
|
142
|
+
* @param {string} [props.align='start'] - Horizontal alignment of children. Options: 'start', 'center', 'end'.
|
|
143
|
+
* @param {string} [props.blockAlign='start'] - Vertical alignment of children. Options: 'start', 'center', 'end'.
|
|
144
|
+
* @param {boolean} [props.wrap=true] - Whether children should wrap to the next line if necessary. Defaults to `true`.
|
|
145
|
+
* @param {Object} [restProps] - Additional props passed to the root element.
|
|
146
|
+
*
|
|
147
|
+
* @returns {JSX.Element} The rendered HorizontalStack component.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* <HorizontalStack gap="2" align="center" blockAlign="start" wrap={false}>
|
|
151
|
+
* <div>Item 1</div>
|
|
152
|
+
* <div>Item 2</div>
|
|
153
|
+
* </HorizontalStack>
|
|
154
|
+
*/ function HorizontalStack() {
|
|
155
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
156
|
+
var _props_as = props.as, as = _props_as === void 0 ? 'div' : _props_as, children = props.children, gap = props.gap, id = props.id, className = props.className, align = props.align, blockAlign = props.blockAlign, _props_wrap = props.wrap, wrap = _props_wrap === void 0 ? true : _props_wrap, restProps = _object_without_properties(props, [
|
|
157
|
+
"as",
|
|
158
|
+
"children",
|
|
159
|
+
"gap",
|
|
160
|
+
"id",
|
|
161
|
+
"className",
|
|
162
|
+
"align",
|
|
163
|
+
"blockAlign",
|
|
164
|
+
"wrap"
|
|
165
|
+
]);
|
|
166
|
+
var classes = styles({
|
|
167
|
+
gap: gap,
|
|
168
|
+
align: align,
|
|
169
|
+
blockAlign: blockAlign,
|
|
170
|
+
wrap: wrap
|
|
171
|
+
});
|
|
172
|
+
var Element = as;
|
|
173
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(Element, _object_spread_props(_object_spread({
|
|
174
|
+
id: id,
|
|
175
|
+
className: "".concat(classes).concat(className ? " ".concat(className) : "")
|
|
176
|
+
}, restProps), {
|
|
177
|
+
children: children
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
var _default = HorizontalStack;
|