@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,593 @@
|
|
|
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 = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
14
|
+
var _tailwindvariants = require("tailwind-variants");
|
|
15
|
+
var _AppProvider = require("../components/AppProvider");
|
|
16
|
+
var _Button = /*#__PURE__*/ _interop_require_default(require("./Button"));
|
|
17
|
+
var _Icon = /*#__PURE__*/ _interop_require_default(require("./Icon"));
|
|
18
|
+
var _Spinner = /*#__PURE__*/ _interop_require_default(require("./Spinner"));
|
|
19
|
+
var _Text = /*#__PURE__*/ _interop_require_default(require("./Text"));
|
|
20
|
+
var _Tooltip = /*#__PURE__*/ _interop_require_default(require("./Tooltip"));
|
|
21
|
+
function _interop_require_default(obj) {
|
|
22
|
+
return obj && obj.__esModule ? obj : {
|
|
23
|
+
default: obj
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
27
|
+
if (typeof WeakMap !== "function") return null;
|
|
28
|
+
var cacheBabelInterop = new WeakMap();
|
|
29
|
+
var cacheNodeInterop = new WeakMap();
|
|
30
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
31
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
32
|
+
})(nodeInterop);
|
|
33
|
+
}
|
|
34
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
35
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
36
|
+
return obj;
|
|
37
|
+
}
|
|
38
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
39
|
+
return {
|
|
40
|
+
default: obj
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
44
|
+
if (cache && cache.has(obj)) {
|
|
45
|
+
return cache.get(obj);
|
|
46
|
+
}
|
|
47
|
+
var newObj = {
|
|
48
|
+
__proto__: null
|
|
49
|
+
};
|
|
50
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
51
|
+
for(var key in obj){
|
|
52
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
53
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
54
|
+
if (desc && (desc.get || desc.set)) {
|
|
55
|
+
Object.defineProperty(newObj, key, desc);
|
|
56
|
+
} else {
|
|
57
|
+
newObj[key] = obj[key];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
newObj.default = obj;
|
|
62
|
+
if (cache) {
|
|
63
|
+
cache.set(obj, newObj);
|
|
64
|
+
}
|
|
65
|
+
return newObj;
|
|
66
|
+
}
|
|
67
|
+
function _type_of(obj) {
|
|
68
|
+
"@swc/helpers - typeof";
|
|
69
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
70
|
+
}
|
|
71
|
+
var styles = (0, _tailwindvariants.tv)({
|
|
72
|
+
base: "Litho-Card relative",
|
|
73
|
+
variants: {
|
|
74
|
+
hideOnPrint: {
|
|
75
|
+
true: "print:hidden",
|
|
76
|
+
false: ""
|
|
77
|
+
},
|
|
78
|
+
allowOverflow: {
|
|
79
|
+
true: "overflow-visible",
|
|
80
|
+
false: "overflow-hidden"
|
|
81
|
+
},
|
|
82
|
+
subdued: {
|
|
83
|
+
true: "bg-surface-higher",
|
|
84
|
+
false: ""
|
|
85
|
+
},
|
|
86
|
+
alternate: {
|
|
87
|
+
true: "bg-surface-lower",
|
|
88
|
+
false: ""
|
|
89
|
+
},
|
|
90
|
+
isClickable: {
|
|
91
|
+
true: "cursor-pointer hover:ring hover:ring-form-focus hover:outline-form-border-focus",
|
|
92
|
+
false: ""
|
|
93
|
+
},
|
|
94
|
+
fullWidthOnMobile: {
|
|
95
|
+
true: "-left-4 w-full-plus-8",
|
|
96
|
+
false: ""
|
|
97
|
+
},
|
|
98
|
+
roundedOnMobile: {
|
|
99
|
+
true: "rounded-md",
|
|
100
|
+
false: "rounded-none @md:rounded-md"
|
|
101
|
+
},
|
|
102
|
+
outlined: {
|
|
103
|
+
true: "outline outline-tint-3",
|
|
104
|
+
false: ""
|
|
105
|
+
},
|
|
106
|
+
highlighted: {
|
|
107
|
+
true: "cursor-pointer ring ring-form-focus outline outline-form-border-focus",
|
|
108
|
+
false: ""
|
|
109
|
+
},
|
|
110
|
+
shadow: {
|
|
111
|
+
default: "shadow-card",
|
|
112
|
+
strong: "shadow-card-strong",
|
|
113
|
+
none: ""
|
|
114
|
+
},
|
|
115
|
+
embedded: {
|
|
116
|
+
true: "",
|
|
117
|
+
false: ""
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
compoundVariants: [
|
|
121
|
+
{
|
|
122
|
+
embedded: false,
|
|
123
|
+
fullWidthOnMobile: true,
|
|
124
|
+
className: "@md:left-0 @md:rounded-md @md:w-auto"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
embedded: true,
|
|
128
|
+
fullWidthOnMobile: true,
|
|
129
|
+
className: "@md-embed:left-0 @md-embed:w-auto @md-embed:rounded-md"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
subdued: false,
|
|
133
|
+
alternate: false,
|
|
134
|
+
highlighted: false,
|
|
135
|
+
className: "bg-surface-highest outline outline-tint-2 @md:outline-tint-1 dark:outline-hidden dark:border-t dark:border-tint-alt-2"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
subdued: false,
|
|
139
|
+
alternate: false,
|
|
140
|
+
highlighted: true,
|
|
141
|
+
className: "bg-surface-highest dark:border-t dark:border-tint-alt-2"
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
defaultVariants: {
|
|
145
|
+
isClickable: false,
|
|
146
|
+
subdued: false,
|
|
147
|
+
alternate: false,
|
|
148
|
+
outlined: false,
|
|
149
|
+
highlighted: false,
|
|
150
|
+
shadow: "default",
|
|
151
|
+
embedded: false
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
var headerStyles = (0, _tailwindvariants.tv)({
|
|
155
|
+
base: "Litho-Card__Header p-2 pl-4 @md:p-3 @md:pl-5 flex flex-col justify-center items-stretch gap-1",
|
|
156
|
+
variants: {
|
|
157
|
+
removeHeaderBottomPadding: {
|
|
158
|
+
true: "pb-1 @md:pb-1 min-h-11 @md:min-h-12",
|
|
159
|
+
false: "min-h-12 @md:min-h-14"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
var bodyStyles = (0, _tailwindvariants.tv)({
|
|
164
|
+
base: "Litho-Card__Body",
|
|
165
|
+
variants: {
|
|
166
|
+
padding: {
|
|
167
|
+
none: "p-0",
|
|
168
|
+
half: "pr-2 pb-4 pl-2 @md:pr-2.5 @md:pl-2.5 @md:pb-2.5",
|
|
169
|
+
full: "pr-4 pb-4 pl-4 @md:pr-5 @md:pl-5 @md:pb-5"
|
|
170
|
+
},
|
|
171
|
+
fullHeight: {
|
|
172
|
+
true: "h-full"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
compoundVariants: [
|
|
176
|
+
{
|
|
177
|
+
showHeader: false,
|
|
178
|
+
padding: "full",
|
|
179
|
+
className: "pt-4 @md:pt-5"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
showHeader: true,
|
|
183
|
+
padding: "full",
|
|
184
|
+
className: "pt-0 @md:pt-0"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
showHeader: false,
|
|
188
|
+
padding: "half",
|
|
189
|
+
className: "pt-2 @md:pt-2.5"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
showHeader: true,
|
|
193
|
+
padding: "half",
|
|
194
|
+
className: "pt-0 @md:pt-0"
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
/**
|
|
199
|
+
* Card component for creating styled containers with optional headers, actions, and children.
|
|
200
|
+
*
|
|
201
|
+
* @component
|
|
202
|
+
* @param {Object} props - Props for the Card component.
|
|
203
|
+
* @param {boolean} [props.allowOverflow=false] - Allows content to overflow the Card boundaries.
|
|
204
|
+
* @param {React.ReactNode} [props.children] - Child elements to render inside the Card.
|
|
205
|
+
* @param {boolean} [props.hideOnPrint] - Hides the Card when printing.
|
|
206
|
+
* @param {string|React.ReactNode} [props.title] - Title of the Card.
|
|
207
|
+
* @param {string} [props.titleVariant='headingMd'] - Typography variant for the Card title.
|
|
208
|
+
* @param {string} [props.description] - Description of the Card.
|
|
209
|
+
* @param {React.ElementType|Object} [props.icon] - Icon to render alongside the title.
|
|
210
|
+
* @param {React.ReactNode|import("./Tooltip").TooltipContentObject} [props.tooltip] - Tooltip content for the title.
|
|
211
|
+
* @param {string} [props.tooltipPreferredPosition='above'] - Preferred position for the tooltip.
|
|
212
|
+
* @param {boolean} [props.outlined=false] - Applies outlined styling to the Card.
|
|
213
|
+
* @param {string} [props.shadow='default'] - Applies a shadow to the Card. Can be 'default', or 'none'.
|
|
214
|
+
* @param {boolean} [props.highlighted=false] - Applies highlighted styling to the Card.
|
|
215
|
+
* @param {boolean} [props.subdued=false] - Applies subdued styling to the Card.
|
|
216
|
+
* @param {boolean} [props.alternate=false] - Applies alternate styling to the Card.
|
|
217
|
+
* @param {boolean} [props.padded=false] - Adds padding to the Card body.
|
|
218
|
+
* @param {boolean} [props.loading=false] - Shows a loading spinner in place of the title.
|
|
219
|
+
* @param {boolean} [props.paddedHalf=false] - Adds half padding to the Card body.
|
|
220
|
+
* @param {boolean} [props.removeHeaderBottomPadding=false] - Removes bottom padding from the header.
|
|
221
|
+
* @param {Function} [props.onClick] - Click handler for the Card, making it clickable.
|
|
222
|
+
* @param {Object} [props.emptyState={}] - Configures the empty state of the Card.
|
|
223
|
+
* @param {Object} [props.action] - Action button or configuration to render in the Card header.
|
|
224
|
+
* @param {string} [props.className] - Additional classes to apply to the Card.
|
|
225
|
+
* @param {string} [props.headerClassName] - Additional classes to apply to the Card header.
|
|
226
|
+
* @param {React.ReactNode} [props.accessory] - Accessory element to render in the header.
|
|
227
|
+
* @param {boolean} [props.fullWidthOnMobile=true] - Makes the Card full width on mobile.
|
|
228
|
+
* @param {boolean} [props.roundedOnMobile=false] - Makes the Card rounded on mobile.
|
|
229
|
+
* @returns {React.ReactElement} The rendered Card component.
|
|
230
|
+
*/ var Card = function(param) {
|
|
231
|
+
var _param_allowOverflow = param.allowOverflow, allowOverflow = _param_allowOverflow === void 0 ? false : _param_allowOverflow, _param_roundedOnMobile = param.roundedOnMobile, roundedOnMobile = _param_roundedOnMobile === void 0 ? false : _param_roundedOnMobile, children = param.children, hideOnPrint = param.hideOnPrint, title = param.title, _param_titleVariant = param.titleVariant, titleVariant = _param_titleVariant === void 0 ? "headingMd" : _param_titleVariant, description = param.description, icon = param.icon, tooltip = param.tooltip, _param_tooltipPreferredPosition = param.tooltipPreferredPosition, tooltipPreferredPosition = _param_tooltipPreferredPosition === void 0 ? "above" : _param_tooltipPreferredPosition, _param_outlined = param.outlined, outlined = _param_outlined === void 0 ? false : _param_outlined, _param_highlighted = param.highlighted, highlighted = _param_highlighted === void 0 ? false : _param_highlighted, _param_subdued = param.subdued, subdued = _param_subdued === void 0 ? false : _param_subdued, _param_alternate = param.alternate, alternate = _param_alternate === void 0 ? false : _param_alternate, _param_padded = param.padded, padded = _param_padded === void 0 ? false : _param_padded, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading, _param_paddedHalf = param.paddedHalf, paddedHalf = _param_paddedHalf === void 0 ? false : _param_paddedHalf, _param_removeHeaderBottomPadding = param.removeHeaderBottomPadding, removeHeaderBottomPadding = _param_removeHeaderBottomPadding === void 0 ? false : _param_removeHeaderBottomPadding, onClick = param.onClick, _param_emptyState = param.emptyState, emptyState = _param_emptyState === void 0 ? {} : _param_emptyState, action = param.action, className = param.className, headerClassName = param.headerClassName, accessory = param.accessory, _param_fullHeightBody = param.fullHeightBody, fullHeightBody = _param_fullHeightBody === void 0 ? false : _param_fullHeightBody, _param_fullWidthOnMobile = param.fullWidthOnMobile, fullWidthOnMobile = _param_fullWidthOnMobile === void 0 ? true : _param_fullWidthOnMobile, _param_shadow = param.shadow, shadow = _param_shadow === void 0 ? "default" : _param_shadow;
|
|
232
|
+
var embedded = (0, _react.useContext)(_AppProvider.FrameContext).embedded;
|
|
233
|
+
var showHeader = !!(title || action);
|
|
234
|
+
var isClickable = !!onClick;
|
|
235
|
+
var classes = styles({
|
|
236
|
+
hideOnPrint: hideOnPrint,
|
|
237
|
+
subdued: subdued,
|
|
238
|
+
alternate: alternate,
|
|
239
|
+
allowOverflow: allowOverflow,
|
|
240
|
+
isClickable: isClickable,
|
|
241
|
+
fullWidthOnMobile: fullWidthOnMobile,
|
|
242
|
+
roundedOnMobile: roundedOnMobile,
|
|
243
|
+
outlined: outlined,
|
|
244
|
+
shadow: shadow,
|
|
245
|
+
highlighted: highlighted,
|
|
246
|
+
embedded: embedded
|
|
247
|
+
});
|
|
248
|
+
var headerClasses = headerStyles({
|
|
249
|
+
padded: padded,
|
|
250
|
+
removeHeaderBottomPadding: removeHeaderBottomPadding
|
|
251
|
+
});
|
|
252
|
+
var processCardChildren = function(children) {
|
|
253
|
+
if (!children) return null;
|
|
254
|
+
var firstSectionDetected = false;
|
|
255
|
+
function process(child) {
|
|
256
|
+
if (/*#__PURE__*/ _react.default.isValidElement(child)) {
|
|
257
|
+
if (child.type.displayName === "Card.Section" && !firstSectionDetected) {
|
|
258
|
+
firstSectionDetected = true;
|
|
259
|
+
return /*#__PURE__*/ _react.default.cloneElement(child, {
|
|
260
|
+
isFirst: true,
|
|
261
|
+
cardHasHeader: showHeader
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
if (child.props.children) {
|
|
265
|
+
var nestedChildren = _react.default.Children.toArray(child.props.children).map(process);
|
|
266
|
+
return /*#__PURE__*/ _react.default.cloneElement(child, {
|
|
267
|
+
children: nestedChildren
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return child;
|
|
272
|
+
}
|
|
273
|
+
return _react.default.Children.toArray(children).map(process);
|
|
274
|
+
};
|
|
275
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
276
|
+
className: "".concat(classes).concat(className ? " ".concat(className) : ""),
|
|
277
|
+
onClick: isClickable ? onClick : undefined,
|
|
278
|
+
children: [
|
|
279
|
+
showHeader && /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
280
|
+
className: "".concat(headerClasses).concat(headerClassName ? " ".concat(headerClassName) : ""),
|
|
281
|
+
children: [
|
|
282
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
283
|
+
className: "w-full flex gap-2 justify-between items-center",
|
|
284
|
+
children: [
|
|
285
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
286
|
+
className: "Litho-Card__HeaderTitle flex items-center gap-2",
|
|
287
|
+
children: [
|
|
288
|
+
loading ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_Spinner.default, {
|
|
289
|
+
size: "small"
|
|
290
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
291
|
+
children: [
|
|
292
|
+
icon && typeof icon === "function" && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Icon.default, {
|
|
293
|
+
source: icon,
|
|
294
|
+
color: "subdued"
|
|
295
|
+
}),
|
|
296
|
+
icon && (typeof icon === "undefined" ? "undefined" : _type_of(icon)) === "object" && icon
|
|
297
|
+
]
|
|
298
|
+
}),
|
|
299
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
300
|
+
children: [
|
|
301
|
+
title && typeof title === "string" ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_Text.default, {
|
|
302
|
+
variant: titleVariant,
|
|
303
|
+
children: title
|
|
304
|
+
}) : title,
|
|
305
|
+
description && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Text.default, {
|
|
306
|
+
color: "subdued",
|
|
307
|
+
children: description
|
|
308
|
+
})
|
|
309
|
+
]
|
|
310
|
+
}),
|
|
311
|
+
tooltip && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Tooltip.default, {
|
|
312
|
+
content: tooltip,
|
|
313
|
+
preferredPosition: tooltipPreferredPosition
|
|
314
|
+
})
|
|
315
|
+
]
|
|
316
|
+
}),
|
|
317
|
+
action && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
318
|
+
className: "Litho-Card__HeaderAction self-start",
|
|
319
|
+
children: action.content ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_Button.default, {
|
|
320
|
+
link: true,
|
|
321
|
+
onClick: action.onAction || action.onClick,
|
|
322
|
+
primary: action.primary,
|
|
323
|
+
destructive: action.destructive,
|
|
324
|
+
icon: action.icon,
|
|
325
|
+
loading: action.loading,
|
|
326
|
+
disabled: action.disabled,
|
|
327
|
+
connectedDisclosure: action.connectedDisclosure,
|
|
328
|
+
children: action.content
|
|
329
|
+
}) : action
|
|
330
|
+
})
|
|
331
|
+
]
|
|
332
|
+
}),
|
|
333
|
+
accessory && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
334
|
+
className: "Litho-Card__HeaderAccessory pr-2",
|
|
335
|
+
children: accessory
|
|
336
|
+
})
|
|
337
|
+
]
|
|
338
|
+
}),
|
|
339
|
+
emptyState.showIf ? /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
340
|
+
className: bodyStyles({
|
|
341
|
+
padding: "full",
|
|
342
|
+
showHeader: showHeader,
|
|
343
|
+
fullHeight: fullHeightBody
|
|
344
|
+
}),
|
|
345
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Text.default, {
|
|
346
|
+
color: "subdued",
|
|
347
|
+
children: emptyState.text
|
|
348
|
+
})
|
|
349
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
350
|
+
className: bodyStyles({
|
|
351
|
+
padding: padded ? "full" : paddedHalf ? "half" : "none",
|
|
352
|
+
showHeader: showHeader,
|
|
353
|
+
fullHeight: fullHeightBody
|
|
354
|
+
}),
|
|
355
|
+
children: processCardChildren(children)
|
|
356
|
+
})
|
|
357
|
+
]
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
var sectionStyles = (0, _tailwindvariants.tv)({
|
|
361
|
+
base: "Litho-Card__Section flex flex-col",
|
|
362
|
+
variants: {
|
|
363
|
+
headerGap: {
|
|
364
|
+
1: "gap-1",
|
|
365
|
+
2: "gap-2",
|
|
366
|
+
3: "gap-3",
|
|
367
|
+
4: "gap-4"
|
|
368
|
+
},
|
|
369
|
+
borderBottom: {
|
|
370
|
+
true: "border-b border-edge-default last:border-b-0",
|
|
371
|
+
false: ""
|
|
372
|
+
},
|
|
373
|
+
borderTop: {
|
|
374
|
+
true: "border-t border-edge-default",
|
|
375
|
+
false: ""
|
|
376
|
+
},
|
|
377
|
+
subdued: {
|
|
378
|
+
true: "bg-surface-higher",
|
|
379
|
+
false: ""
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
var sectionHeaderStyles = (0, _tailwindvariants.tv)({
|
|
384
|
+
base: "Litho-Card__SectionHeader pr-2 pt-2 pl-4 @md:pr-3 @md:pt-3 @md:pl-5 min-h-9 @md:min-h-10"
|
|
385
|
+
});
|
|
386
|
+
var sectionBodyStyles = (0, _tailwindvariants.tv)({
|
|
387
|
+
base: "Litho-Card__SectionBody flex flex-col",
|
|
388
|
+
variants: {
|
|
389
|
+
gap: {
|
|
390
|
+
1: "gap-1",
|
|
391
|
+
2: "gap-2",
|
|
392
|
+
3: "gap-3",
|
|
393
|
+
4: "gap-4"
|
|
394
|
+
},
|
|
395
|
+
padding: {
|
|
396
|
+
none: "p-0",
|
|
397
|
+
half: "",
|
|
398
|
+
full: ""
|
|
399
|
+
},
|
|
400
|
+
isFirst: {
|
|
401
|
+
true: "",
|
|
402
|
+
false: ""
|
|
403
|
+
},
|
|
404
|
+
showHeader: {
|
|
405
|
+
true: "",
|
|
406
|
+
false: ""
|
|
407
|
+
},
|
|
408
|
+
cardHasHeader: {
|
|
409
|
+
true: "",
|
|
410
|
+
false: ""
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
compoundVariants: [
|
|
414
|
+
{
|
|
415
|
+
showHeader: true,
|
|
416
|
+
isFirst: true,
|
|
417
|
+
className: "pt-0!"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
cardHasHeader: true,
|
|
421
|
+
isFirst: true,
|
|
422
|
+
className: "pt-0!"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
showHeader: false,
|
|
426
|
+
padding: "full",
|
|
427
|
+
className: "p-4 @md:p-5"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
showHeader: false,
|
|
431
|
+
padding: "half",
|
|
432
|
+
className: "p-2 @md:p-2.5"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
showHeader: true,
|
|
436
|
+
padding: "full",
|
|
437
|
+
className: "p-4 pt-1 @md:p-5 @md:pt-1"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
showHeader: true,
|
|
441
|
+
padding: "half",
|
|
442
|
+
className: "p-2 pt-1 @md:p-2.5 @md:pt-1"
|
|
443
|
+
}
|
|
444
|
+
]
|
|
445
|
+
});
|
|
446
|
+
/**
|
|
447
|
+
* Section component for dividing the Card into segments.
|
|
448
|
+
*
|
|
449
|
+
* @component
|
|
450
|
+
* @param {Object} props - Props for the Section component.
|
|
451
|
+
* @param {string|React.ReactNode} [props.title] - Title of the Section.
|
|
452
|
+
* @param {string} [props.titleVariant='headingSm'] - Typography variant for the Section title.
|
|
453
|
+
* @param {Object} [props.action] - Action button or configuration to render in the Section header.
|
|
454
|
+
* @param {React.ReactNode} [props.children] - Child elements to render inside the Section.
|
|
455
|
+
* @param {boolean} [props.padded=true] - Adds padding to the Section body.
|
|
456
|
+
* @param {boolean} [props.paddedHalf=false] - Adds half padding to the Section body.
|
|
457
|
+
* @param {boolean} [props.isFirst=false] - Indicates whether this is the first Section in the Card.
|
|
458
|
+
* @param {boolean} [props.cardHasHeader=false] - Indicates whether the Card has a header.
|
|
459
|
+
* @param {boolean} [props.borderBottom=true] - Adds a bottom border to the Section.
|
|
460
|
+
* @param {boolean} [props.borderTop=false] - Adds a top border to the Section.
|
|
461
|
+
* @param {boolean} [props.subdued=false] - Applies subdued styling to the Section.
|
|
462
|
+
* @param {string} [props.headerGap='0'] - Gap between items in the Section header.
|
|
463
|
+
* @param {string} [props.gap='0'] - Gap between items in the Section body.
|
|
464
|
+
* @param {React.ElementType|Object} [props.icon] - Icon to render alongside the title.
|
|
465
|
+
* @param {string} [props.tooltip] - Tooltip content for the title.
|
|
466
|
+
* @param {string} [props.description] - Description text for the Section.
|
|
467
|
+
* @param {React.ReactNode} [props.accessory] - Accessory element to render in the Section header.
|
|
468
|
+
* @param {Object} [props.emptyState={}] - Configures the empty state of the Section.
|
|
469
|
+
*
|
|
470
|
+
* @returns {React.ReactElement} The rendered Section component.
|
|
471
|
+
*/ Card.Section = function(param) {
|
|
472
|
+
var title = param.title, _param_titleVariant = param.titleVariant, titleVariant = _param_titleVariant === void 0 ? "headingSm" : _param_titleVariant, action = param.action, children = param.children, _param_padded = param.padded, padded = _param_padded === void 0 ? true : _param_padded, _param_paddedHalf = param.paddedHalf, paddedHalf = _param_paddedHalf === void 0 ? false : _param_paddedHalf, _param_isFirst = param.isFirst, isFirst = _param_isFirst === void 0 ? false : _param_isFirst, _param_cardHasHeader = param.cardHasHeader, cardHasHeader = _param_cardHasHeader === void 0 ? false : _param_cardHasHeader, _param_borderBottom = param.borderBottom, borderBottom = _param_borderBottom === void 0 ? true : _param_borderBottom, _param_borderTop = param.borderTop, borderTop = _param_borderTop === void 0 ? false : _param_borderTop, _param_subdued = param.subdued, subdued = _param_subdued === void 0 ? false : _param_subdued, _param_headerGap = param.headerGap, headerGap = _param_headerGap === void 0 ? "0" : _param_headerGap, _param_gap = param.gap, gap = _param_gap === void 0 ? "0" : _param_gap, icon = param.icon, tooltip = param.tooltip, description = param.description, accessory = param.accessory, _param_emptyState = param.emptyState, emptyState = _param_emptyState === void 0 ? {} : _param_emptyState, className = param.className;
|
|
473
|
+
var showHeader = !!(title || action);
|
|
474
|
+
var sectionClasses = sectionStyles({
|
|
475
|
+
borderBottom: borderBottom,
|
|
476
|
+
borderTop: borderTop,
|
|
477
|
+
subdued: subdued,
|
|
478
|
+
headerGap: headerGap
|
|
479
|
+
});
|
|
480
|
+
var sectionHeaderClasses = sectionHeaderStyles();
|
|
481
|
+
var sectionBodyClasses = sectionBodyStyles({
|
|
482
|
+
padding: paddedHalf ? "half" : padded ? "full" : "none",
|
|
483
|
+
showHeader: showHeader,
|
|
484
|
+
cardHasHeader: cardHasHeader,
|
|
485
|
+
isFirst: isFirst,
|
|
486
|
+
gap: gap
|
|
487
|
+
});
|
|
488
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
489
|
+
className: "".concat(sectionClasses).concat(className ? " ".concat(className) : ""),
|
|
490
|
+
children: [
|
|
491
|
+
showHeader && /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
492
|
+
className: sectionHeaderClasses,
|
|
493
|
+
children: [
|
|
494
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
495
|
+
className: "flex items-center justify-between gap-1",
|
|
496
|
+
children: [
|
|
497
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
498
|
+
className: "flex items-center gap-2 min-h-8",
|
|
499
|
+
children: [
|
|
500
|
+
icon && typeof icon === "function" && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Icon.default, {
|
|
501
|
+
source: icon,
|
|
502
|
+
color: "subdued"
|
|
503
|
+
}),
|
|
504
|
+
icon && (typeof icon === "undefined" ? "undefined" : _type_of(icon)) === "object" && icon,
|
|
505
|
+
title && typeof title === "string" ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_Text.default, {
|
|
506
|
+
variant: titleVariant,
|
|
507
|
+
children: title
|
|
508
|
+
}) : title,
|
|
509
|
+
tooltip && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Tooltip.default, {
|
|
510
|
+
content: tooltip,
|
|
511
|
+
preferredPosition: "above"
|
|
512
|
+
})
|
|
513
|
+
]
|
|
514
|
+
}),
|
|
515
|
+
accessory && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
516
|
+
className: "Litho-CardSection__HeaderAccessory pr-2",
|
|
517
|
+
children: accessory
|
|
518
|
+
}),
|
|
519
|
+
action && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
520
|
+
className: "Litho-CardSection__HeaderAction",
|
|
521
|
+
children: action.content ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_Button.default, {
|
|
522
|
+
link: true,
|
|
523
|
+
onClick: action.onAction,
|
|
524
|
+
primary: action.primary,
|
|
525
|
+
destructive: action.destructive,
|
|
526
|
+
icon: action.icon,
|
|
527
|
+
loading: action.loading,
|
|
528
|
+
disabled: action.disabled,
|
|
529
|
+
connectedDisclosure: action.connectedDisclosure,
|
|
530
|
+
children: action.content
|
|
531
|
+
}) : action
|
|
532
|
+
})
|
|
533
|
+
]
|
|
534
|
+
}),
|
|
535
|
+
description && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Text.default, {
|
|
536
|
+
color: "subdued",
|
|
537
|
+
children: description
|
|
538
|
+
})
|
|
539
|
+
]
|
|
540
|
+
}),
|
|
541
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
542
|
+
className: sectionBodyClasses,
|
|
543
|
+
children: [
|
|
544
|
+
emptyState.showIf && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
545
|
+
className: paddedHalf ? "px-2 @md:px-2.5 pb-2" : !padded ? "px-4 @md:px-5 pb-4" : "",
|
|
546
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Text.default, {
|
|
547
|
+
color: "subdued",
|
|
548
|
+
children: emptyState.text
|
|
549
|
+
})
|
|
550
|
+
}),
|
|
551
|
+
children
|
|
552
|
+
]
|
|
553
|
+
})
|
|
554
|
+
]
|
|
555
|
+
});
|
|
556
|
+
};
|
|
557
|
+
Card.Section.displayName = "Card.Section";
|
|
558
|
+
var clickableRowStyles = (0, _tailwindvariants.tv)({
|
|
559
|
+
base: "Litho-Card__ClickableRow flex py-1.5 px-2.5 cursor-pointer rounded-md hover:bg-tint-2 active:bg-tint-3",
|
|
560
|
+
variants: {
|
|
561
|
+
disabled: {
|
|
562
|
+
true: "opacity-50 cursor-not-allowed pointer-events-none"
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
/**
|
|
567
|
+
* ClickableRow component for creating clickable rows inside the Card.
|
|
568
|
+
*
|
|
569
|
+
* @component
|
|
570
|
+
* @param {Object} props - Props for the ClickableRow component.
|
|
571
|
+
* @param {React.ReactNode} [props.children] - Child elements to render inside the row.
|
|
572
|
+
* @param {Function} [props.onClick] - Click handler for the row.
|
|
573
|
+
* @param {string} [props.id] - ID to apply to the row element.
|
|
574
|
+
* @param {string} [props.url] - URL to open when the row is clicked.
|
|
575
|
+
* @param {boolean} [props.disabled=false] - Disables interaction with the row.
|
|
576
|
+
*
|
|
577
|
+
* @returns {React.ReactElement} The rendered ClickableRow component.
|
|
578
|
+
*/ Card.ClickableRow = function(param) {
|
|
579
|
+
var children = param.children, onClick = param.onClick, id = param.id, url = param.url, _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, className = param.className;
|
|
580
|
+
var classes = clickableRowStyles({
|
|
581
|
+
disabled: disabled
|
|
582
|
+
});
|
|
583
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
584
|
+
id: id,
|
|
585
|
+
onClick: url ? function() {
|
|
586
|
+
return window.open(url, "_blank");
|
|
587
|
+
} : onClick,
|
|
588
|
+
className: "".concat(classes).concat(className ? " ".concat(className) : ""),
|
|
589
|
+
children: children
|
|
590
|
+
});
|
|
591
|
+
};
|
|
592
|
+
Card.ClickableRow.displayName = "Card.ClickableRow";
|
|
593
|
+
var _default = Card;
|