@ultraviolet/plus 3.5.1 → 3.6.0
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/dist/components/CodeEditor/CodeEditor.d.ts +5 -38
- package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/components/CodeEditor/CodeEditor.js +6 -113
- package/dist/components/ContentCard/index.d.ts +3 -34
- package/dist/components/ContentCard/index.d.ts.map +1 -1
- package/dist/components/ContentCard/index.js +4 -103
- package/dist/components/ContentCardGroup/index.d.ts +5 -20
- package/dist/components/ContentCardGroup/index.d.ts.map +1 -1
- package/dist/components/ContentCardGroup/index.js +6 -16
- package/dist/components/Conversation/index.d.ts +5 -49
- package/dist/components/Conversation/index.d.ts.map +1 -1
- package/dist/components/Conversation/index.js +6 -46
- package/dist/components/CustomerSatisfaction/index.d.ts +5 -32
- package/dist/components/CustomerSatisfaction/index.d.ts.map +1 -1
- package/dist/components/CustomerSatisfaction/index.js +6 -84
- package/dist/components/EstimateCost/index.d.ts +9 -3
- package/dist/components/EstimateCost/index.d.ts.map +1 -1
- package/dist/components/EstimateCost/index.js +15 -0
- package/dist/components/FAQ/index.d.ts +5 -13
- package/dist/components/FAQ/index.d.ts.map +1 -1
- package/dist/components/FAQ/index.js +6 -35
- package/dist/components/InfoTable/index.d.ts +5 -1
- package/dist/components/InfoTable/index.d.ts.map +1 -1
- package/dist/components/InfoTable/index.js +11 -0
- package/dist/components/Navigation/index.d.ts +13 -2
- package/dist/components/Navigation/index.d.ts.map +1 -1
- package/dist/components/Navigation/index.js +19 -0
- package/dist/index.js +4 -6
- package/package.json +9 -9
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/defineProperty.js +0 -15
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js +0 -28
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutProperties.js +0 -18
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutPropertiesLoose.js +0 -15
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/toPrimitive.js +0 -17
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/toPropertyKey.js +0 -12
- package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/typeof.js +0 -14
- package/dist/_virtual/_rolldown/runtime.js +0 -9
- package/dist/components/CodeEditor/styles.css.d.ts +0 -10
- package/dist/components/CodeEditor/styles.css.d.ts.map +0 -1
- package/dist/components/CodeEditor/styles.css.js +0 -24
- package/dist/components/ContentCard/Skeleton.d.ts +0 -6
- package/dist/components/ContentCard/Skeleton.d.ts.map +0 -1
- package/dist/components/ContentCard/Skeleton.js +0 -32
- package/dist/components/ContentCard/styles.css.d.ts +0 -13
- package/dist/components/ContentCard/styles.css.d.ts.map +0 -1
- package/dist/components/ContentCard/styles.css.js +0 -31
- package/dist/components/ContentCardGroup/Card.d.ts +0 -15
- package/dist/components/ContentCardGroup/Card.d.ts.map +0 -1
- package/dist/components/ContentCardGroup/Card.js +0 -57
- package/dist/components/ContentCardGroup/SkeletonCard.d.ts +0 -2
- package/dist/components/ContentCardGroup/SkeletonCard.d.ts.map +0 -1
- package/dist/components/ContentCardGroup/SkeletonCard.js +0 -29
- package/dist/components/ContentCardGroup/styles.css.d.ts +0 -8
- package/dist/components/ContentCardGroup/styles.css.d.ts.map +0 -1
- package/dist/components/ContentCardGroup/styles.css.js +0 -13
- package/dist/components/Conversation/styles.css.js +0 -23
- package/dist/components/CustomerSatisfaction/assets/1-5.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/1-5NB.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/2-5.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/2-5NB.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/3-5.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/3-5NB.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/4-5.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/4-5NB.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/5-5.js +0 -5
- package/dist/components/CustomerSatisfaction/assets/5-5NB.js +0 -5
- package/dist/components/CustomerSatisfaction/styles.css.d.ts +0 -19
- package/dist/components/CustomerSatisfaction/styles.css.d.ts.map +0 -1
- package/dist/components/CustomerSatisfaction/styles.css.js +0 -20
- package/dist/components/EstimateCost/Components/CustomUnitInput.d.ts +0 -10
- package/dist/components/EstimateCost/Components/CustomUnitInput.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/CustomUnitInput.js +0 -41
- package/dist/components/EstimateCost/Components/Item.d.ts +0 -118
- package/dist/components/EstimateCost/Components/Item.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Item.js +0 -228
- package/dist/components/EstimateCost/Components/LineThrough.d.ts +0 -7
- package/dist/components/EstimateCost/Components/LineThrough.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/LineThrough.js +0 -18
- package/dist/components/EstimateCost/Components/NumberInput.d.ts +0 -11
- package/dist/components/EstimateCost/Components/NumberInput.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/NumberInput.js +0 -35
- package/dist/components/EstimateCost/Components/Region.d.ts +0 -23
- package/dist/components/EstimateCost/Components/Region.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Region.js +0 -38
- package/dist/components/EstimateCost/Components/Regular.d.ts +0 -11
- package/dist/components/EstimateCost/Components/Regular.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Regular.js +0 -23
- package/dist/components/EstimateCost/Components/Strong.d.ts +0 -10
- package/dist/components/EstimateCost/Components/Strong.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Strong.js +0 -16
- package/dist/components/EstimateCost/Components/Unit.d.ts +0 -11
- package/dist/components/EstimateCost/Components/Unit.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Unit.js +0 -50
- package/dist/components/EstimateCost/Components/Zone.d.ts +0 -23
- package/dist/components/EstimateCost/Components/Zone.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/Zone.js +0 -37
- package/dist/components/EstimateCost/Components/components.css.d.ts +0 -78
- package/dist/components/EstimateCost/Components/components.css.d.ts.map +0 -1
- package/dist/components/EstimateCost/Components/components.css.js +0 -161
- package/dist/components/EstimateCost/EstimateCost.d.ts +0 -176
- package/dist/components/EstimateCost/EstimateCost.d.ts.map +0 -1
- package/dist/components/EstimateCost/EstimateCost.js +0 -97
- package/dist/components/EstimateCost/EstimateCostContent.d.ts +0 -3
- package/dist/components/EstimateCost/EstimateCostContent.d.ts.map +0 -1
- package/dist/components/EstimateCost/EstimateCostContent.js +0 -289
- package/dist/components/EstimateCost/EstimateCostProvider.d.ts +0 -26
- package/dist/components/EstimateCost/EstimateCostProvider.d.ts.map +0 -1
- package/dist/components/EstimateCost/EstimateCostProvider.js +0 -33
- package/dist/components/EstimateCost/OverlayComponent.d.ts +0 -27
- package/dist/components/EstimateCost/OverlayComponent.d.ts.map +0 -1
- package/dist/components/EstimateCost/OverlayComponent.js +0 -99
- package/dist/components/EstimateCost/OverlayContext.d.ts +0 -13
- package/dist/components/EstimateCost/OverlayContext.d.ts.map +0 -1
- package/dist/components/EstimateCost/OverlayContext.js +0 -15
- package/dist/components/EstimateCost/constants.d.ts +0 -8
- package/dist/components/EstimateCost/constants.d.ts.map +0 -1
- package/dist/components/EstimateCost/constants.js +0 -26
- package/dist/components/EstimateCost/helper.d.ts +0 -10
- package/dist/components/EstimateCost/helper.d.ts.map +0 -1
- package/dist/components/EstimateCost/helper.js +0 -11
- package/dist/components/EstimateCost/locales/en.d.ts +0 -23
- package/dist/components/EstimateCost/locales/en.d.ts.map +0 -1
- package/dist/components/EstimateCost/locales/en.js +0 -25
- package/dist/components/EstimateCost/styles.css.d.ts +0 -80
- package/dist/components/EstimateCost/styles.css.d.ts.map +0 -1
- package/dist/components/EstimateCost/styles.css.js +0 -70
- package/dist/components/EstimateCost/types.d.ts +0 -148
- package/dist/components/EstimateCost/types.d.ts.map +0 -1
- package/dist/components/FAQ/styles.css.d.ts +0 -2
- package/dist/components/FAQ/styles.css.d.ts.map +0 -1
- package/dist/components/FAQ/styles.css.js +0 -7
- package/dist/components/InfoTable/InfoTable.d.ts +0 -25
- package/dist/components/InfoTable/InfoTable.d.ts.map +0 -1
- package/dist/components/InfoTable/InfoTable.js +0 -28
- package/dist/components/InfoTable/components/Cell.d.ts +0 -10
- package/dist/components/InfoTable/components/Cell.d.ts.map +0 -1
- package/dist/components/InfoTable/components/Cell.js +0 -38
- package/dist/components/InfoTable/components/Row.d.ts +0 -9
- package/dist/components/InfoTable/components/Row.d.ts.map +0 -1
- package/dist/components/InfoTable/components/Row.js +0 -23
- package/dist/components/InfoTable/context.d.ts +0 -4
- package/dist/components/InfoTable/context.d.ts.map +0 -1
- package/dist/components/InfoTable/context.js +0 -7
- package/dist/components/InfoTable/styles.css.d.ts +0 -8
- package/dist/components/InfoTable/styles.css.d.ts.map +0 -1
- package/dist/components/InfoTable/styles.css.js +0 -13
- package/dist/components/Navigation/Footer.d.ts +0 -9
- package/dist/components/Navigation/Footer.d.ts.map +0 -1
- package/dist/components/Navigation/Footer.js +0 -64
- package/dist/components/Navigation/Header.d.ts +0 -7
- package/dist/components/Navigation/Header.d.ts.map +0 -1
- package/dist/components/Navigation/Header.js +0 -24
- package/dist/components/Navigation/Navigation.d.ts +0 -62
- package/dist/components/Navigation/Navigation.d.ts.map +0 -1
- package/dist/components/Navigation/Navigation.js +0 -34
- package/dist/components/Navigation/NavigationContent.d.ts +0 -3
- package/dist/components/Navigation/NavigationContent.d.ts.map +0 -1
- package/dist/components/Navigation/NavigationContent.js +0 -104
- package/dist/components/Navigation/NavigationProvider.d.ts +0 -94
- package/dist/components/Navigation/NavigationProvider.d.ts.map +0 -1
- package/dist/components/Navigation/NavigationProvider.js +0 -121
- package/dist/components/Navigation/animations.css.d.ts +0 -7
- package/dist/components/Navigation/animations.css.d.ts.map +0 -1
- package/dist/components/Navigation/components/Group.d.ts +0 -10
- package/dist/components/Navigation/components/Group.d.ts.map +0 -1
- package/dist/components/Navigation/components/Group.js +0 -39
- package/dist/components/Navigation/components/Item.d.ts +0 -89
- package/dist/components/Navigation/components/Item.d.ts.map +0 -1
- package/dist/components/Navigation/components/Item.js +0 -448
- package/dist/components/Navigation/components/ItemProvider.d.ts +0 -8
- package/dist/components/Navigation/components/ItemProvider.d.ts.map +0 -1
- package/dist/components/Navigation/components/ItemProvider.js +0 -17
- package/dist/components/Navigation/components/PinnedItems.d.ts +0 -24
- package/dist/components/Navigation/components/PinnedItems.d.ts.map +0 -1
- package/dist/components/Navigation/components/PinnedItems.js +0 -105
- package/dist/components/Navigation/components/Separator.d.ts +0 -2
- package/dist/components/Navigation/components/Separator.d.ts.map +0 -1
- package/dist/components/Navigation/components/Separator.js +0 -11
- package/dist/components/Navigation/components/ShowHide.d.ts +0 -16
- package/dist/components/Navigation/components/ShowHide.d.ts.map +0 -1
- package/dist/components/Navigation/components/ShowHide.js +0 -53
- package/dist/components/Navigation/components/items.css.d.ts +0 -71
- package/dist/components/Navigation/components/items.css.d.ts.map +0 -1
- package/dist/components/Navigation/components/items.css.js +0 -87
- package/dist/components/Navigation/components/styles.css.d.ts +0 -25
- package/dist/components/Navigation/components/styles.css.d.ts.map +0 -1
- package/dist/components/Navigation/components/styles.css.js +0 -29
- package/dist/components/Navigation/constants.d.ts +0 -10
- package/dist/components/Navigation/constants.d.ts.map +0 -1
- package/dist/components/Navigation/locales/en.d.ts +0 -11
- package/dist/components/Navigation/locales/en.d.ts.map +0 -1
- package/dist/components/Navigation/locales/en.js +0 -13
- package/dist/components/Navigation/styles.css.d.ts +0 -34
- package/dist/components/Navigation/styles.css.d.ts.map +0 -1
- package/dist/components/Navigation/styles.css.js +0 -36
- package/dist/components/Navigation/types.d.ts +0 -42
- package/dist/components/Navigation/types.d.ts.map +0 -1
- package/dist/components/Navigation/variables.css.d.ts +0 -2
- package/dist/components/Navigation/variables.css.d.ts.map +0 -1
- package/dist/components/Navigation/variables.css.js +0 -7
- package/dist/plus.css +0 -2
|
@@ -1,448 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { __name } from "../../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { useNavigation } from "../NavigationProvider.js";
|
|
4
|
-
import { ItemContext, ItemProvider } from "./ItemProvider.js";
|
|
5
|
-
import { navigationItemAnimatedIcon, navigationItemBadge, navigationItemCategoryIcon, navigationItemContainer, navigationItemContainerAnimated, navigationItemDragIcon, navigationItemMenu, navigationItemMenuContainer, navigationItemMenuPinned, navigationItemMenuStack, navigationItemPadded, navigationItemPaddingStack, navigationItemPinIcon, navigationItemPinnedButton, navigationItemRelative, navigationItemShowDraggable, navigationItemShowPinButton, navigationItemStackIcon, navigationItemWeakText, navigationItemWrapText } from "./items.css.js";
|
|
6
|
-
import { ArrowDownIcon } from "@ultraviolet/icons/ArrowDownIcon";
|
|
7
|
-
import { Badge, Button, Expandable, Menu, Stack, Text, Tooltip } from "@ultraviolet/ui";
|
|
8
|
-
import { cn } from "@ultraviolet/utils";
|
|
9
|
-
import { Children, isValidElement, memo, useCallback, useContext, useEffect, useMemo, useReducer, useRef } from "react";
|
|
10
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { OpenInNewIcon } from "@ultraviolet/icons/OpenInNewIcon";
|
|
12
|
-
import { ArrowRightIcon } from "@ultraviolet/icons/ArrowRightIcon";
|
|
13
|
-
import { OrganizationDashboardCategoryIcon } from "@ultraviolet/icons/category";
|
|
14
|
-
import { DragIcon } from "@ultraviolet/icons/DragIcon";
|
|
15
|
-
import { PinOutlineIcon } from "@ultraviolet/icons/PinOutlineIcon";
|
|
16
|
-
import { UnpinIcon } from "@ultraviolet/icons/UnpinIcon";
|
|
17
|
-
|
|
18
|
-
//#region src/components/Navigation/components/Item.tsx
|
|
19
|
-
const onDragStopTrigger = (event) => {
|
|
20
|
-
const element = event.currentTarget;
|
|
21
|
-
element.style.opacity = "1";
|
|
22
|
-
};
|
|
23
|
-
const Item = memo(({ children, categoryIcon, label, labelDescription, subLabel, badgeText, badgeSentiment, href, target, rel, onToggle, onClickPinUnpin, toggle, active, noPinButton, type = "default", as, disabled, noExpand = false, index, id, "data-testid": dataTestId, style, alwaysVisible }) => {
|
|
24
|
-
const context = useNavigation();
|
|
25
|
-
if (!context) throw new Error("Navigation.Item can only be used inside a NavigationProvider.");
|
|
26
|
-
const hasParents = !!useContext(ItemContext);
|
|
27
|
-
const { expanded, locales, pinnedFeature, pinItem, unpinItem, pinnedItems, pinLimit, animation, registerItem, shouldAnimate, animationType, showHide } = context;
|
|
28
|
-
const makeRegisterRef = useRef(null);
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
makeRegisterRef.current = () => registerItem({ [id]: {
|
|
31
|
-
active,
|
|
32
|
-
label,
|
|
33
|
-
onClickPinUnpin,
|
|
34
|
-
onToggle
|
|
35
|
-
} });
|
|
36
|
-
}, [
|
|
37
|
-
active,
|
|
38
|
-
id,
|
|
39
|
-
label,
|
|
40
|
-
onClickPinUnpin,
|
|
41
|
-
registerItem,
|
|
42
|
-
onToggle
|
|
43
|
-
]);
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (type !== "pinnedGroup" && pinnedFeature) {
|
|
46
|
-
var _makeRegisterRef$curr;
|
|
47
|
-
(_makeRegisterRef$curr = makeRegisterRef.current) === null || _makeRegisterRef$curr === void 0 || _makeRegisterRef$curr.call(makeRegisterRef);
|
|
48
|
-
}
|
|
49
|
-
}, [
|
|
50
|
-
type,
|
|
51
|
-
pinnedFeature,
|
|
52
|
-
active,
|
|
53
|
-
id,
|
|
54
|
-
label,
|
|
55
|
-
registerItem
|
|
56
|
-
]);
|
|
57
|
-
const [internalExpanded, onToggleExpand] = useReducer((prevState) => !prevState, Boolean(toggle));
|
|
58
|
-
const triggerToggle = useCallback(() => {
|
|
59
|
-
onToggleExpand();
|
|
60
|
-
onToggle === null || onToggle === void 0 || onToggle(internalExpanded);
|
|
61
|
-
}, [internalExpanded, onToggle]);
|
|
62
|
-
const hasHrefAndNoChildren = href && !children;
|
|
63
|
-
const hasPinnedFeatureAndNoChildren = pinnedFeature && !children && !noPinButton;
|
|
64
|
-
const isItemPinned = pinnedItems.includes(id);
|
|
65
|
-
const shouldShowPinnedButton = useMemo(() => {
|
|
66
|
-
if (href || disabled) return false;
|
|
67
|
-
if (hasPinnedFeatureAndNoChildren && type !== "default") return true;
|
|
68
|
-
if (hasPinnedFeatureAndNoChildren) return true;
|
|
69
|
-
return false;
|
|
70
|
-
}, [
|
|
71
|
-
disabled,
|
|
72
|
-
hasPinnedFeatureAndNoChildren,
|
|
73
|
-
href,
|
|
74
|
-
type
|
|
75
|
-
]);
|
|
76
|
-
const hasActiveChildren = useMemo(() => {
|
|
77
|
-
if (!children) return false;
|
|
78
|
-
return Children.map(children, (child) => {
|
|
79
|
-
if (isValidElement(child)) {
|
|
80
|
-
if ("to" in child.props) {
|
|
81
|
-
var _child$props$children;
|
|
82
|
-
return (_child$props$children = child.props.children) === null || _child$props$children === void 0 ? void 0 : _child$props$children.props.active;
|
|
83
|
-
}
|
|
84
|
-
return child.props.active;
|
|
85
|
-
}
|
|
86
|
-
return null;
|
|
87
|
-
}).includes(true);
|
|
88
|
-
}, [children]);
|
|
89
|
-
const containerTag = useMemo(() => {
|
|
90
|
-
if (as) return as;
|
|
91
|
-
if (hasHrefAndNoChildren) return "a";
|
|
92
|
-
if (noExpand) return "div";
|
|
93
|
-
return "button";
|
|
94
|
-
}, [
|
|
95
|
-
as,
|
|
96
|
-
hasHrefAndNoChildren,
|
|
97
|
-
noExpand
|
|
98
|
-
]);
|
|
99
|
-
const ArrowIcon = useMemo(() => internalExpanded ? ArrowDownIcon : ArrowRightIcon, [internalExpanded]);
|
|
100
|
-
const PinUnpinIcon = useMemo(() => isItemPinned ? UnpinIcon : PinOutlineIcon, [isItemPinned]);
|
|
101
|
-
const ariaExpanded = useMemo(() => {
|
|
102
|
-
if (hasHrefAndNoChildren && internalExpanded) return true;
|
|
103
|
-
if (hasHrefAndNoChildren && !internalExpanded) return false;
|
|
104
|
-
}, [hasHrefAndNoChildren, internalExpanded]);
|
|
105
|
-
const isPinDisabled = pinnedItems.length >= pinLimit;
|
|
106
|
-
const pinTooltipLocale = useMemo(() => {
|
|
107
|
-
if (isPinDisabled) return locales["navigation.pin.limit"];
|
|
108
|
-
if (isItemPinned) return locales["navigation.unpin.tooltip"];
|
|
109
|
-
return locales["navigation.pin.tooltip"];
|
|
110
|
-
}, [
|
|
111
|
-
isItemPinned,
|
|
112
|
-
isPinDisabled,
|
|
113
|
-
locales
|
|
114
|
-
]);
|
|
115
|
-
const onDragStart = useCallback((event) => {
|
|
116
|
-
if (expanded) {
|
|
117
|
-
event.dataTransfer.setData("text/plain", JSON.stringify({
|
|
118
|
-
index,
|
|
119
|
-
label
|
|
120
|
-
}));
|
|
121
|
-
const element = event.currentTarget;
|
|
122
|
-
element.style.opacity = "0.5";
|
|
123
|
-
}
|
|
124
|
-
}, [
|
|
125
|
-
expanded,
|
|
126
|
-
index,
|
|
127
|
-
label
|
|
128
|
-
]);
|
|
129
|
-
const onDragEnd = useCallback((event) => expanded ? onDragStopTrigger(event) : void 0, [expanded]);
|
|
130
|
-
const showDraggableIcon = !noExpand && pinnedFeature && shouldShowPinnedButton && !disabled;
|
|
131
|
-
const showPinIcon = !(noExpand || disabled) && shouldShowPinnedButton && pinnedFeature;
|
|
132
|
-
const shouldHaveWeakText = !!children && !active && shouldShowPinnedButton && !disabled;
|
|
133
|
-
if (!alwaysVisible && showHide === "hide") return null;
|
|
134
|
-
if (expanded || !expanded && animation === "expand") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Stack, {
|
|
135
|
-
alignItems: categoryIcon ? "flex-start" : "center",
|
|
136
|
-
"aria-expanded": ariaExpanded,
|
|
137
|
-
as: containerTag,
|
|
138
|
-
className: cn(navigationItemContainer({
|
|
139
|
-
disabled,
|
|
140
|
-
hasActive: hasActiveChildren,
|
|
141
|
-
isActive: !!active,
|
|
142
|
-
noExpand,
|
|
143
|
-
subLabel: !!subLabel
|
|
144
|
-
}), shouldAnimate && animationType === "complex" ? navigationItemContainerAnimated[animation === "collapse" ? "collapse" : "expand"] : "", showDraggableIcon ? navigationItemShowDraggable : "", showPinIcon ? navigationItemShowPinButton : "", shouldHaveWeakText ? navigationItemWeakText : ""),
|
|
145
|
-
"data-testid": dataTestId,
|
|
146
|
-
direction: "row",
|
|
147
|
-
disabled: containerTag === "button" ? disabled : void 0,
|
|
148
|
-
draggable: type === "pinned" && expanded,
|
|
149
|
-
gap: 1,
|
|
150
|
-
href,
|
|
151
|
-
id,
|
|
152
|
-
justifyContent: "space-between",
|
|
153
|
-
onClick: triggerToggle,
|
|
154
|
-
onDragEnd,
|
|
155
|
-
onDragStart,
|
|
156
|
-
rel,
|
|
157
|
-
style,
|
|
158
|
-
target,
|
|
159
|
-
children: [/* @__PURE__ */ jsxs(Stack, {
|
|
160
|
-
alignItems: categoryIcon ? "flex-start" : "center",
|
|
161
|
-
direction: "row",
|
|
162
|
-
gap: 1,
|
|
163
|
-
justifyContent: "center",
|
|
164
|
-
children: [
|
|
165
|
-
categoryIcon ? /* @__PURE__ */ jsx(Stack, {
|
|
166
|
-
alignItems: "center",
|
|
167
|
-
className: navigationItemCategoryIcon,
|
|
168
|
-
justifyContent: "center",
|
|
169
|
-
children: categoryIcon
|
|
170
|
-
}) : null,
|
|
171
|
-
type === "pinned" && expanded ? /* @__PURE__ */ jsx(DragIcon, {
|
|
172
|
-
className: navigationItemDragIcon,
|
|
173
|
-
disabled,
|
|
174
|
-
prominence: "weak",
|
|
175
|
-
sentiment: "neutral",
|
|
176
|
-
size: "small"
|
|
177
|
-
}) : null,
|
|
178
|
-
/* @__PURE__ */ jsxs(Stack, { children: [animation ? null : /* @__PURE__ */ jsxs(Text, {
|
|
179
|
-
as: "span",
|
|
180
|
-
className: navigationItemWrapText({
|
|
181
|
-
disabled,
|
|
182
|
-
weak: hasActiveChildren && !noExpand && !disabled && !!active
|
|
183
|
-
}),
|
|
184
|
-
"data-animation": animation,
|
|
185
|
-
disabled,
|
|
186
|
-
prominence: (categoryIcon || !hasParents) && !active ? "strong" : "default",
|
|
187
|
-
sentiment: active ? "primary" : "neutral",
|
|
188
|
-
variant: "bodySmallStrong",
|
|
189
|
-
whiteSpace: "pre-wrap",
|
|
190
|
-
children: [label, labelDescription ? /* @__PURE__ */ jsx("span", {
|
|
191
|
-
className: navigationItemPadded,
|
|
192
|
-
children: labelDescription
|
|
193
|
-
}) : null]
|
|
194
|
-
}), subLabel && !animation ? /* @__PURE__ */ jsx(Text, {
|
|
195
|
-
as: "span",
|
|
196
|
-
className: navigationItemWrapText({
|
|
197
|
-
disabled,
|
|
198
|
-
weak: hasActiveChildren && !noExpand && !disabled && !!active
|
|
199
|
-
}),
|
|
200
|
-
"data-animation": animation,
|
|
201
|
-
disabled,
|
|
202
|
-
prominence: "weak",
|
|
203
|
-
sentiment: "neutral",
|
|
204
|
-
variant: "caption",
|
|
205
|
-
whiteSpace: "pre-wrap",
|
|
206
|
-
children: subLabel
|
|
207
|
-
}) : null] })
|
|
208
|
-
]
|
|
209
|
-
}), /* @__PURE__ */ jsxs(Stack, {
|
|
210
|
-
alignItems: "center",
|
|
211
|
-
direction: "row",
|
|
212
|
-
gap: href ? 1 : void 0,
|
|
213
|
-
children: [
|
|
214
|
-
badgeText || hasPinnedFeatureAndNoChildren ? /* @__PURE__ */ jsxs(Fragment, { children: [badgeText && !animation ? /* @__PURE__ */ jsx(Badge, {
|
|
215
|
-
className: navigationItemBadge,
|
|
216
|
-
disabled,
|
|
217
|
-
prominence: "strong",
|
|
218
|
-
sentiment: badgeSentiment,
|
|
219
|
-
size: "small",
|
|
220
|
-
children: badgeText
|
|
221
|
-
}) : null, shouldShowPinnedButton ? /* @__PURE__ */ jsx(Tooltip, {
|
|
222
|
-
placement: "right",
|
|
223
|
-
tabIndex: -1,
|
|
224
|
-
text: isItemPinned ? locales["navigation.unpin.tooltip"] : pinTooltipLocale,
|
|
225
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
226
|
-
className: navigationItemRelative,
|
|
227
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
228
|
-
"aria-disabled": isItemPinned ? false : isPinDisabled,
|
|
229
|
-
"aria-label": isItemPinned ? "unpin" : "pin",
|
|
230
|
-
className: navigationItemPinnedButton,
|
|
231
|
-
onClick: (event) => {
|
|
232
|
-
if (pinnedItems.length < pinLimit || isItemPinned) {
|
|
233
|
-
event.preventDefault();
|
|
234
|
-
event.stopPropagation();
|
|
235
|
-
let newValue;
|
|
236
|
-
if (isItemPinned) newValue = unpinItem(id);
|
|
237
|
-
else newValue = pinItem(id);
|
|
238
|
-
onClickPinUnpin === null || onClickPinUnpin === void 0 || onClickPinUnpin({
|
|
239
|
-
id,
|
|
240
|
-
state: isItemPinned ? "unpin" : "pin",
|
|
241
|
-
totalPinned: newValue
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
onKeyDown: () => {},
|
|
246
|
-
type: "button",
|
|
247
|
-
children: /* @__PURE__ */ jsx(PinUnpinIcon, {
|
|
248
|
-
className: navigationItemPinIcon[active ? "active" : "inactive"],
|
|
249
|
-
disabled: isItemPinned ? false : isPinDisabled,
|
|
250
|
-
sentiment: active ? "primary" : "neutral",
|
|
251
|
-
size: "medium"
|
|
252
|
-
})
|
|
253
|
-
})
|
|
254
|
-
})
|
|
255
|
-
}) : null] }) : null,
|
|
256
|
-
hasHrefAndNoChildren && target === "_blank" && !animation ? /* @__PURE__ */ jsx(OpenInNewIcon, {
|
|
257
|
-
disabled,
|
|
258
|
-
prominence: "default",
|
|
259
|
-
sentiment: "neutral"
|
|
260
|
-
}) : null,
|
|
261
|
-
children ? /* @__PURE__ */ jsx(Stack, {
|
|
262
|
-
alignItems: "center",
|
|
263
|
-
className: navigationItemStackIcon,
|
|
264
|
-
direction: "row",
|
|
265
|
-
gap: 1,
|
|
266
|
-
children: animation || noExpand ? null : /* @__PURE__ */ jsx(ArrowIcon, {
|
|
267
|
-
prominence: "weak",
|
|
268
|
-
sentiment: "neutral"
|
|
269
|
-
})
|
|
270
|
-
}) : null
|
|
271
|
-
]
|
|
272
|
-
})]
|
|
273
|
-
}), children ? /* @__PURE__ */ jsx(Fragment, { children: noExpand ? /* @__PURE__ */ jsx(ItemProvider, { children: /* @__PURE__ */ jsx(Stack, {
|
|
274
|
-
className: noExpand || type === "pinnedGroup" ? "" : navigationItemPaddingStack({ hide: shouldAnimate && animationType === "complex" && animation === "expand" }),
|
|
275
|
-
width: animation ? "100%" : void 0,
|
|
276
|
-
children
|
|
277
|
-
}) }) : /* @__PURE__ */ jsx(ItemProvider, { children: /* @__PURE__ */ jsx(Expandable, {
|
|
278
|
-
animationDuration: 0,
|
|
279
|
-
opened: internalExpanded,
|
|
280
|
-
children: /* @__PURE__ */ jsx(Stack, {
|
|
281
|
-
className: noExpand || type === "pinnedGroup" ? "" : navigationItemPaddingStack({ hide: shouldAnimate && animationType === "complex" && animation === "expand" }),
|
|
282
|
-
width: animation ? "100%" : void 0,
|
|
283
|
-
children
|
|
284
|
-
})
|
|
285
|
-
}) }) }) : null] });
|
|
286
|
-
if (categoryIcon || Children.count(children) > 0 && !hasParents) return /* @__PURE__ */ jsx(Stack, {
|
|
287
|
-
alignItems: "flex-start",
|
|
288
|
-
className: navigationItemMenuStack,
|
|
289
|
-
gap: 1,
|
|
290
|
-
justifyContent: "flex-start",
|
|
291
|
-
style,
|
|
292
|
-
children: Children.count(children) > 0 ? /* @__PURE__ */ jsx(Menu, {
|
|
293
|
-
className: navigationItemMenuContainer,
|
|
294
|
-
disclosure: /* @__PURE__ */ jsx(Button, {
|
|
295
|
-
"aria-label": label,
|
|
296
|
-
sentiment: "neutral",
|
|
297
|
-
size: "small",
|
|
298
|
-
variant: hasActiveChildren ? "filled" : "ghost",
|
|
299
|
-
children: categoryIcon ? /* @__PURE__ */ jsx(Stack, {
|
|
300
|
-
alignItems: "center",
|
|
301
|
-
direction: "row",
|
|
302
|
-
gap: 1,
|
|
303
|
-
justifyContent: "center",
|
|
304
|
-
children: categoryIcon
|
|
305
|
-
}) : null
|
|
306
|
-
}),
|
|
307
|
-
dynamicDomRendering: false,
|
|
308
|
-
placement: "right",
|
|
309
|
-
triggerMethod: "hover",
|
|
310
|
-
children: /* @__PURE__ */ jsx(ItemProvider, { children })
|
|
311
|
-
}) : /* @__PURE__ */ jsx(Tooltip, {
|
|
312
|
-
placement: "right",
|
|
313
|
-
tabIndex: -1,
|
|
314
|
-
text: label,
|
|
315
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
316
|
-
"aria-label": label,
|
|
317
|
-
sentiment: "neutral",
|
|
318
|
-
size: "small",
|
|
319
|
-
variant: active ? "filled" : "ghost",
|
|
320
|
-
children: /* @__PURE__ */ jsx(Stack, {
|
|
321
|
-
alignItems: "center",
|
|
322
|
-
direction: "row",
|
|
323
|
-
gap: 1,
|
|
324
|
-
justifyContent: "center",
|
|
325
|
-
children: categoryIcon !== null && categoryIcon !== void 0 ? categoryIcon : /* @__PURE__ */ jsx(OrganizationDashboardCategoryIcon, { variant: active ? "primary" : "neutral" })
|
|
326
|
-
})
|
|
327
|
-
})
|
|
328
|
-
})
|
|
329
|
-
});
|
|
330
|
-
if (hasParents) return /* @__PURE__ */ jsx(Menu.Item, {
|
|
331
|
-
active,
|
|
332
|
-
borderless: true,
|
|
333
|
-
className: cn(navigationItemMenu, pinnedFeature && shouldShowPinnedButton ? navigationItemMenuPinned : ""),
|
|
334
|
-
disabled,
|
|
335
|
-
href,
|
|
336
|
-
onClick: () => onToggle === null || onToggle === void 0 ? void 0 : onToggle(!!active),
|
|
337
|
-
rel,
|
|
338
|
-
sentiment: active ? "primary" : "neutral",
|
|
339
|
-
style,
|
|
340
|
-
target,
|
|
341
|
-
children: /* @__PURE__ */ jsxs(Stack, {
|
|
342
|
-
alignItems: "center",
|
|
343
|
-
direction: "row",
|
|
344
|
-
flex: 1,
|
|
345
|
-
gap: 1,
|
|
346
|
-
justifyContent: "space-between",
|
|
347
|
-
width: "100%",
|
|
348
|
-
children: [
|
|
349
|
-
animation ? null : /* @__PURE__ */ jsx(Text, {
|
|
350
|
-
as: "span",
|
|
351
|
-
className: navigationItemWrapText({
|
|
352
|
-
disabled,
|
|
353
|
-
weak: hasActiveChildren && !noExpand && !disabled && !!active
|
|
354
|
-
}),
|
|
355
|
-
variant: "bodySmall",
|
|
356
|
-
whiteSpace: "pre-wrap",
|
|
357
|
-
children: label
|
|
358
|
-
}),
|
|
359
|
-
labelDescription ? /* @__PURE__ */ jsx("span", {
|
|
360
|
-
className: navigationItemPadded,
|
|
361
|
-
children: labelDescription
|
|
362
|
-
}) : null,
|
|
363
|
-
/* @__PURE__ */ jsxs(Stack, {
|
|
364
|
-
direction: "row",
|
|
365
|
-
children: [
|
|
366
|
-
badgeText && !animation ? /* @__PURE__ */ jsx(Badge, {
|
|
367
|
-
className: navigationItemBadge,
|
|
368
|
-
disabled,
|
|
369
|
-
prominence: "strong",
|
|
370
|
-
sentiment: badgeSentiment,
|
|
371
|
-
size: "small",
|
|
372
|
-
children: badgeText
|
|
373
|
-
}) : null,
|
|
374
|
-
hasHrefAndNoChildren && target === "_blank" ? /* @__PURE__ */ jsx(OpenInNewIcon, {
|
|
375
|
-
className: shouldAnimate && animationType === "complex" ? navigationItemAnimatedIcon[animation === "expand" ? "expand" : "collapse"] : "",
|
|
376
|
-
disabled,
|
|
377
|
-
prominence: "weak",
|
|
378
|
-
sentiment: "neutral"
|
|
379
|
-
}) : null,
|
|
380
|
-
shouldShowPinnedButton ? /* @__PURE__ */ jsx(Tooltip, {
|
|
381
|
-
placement: "right",
|
|
382
|
-
text: isItemPinned ? locales["navigation.unpin.tooltip"] : pinTooltipLocale,
|
|
383
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
384
|
-
className: navigationItemRelative,
|
|
385
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
386
|
-
"aria-disabled": isItemPinned ? false : isPinDisabled,
|
|
387
|
-
"aria-label": isItemPinned ? "unpin" : "pin",
|
|
388
|
-
className: navigationItemPinnedButton,
|
|
389
|
-
onClick: (event) => {
|
|
390
|
-
if (pinnedItems.length < pinLimit || isItemPinned) {
|
|
391
|
-
event.preventDefault();
|
|
392
|
-
event.stopPropagation();
|
|
393
|
-
let newValue;
|
|
394
|
-
if (isItemPinned) newValue = unpinItem(id);
|
|
395
|
-
else newValue = pinItem(id);
|
|
396
|
-
onClickPinUnpin === null || onClickPinUnpin === void 0 || onClickPinUnpin({
|
|
397
|
-
id,
|
|
398
|
-
state: isItemPinned ? "unpin" : "pin",
|
|
399
|
-
totalPinned: newValue
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
},
|
|
403
|
-
onKeyDown: () => {},
|
|
404
|
-
type: "button",
|
|
405
|
-
children: /* @__PURE__ */ jsx(PinUnpinIcon, {
|
|
406
|
-
className: navigationItemPinIcon[active ? "active" : "inactive"],
|
|
407
|
-
disabled: isItemPinned ? false : isPinDisabled,
|
|
408
|
-
sentiment: active ? "primary" : "neutral",
|
|
409
|
-
size: "medium"
|
|
410
|
-
})
|
|
411
|
-
})
|
|
412
|
-
})
|
|
413
|
-
}) : null
|
|
414
|
-
]
|
|
415
|
-
})
|
|
416
|
-
]
|
|
417
|
-
})
|
|
418
|
-
});
|
|
419
|
-
if (!hasParents && href) return /* @__PURE__ */ jsx(Tooltip, {
|
|
420
|
-
placement: "right",
|
|
421
|
-
text: label,
|
|
422
|
-
children: /* @__PURE__ */ jsx(Stack, {
|
|
423
|
-
alignItems: "flex-start",
|
|
424
|
-
className: navigationItemMenuStack,
|
|
425
|
-
gap: 1,
|
|
426
|
-
justifyContent: "flex-start",
|
|
427
|
-
children: /* @__PURE__ */ jsx(Stack, {
|
|
428
|
-
alignItems: "center",
|
|
429
|
-
as: containerTag,
|
|
430
|
-
className: cn(navigationItemContainer({ disabled }), shouldAnimate && animationType === "complex" ? navigationItemContainerAnimated[animation === "collapse" ? "collapse" : "expand"] : ""),
|
|
431
|
-
gap: 1,
|
|
432
|
-
href,
|
|
433
|
-
justifyContent: "center",
|
|
434
|
-
rel,
|
|
435
|
-
target,
|
|
436
|
-
children: /* @__PURE__ */ jsx(OpenInNewIcon, {
|
|
437
|
-
className: shouldAnimate && animationType === "complex" ? navigationItemAnimatedIcon[animation === "expand" ? "expand" : "collapse"] : "",
|
|
438
|
-
prominence: "weak",
|
|
439
|
-
sentiment: "neutral"
|
|
440
|
-
})
|
|
441
|
-
})
|
|
442
|
-
})
|
|
443
|
-
});
|
|
444
|
-
return null;
|
|
445
|
-
});
|
|
446
|
-
|
|
447
|
-
//#endregion
|
|
448
|
-
export { Item };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
export declare const ItemContext: import("react").Context<boolean>;
|
|
3
|
-
type ItemProviderProps = {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
};
|
|
6
|
-
export declare const ItemProvider: ({ children }: ItemProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=ItemProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ItemProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/Navigation/components/ItemProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,eAAO,MAAM,WAAW,kCAAuB,CAAA;AAE/C,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,YAAY,8EAIxB,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { __name } from "../../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { createContext, useMemo } from "react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
6
|
-
//#region src/components/Navigation/components/ItemProvider.tsx
|
|
7
|
-
const ItemContext = createContext(false);
|
|
8
|
-
const ItemProvider = ({ children }) => {
|
|
9
|
-
const value = useMemo(() => true, []);
|
|
10
|
-
return /* @__PURE__ */ jsx(ItemContext.Provider, {
|
|
11
|
-
value,
|
|
12
|
-
children
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
//#endregion
|
|
17
|
-
export { ItemContext, ItemProvider };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties, ReactElement } from 'react';
|
|
2
|
-
type PinnedItemsProps = {
|
|
3
|
-
/**
|
|
4
|
-
* This prop is used to control if the item is expanded or collapsed
|
|
5
|
-
*/
|
|
6
|
-
toggle?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* This function will be triggered on click of the item. If the item is expandable
|
|
9
|
-
* toggle will be passed with it.
|
|
10
|
-
*/
|
|
11
|
-
onToggle?: (toggle: boolean) => void;
|
|
12
|
-
/**
|
|
13
|
-
* This function will be called when the user reorder the pinned items
|
|
14
|
-
*/
|
|
15
|
-
onReorder?: (pinnedItems: string[]) => void;
|
|
16
|
-
/**
|
|
17
|
-
* Use this prop if it is needed to wrap each PinnedItem component into another component (eg NavLink)
|
|
18
|
-
*/
|
|
19
|
-
itemWrapper?: (item: ReactElement, itemId: string) => ReactElement;
|
|
20
|
-
style?: CSSProperties;
|
|
21
|
-
};
|
|
22
|
-
export declare const PinnedItems: ({ toggle, onReorder, onToggle, itemWrapper, style, }: PinnedItemsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=PinnedItems.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PinnedItems.d.ts","sourceRoot":"","sources":["../../../../src/components/Navigation/components/PinnedItems.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAa,YAAY,EAAE,MAAM,OAAO,CAAA;AAWnE,KAAK,gBAAgB,GAAG;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IAC3C;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,YAAY,CAAA;IAClE,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,WAAW,4HAiJvB,CAAA"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { __name } from "../../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js";
|
|
4
|
-
import { useNavigation } from "../NavigationProvider.js";
|
|
5
|
-
import { navigationPinnedItemContainer, navigationPinnedItemDropableArea, navigationPinnedItemRelativeDiv } from "./styles.css.js";
|
|
6
|
-
import { Item } from "./Item.js";
|
|
7
|
-
import { Text } from "@ultraviolet/ui";
|
|
8
|
-
import { useCallback } from "react";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { PinCategoryIcon } from "@ultraviolet/icons/category";
|
|
11
|
-
import { useTheme } from "@ultraviolet/themes";
|
|
12
|
-
|
|
13
|
-
//#region src/components/Navigation/components/PinnedItems.tsx
|
|
14
|
-
const PinnedItems = ({ toggle = true, onReorder, onToggle, itemWrapper, style }) => {
|
|
15
|
-
const context = useNavigation();
|
|
16
|
-
if (!context) throw new Error("Navigation.PinnedItems can only be used inside a NavigationProvider.");
|
|
17
|
-
const { locales, pinnedItems, pinnedFeature, reorderItems, expanded, items, animation, showHide } = context;
|
|
18
|
-
const theme = useTheme();
|
|
19
|
-
const onDrop = useCallback((event, index) => {
|
|
20
|
-
event.preventDefault();
|
|
21
|
-
if (event === null || event === void 0 ? void 0 : event.dataTransfer) {
|
|
22
|
-
event.currentTarget.style.borderColor = "transparent";
|
|
23
|
-
const data = JSON.parse(event.dataTransfer.getData("text"));
|
|
24
|
-
if (data.index === index - 1 || index > data.index) {
|
|
25
|
-
const newItems = reorderItems(data.index, index - 1);
|
|
26
|
-
onReorder === null || onReorder === void 0 || onReorder(newItems);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const newItems = reorderItems(data.index, index);
|
|
30
|
-
onReorder === null || onReorder === void 0 || onReorder(newItems);
|
|
31
|
-
}
|
|
32
|
-
}, [onReorder, reorderItems]);
|
|
33
|
-
const onDragOver = useCallback((event) => {
|
|
34
|
-
event.preventDefault();
|
|
35
|
-
event.currentTarget.style.borderColor = theme.colors.primary.border;
|
|
36
|
-
}, [theme.colors.primary.border]);
|
|
37
|
-
const onDragLeave = useCallback((event) => {
|
|
38
|
-
event.preventDefault();
|
|
39
|
-
event.currentTarget.style.borderColor = "transparent";
|
|
40
|
-
}, []);
|
|
41
|
-
if (Object.keys(items).length === 0) return null;
|
|
42
|
-
if (pinnedFeature && showHide !== "hide") return /* @__PURE__ */ jsx("div", {
|
|
43
|
-
style: _objectSpread2({ width: animation ? "100%" : void 0 }, style),
|
|
44
|
-
children: /* @__PURE__ */ jsxs(Item, {
|
|
45
|
-
categoryIcon: /* @__PURE__ */ jsx(PinCategoryIcon, { variant: "neutral" }),
|
|
46
|
-
"data-testid": "pinned-group",
|
|
47
|
-
id: "pinned-group",
|
|
48
|
-
label: locales["navigation.pinned.item.group.label"],
|
|
49
|
-
onToggle,
|
|
50
|
-
toggle,
|
|
51
|
-
type: "pinnedGroup",
|
|
52
|
-
children: [pinnedItems.length > 0 ? pinnedItems.map((itemId, index) => {
|
|
53
|
-
var _items$itemId;
|
|
54
|
-
if ((_items$itemId = items[itemId]) === null || _items$itemId === void 0 ? void 0 : _items$itemId.label) {
|
|
55
|
-
var _items$itemId$active;
|
|
56
|
-
var _items$itemId2;
|
|
57
|
-
var _items$itemId$onClick;
|
|
58
|
-
var _items$itemId3;
|
|
59
|
-
var _items$itemId4;
|
|
60
|
-
const itemElement = /* @__PURE__ */ jsx(Item, {
|
|
61
|
-
active: (_items$itemId$active = (_items$itemId2 = items[itemId]) === null || _items$itemId2 === void 0 ? void 0 : _items$itemId2.active) !== null && _items$itemId$active !== void 0 ? _items$itemId$active : false,
|
|
62
|
-
id: itemId,
|
|
63
|
-
index,
|
|
64
|
-
label: items[itemId].label,
|
|
65
|
-
onClickPinUnpin: (_items$itemId$onClick = (_items$itemId3 = items[itemId]) === null || _items$itemId3 === void 0 ? void 0 : _items$itemId3.onClickPinUnpin) !== null && _items$itemId$onClick !== void 0 ? _items$itemId$onClick : void 0,
|
|
66
|
-
onToggle: (_items$itemId4 = items[itemId]) === null || _items$itemId4 === void 0 ? void 0 : _items$itemId4.onToggle,
|
|
67
|
-
toggle,
|
|
68
|
-
type: "pinned"
|
|
69
|
-
}, itemId);
|
|
70
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
71
|
-
className: navigationPinnedItemRelativeDiv,
|
|
72
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
73
|
-
className: navigationPinnedItemDropableArea,
|
|
74
|
-
onDragLeave,
|
|
75
|
-
onDragOver,
|
|
76
|
-
onDrop: (event) => onDrop(event, index)
|
|
77
|
-
}), itemWrapper ? itemWrapper(itemElement, itemId) : itemElement]
|
|
78
|
-
}, itemId);
|
|
79
|
-
}
|
|
80
|
-
return null;
|
|
81
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
82
|
-
className: navigationPinnedItemContainer({ expanded }),
|
|
83
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
84
|
-
as: "p",
|
|
85
|
-
prominence: "weak",
|
|
86
|
-
sentiment: "neutral",
|
|
87
|
-
variant: "caption",
|
|
88
|
-
children: locales["navigation.pinned.item.group.empty"]
|
|
89
|
-
})
|
|
90
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
91
|
-
className: navigationPinnedItemRelativeDiv,
|
|
92
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
93
|
-
className: navigationPinnedItemDropableArea,
|
|
94
|
-
onDragLeave,
|
|
95
|
-
onDragOver,
|
|
96
|
-
onDrop: (event) => onDrop(event, pinnedItems.length)
|
|
97
|
-
})
|
|
98
|
-
})]
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
return null;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
//#endregion
|
|
105
|
-
export { PinnedItems };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Separator.d.ts","sourceRoot":"","sources":["../../../../src/components/Navigation/components/Separator.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,+CAAwD,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { __name } from "../../../_virtual/_rolldown/runtime.js";
|
|
3
|
-
import { navigationSeparator } from "./styles.css.js";
|
|
4
|
-
import { Separator } from "@ultraviolet/ui";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
//#region src/components/Navigation/components/Separator.tsx
|
|
8
|
-
const Separator$1 = /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx(Separator, { className: navigationSeparator }), "Separator");
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
export { Separator$1 as Separator };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
type ShowAllProp = {
|
|
3
|
-
showContent: ReactNode;
|
|
4
|
-
hideContent: ReactNode;
|
|
5
|
-
onShowHide?: (expanded: 'show' | 'hide') => void;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Add a tooltip to display on hover when the navigation is not-exanped
|
|
9
|
-
*/
|
|
10
|
-
tooltip?: string;
|
|
11
|
-
'data-testid'?: string;
|
|
12
|
-
style?: CSSProperties;
|
|
13
|
-
};
|
|
14
|
-
export declare const ShowHide: import("react").MemoExoticComponent<({ showContent, hideContent, onShowHide, tooltip, 'data-testid': dataTestId, style, }: ShowAllProp) => import("react/jsx-runtime").JSX.Element>;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=ShowHide.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ShowHide.d.ts","sourceRoot":"","sources":["../../../../src/components/Navigation/components/ShowHide.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKrD,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,SAAS,CAAA;IACtB,WAAW,EAAE,SAAS,CAAA;IACtB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAA;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,qLAgEpB,CAAA"}
|