@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,331 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
var _AppProvider = require("../components/AppProvider");
|
|
14
|
+
var _tailwindvariants = require("tailwind-variants");
|
|
15
|
+
var _index = require("../index");
|
|
16
|
+
var _polarisicons = require("@shopify/polaris-icons");
|
|
17
|
+
function _define_property(obj, key, value) {
|
|
18
|
+
if (key in obj) {
|
|
19
|
+
Object.defineProperty(obj, key, {
|
|
20
|
+
value: value,
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true
|
|
24
|
+
});
|
|
25
|
+
} else {
|
|
26
|
+
obj[key] = value;
|
|
27
|
+
}
|
|
28
|
+
return obj;
|
|
29
|
+
}
|
|
30
|
+
function _object_spread(target) {
|
|
31
|
+
for(var i = 1; i < arguments.length; i++){
|
|
32
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
33
|
+
var ownKeys = Object.keys(source);
|
|
34
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
35
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
36
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
ownKeys.forEach(function(key) {
|
|
40
|
+
_define_property(target, key, source[key]);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return target;
|
|
44
|
+
}
|
|
45
|
+
var styles = (0, _tailwindvariants.tv)({
|
|
46
|
+
base: "Litho-Navigation h-full w-full pt-12 @md:pt-0 pr-2.5 pb-3 @md:pb-0 flex flex-col gap-2 justify-between bg-surface-normal"
|
|
47
|
+
});
|
|
48
|
+
var sectionStyles = (0, _tailwindvariants.tv)({
|
|
49
|
+
base: "Litho-Navigation-Section mb-4"
|
|
50
|
+
});
|
|
51
|
+
var titleStyles = (0, _tailwindvariants.tv)({
|
|
52
|
+
base: "Litho-Navigation-Title relative min-h-8 ml-2.5 px-2.5 py-1.5 flex items-center justify-between gap-2",
|
|
53
|
+
variants: {
|
|
54
|
+
selected: {
|
|
55
|
+
true: "after:content-[''] after:absolute after:-left-2.5 after:top-0.5 after:bottom-0.5 after:w-0.75 after:rounded-r-md after:bg-brand-saturated"
|
|
56
|
+
},
|
|
57
|
+
hasAction: {
|
|
58
|
+
true: "cursor-pointer rounded-md hover"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Navigation component.
|
|
64
|
+
* A sidebar navigation component for displaying links, sections, and footer links.
|
|
65
|
+
*
|
|
66
|
+
* @component
|
|
67
|
+
* @param {Object} props - Component properties.
|
|
68
|
+
* @param {Object} [props.breadcrumb] - Breadcrumb navigation item.
|
|
69
|
+
* @param {string} [props.breadcrumb.content] - Label for the breadcrumb.
|
|
70
|
+
* @param {Function} [props.breadcrumb.onAction] - Callback for breadcrumb action.
|
|
71
|
+
* @param {Array<Object>} [props.sections] - Array of navigation sections.
|
|
72
|
+
* @param {Object} [props.sections[].title] - Section title configuration.
|
|
73
|
+
* @param {string} [props.sections[].title.label] - Title label.
|
|
74
|
+
* @param {boolean} [props.sections[].title.selected] - Whether the title is selected.
|
|
75
|
+
* @param {Function} [props.sections[].title.onAction] - Callback for title action.
|
|
76
|
+
* @param {Array<Object>} [props.sections[].links] - Array of link configurations for the section.
|
|
77
|
+
* @param {Array<Object>} [props.footerLinks] - Array of footer link configurations.
|
|
78
|
+
* @returns {JSX.Element} The rendered Navigation component.
|
|
79
|
+
*/ function Navigation() {
|
|
80
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
81
|
+
var breadcrumb = props.breadcrumb, sections = props.sections, footerLinks = props.footerLinks;
|
|
82
|
+
var setShowMobileNavigation = (0, _react.useContext)(_AppProvider.FrameContext).setShowMobileNavigation;
|
|
83
|
+
var classes = styles(props);
|
|
84
|
+
var sectionClasses = sectionStyles(props);
|
|
85
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
86
|
+
className: classes,
|
|
87
|
+
children: [
|
|
88
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
89
|
+
children: [
|
|
90
|
+
breadcrumb && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
91
|
+
className: sectionClasses,
|
|
92
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Navigation.Link, {
|
|
93
|
+
label: breadcrumb.content || "Back",
|
|
94
|
+
onAction: breadcrumb.onAction,
|
|
95
|
+
icon: _polarisicons.ChevronLeftMinor,
|
|
96
|
+
keepNavigationOpen: breadcrumb.keepNavigationOpen
|
|
97
|
+
})
|
|
98
|
+
}),
|
|
99
|
+
sections && sections.map(function(section, index) {
|
|
100
|
+
var _section_title, _section_title1;
|
|
101
|
+
if (!section.links) return null;
|
|
102
|
+
var titleClasses = titleStyles({
|
|
103
|
+
selected: (_section_title = section.title) === null || _section_title === void 0 ? void 0 : _section_title.selected,
|
|
104
|
+
hasAction: !!((_section_title1 = section.title) === null || _section_title1 === void 0 ? void 0 : _section_title1.onAction)
|
|
105
|
+
});
|
|
106
|
+
var handleTitleClick = function() {
|
|
107
|
+
var _section_title_onAction, _section_title;
|
|
108
|
+
(_section_title_onAction = (_section_title = section.title).onAction) === null || _section_title_onAction === void 0 ? void 0 : _section_title_onAction.call(_section_title);
|
|
109
|
+
if (!section.title.keepNavigationOpen) {
|
|
110
|
+
setShowMobileNavigation(false);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
114
|
+
className: sectionClasses,
|
|
115
|
+
children: [
|
|
116
|
+
section.title && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
117
|
+
className: titleClasses,
|
|
118
|
+
onClick: handleTitleClick,
|
|
119
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Text, {
|
|
120
|
+
color: section.title.selected ? "link" : "normal",
|
|
121
|
+
fontWeight: "medium",
|
|
122
|
+
variant: "bodySm",
|
|
123
|
+
truncate: true,
|
|
124
|
+
children: section.title.label
|
|
125
|
+
})
|
|
126
|
+
}),
|
|
127
|
+
section.links.map(function(link, index) {
|
|
128
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(Navigation.Link, _object_spread({}, link), "navigation-link-".concat(index));
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
}, "navigation-section-".concat(index));
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
}),
|
|
135
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
136
|
+
children: footerLinks && footerLinks.map(function(link, index) {
|
|
137
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(Navigation.Link, _object_spread({}, link), "navigation-footer-link-".concat(index));
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
var linkStyles = (0, _tailwindvariants.tv)({
|
|
144
|
+
base: "Litho-Navigation-Link relative min-h-8 ml-2.5 px-2.5 py-1.5 flex items-center justify-between gap-2",
|
|
145
|
+
variants: {
|
|
146
|
+
selected: {
|
|
147
|
+
true: "Litho-Navigation-Link-Selected after:content-[''] after:absolute after:-left-2.5 after:top-0.5 after:bottom-0.5 after:w-0.75 after:rounded-r-md after:bg-brand-saturated"
|
|
148
|
+
},
|
|
149
|
+
hasAction: {
|
|
150
|
+
true: "cursor-pointer rounded-md hover"
|
|
151
|
+
},
|
|
152
|
+
onlyShowOnMobile: {
|
|
153
|
+
true: "@md:hidden"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
defaultVariants: {
|
|
157
|
+
onlyShowOnMobile: false
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* Navigation.Link component.
|
|
162
|
+
* Represents a link within the navigation.
|
|
163
|
+
*
|
|
164
|
+
* @component
|
|
165
|
+
* @param {Object} props - Component properties.
|
|
166
|
+
* @param {boolean} [props.selected] - Whether the link is selected.
|
|
167
|
+
* @param {boolean} [props.highlight] - Whether the link is highlighted.
|
|
168
|
+
* @param {Array<Object>} [props.subLinks] - Array of sub-links for this link.
|
|
169
|
+
* @param {boolean} [props.showSubLinksAsRegularLinks] - Whether to render sub-links as regular links.
|
|
170
|
+
* @param {boolean} [props.showDividerAbove] - Whether to show a divider above the link.
|
|
171
|
+
* @param {boolean} [props.showDividerBelow] - Whether to show a divider below the link.
|
|
172
|
+
* @param {Function} [props.onAction] - Callback for the link action.
|
|
173
|
+
* @param {React.ReactNode} [props.source] - Optional source content to render.
|
|
174
|
+
* @param {React.ReactNode} [props.icon] - Optional icon to render.
|
|
175
|
+
* @param {string} [props.label] - Label for the link.
|
|
176
|
+
* @param {Object} [props.badge] - Badge configuration.
|
|
177
|
+
* @param {string} [props.badge.status] - Badge status (e.g., "success", "warning").
|
|
178
|
+
* @param {string} [props.badge.label] - Badge label.
|
|
179
|
+
* @param {boolean} [props.external] - Whether the link is external.
|
|
180
|
+
* @param {boolean} [props.disclosure] - Whether the link has a disclosure icon.
|
|
181
|
+
* @param {string} [props.iconDisplay] - Icon display style (e.g., "block", "inline").
|
|
182
|
+
* @param {boolean} [props.keepNavigationOpen] - Whether to keep the navigation open.
|
|
183
|
+
* @returns {JSX.Element} The rendered Link component.
|
|
184
|
+
*/ function Link() {
|
|
185
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
186
|
+
var selected = props.selected, highlight = props.highlight, subLinks = props.subLinks, showSubLinksAsRegularLinks = props.showSubLinksAsRegularLinks, showDividerAbove = props.showDividerAbove, showDividerBelow = props.showDividerBelow, onAction = props.onAction, source = props.source, icon = props.icon, label = props.label, badge = props.badge, external = props.external, expanded = props.expanded, _props_iconDisplay = props.iconDisplay, iconDisplay = _props_iconDisplay === void 0 ? "block" : _props_iconDisplay, _props_keepNavigationOpen = props.keepNavigationOpen, keepNavigationOpen = _props_keepNavigationOpen === void 0 ? false : _props_keepNavigationOpen, _props_onlyShowOnMobile = props.onlyShowOnMobile, onlyShowOnMobile = _props_onlyShowOnMobile === void 0 ? false : _props_onlyShowOnMobile, _props_disclosure = props.disclosure, disclosure = _props_disclosure === void 0 ? false : _props_disclosure;
|
|
187
|
+
var setShowMobileNavigation = (0, _react.useContext)(_AppProvider.FrameContext).setShowMobileNavigation;
|
|
188
|
+
var subLinkIsSelected = subLinks === null || subLinks === void 0 ? void 0 : subLinks.some(function(subLink) {
|
|
189
|
+
return subLink.selected;
|
|
190
|
+
});
|
|
191
|
+
var grandChildLinkIsSelected = subLinks === null || subLinks === void 0 ? void 0 : subLinks.some(function(subLink) {
|
|
192
|
+
var _subLink_subLinks;
|
|
193
|
+
return (_subLink_subLinks = subLink.subLinks) === null || _subLink_subLinks === void 0 ? void 0 : _subLink_subLinks.some(function(grandChildLink) {
|
|
194
|
+
return grandChildLink.selected;
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
var linkSelected = selected || subLinkIsSelected && !highlight;
|
|
198
|
+
var linkClasses = linkStyles({
|
|
199
|
+
selected: linkSelected,
|
|
200
|
+
hasAction: !!onAction,
|
|
201
|
+
highlight: highlight,
|
|
202
|
+
onlyShowOnMobile: onlyShowOnMobile
|
|
203
|
+
});
|
|
204
|
+
var handleClick = function() {
|
|
205
|
+
onAction === null || onAction === void 0 ? void 0 : onAction();
|
|
206
|
+
if (!keepNavigationOpen) {
|
|
207
|
+
setShowMobileNavigation(false);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
211
|
+
children: [
|
|
212
|
+
showDividerAbove && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
213
|
+
className: "h-px w-full bg-tint-3 dark:bg-tint-alt-3 my-3"
|
|
214
|
+
}),
|
|
215
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
216
|
+
className: linkClasses,
|
|
217
|
+
onClick: handleClick,
|
|
218
|
+
children: [
|
|
219
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
220
|
+
className: "flex items-center gap-2 truncate",
|
|
221
|
+
children: [
|
|
222
|
+
source ? source : icon ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Icon, {
|
|
223
|
+
source: icon,
|
|
224
|
+
color: linkSelected ? "link" : "subdued",
|
|
225
|
+
display: iconDisplay
|
|
226
|
+
}) : null,
|
|
227
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Text, {
|
|
228
|
+
fontWeight: "medium",
|
|
229
|
+
color: linkSelected ? "link" : subLinkIsSelected || grandChildLinkIsSelected ? "default" : "normal",
|
|
230
|
+
truncate: true,
|
|
231
|
+
children: label
|
|
232
|
+
})
|
|
233
|
+
]
|
|
234
|
+
}),
|
|
235
|
+
badge ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Badge, {
|
|
236
|
+
status: badge.status,
|
|
237
|
+
children: badge.label
|
|
238
|
+
}) : external ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Icon, {
|
|
239
|
+
source: _polarisicons.ExternalMinor,
|
|
240
|
+
color: "subdued"
|
|
241
|
+
}) : disclosure ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Icon, {
|
|
242
|
+
source: _polarisicons.ChevronRightMinor,
|
|
243
|
+
color: "subdued",
|
|
244
|
+
className: "opacity-50"
|
|
245
|
+
}) : null
|
|
246
|
+
]
|
|
247
|
+
}),
|
|
248
|
+
(expanded || selected || subLinkIsSelected || grandChildLinkIsSelected) && !disclosure && subLinks && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
249
|
+
className: "flex flex-col mb-3",
|
|
250
|
+
children: subLinks.map(function(subLink, index) {
|
|
251
|
+
if (showSubLinksAsRegularLinks) {
|
|
252
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(Navigation.Link, _object_spread({}, subLink), "navigation-sublink-".concat(index));
|
|
253
|
+
}
|
|
254
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(Navigation.SubLink, _object_spread({}, subLink), "navigation-sublink-".concat(index));
|
|
255
|
+
})
|
|
256
|
+
}),
|
|
257
|
+
showDividerBelow && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
258
|
+
className: "h-px w-full bg-tint-3 dark:bg-tint-alt-3 mb-3"
|
|
259
|
+
})
|
|
260
|
+
]
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
Navigation.Link = Link;
|
|
264
|
+
var subLinkStyles = (0, _tailwindvariants.tv)({
|
|
265
|
+
base: "Litho-Navigation-SubLink min-h-8 ml-2.5 pr-2.5 py-1.5 flex items-center justify-between gap-2",
|
|
266
|
+
variants: {
|
|
267
|
+
selected: {
|
|
268
|
+
true: "pl-2.5",
|
|
269
|
+
false: "pl-9.5"
|
|
270
|
+
},
|
|
271
|
+
hasAction: {
|
|
272
|
+
true: "cursor-pointer rounded-md hover"
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
/**
|
|
277
|
+
* Navigation.SubLink component.
|
|
278
|
+
* Represents a sub-link within the navigation.
|
|
279
|
+
*
|
|
280
|
+
* @component
|
|
281
|
+
* @param {Object} props - Component properties.
|
|
282
|
+
* @param {boolean} [props.selected] - Whether the sub-link is selected.
|
|
283
|
+
* @param {Function} [props.onAction] - Callback for the sub-link action.
|
|
284
|
+
* @param {string} [props.label] - Label for the sub-link.
|
|
285
|
+
* @param {Object} [props.badge] - Badge configuration.
|
|
286
|
+
* @param {string} [props.badge.status] - Badge status (e.g., "success", "warning").
|
|
287
|
+
* @param {string} [props.badge.label] - Badge label.
|
|
288
|
+
* @param {boolean} [props.keepNavigationOpen] - Whether to keep the navigation open.
|
|
289
|
+
* @returns {JSX.Element} The rendered SubLink component.
|
|
290
|
+
*/ function SubLink() {
|
|
291
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
292
|
+
var selected = props.selected, onAction = props.onAction, label = props.label, badge = props.badge, _props_keepNavigationOpen = props.keepNavigationOpen, keepNavigationOpen = _props_keepNavigationOpen === void 0 ? false : _props_keepNavigationOpen;
|
|
293
|
+
var subLinkClasses = subLinkStyles({
|
|
294
|
+
selected: selected,
|
|
295
|
+
hasAction: !!onAction
|
|
296
|
+
});
|
|
297
|
+
var setShowMobileNavigation = (0, _react.useContext)(_AppProvider.FrameContext).setShowMobileNavigation;
|
|
298
|
+
var handleClick = function() {
|
|
299
|
+
onAction === null || onAction === void 0 ? void 0 : onAction();
|
|
300
|
+
if (!keepNavigationOpen) {
|
|
301
|
+
setShowMobileNavigation(false);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
305
|
+
className: subLinkClasses,
|
|
306
|
+
onClick: handleClick,
|
|
307
|
+
children: [
|
|
308
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
309
|
+
className: "flex items-center gap-2",
|
|
310
|
+
children: [
|
|
311
|
+
selected && /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Icon, {
|
|
312
|
+
source: _polarisicons.ChevronRightMinor,
|
|
313
|
+
color: "subdued",
|
|
314
|
+
className: "opacity-50"
|
|
315
|
+
}),
|
|
316
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Text, {
|
|
317
|
+
fontWeight: selected ? "medium" : "normal",
|
|
318
|
+
color: selected ? "default" : "normal",
|
|
319
|
+
children: label
|
|
320
|
+
})
|
|
321
|
+
]
|
|
322
|
+
}),
|
|
323
|
+
badge && /*#__PURE__*/ (0, _jsxruntime.jsx)(_index.Badge, {
|
|
324
|
+
status: badge.status,
|
|
325
|
+
children: badge.label
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
Navigation.SubLink = SubLink;
|
|
331
|
+
var _default = Navigation;
|