@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,254 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
import { Icon, Spinner, Text, Button, Link } from "../index.js";
|
|
4
|
+
import { CancelMinor, CircleAlertMajor, CircleInformationMajor, TickMinor } from "@shopify/polaris-icons";
|
|
5
|
+
var styles = tv({
|
|
6
|
+
base: "Litho-Banner relative rounded-md shadow-card bg-surface-highest outline outline-tint-3"
|
|
7
|
+
});
|
|
8
|
+
var headerStyles = tv({
|
|
9
|
+
base: "Litho-Banner__Header flex items-start justify-start min-h-3 dark:border-b",
|
|
10
|
+
variants: {
|
|
11
|
+
hasBodyContent: {
|
|
12
|
+
true: "rounded-t-md",
|
|
13
|
+
false: "rounded-md"
|
|
14
|
+
},
|
|
15
|
+
status: {
|
|
16
|
+
success: "bg-success text-success-fg dark:border-b-success-fg/5",
|
|
17
|
+
critical: "bg-critical text-critical-fg dark:border-b-critical-fg/5",
|
|
18
|
+
warning: "bg-attention text-attention-fg dark:border-b-attention-fg/5",
|
|
19
|
+
attention: "bg-attention text-attention-fg dark:border-b-attention-fg/5",
|
|
20
|
+
info: "bg-info text-info-fg dark:border-b-info-fg/5",
|
|
21
|
+
highlight: "bg-highlight text-highlight-fg dark:border-b-highlight-fg/5",
|
|
22
|
+
insight: "bg-insight text-insight-fg dark:border-b-insight-fg/5",
|
|
23
|
+
neutral: "bg-neutral text-neutral-fg dark:border-b-neutral-fg/5"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
status: "neutral"
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var closeIconStyles = tv({
|
|
31
|
+
base: "Litho-Banner__Close_Icon p-1 cursor-pointer rounded-md",
|
|
32
|
+
variants: {
|
|
33
|
+
status: {
|
|
34
|
+
success: "hover:bg-success-low active:bg-success-lower",
|
|
35
|
+
critical: "hover:bg-critical-low active:bg-critical-lower",
|
|
36
|
+
warning: "hover:bg-attention-low active:bg-attention-lower",
|
|
37
|
+
attention: "hover:bg-attention-low active:bg-attention-lower",
|
|
38
|
+
info: "hover:bg-info-low active:bg-info-lower",
|
|
39
|
+
highlight: "hover:bg-highlight-low active:bg-highlight-lower",
|
|
40
|
+
insight: "hover:bg-insight-low active:bg-insight-lower",
|
|
41
|
+
neutral: "hover:bg-neutral-low active:bg-neutral-lower"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
status: "neutral"
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var STATUS_STYLES = {
|
|
49
|
+
success: {
|
|
50
|
+
fg: "success-fg",
|
|
51
|
+
icon: "success-icon"
|
|
52
|
+
},
|
|
53
|
+
critical: {
|
|
54
|
+
fg: "critical-fg",
|
|
55
|
+
icon: "critical-icon"
|
|
56
|
+
},
|
|
57
|
+
warning: {
|
|
58
|
+
fg: "attention-fg",
|
|
59
|
+
icon: "attention-icon"
|
|
60
|
+
},
|
|
61
|
+
attention: {
|
|
62
|
+
fg: "attention-fg",
|
|
63
|
+
icon: "attention-icon"
|
|
64
|
+
},
|
|
65
|
+
info: {
|
|
66
|
+
fg: "info-fg",
|
|
67
|
+
icon: "info-icon"
|
|
68
|
+
},
|
|
69
|
+
highlight: {
|
|
70
|
+
fg: "highlight-fg",
|
|
71
|
+
icon: "highlight-icon"
|
|
72
|
+
},
|
|
73
|
+
insight: {
|
|
74
|
+
fg: "insight-fg",
|
|
75
|
+
icon: "insight-icon"
|
|
76
|
+
},
|
|
77
|
+
neutral: {
|
|
78
|
+
fg: "neutral-fg",
|
|
79
|
+
icon: "neutral-icon"
|
|
80
|
+
},
|
|
81
|
+
default: {
|
|
82
|
+
fg: "neutral-fg",
|
|
83
|
+
icon: "neutral-icon"
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* @typedef {'neutral' | 'critical' | 'highlight' | 'success' | 'warning' | 'info' | 'caution' | 'attention'} BannerStatus
|
|
88
|
+
*/ /**
|
|
89
|
+
* A Banner component that displays a styled banner with customizable title, status, icon, actions, and dismiss functionality.
|
|
90
|
+
* The banner style and content change based on the provided props, allowing for various statuses and themes.
|
|
91
|
+
*
|
|
92
|
+
* @component
|
|
93
|
+
*
|
|
94
|
+
* @param {Object} props - The properties for configuring the Banner component.
|
|
95
|
+
* @param {string} [props.title=null] - The title text for the banner. If not provided, no title will be displayed.
|
|
96
|
+
* @param {BannerStatus} [props.status='neutral'] - The status of the banner, which determines its color and icon.
|
|
97
|
+
* @param {Function} [props.onDismiss=null] - Callback function to handle the banner's dismiss action.
|
|
98
|
+
* @param {React.ReactNode} [props.children=null] - Additional content to display within the banner.
|
|
99
|
+
* @param {Object} [props.action=null] - Primary action configuration object
|
|
100
|
+
* @param {string} props.action.content - The button label text
|
|
101
|
+
* @param {boolean} [props.action.primary=false] - Whether the button should have primary styling
|
|
102
|
+
* @param {boolean} [props.action.disabled=false] - Whether the button is disabled
|
|
103
|
+
* @param {boolean} [props.action.loading=false] - Whether to show a loading state
|
|
104
|
+
* @param {Function} [props.action.onAction] - Click handler for the action
|
|
105
|
+
* @param {string} [props.action.url] - URL to navigate to when clicked (opens in new tab)
|
|
106
|
+
* @param {Object} [props.secondaryAction=null] - Secondary action configuration object
|
|
107
|
+
* @param {string} props.secondaryAction.content - The action label text
|
|
108
|
+
* @param {boolean} [props.secondaryAction.link=false] - Whether to render as a link instead of a button
|
|
109
|
+
* @param {boolean} [props.secondaryAction.monochrome=false] - Whether the link should be monochrome (only applies if link=true)
|
|
110
|
+
* @param {boolean} [props.secondaryAction.disabled=false] - Whether the action is disabled
|
|
111
|
+
* @param {boolean} [props.secondaryAction.loading=false] - Whether to show a loading state
|
|
112
|
+
* @param {Function} [props.secondaryAction.onAction] - Click handler for the action
|
|
113
|
+
* @param {string} [props.secondaryAction.url] - URL to navigate to when clicked (opens in new tab)
|
|
114
|
+
* @param {FunctionComponent} [props.icon=null] - Custom icon to display on the banner. If not provided, a default icon is used based on the status.
|
|
115
|
+
* @param {boolean} [props.spinner=false] - Shows a spinner icon instead of a status icon when set to true.
|
|
116
|
+
*
|
|
117
|
+
* @returns {JSX.Element} The rendered Banner component.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* <Banner
|
|
121
|
+
* title="Warning"
|
|
122
|
+
* status="warning"
|
|
123
|
+
* onDismiss={() => console.log('Dismissed')}
|
|
124
|
+
* action={{ content: "Action", primary: true, onAction: () => console.log('Action clicked') }}
|
|
125
|
+
* secondaryAction={{ content: "Learn more", link: true, monochrome: true, url: "https://example.com" }}
|
|
126
|
+
* />
|
|
127
|
+
*/ function Banner() {
|
|
128
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
129
|
+
var _props_title = props.title, title = _props_title === void 0 ? null : _props_title, _props_status = props.status, status = _props_status === void 0 ? "neutral" : _props_status, _props_onDismiss = props.onDismiss, onDismiss = _props_onDismiss === void 0 ? null : _props_onDismiss, _props_children = props.children, children = _props_children === void 0 ? null : _props_children, _props_action = props.action, action = _props_action === void 0 ? null : _props_action, _props_secondaryAction = props.secondaryAction, secondaryAction = _props_secondaryAction === void 0 ? null : _props_secondaryAction, _props_icon = props.icon, icon = _props_icon === void 0 ? null : _props_icon, _props_spinner = props.spinner, spinner = _props_spinner === void 0 ? false : _props_spinner;
|
|
130
|
+
var statusColors = STATUS_STYLES[status];
|
|
131
|
+
var hasBodyContent = !!(children || action || secondaryAction);
|
|
132
|
+
var classes = styles({
|
|
133
|
+
status: status
|
|
134
|
+
});
|
|
135
|
+
var headerClasses = headerStyles({
|
|
136
|
+
status: status,
|
|
137
|
+
hasBodyContent: hasBodyContent
|
|
138
|
+
});
|
|
139
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
140
|
+
className: classes,
|
|
141
|
+
children: [
|
|
142
|
+
title ? /*#__PURE__*/ _jsxs("div", {
|
|
143
|
+
className: headerClasses,
|
|
144
|
+
children: [
|
|
145
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
146
|
+
className: "Litho-Banner__Icon_Container flex-none p-3 pr-2",
|
|
147
|
+
children: [
|
|
148
|
+
spinner && /*#__PURE__*/ _jsx(Spinner, {
|
|
149
|
+
size: "small"
|
|
150
|
+
}),
|
|
151
|
+
icon && !spinner && /*#__PURE__*/ _jsx(Icon, {
|
|
152
|
+
source: icon,
|
|
153
|
+
color: statusColors.icon || ""
|
|
154
|
+
}),
|
|
155
|
+
!icon && !spinner && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
156
|
+
children: [
|
|
157
|
+
![
|
|
158
|
+
"warning",
|
|
159
|
+
"attention",
|
|
160
|
+
"success"
|
|
161
|
+
].includes(status) && /*#__PURE__*/ _jsx(Icon, {
|
|
162
|
+
source: CircleInformationMajor,
|
|
163
|
+
color: statusColors.icon
|
|
164
|
+
}),
|
|
165
|
+
[
|
|
166
|
+
"warning",
|
|
167
|
+
"attention"
|
|
168
|
+
].includes(status) && /*#__PURE__*/ _jsx(Icon, {
|
|
169
|
+
source: CircleAlertMajor,
|
|
170
|
+
color: statusColors.icon
|
|
171
|
+
}),
|
|
172
|
+
status === "success" && /*#__PURE__*/ _jsx(Icon, {
|
|
173
|
+
source: TickMinor,
|
|
174
|
+
color: statusColors.icon
|
|
175
|
+
})
|
|
176
|
+
]
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
}),
|
|
180
|
+
/*#__PURE__*/ _jsx("div", {
|
|
181
|
+
className: "Litho-Banner__Title grow py-3",
|
|
182
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
183
|
+
variant: "headingSm",
|
|
184
|
+
color: statusColors.fg,
|
|
185
|
+
children: title
|
|
186
|
+
})
|
|
187
|
+
}),
|
|
188
|
+
onDismiss && /*#__PURE__*/ _jsx("div", {
|
|
189
|
+
className: "Litho-Banner__Close flex-none p-2",
|
|
190
|
+
onClick: onDismiss,
|
|
191
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
192
|
+
className: closeIconStyles({
|
|
193
|
+
status: status
|
|
194
|
+
}),
|
|
195
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
196
|
+
source: CancelMinor,
|
|
197
|
+
color: statusColors.icon
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
})
|
|
201
|
+
]
|
|
202
|
+
}) : /*#__PURE__*/ _jsx("div", {
|
|
203
|
+
className: headerClasses
|
|
204
|
+
}),
|
|
205
|
+
hasBodyContent && /*#__PURE__*/ _jsxs("div", {
|
|
206
|
+
className: "Litho-Banner__Body_Container p-4 ".concat(title ? " dark:border-t dark:border-t-tint-4" : ""),
|
|
207
|
+
children: [
|
|
208
|
+
children && /*#__PURE__*/ _jsx("div", {
|
|
209
|
+
className: "Litho-Banner__Body",
|
|
210
|
+
children: children
|
|
211
|
+
}),
|
|
212
|
+
(action || secondaryAction) && /*#__PURE__*/ _jsxs("div", {
|
|
213
|
+
className: "Litho-Banner__Actions flex items-center gap-2".concat((secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.link) ? " gap-3" : "").concat(children ? " pt-2" : ""),
|
|
214
|
+
children: [
|
|
215
|
+
action && /*#__PURE__*/ _jsx(Button, {
|
|
216
|
+
primary: action.primary,
|
|
217
|
+
disabled: action.disabled,
|
|
218
|
+
loading: action.loading,
|
|
219
|
+
onClick: action.onAction || function() {
|
|
220
|
+
if (action.url) {
|
|
221
|
+
window.open(action.url, "_blank");
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
children: action.content
|
|
225
|
+
}),
|
|
226
|
+
secondaryAction && !secondaryAction.link && /*#__PURE__*/ _jsx(Button, {
|
|
227
|
+
disabled: secondaryAction.disabled,
|
|
228
|
+
loading: secondaryAction.loading,
|
|
229
|
+
onClick: secondaryAction.onAction || function() {
|
|
230
|
+
if (secondaryAction.url) {
|
|
231
|
+
window.open(secondaryAction.url, "_blank");
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
children: secondaryAction.content
|
|
235
|
+
}),
|
|
236
|
+
secondaryAction && secondaryAction.link && /*#__PURE__*/ _jsx(Link, {
|
|
237
|
+
monochrome: secondaryAction.monochrome,
|
|
238
|
+
disabled: secondaryAction.disabled,
|
|
239
|
+
loading: secondaryAction.loading,
|
|
240
|
+
onClick: secondaryAction.onAction || function() {
|
|
241
|
+
if (secondaryAction.url) {
|
|
242
|
+
window.open(secondaryAction.url, "_blank");
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
children: secondaryAction.content
|
|
246
|
+
})
|
|
247
|
+
]
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
})
|
|
251
|
+
]
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
export default Banner;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
30
|
+
import { tv } from "tailwind-variants";
|
|
31
|
+
var styles = tv({
|
|
32
|
+
base: "Litho-Box",
|
|
33
|
+
variants: {
|
|
34
|
+
background: {
|
|
35
|
+
default: "bg-surface-highest",
|
|
36
|
+
subdued: "bg-surface-higher"
|
|
37
|
+
},
|
|
38
|
+
borderColor: {
|
|
39
|
+
default: "border-edge-default",
|
|
40
|
+
subdued: "border-edge-subdued"
|
|
41
|
+
},
|
|
42
|
+
borderRadius: {
|
|
43
|
+
default: "rounded-md",
|
|
44
|
+
sm: "rounded-sm",
|
|
45
|
+
lg: "rounded-lg",
|
|
46
|
+
full: "rounded-full"
|
|
47
|
+
},
|
|
48
|
+
borderBlockStartWidth: {
|
|
49
|
+
none: "border-t-0",
|
|
50
|
+
"0": "border-t-0",
|
|
51
|
+
"1": "border-t-1"
|
|
52
|
+
},
|
|
53
|
+
borderBlockEndWidth: {
|
|
54
|
+
none: "border-b-0",
|
|
55
|
+
"0": "border-b-0",
|
|
56
|
+
"1": "border-b-1"
|
|
57
|
+
},
|
|
58
|
+
borderInlineStartWidth: {
|
|
59
|
+
none: "border-l-0",
|
|
60
|
+
"0": "border-l-0",
|
|
61
|
+
"1": "border-l-1"
|
|
62
|
+
},
|
|
63
|
+
borderInlineEndWidth: {
|
|
64
|
+
none: "border-r-0",
|
|
65
|
+
"0": "border-r-0",
|
|
66
|
+
"1": "border-r-1"
|
|
67
|
+
},
|
|
68
|
+
padding: {
|
|
69
|
+
none: "p-0",
|
|
70
|
+
"0": "p-0",
|
|
71
|
+
"1": "p-1",
|
|
72
|
+
"2": "p-2",
|
|
73
|
+
"3": "p-3",
|
|
74
|
+
"4": "p-4",
|
|
75
|
+
"5": "p-5",
|
|
76
|
+
"6": "p-6",
|
|
77
|
+
"7": "p-7",
|
|
78
|
+
"8": "p-8",
|
|
79
|
+
"9": "p-9",
|
|
80
|
+
"10": "p-10"
|
|
81
|
+
},
|
|
82
|
+
paddingBlockStart: {
|
|
83
|
+
none: "pt-0",
|
|
84
|
+
"0": "pt-0",
|
|
85
|
+
"1": "pt-1",
|
|
86
|
+
"2": "pt-2",
|
|
87
|
+
"3": "pt-3",
|
|
88
|
+
"4": "pt-4",
|
|
89
|
+
"5": "pt-5",
|
|
90
|
+
"6": "pt-6",
|
|
91
|
+
"7": "pt-7",
|
|
92
|
+
"8": "pt-8",
|
|
93
|
+
"9": "pt-9",
|
|
94
|
+
"10": "pt-10"
|
|
95
|
+
},
|
|
96
|
+
paddingBlockEnd: {
|
|
97
|
+
none: "pb-0",
|
|
98
|
+
"0": "pb-0",
|
|
99
|
+
"1": "pb-1",
|
|
100
|
+
"2": "pb-2",
|
|
101
|
+
"3": "pb-3",
|
|
102
|
+
"4": "pb-4",
|
|
103
|
+
"5": "pb-5",
|
|
104
|
+
"6": "pb-6",
|
|
105
|
+
"7": "pb-7",
|
|
106
|
+
"8": "pb-8",
|
|
107
|
+
"9": "pb-9",
|
|
108
|
+
"10": "pb-10"
|
|
109
|
+
},
|
|
110
|
+
paddingInlineStart: {
|
|
111
|
+
none: "pl-0",
|
|
112
|
+
"0": "pl-0",
|
|
113
|
+
"1": "pl-1",
|
|
114
|
+
"2": "pl-2",
|
|
115
|
+
"3": "pl-3",
|
|
116
|
+
"4": "pl-4",
|
|
117
|
+
"5": "pl-5",
|
|
118
|
+
"6": "pl-6",
|
|
119
|
+
"7": "pl-7",
|
|
120
|
+
"8": "pl-8",
|
|
121
|
+
"9": "pl-9",
|
|
122
|
+
"10": "pl-10"
|
|
123
|
+
},
|
|
124
|
+
paddingInlineEnd: {
|
|
125
|
+
none: "pr-0",
|
|
126
|
+
"0": "pr-0",
|
|
127
|
+
"1": "pr-1",
|
|
128
|
+
"2": "pr-2",
|
|
129
|
+
"3": "pr-3",
|
|
130
|
+
"4": "pr-4",
|
|
131
|
+
"5": "pr-5",
|
|
132
|
+
"6": "pr-6",
|
|
133
|
+
"7": "pr-7",
|
|
134
|
+
"8": "pr-8",
|
|
135
|
+
"9": "pr-9",
|
|
136
|
+
"10": "pr-10"
|
|
137
|
+
},
|
|
138
|
+
overflow: {
|
|
139
|
+
hidden: "overflow-hidden",
|
|
140
|
+
scroll: "overflow-scroll"
|
|
141
|
+
},
|
|
142
|
+
overflowX: {
|
|
143
|
+
hidden: "overflow-x-hidden",
|
|
144
|
+
scroll: "overflow-x-scroll"
|
|
145
|
+
},
|
|
146
|
+
overflowY: {
|
|
147
|
+
hidden: "overflow-y-hidden",
|
|
148
|
+
scroll: "overflow-y-scroll"
|
|
149
|
+
},
|
|
150
|
+
position: {
|
|
151
|
+
relative: "relative",
|
|
152
|
+
absolute: "absolute",
|
|
153
|
+
fixed: "fixed",
|
|
154
|
+
sticky: "sticky"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
/**
|
|
159
|
+
* Renders a customizable Box component with various styling options.
|
|
160
|
+
*
|
|
161
|
+
* @component
|
|
162
|
+
* @param {Object} props - Properties to configure the Box component.
|
|
163
|
+
* @param {string} [props.as='div'] - The HTML element to render as. Defaults to `div`.
|
|
164
|
+
* @param {'default' | 'subdued'} [props.background] - Background color variant.
|
|
165
|
+
* @param {'default' | 'subdued'} [props.borderColor] - Border color variant.
|
|
166
|
+
* @param {'default' | 'sm' | 'lg' | 'full'} [props.borderRadius] - Border radius variant.
|
|
167
|
+
* @param {'none' | '0' | '1'} [props.borderBlockStartWidth] - Top border width variant.
|
|
168
|
+
* @param {'none' | '0' | '1'} [props.borderBlockEndWidth] - Bottom border width variant.
|
|
169
|
+
* @param {'none' | '0' | '1'} [props.borderInlineStartWidth] - Left border width variant.
|
|
170
|
+
* @param {'none' | '0' | '1'} [props.borderInlineEndWidth] - Right border width variant.
|
|
171
|
+
* @param {'none' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10'} [props.padding] - Padding for all sides.
|
|
172
|
+
* @param {'none' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10'} [props.paddingBlockStart] - Top padding.
|
|
173
|
+
* @param {'none' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10'} [props.paddingBlockEnd] - Bottom padding.
|
|
174
|
+
* @param {'none' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10'} [props.paddingInlineStart] - Left padding.
|
|
175
|
+
* @param {'none' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10'} [props.paddingInlineEnd] - Right padding.
|
|
176
|
+
* @param {'hidden' | 'scroll'} [props.overflow] - Overflow setting for all sides.
|
|
177
|
+
* @param {'hidden' | 'scroll'} [props.overflowX] - Overflow setting for x-axis.
|
|
178
|
+
* @param {'hidden' | 'scroll'} [props.overflowY] - Overflow setting for y-axis.
|
|
179
|
+
* @param {'relative' | 'absolute' | 'fixed' | 'sticky'} [props.position] - CSS positioning of the box.
|
|
180
|
+
* @param {React.ReactNode} [props.children] - Child elements to render inside the Box.
|
|
181
|
+
* @param {string} [props.id] - ID for the Box element.
|
|
182
|
+
* @param {number | string} [props.height] - CSS height of the Box.
|
|
183
|
+
* @param {number | string} [props.width] - CSS width of the Box.
|
|
184
|
+
* @param {number | string} [props.minHeight] - Minimum CSS height.
|
|
185
|
+
* @param {number | string} [props.maxHeight] - Maximum CSS height.
|
|
186
|
+
* @param {number | string} [props.minWidth] - Minimum CSS width.
|
|
187
|
+
* @param {number | string} [props.maxWidth] - Maximum CSS width.
|
|
188
|
+
* @param {number | string} [props.zIndex] - CSS z-index.
|
|
189
|
+
* @param {Object} [props.style] - Additional inline styles for the Box.
|
|
190
|
+
*
|
|
191
|
+
* @returns {JSX.Element} A rendered Box component with customized styling.
|
|
192
|
+
*/ function Box() {
|
|
193
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
194
|
+
var _props_as = props.as, as = _props_as === void 0 ? 'div' : _props_as, background = props.background, borderColor = props.borderColor, borderBlockStartWidth = props.borderBlockStartWidth, borderBlockEndWidth = props.borderBlockEndWidth, borderInlineStartWidth = props.borderInlineStartWidth, borderInlineEndWidth = props.borderInlineEndWidth, borderRadius = props.borderRadius, children = props.children, id = props.id, height = props.height, width = props.width, minHeight = props.minHeight, maxHeight = props.maxHeight, minWidth = props.minWidth, maxWidth = props.maxWidth, overflow = props.overflow, overflowX = props.overflowX, overflowY = props.overflowY, padding = props.padding, paddingBlockStart = props.paddingBlockStart, paddingBlockEnd = props.paddingBlockEnd, paddingInlineStart = props.paddingInlineStart, paddingInlineEnd = props.paddingInlineEnd, position = props.position, zIndex = props.zIndex, onClick = props.onClick, style = props.style, className = props.className;
|
|
195
|
+
var classes = styles({
|
|
196
|
+
background: background,
|
|
197
|
+
borderColor: borderColor,
|
|
198
|
+
borderBlockStartWidth: borderBlockStartWidth,
|
|
199
|
+
borderBlockEndWidth: borderBlockEndWidth,
|
|
200
|
+
borderInlineStartWidth: borderInlineStartWidth,
|
|
201
|
+
borderInlineEndWidth: borderInlineEndWidth,
|
|
202
|
+
borderRadius: borderRadius,
|
|
203
|
+
position: position,
|
|
204
|
+
overflow: overflow,
|
|
205
|
+
overflowX: overflowX,
|
|
206
|
+
overflowY: overflowY,
|
|
207
|
+
padding: padding,
|
|
208
|
+
paddingBlockStart: paddingBlockStart,
|
|
209
|
+
paddingBlockEnd: paddingBlockEnd,
|
|
210
|
+
paddingInlineStart: paddingInlineStart,
|
|
211
|
+
paddingInlineEnd: paddingInlineEnd
|
|
212
|
+
});
|
|
213
|
+
var inlineStyles = _object_spread({}, style && _object_spread({}, style), zIndex && {
|
|
214
|
+
zIndex: zIndex
|
|
215
|
+
}, height && {
|
|
216
|
+
height: height
|
|
217
|
+
}, width && {
|
|
218
|
+
width: width
|
|
219
|
+
}, minHeight && {
|
|
220
|
+
minHeight: minHeight
|
|
221
|
+
}, maxHeight && {
|
|
222
|
+
maxHeight: maxHeight
|
|
223
|
+
}, minWidth && {
|
|
224
|
+
minWidth: minWidth
|
|
225
|
+
}, maxWidth && {
|
|
226
|
+
maxWidth: maxWidth
|
|
227
|
+
});
|
|
228
|
+
var Element = as;
|
|
229
|
+
return /*#__PURE__*/ _jsx(Element, {
|
|
230
|
+
id: id,
|
|
231
|
+
className: "".concat(classes).concat(className ? " ".concat(className) : ""),
|
|
232
|
+
style: inlineStyles,
|
|
233
|
+
onClick: onClick,
|
|
234
|
+
children: children
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
;
|
|
238
|
+
export default Box;
|