@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,141 @@
|
|
|
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
|
+
function _object_without_properties(source, excluded) {
|
|
30
|
+
if (source == null) return {};
|
|
31
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
32
|
+
var key, i;
|
|
33
|
+
if (Object.getOwnPropertySymbols) {
|
|
34
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
35
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
36
|
+
key = sourceSymbolKeys[i];
|
|
37
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
38
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
39
|
+
target[key] = source[key];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return target;
|
|
43
|
+
}
|
|
44
|
+
function _object_without_properties_loose(source, excluded) {
|
|
45
|
+
if (source == null) return {};
|
|
46
|
+
var target = {};
|
|
47
|
+
var sourceKeys = Object.keys(source);
|
|
48
|
+
var key, i;
|
|
49
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
50
|
+
key = sourceKeys[i];
|
|
51
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
52
|
+
target[key] = source[key];
|
|
53
|
+
}
|
|
54
|
+
return target;
|
|
55
|
+
}
|
|
56
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
57
|
+
import React, { useCallback } from "react";
|
|
58
|
+
import { tv } from "tailwind-variants";
|
|
59
|
+
var styles = tv({
|
|
60
|
+
base: "Litho-Image",
|
|
61
|
+
variants: {
|
|
62
|
+
borderRadius: {
|
|
63
|
+
default: "",
|
|
64
|
+
none: "rounded-none",
|
|
65
|
+
xs: "rounded-xs",
|
|
66
|
+
sm: "rounded-sm",
|
|
67
|
+
md: "rounded-md",
|
|
68
|
+
lg: "rounded-lg",
|
|
69
|
+
full: "rounded-full",
|
|
70
|
+
max: "rounded-max"
|
|
71
|
+
},
|
|
72
|
+
rounded: {
|
|
73
|
+
true: "rounded-md"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* Image component that renders an image with optional styling and behavior.
|
|
79
|
+
*
|
|
80
|
+
* @component
|
|
81
|
+
* @param {Object} props - Properties passed to the Image component.
|
|
82
|
+
* @param {string} [props.alt] - Alternative text for the image.
|
|
83
|
+
* @param {Array<{source: string, descriptor: string}>} [props.sourceSet] - Array of image sources and descriptors for responsive images.
|
|
84
|
+
* @param {string} [props.source] - URL of the image to display.
|
|
85
|
+
* @param {boolean} [props.rounded] - Whether to round the image.
|
|
86
|
+
* @param {string} [props.crossOrigin] - Sets the crossOrigin attribute for the image. Possible values are "anonymous" or "use-credentials".
|
|
87
|
+
* @param {function} [props.onLoad] - Callback function to handle the image load event.
|
|
88
|
+
* @param {string} [props.className] - Additional classes to apply to the image.
|
|
89
|
+
* @param {('default'|'none'|'xs'|'sm'|'md'|'lg'|'full'|'max')} [props.borderRadius='default'] - The border radius variant for the image.
|
|
90
|
+
* @param {Object} [rest] - Any additional props passed to the underlying `<img>` element.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* <Image
|
|
94
|
+
* alt="Sample Image"
|
|
95
|
+
* sourceSet={[
|
|
96
|
+
* { source: 'image-320w.jpg', descriptor: '320w' },
|
|
97
|
+
* { source: 'image-640w.jpg', descriptor: '640w' }
|
|
98
|
+
* ]}
|
|
99
|
+
* source="image.jpg"
|
|
100
|
+
* borderRadius="md"
|
|
101
|
+
* onLoad={() => console.log("Image loaded")}
|
|
102
|
+
* className="custom-class"
|
|
103
|
+
* />
|
|
104
|
+
*
|
|
105
|
+
* @returns {JSX.Element} A styled image component with optional responsive support.
|
|
106
|
+
*/ function Image() {
|
|
107
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
108
|
+
var alt = props.alt, sourceSet = props.sourceSet, source = props.source, crossOrigin = props.crossOrigin, onLoad = props.onLoad, rounded = props.rounded, className = props.className, borderRadius = props.borderRadius, rest = _object_without_properties(props, [
|
|
109
|
+
"alt",
|
|
110
|
+
"sourceSet",
|
|
111
|
+
"source",
|
|
112
|
+
"crossOrigin",
|
|
113
|
+
"onLoad",
|
|
114
|
+
"rounded",
|
|
115
|
+
"className",
|
|
116
|
+
"borderRadius"
|
|
117
|
+
]);
|
|
118
|
+
var classes = styles({
|
|
119
|
+
borderRadius: borderRadius,
|
|
120
|
+
rounded: rounded
|
|
121
|
+
});
|
|
122
|
+
var finalSourceSet = sourceSet ? sourceSet.map(function(param) {
|
|
123
|
+
var subSource = param.source, descriptor = param.descriptor;
|
|
124
|
+
return "".concat(subSource, " ").concat(descriptor);
|
|
125
|
+
}).join(',') : null;
|
|
126
|
+
var handleLoad = useCallback(function() {
|
|
127
|
+
if (onLoad) onLoad();
|
|
128
|
+
}, [
|
|
129
|
+
onLoad
|
|
130
|
+
]);
|
|
131
|
+
return /*#__PURE__*/ _jsx("img", _object_spread({
|
|
132
|
+
alt: alt,
|
|
133
|
+
srcSet: finalSourceSet,
|
|
134
|
+
src: source,
|
|
135
|
+
crossOrigin: crossOrigin,
|
|
136
|
+
onLoad: handleLoad,
|
|
137
|
+
className: "".concat(classes).concat(className ? " ".concat(className) : '')
|
|
138
|
+
}, rest));
|
|
139
|
+
}
|
|
140
|
+
;
|
|
141
|
+
export default Image;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
import { default as Icon } from "./Icon.js";
|
|
4
|
+
import { CircleAlertMajor } from "@shopify/polaris-icons";
|
|
5
|
+
var styles = tv({
|
|
6
|
+
base: "Litho-InlineError flex items-start justify-start gap-2"
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* InlineError Component
|
|
10
|
+
*
|
|
11
|
+
* Displays an inline error message with an icon, useful for indicating errors next to form fields.
|
|
12
|
+
*
|
|
13
|
+
* @component
|
|
14
|
+
* @param {Object} props - Component properties.
|
|
15
|
+
* @param {string} props.message - The error message to display.
|
|
16
|
+
* @param {string} props.fieldID - The ID of the field this error is associated with, used to generate an accessible ID for the error element.
|
|
17
|
+
*
|
|
18
|
+
* @returns {JSX.Element} A styled inline error message with an icon.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <InlineError message="This field is required" fieldID="username" />
|
|
22
|
+
*
|
|
23
|
+
*/ function InlineError() {
|
|
24
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
25
|
+
var message = props.message, fieldID = props.fieldID, _props_icon = props.icon, icon = _props_icon === void 0 ? CircleAlertMajor : _props_icon;
|
|
26
|
+
var classes = styles();
|
|
27
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
28
|
+
id: "".concat(fieldID, "Error"),
|
|
29
|
+
className: classes,
|
|
30
|
+
children: [
|
|
31
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
32
|
+
source: icon,
|
|
33
|
+
color: "critical"
|
|
34
|
+
}),
|
|
35
|
+
/*#__PURE__*/ _jsx("span", {
|
|
36
|
+
className: "Litho-InlineError__Text text-fg-critical",
|
|
37
|
+
children: message
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
;
|
|
43
|
+
export default InlineError;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
import Text from "./Text.js";
|
|
4
|
+
import Tooltip from "./Tooltip.js";
|
|
5
|
+
var styles = tv({
|
|
6
|
+
base: "Litho-Label flex items-center gap-1 text-highest",
|
|
7
|
+
variants: {
|
|
8
|
+
hidden: {
|
|
9
|
+
true: "sr-only"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Label component
|
|
15
|
+
*
|
|
16
|
+
* This component renders a customizable label element with optional required indicator styling.
|
|
17
|
+
* It uses `tailwind-variants` to apply base styles and accepts various props for customization.
|
|
18
|
+
*
|
|
19
|
+
* @param {Object} props - The properties passed to the component.
|
|
20
|
+
* @param {React.ReactNode} props.children - The content to be displayed within the label.
|
|
21
|
+
* @param {string} [props.id] - The identifier for the label and its associated form element.
|
|
22
|
+
* @param {boolean} [props.hidden] - If true, the label is visually hidden.
|
|
23
|
+
* @param {boolean} [props.requiredIndicator] - If true, displays an asterisk (*) to indicate a required field.
|
|
24
|
+
* @param {string} [props.className] - Additional CSS class names.
|
|
25
|
+
* @param {React.ReactNode|import("./Tooltip").TooltipContentObject} [props.tooltip] - Tooltip content for the label.
|
|
26
|
+
* @param {Object} [props.rest] - Additional props to be spread onto the label element.
|
|
27
|
+
*
|
|
28
|
+
* @returns {JSX.Element} The rendered label component with optional required indicator.
|
|
29
|
+
*/ function Label() {
|
|
30
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
31
|
+
var tmp = props.color, _color = tmp === void 0 ? "subdued" : tmp, children = props.children, _props_variant = props.variant, variant = _props_variant === void 0 ? "bodyMd" : _props_variant, _props_fontWeight = props.fontWeight, fontWeight = _props_fontWeight === void 0 ? "normal" : _props_fontWeight, id = props.id, hidden = props.hidden, className = props.className, requiredIndicator = props.requiredIndicator, _props_as = props.as, as = _props_as === void 0 ? "label" : _props_as, disabled = props.disabled, tooltip = props.tooltip;
|
|
32
|
+
var classes = styles({
|
|
33
|
+
requiredIndicator: requiredIndicator,
|
|
34
|
+
hidden: hidden,
|
|
35
|
+
disabled: disabled
|
|
36
|
+
});
|
|
37
|
+
var color = disabled ? "disabled" : _color;
|
|
38
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
39
|
+
className: "flex items-center gap-1".concat(className ? " ".concat(className) : ""),
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ _jsxs(Text, {
|
|
42
|
+
as: as,
|
|
43
|
+
id: id ? "".concat(id, "Label") : undefined,
|
|
44
|
+
htmlFor: id,
|
|
45
|
+
className: classes,
|
|
46
|
+
variant: variant,
|
|
47
|
+
fontWeight: fontWeight,
|
|
48
|
+
color: color,
|
|
49
|
+
children: [
|
|
50
|
+
children,
|
|
51
|
+
requiredIndicator ? /*#__PURE__*/ _jsx("span", {
|
|
52
|
+
className: "Litho-Label__RequiredIndicator text-fg-critical ml-0.5",
|
|
53
|
+
children: "*"
|
|
54
|
+
}) : null
|
|
55
|
+
]
|
|
56
|
+
}),
|
|
57
|
+
tooltip && /*#__PURE__*/ _jsx(Tooltip, {
|
|
58
|
+
content: tooltip
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export default Label;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { createContext, useContext, useMemo } from "react";
|
|
4
|
+
import { tv } from "tailwind-variants";
|
|
5
|
+
import { FrameContext } from "./AppProvider.js";
|
|
6
|
+
import Section from "./LayoutSection.js";
|
|
7
|
+
import Text from "./Text.js";
|
|
8
|
+
export var LayoutContext = /*#__PURE__*/ createContext();
|
|
9
|
+
var styles = tv({
|
|
10
|
+
base: "Litho-Layout flex flex-col gap-4 w-full max-w-full",
|
|
11
|
+
variants: {
|
|
12
|
+
hasSidebarSection: {
|
|
13
|
+
true: ""
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
compoundVariants: [
|
|
17
|
+
{
|
|
18
|
+
hasSidebarSection: true,
|
|
19
|
+
embedded: false,
|
|
20
|
+
className: "@lg:flex-row @lg:gap-5"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
hasSidebarSection: true,
|
|
24
|
+
embedded: true,
|
|
25
|
+
className: "@lg-embed:flex-row @lg-embed:items-start @lg-embed:gap-5"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
hasSidebarSection: false,
|
|
30
|
+
embedded: false
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Layout component for structuring content.
|
|
35
|
+
*
|
|
36
|
+
* The `Layout` component organizes its children into a flexible and responsive layout.
|
|
37
|
+
* If no `Layout.Section` or `Layout.AnnotatedSection` children are found, it wraps the
|
|
38
|
+
* children inside a default `Layout.Section`.
|
|
39
|
+
*
|
|
40
|
+
* @param {Object} props - Component props.
|
|
41
|
+
* @param {React.ReactNode} props.children - The content to render inside the layout.
|
|
42
|
+
* @returns {JSX.Element} The rendered layout component.
|
|
43
|
+
*/ function Layout() {
|
|
44
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
45
|
+
var embedded = useContext(FrameContext).embedded;
|
|
46
|
+
var children = props.children;
|
|
47
|
+
var analyzeChildren = function(children) {
|
|
48
|
+
var depth = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
49
|
+
if (depth > 3) return {
|
|
50
|
+
sections: [],
|
|
51
|
+
hasSection: false,
|
|
52
|
+
parentHasSidebar: false
|
|
53
|
+
};
|
|
54
|
+
var sections = [];
|
|
55
|
+
var hasSection = false;
|
|
56
|
+
var parentHasSidebar = false;
|
|
57
|
+
React.Children.forEach(children, function(child) {
|
|
58
|
+
if (/*#__PURE__*/ React.isValidElement(child)) {
|
|
59
|
+
var type = child.type, childProps = child.props;
|
|
60
|
+
if ([
|
|
61
|
+
"Layout.Section",
|
|
62
|
+
"Layout.AnnotatedSection"
|
|
63
|
+
].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
|
|
64
|
+
hasSection = true;
|
|
65
|
+
}
|
|
66
|
+
if ((type === null || type === void 0 ? void 0 : type.displayName) === "Layout.Section") {
|
|
67
|
+
sections.push(child);
|
|
68
|
+
if (childProps.sidebar === true || childProps.sidebar === "slim") {
|
|
69
|
+
parentHasSidebar = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
var childAnalysis = analyzeChildren(childProps === null || childProps === void 0 ? void 0 : childProps.children, depth + 1);
|
|
73
|
+
sections = sections.concat(childAnalysis.sections);
|
|
74
|
+
hasSection = hasSection || childAnalysis.hasSection;
|
|
75
|
+
parentHasSidebar = parentHasSidebar || childAnalysis.parentHasSidebar;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
sections: sections,
|
|
80
|
+
hasSection: hasSection,
|
|
81
|
+
parentHasSidebar: parentHasSidebar
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
var _useMemo = useMemo(function() {
|
|
85
|
+
return analyzeChildren(children);
|
|
86
|
+
}, [
|
|
87
|
+
children
|
|
88
|
+
]), sections = _useMemo.sections, hasSection = _useMemo.hasSection, parentHasSidebar = _useMemo.parentHasSidebar;
|
|
89
|
+
var hasSidebarSection = sections.length > 0;
|
|
90
|
+
var classes = styles({
|
|
91
|
+
hasSidebarSection: hasSidebarSection,
|
|
92
|
+
embedded: embedded
|
|
93
|
+
});
|
|
94
|
+
var wrappedChildren = hasSection ? children : /*#__PURE__*/ _jsx(Layout.Section, {
|
|
95
|
+
children: children
|
|
96
|
+
});
|
|
97
|
+
return /*#__PURE__*/ _jsx(LayoutContext.Provider, {
|
|
98
|
+
value: {
|
|
99
|
+
parentHasSidebar: parentHasSidebar
|
|
100
|
+
},
|
|
101
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
102
|
+
className: classes,
|
|
103
|
+
children: wrappedChildren
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
var annotatedSectionStyles = tv({
|
|
108
|
+
base: "Litho-Layout__AnnotatedSection w-full flex flex-col gap-1 border-edge-subdued dark:border-tint-alt-2 pb-5",
|
|
109
|
+
variants: {
|
|
110
|
+
embedded: {
|
|
111
|
+
true: "@md-embed:grid @md-embed:grid-cols-12 @md-embed:gap-8 @md-embed:border-b @md-embed:last:border-b-0",
|
|
112
|
+
false: "@md:grid @md:grid-cols-12 @md:gap-8 @md:border-b @md:last:border-b-0"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
defaultVariants: {
|
|
116
|
+
embedded: false
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* AnnotatedSection component for displaying a titled section with optional description.
|
|
121
|
+
*
|
|
122
|
+
* The `AnnotatedSection` organizes content into two main areas:
|
|
123
|
+
* - Annotation: Displays a title and description.
|
|
124
|
+
* - Content: Displays the main content provided as children.
|
|
125
|
+
*
|
|
126
|
+
* @param {Object} props - Component props.
|
|
127
|
+
* @param {React.ReactNode} props.children - The main content of the section.
|
|
128
|
+
* @param {string|React.ReactNode} [props.title] - The title for the annotated section.
|
|
129
|
+
* @param {string|React.ReactNode} [props.description] - A brief description for the annotated section.
|
|
130
|
+
* @returns {JSX.Element} The rendered annotated section component.
|
|
131
|
+
*/ function AnnotatedSection() {
|
|
132
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
133
|
+
var children = props.children, title = props.title, description = props.description;
|
|
134
|
+
var embedded = useContext(FrameContext).embedded;
|
|
135
|
+
var annotatedSectionClasses = annotatedSectionStyles({
|
|
136
|
+
embedded: embedded
|
|
137
|
+
});
|
|
138
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
139
|
+
className: annotatedSectionClasses,
|
|
140
|
+
children: [
|
|
141
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
142
|
+
className: "Litho-Layout__Annotation flex flex-col gap-1 @md:col-span-4 py-2",
|
|
143
|
+
children: [
|
|
144
|
+
title && (typeof title === "string" ? /*#__PURE__*/ _jsx(Text, {
|
|
145
|
+
variant: "headingMd",
|
|
146
|
+
children: title
|
|
147
|
+
}) : title),
|
|
148
|
+
description && (typeof description === "string" ? /*#__PURE__*/ _jsx(Text, {
|
|
149
|
+
color: "subdued",
|
|
150
|
+
children: description
|
|
151
|
+
}) : description)
|
|
152
|
+
]
|
|
153
|
+
}),
|
|
154
|
+
/*#__PURE__*/ _jsx("div", {
|
|
155
|
+
className: "Litho-Layout__AnnotationContent @md:col-span-8",
|
|
156
|
+
children: children
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
AnnotatedSection.displayName = "Layout.AnnotatedSection";
|
|
162
|
+
Layout.AnnotatedSection = AnnotatedSection;
|
|
163
|
+
Layout.Section = Section;
|
|
164
|
+
export default Layout;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { useContext } from "react";
|
|
4
|
+
import { tv } from "tailwind-variants";
|
|
5
|
+
import { FrameContext } from "./AppProvider.js";
|
|
6
|
+
import { LayoutContext } from "./Layout.js";
|
|
7
|
+
var sectionStyles = tv({
|
|
8
|
+
base: "Litho-Layout__Section",
|
|
9
|
+
variants: {
|
|
10
|
+
sidebar: {
|
|
11
|
+
true: "",
|
|
12
|
+
slim: ""
|
|
13
|
+
},
|
|
14
|
+
sibling: {
|
|
15
|
+
none: "w-full",
|
|
16
|
+
sidebar: "flex-1 basis-0 min-w-0"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
compoundVariants: [
|
|
20
|
+
{
|
|
21
|
+
sidebar: true,
|
|
22
|
+
embedded: true,
|
|
23
|
+
className: "@lg-embed:w-1/3 @lg-embed:max-w-80 @xl-embed:max-w-120 @lg-embed:w-1/3 @lg-embed:max-w-120"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
sidebar: true,
|
|
27
|
+
embedded: false,
|
|
28
|
+
className: "@lg:w-1/3 @lg:max-w-80 @xl:max-w-120 @lg:w-1/3 @lg:max-w-120"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
sidebar: "slim",
|
|
32
|
+
embedded: true,
|
|
33
|
+
className: "@lg-embed:w-1/3 @lg-embed:max-w-80 @lg-embed:w-1/3 @lg-embed:max-w-80"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
sidebar: "slim",
|
|
37
|
+
embedded: false,
|
|
38
|
+
className: "@lg:w-1/3 @lg:max-w-80 @lg:w-1/3 @lg:max-w-80"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
sidebar: false,
|
|
43
|
+
embedded: false
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Section component for flexible content grouping.
|
|
48
|
+
*
|
|
49
|
+
* The `Section` allows for configuring its layout, supporting sidebar and slim variants.
|
|
50
|
+
*
|
|
51
|
+
* @param {Object} props - Component props.
|
|
52
|
+
* @param {React.ReactNode} props.children - The content to render inside the section.
|
|
53
|
+
* @param {boolean|"slim"} [props.sidebar=false] - Configures the section layout:
|
|
54
|
+
* - `true`: Makes it a sidebar with a 1/3 basis.
|
|
55
|
+
* - `"slim"`: Makes it a slim sidebar with a max width of 320px.
|
|
56
|
+
* - `false`: Allows it to grow.
|
|
57
|
+
* @params {boolean|integer} props.sticky - Specify whether the section becomes sticky or not
|
|
58
|
+
* @returns {JSX.Element} The rendered section component.
|
|
59
|
+
*/ function Section() {
|
|
60
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
61
|
+
var children = props.children, _props_sidebar = props.sidebar, sidebar = _props_sidebar === void 0 ? false : _props_sidebar, className = props.className, sticky = props.sticky;
|
|
62
|
+
var embedded = useContext(FrameContext).embedded;
|
|
63
|
+
var parentHasSidebar = useContext(LayoutContext).parentHasSidebar;
|
|
64
|
+
var sectionClasses = sectionStyles({
|
|
65
|
+
sidebar: sidebar,
|
|
66
|
+
sticky: sticky,
|
|
67
|
+
sibling: sidebar ? undefined : parentHasSidebar ? "sidebar" : "none",
|
|
68
|
+
embedded: embedded
|
|
69
|
+
});
|
|
70
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
71
|
+
className: "".concat(sectionClasses).concat(className ? " ".concat(className) : ""),
|
|
72
|
+
children: sticky ? /*#__PURE__*/ _jsx("div", {
|
|
73
|
+
className: "sticky".concat(typeof sticky === "boolean" ? " top-[calc(var(--litho-top-bar-height)+var(--spacing)*4)]" : ""),
|
|
74
|
+
style: typeof sticky === "number" ? {
|
|
75
|
+
top: sticky
|
|
76
|
+
} : undefined,
|
|
77
|
+
children: children
|
|
78
|
+
}) : children
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
Section.displayName = "Layout.Section";
|
|
82
|
+
export default Section;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
var styles = tv({
|
|
4
|
+
base: "Litho-Link cursor-pointer hover:underline",
|
|
5
|
+
variants: {
|
|
6
|
+
monochrome: {
|
|
7
|
+
true: "text-normal hover:text-higher"
|
|
8
|
+
},
|
|
9
|
+
removeUnderline: {
|
|
10
|
+
true: "no-underline",
|
|
11
|
+
false: "underline"
|
|
12
|
+
},
|
|
13
|
+
bold: {
|
|
14
|
+
true: "font-medium no-underline",
|
|
15
|
+
false: "font-normal"
|
|
16
|
+
},
|
|
17
|
+
disabled: {
|
|
18
|
+
true: "text-lowest hover:text-lowest cursor-default hover:no-underline",
|
|
19
|
+
false: ""
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
compoundVariants: [
|
|
23
|
+
{
|
|
24
|
+
monochrome: false,
|
|
25
|
+
disabled: false,
|
|
26
|
+
color: "link",
|
|
27
|
+
className: "text-link hover:text-link-lower"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
disabled: false,
|
|
31
|
+
monochrome: false,
|
|
32
|
+
color: "info",
|
|
33
|
+
className: "text-info-alt-fg dark:text-info-alt-fg-dark"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
disabled: false,
|
|
37
|
+
monochrome: false,
|
|
38
|
+
color: "critical",
|
|
39
|
+
className: "text-critical-alt-fg dark:text-critical-alt-fg-dark"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
disabled: false,
|
|
43
|
+
monochrome: false,
|
|
44
|
+
color: "success",
|
|
45
|
+
className: "text-success-alt-fg dark:text-success-alt-fg-dark"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
disabled: false,
|
|
49
|
+
monochrome: false,
|
|
50
|
+
color: "warning",
|
|
51
|
+
className: "text-warning-alt-fg dark:text-warning-alt-fg-dark"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
disabled: false,
|
|
55
|
+
monochrome: false,
|
|
56
|
+
color: "attention",
|
|
57
|
+
className: "text-attention-alt-fg dark:text-attention-alt-fg-dark"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
disabled: false,
|
|
61
|
+
monochrome: false,
|
|
62
|
+
color: "highlight",
|
|
63
|
+
className: "text-highlight-alt-fg dark:text-highlight-alt-fg-dark"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
disabled: false,
|
|
67
|
+
monochrome: false,
|
|
68
|
+
color: "neutral",
|
|
69
|
+
className: "text-neutral-alt-fg dark:text-neutral-alt-fg-dark"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
defaultVariants: {
|
|
73
|
+
monochrome: false,
|
|
74
|
+
removeUnderline: false,
|
|
75
|
+
bold: false,
|
|
76
|
+
disabled: false,
|
|
77
|
+
color: "link"
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* Renders an accessible link with customizable styling based on variants.
|
|
82
|
+
*
|
|
83
|
+
* @param {Object} props - Props for the Link component.
|
|
84
|
+
* @param {string} props.url - The URL the link points to.
|
|
85
|
+
* @param {React.ReactNode} props.children - Content to display within the link.
|
|
86
|
+
* @param {Function} [props.onClick] - Optional click event handler for the link.
|
|
87
|
+
* @param {boolean} [props.external=false] - If true, opens the link in a new tab.
|
|
88
|
+
* @param {string} [props.target] - Optional target attribute for specifying where to open the link.
|
|
89
|
+
* @param {string} [props.id] - Optional id attribute for the link.
|
|
90
|
+
* @param {boolean} [props.monochrome=false] - If true, applies monochrome color scheme.
|
|
91
|
+
* @param {boolean} [props.removeUnderline=false] - If true, removes underline from the link.
|
|
92
|
+
* @param {string} [props.accessibilityLabel] - Optional aria-label for accessibility.
|
|
93
|
+
* @param {string} [props.dataPrimaryLink] - Optional data attribute for custom tracking.
|
|
94
|
+
*
|
|
95
|
+
* @returns {JSX.Element} Rendered link element.
|
|
96
|
+
*/ function Link() {
|
|
97
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
98
|
+
var url = props.url, children = props.children, onClick = props.onClick, external = props.external, target = props.target, _props_bold = props.bold, bold = _props_bold === void 0 ? false : _props_bold, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, id = props.id, monochrome = props.monochrome, removeUnderline = props.removeUnderline, accessibilityLabel = props.accessibilityLabel, dataPrimaryLink = props.dataPrimaryLink, color = props.color, className = props.className;
|
|
99
|
+
var classes = styles({
|
|
100
|
+
monochrome: monochrome,
|
|
101
|
+
removeUnderline: removeUnderline,
|
|
102
|
+
bold: bold,
|
|
103
|
+
disabled: disabled,
|
|
104
|
+
color: color
|
|
105
|
+
});
|
|
106
|
+
return /*#__PURE__*/ _jsx("a", {
|
|
107
|
+
href: disabled ? undefined : url,
|
|
108
|
+
className: "".concat(classes).concat(className ? " ".concat(className) : ""),
|
|
109
|
+
onClick: disabled ? undefined : onClick,
|
|
110
|
+
target: target ? target : external ? "_blank" : undefined,
|
|
111
|
+
id: id,
|
|
112
|
+
"aria-label": accessibilityLabel,
|
|
113
|
+
"data-primary-link": dataPrimaryLink,
|
|
114
|
+
children: children
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
;
|
|
118
|
+
Link.displayName = "Link";
|
|
119
|
+
export default Link;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
var styles = tv({
|
|
4
|
+
base: "Litho-List list-outside ml-5",
|
|
5
|
+
variants: {
|
|
6
|
+
type: {
|
|
7
|
+
bullet: "list-disc",
|
|
8
|
+
number: "list-decimal"
|
|
9
|
+
},
|
|
10
|
+
spacing: {
|
|
11
|
+
loose: "space-y-2",
|
|
12
|
+
normal: "space-y-1",
|
|
13
|
+
tight: "space-y-0"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* List component for rendering unordered or ordered lists.
|
|
19
|
+
*
|
|
20
|
+
* @param {Object} props - Component props.
|
|
21
|
+
* @param {React.ReactNode} props.children - The list items to render inside the list.
|
|
22
|
+
* @param {'normal' | 'loose' | 'tight'} [props.spacing='normal'] - Controls vertical spacing between list items.
|
|
23
|
+
* @param {'bullet' | 'number'} [props.type='bullet'] - Determines list type: bullet (unordered) or number (ordered).
|
|
24
|
+
* @param {string} [props.className] - Additional class names to apply to the list container.
|
|
25
|
+
* @returns {JSX.Element} The rendered List component.
|
|
26
|
+
*/ function List() {
|
|
27
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
28
|
+
var children = props.children, _props_spacing = props.spacing, spacing = _props_spacing === void 0 ? 'normal' : _props_spacing, _props_type = props.type, type = _props_type === void 0 ? 'bullet' : _props_type, className = props.className;
|
|
29
|
+
var classes = styles({
|
|
30
|
+
spacing: spacing,
|
|
31
|
+
type: type
|
|
32
|
+
});
|
|
33
|
+
var Element = type === 'bullet' ? 'ul' : 'ol';
|
|
34
|
+
return /*#__PURE__*/ _jsx(Element, {
|
|
35
|
+
className: "".concat(classes).concat(className ? " ".concat(className) : ''),
|
|
36
|
+
children: children
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
;
|
|
40
|
+
var itemStyles = tv({
|
|
41
|
+
base: "Litho-ListItem text-left leading-4"
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Item component for individual list items in the List component.
|
|
45
|
+
*
|
|
46
|
+
* @param {Object} props - Component props.
|
|
47
|
+
* @param {React.ReactNode} props.children - The content of the list item.
|
|
48
|
+
* @param {string} [props.className] - Additional class names to apply to the list item.
|
|
49
|
+
* @returns {JSX.Element} The rendered Item component.
|
|
50
|
+
*/ function Item() {
|
|
51
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
52
|
+
var children = props.children, className = props.className;
|
|
53
|
+
var itemClasses = itemStyles();
|
|
54
|
+
return /*#__PURE__*/ _jsx("li", {
|
|
55
|
+
className: "".concat(itemClasses).concat(className ? " ".concat(className) : ''),
|
|
56
|
+
children: children
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
;
|
|
60
|
+
List.Item = Item;
|
|
61
|
+
export default List;
|