@lt-ui/uikit 0.0.1 → 0.0.3
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/_internal/base-button/styles.module.css +1 -1
- package/_internal/field/_motion.css +0 -0
- package/_internal/field/field.module.css +21 -23
- package/_internal/floating/use-floating.d.ts +1 -1
- package/_internal/floating/use-floating.js +6 -2
- package/_internal/picker/picker-field.module.css +1 -1
- package/_internal/picker/picker-sheet.module.css +1 -1
- package/accordion/styles.module.css +3 -4
- package/alert/styles/alert.module.css +8 -8
- package/avatar/avatar-group.module.css +1 -1
- package/avatar/styles.module.css +3 -3
- package/badge/styles.module.css +3 -3
- package/breadcrumbs/styles.module.css +4 -4
- package/button/styles.module.css +7 -7
- package/calendar/styles.module.css +11 -11
- package/caption/styles.module.css +1 -1
- package/checkbox/styles/style.module.css +10 -12
- package/chip/styles.module.css +3 -3
- package/cjs/_internal/base-button/styles.module.css +1 -1
- package/cjs/_internal/field/_motion.css +0 -0
- package/cjs/_internal/field/field.module.css +21 -23
- package/cjs/_internal/floating/use-floating.js +6 -2
- package/cjs/_internal/picker/picker-field.module.css +1 -1
- package/cjs/_internal/picker/picker-sheet.module.css +1 -1
- package/cjs/accordion/styles.module.css +3 -4
- package/cjs/alert/styles/alert.module.css +8 -8
- package/cjs/avatar/avatar-group.module.css +1 -1
- package/cjs/avatar/styles.module.css +3 -3
- package/cjs/badge/styles.module.css +3 -3
- package/cjs/breadcrumbs/styles.module.css +4 -4
- package/cjs/button/styles.module.css +7 -7
- package/cjs/calendar/styles.module.css +11 -11
- package/cjs/caption/styles.module.css +1 -1
- package/cjs/checkbox/styles/style.module.css +10 -12
- package/cjs/chip/styles.module.css +3 -3
- package/cjs/date-picker/styles.module.css +10 -10
- package/cjs/drawer/styles.module.css +10 -12
- package/cjs/file/styles.module.css +3 -4
- package/cjs/hint/styles/buttons.module.css +2 -2
- package/cjs/hint/styles/hint-content.module.css +3 -3
- package/cjs/hint/styles/hint.module.css +2 -2
- package/cjs/image/image-viewer.js +3 -13
- package/cjs/image/image.js +4 -27
- package/cjs/image/use-image-preview.js +32 -0
- package/cjs/image/use-image-viewer.js +21 -0
- package/cjs/image/viewer.module.css +1 -1
- package/cjs/list/list-divider/styles.module.css +2 -2
- package/cjs/list/list-item/styles.module.css +2 -2
- package/cjs/list/list-section/styles.module.css +4 -4
- package/cjs/modal/modal.js +4 -10
- package/cjs/modal/styles/_animations.css +2 -2
- package/cjs/modal/styles/modal-footer.module.css +3 -3
- package/cjs/modal/styles/modal-header.module.css +5 -5
- package/cjs/modal/styles/modal.module.css +9 -4
- package/cjs/modal/use-modal.js +15 -1
- package/cjs/navigation/navigation-compact.js +2 -30
- package/cjs/navigation/navigation-row.js +5 -65
- package/cjs/navigation/navigation-views.js +3 -57
- package/cjs/navigation/navigation.js +2 -1
- package/cjs/navigation/styles/navigation.module.css +98 -81
- package/cjs/navigation/use-navigation-flyout.js +39 -0
- package/cjs/navigation/use-navigation-panel-stages.js +23 -0
- package/cjs/navigation/use-navigation-row.js +39 -0
- package/cjs/pagination/styles.module.css +2 -2
- package/cjs/pin-input/styles.module.css +2 -2
- package/cjs/progress-bar/styles.module.css +1 -1
- package/cjs/quantity-input/styles.module.css +3 -3
- package/cjs/radio/styles.module.css +4 -5
- package/cjs/radio-group/styles.module.css +1 -1
- package/cjs/segmented-control/styles/segmented-control-item.module.css +9 -9
- package/cjs/segmented-control/styles/segmented-control.module.css +4 -4
- package/cjs/select/components/select-field-multiselect-value.js +2 -2
- package/cjs/select/components/select-field.js +8 -6
- package/cjs/select/components/select-multiselect-panel.js +9 -67
- package/cjs/select/components/select-option-row.js +7 -53
- package/cjs/select/hooks/use-select-multiselect-panel-layout.js +53 -0
- package/cjs/select/hooks/use-select-option-row.js +23 -0
- package/cjs/select/hooks/use-select-view-model.js +3 -1
- package/cjs/select/styles/select-field.module.css +20 -1
- package/cjs/select/styles/select.module.css +2 -2
- package/cjs/select/views/select-view.js +4 -4
- package/cjs/select/views/styles.module.css +1 -1
- package/cjs/snackbar/snack-view.js +9 -42
- package/cjs/snackbar/styles/snack.module.css +1 -1
- package/cjs/snackbar/use-snack-view.js +16 -0
- package/cjs/switch/styles/base.module.css +2 -2
- package/cjs/tabs/styles/tab-list.module.css +1 -1
- package/cjs/tabs/styles/tab.module.css +6 -6
- package/cjs/tabs/tab-list.js +2 -20
- package/cjs/tabs/tab-panel.js +4 -39
- package/cjs/tabs/use-tab-list-navigation.js +27 -0
- package/cjs/tabs/use-tab-panel.js +12 -0
- package/cjs/textarea/styles.module.css +1 -1
- package/cjs/theme-provider/styles.module.css +6 -6
- package/cjs/time-picker/styles.module.css +9 -9
- package/cjs/time-picker/time-panel.js +2 -47
- package/cjs/time-picker/use-time-column-list.js +48 -0
- package/cjs/tooltip/tooltip.js +1 -1
- package/cjs/tree/styles.module.css +5 -5
- package/cjs/tree/tree-row.js +13 -73
- package/cjs/tree/tree-select.module.css +2 -2
- package/cjs/tree/use-tree-row.js +102 -0
- package/cjs/utils/class-names.js +3 -1
- package/date-picker/styles.module.css +10 -10
- package/drawer/styles.module.css +10 -12
- package/file/styles.module.css +3 -4
- package/hint/styles/buttons.module.css +2 -2
- package/hint/styles/hint-content.module.css +3 -3
- package/hint/styles/hint.module.css +2 -2
- package/image/image-viewer.js +3 -13
- package/image/image.js +5 -28
- package/image/use-image-preview.d.ts +10 -0
- package/image/use-image-preview.js +29 -0
- package/image/use-image-viewer.d.ts +8 -0
- package/image/use-image-viewer.js +18 -0
- package/image/viewer.module.css +1 -1
- package/input/fields/use-text-field.d.ts +2 -0
- package/list/list-divider/styles.module.css +2 -2
- package/list/list-item/styles.module.css +2 -2
- package/list/list-section/styles.module.css +4 -4
- package/masked-input/use-mask.d.ts +2 -0
- package/modal/modal.d.ts +1 -0
- package/modal/modal.js +4 -10
- package/modal/styles/_animations.css +2 -2
- package/modal/styles/modal-footer.module.css +3 -3
- package/modal/styles/modal-header.module.css +5 -5
- package/modal/styles/modal.module.css +9 -4
- package/modal/types.d.ts +5 -0
- package/modal/use-modal.d.ts +3 -1
- package/modal/use-modal.js +17 -3
- package/navigation/navigation-compact.d.ts +1 -2
- package/navigation/navigation-compact.js +3 -31
- package/navigation/navigation-row.d.ts +1 -2
- package/navigation/navigation-row.js +6 -33
- package/navigation/navigation-views.js +3 -24
- package/navigation/navigation.d.ts +1 -0
- package/navigation/navigation.js +2 -1
- package/navigation/styles/navigation.module.css +98 -81
- package/navigation/types.d.ts +3 -2
- package/navigation/use-navigation-flyout.d.ts +9 -0
- package/navigation/use-navigation-flyout.js +36 -0
- package/navigation/use-navigation-panel-stages.d.ts +5 -0
- package/navigation/use-navigation-panel-stages.js +20 -0
- package/navigation/use-navigation-row.d.ts +16 -0
- package/navigation/use-navigation-row.js +36 -0
- package/number-input/use-number-input.d.ts +2 -0
- package/package.json +6 -2
- package/pagination/styles.module.css +2 -2
- package/pin-input/styles.module.css +2 -2
- package/popover/types.d.ts +2 -2
- package/progress-bar/styles.module.css +1 -1
- package/quantity-input/styles.module.css +3 -3
- package/radio/styles.module.css +4 -5
- package/radio-group/styles.module.css +1 -1
- package/scss/_functions.scss +12 -24
- package/scss/_grid.scss +2 -2
- package/scss/_index.scss +1 -6
- package/scss/_interaction.scss +3 -3
- package/scss/_mixins.scss +5 -51
- package/scss/_tokens.generated.scss +578 -0
- package/scss/_tokens.scss +2 -396
- package/scss/_typography.scss +0 -1
- package/segmented-control/styles/segmented-control-item.module.css +9 -9
- package/segmented-control/styles/segmented-control.module.css +4 -4
- package/select/components/select-field-multiselect-value.d.ts +1 -0
- package/select/components/select-field-multiselect-value.js +2 -2
- package/select/components/select-field.d.ts +3 -1
- package/select/components/select-field.js +8 -6
- package/select/components/select-multiselect-panel.d.ts +3 -1
- package/select/components/select-multiselect-panel.js +8 -66
- package/select/components/select-option-row.js +7 -20
- package/select/hooks/use-select-multiselect-panel-layout.d.ts +14 -0
- package/select/hooks/use-select-multiselect-panel-layout.js +49 -0
- package/select/hooks/use-select-option-row.d.ts +13 -0
- package/select/hooks/use-select-option-row.js +20 -0
- package/select/hooks/use-select-view-model.d.ts +4 -2
- package/select/hooks/use-select-view-model.js +3 -1
- package/select/select.d.ts +3 -2
- package/select/styles/select-field.module.css +20 -1
- package/select/styles/select.module.css +2 -2
- package/select/types.d.ts +6 -3
- package/select/views/select-view.js +4 -4
- package/select/views/styles.module.css +1 -1
- package/snackbar/snack-view.js +7 -7
- package/snackbar/styles/snack.module.css +1 -1
- package/snackbar/use-snack-view.d.ts +8 -0
- package/snackbar/use-snack-view.js +13 -0
- package/switch/styles/base.module.css +2 -2
- package/tabs/styles/tab-list.module.css +1 -1
- package/tabs/styles/tab.module.css +6 -6
- package/tabs/tab-list.js +4 -22
- package/tabs/tab-panel.js +4 -6
- package/tabs/use-tab-list-navigation.d.ts +2 -0
- package/tabs/use-tab-list-navigation.js +24 -0
- package/tabs/use-tab-panel.d.ts +6 -0
- package/tabs/use-tab-panel.js +9 -0
- package/textarea/styles.module.css +1 -1
- package/theme-provider/styles.module.css +6 -6
- package/time-picker/styles.module.css +9 -9
- package/time-picker/time-panel.js +2 -47
- package/time-picker/use-time-column-list.d.ts +7 -0
- package/time-picker/use-time-column-list.js +45 -0
- package/tooltip/tooltip.js +1 -1
- package/tree/styles.module.css +5 -5
- package/tree/tree-row.js +15 -75
- package/tree/tree-select.module.css +2 -2
- package/tree/use-tree-row.d.ts +331 -0
- package/tree/use-tree-row.js +99 -0
- package/utils/class-names.d.ts +1 -1
- package/utils/class-names.js +3 -1
|
@@ -1,38 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
5
|
};
|
|
@@ -40,47 +7,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
7
|
exports.NavigationRow = NavigationRow;
|
|
41
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
42
9
|
const clsx_1 = __importDefault(require("clsx"));
|
|
43
|
-
const react_1 =
|
|
44
|
-
const use_locale_1 = require("../locale/use-locale");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
45
11
|
const context_1 = require("./context");
|
|
46
12
|
const navigation_compact_1 = require("./navigation-compact");
|
|
47
13
|
const navigation_list_1 = require("./navigation-list");
|
|
48
|
-
const
|
|
49
|
-
const utils_1 = require("./utils");
|
|
14
|
+
const use_navigation_row_1 = require("./use-navigation-row");
|
|
50
15
|
const navigation_module_scss_1 = __importDefault(require("./styles/navigation.module.css"));
|
|
51
16
|
const MoreIcon = () => ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "currentColor", "aria-hidden": true, focusable: "false", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "5", cy: "12", r: "2" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "2" }), (0, jsx_runtime_1.jsx)("circle", { cx: "19", cy: "12", r: "2" })] }));
|
|
52
17
|
/** Плоский ряд пунктов (шапка или нижняя панель); не поместившиеся пункты уходят в «Ещё» */
|
|
53
18
|
function NavigationRow({ entries, variant, }) {
|
|
54
|
-
const { t } = (0, use_locale_1.useLocale)();
|
|
55
|
-
const { value } = (0, context_1.useNavigationContext)('NavigationRow');
|
|
56
19
|
const classNames = (0, context_1.useNavigationClassNames)();
|
|
57
|
-
const listRef = (0,
|
|
58
|
-
const
|
|
59
|
-
// В шапке пункты `placement: 'end'` стоят у правого края; на нижней панели порядок не меняется
|
|
60
|
-
const links = variant === 'bar'
|
|
61
|
-
? [...flat.filter(link => link.placement !== 'end'), ...flat.filter(link => link.placement === 'end')]
|
|
62
|
-
: flat;
|
|
63
|
-
// На нижней панели помещается не больше 5 разделов: остальное сразу в «Ещё»
|
|
64
|
-
const limit = variant === 'bottom' ? 5 : Infinity;
|
|
65
|
-
const base = links.length > limit ? links.length - (limit - 1) : 0;
|
|
66
|
-
const hidden = (0, use_overflow_1.useOverflow)({ listRef, base, max: Math.max(links.length - 1, 0), total: links.length });
|
|
67
|
-
const visibleLinks = hidden > 0 ? links.slice(0, links.length - hidden) : links;
|
|
68
|
-
const hiddenLinks = hidden > 0 ? links.slice(links.length - hidden) : [];
|
|
69
|
-
const more = {
|
|
70
|
-
key: '__more',
|
|
71
|
-
label: t('navigation.more'),
|
|
72
|
-
icon: (0, jsx_runtime_1.jsx)(MoreIcon, {}),
|
|
73
|
-
children: hiddenLinks,
|
|
74
|
-
};
|
|
75
|
-
const moreSelected = hiddenLinks.some(link => link.key === value || hasKey(link, value));
|
|
20
|
+
const { listRef, visibleLinks, hiddenLinks, more, moreSelected } = (0, use_navigation_row_1.useNavigationRow)({ entries, variant });
|
|
21
|
+
const moreItem = { ...more, icon: (0, jsx_runtime_1.jsx)(MoreIcon, {}) };
|
|
76
22
|
return ((0, jsx_runtime_1.jsxs)(navigation_list_1.NavigationList, { orientation: "horizontal", className: (0, clsx_1.default)(navigation_module_scss_1.default.row, navigation_module_scss_1.default[`${variant}List`], classNames.list), ref: listRef, children: [visibleLinks.map((link, index) => {
|
|
77
23
|
var _a;
|
|
78
24
|
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [variant === 'bar' && link.placement === 'end' && ((_a = visibleLinks[index - 1]) === null || _a === void 0 ? void 0 : _a.placement) !== 'end' && ((0, jsx_runtime_1.jsx)("li", { "aria-hidden": true, className: navigation_module_scss_1.default.spacer })), (0, jsx_runtime_1.jsx)(navigation_compact_1.NavigationCompactItem, { item: link, variant: variant })] }, link.key));
|
|
79
|
-
}), hiddenLinks.length > 0 && ((0, jsx_runtime_1.jsx)(navigation_compact_1.NavigationCompactItem, { item:
|
|
80
|
-
}
|
|
81
|
-
function hasKey(item, key) {
|
|
82
|
-
var _a;
|
|
83
|
-
if (key === null)
|
|
84
|
-
return false;
|
|
85
|
-
return ((_a = item.children) !== null && _a !== void 0 ? _a : []).some(child => (0, utils_1.isLinkItem)(child) && (child.key === key || hasKey(child, key)));
|
|
25
|
+
}), hiddenLinks.length > 0 && ((0, jsx_runtime_1.jsx)(navigation_compact_1.NavigationCompactItem, { item: moreItem, variant: variant, forceInPath: moreSelected }))] }));
|
|
86
26
|
}
|
|
@@ -1,38 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
5
|
};
|
|
@@ -42,7 +9,7 @@ exports.NavigationPanel = NavigationPanel;
|
|
|
42
9
|
exports.NavigationDrawer = NavigationDrawer;
|
|
43
10
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
44
11
|
const clsx_1 = __importDefault(require("clsx"));
|
|
45
|
-
const react_1 =
|
|
12
|
+
const react_1 = __importDefault(require("react"));
|
|
46
13
|
const theme_context_1 = require("../theme-provider/theme-context");
|
|
47
14
|
const button_1 = require("../button");
|
|
48
15
|
const compat_1 = require("../_internal/compat");
|
|
@@ -56,40 +23,19 @@ const context_1 = require("./context");
|
|
|
56
23
|
const navigation_rail_1 = require("./navigation-rail");
|
|
57
24
|
const navigation_list_1 = require("./navigation-list");
|
|
58
25
|
const navigation_tree_1 = require("./navigation-tree");
|
|
26
|
+
const use_navigation_panel_stages_1 = require("./use-navigation-panel-stages");
|
|
59
27
|
const utils_1 = require("./utils");
|
|
60
28
|
const navigation_module_scss_1 = __importDefault(require("./styles/navigation.module.css"));
|
|
61
29
|
const BranchesClosedProvider = (0, compat_1.contextProvider)(context_1.NavigationBranchesClosedContext);
|
|
62
30
|
const renderSlot = (slot, state) => typeof slot === 'function' ? slot(state) : slot;
|
|
63
31
|
exports.renderSlot = renderSlot;
|
|
64
32
|
const BurgerIcon = () => ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "currentColor", "aria-hidden": true, focusable: "false", children: [(0, jsx_runtime_1.jsx)("rect", { x: "3", y: "6", width: "18", height: "2", rx: "1" }), (0, jsx_runtime_1.jsx)("rect", { x: "3", y: "11", width: "18", height: "2", rx: "1" }), (0, jsx_runtime_1.jsx)("rect", { x: "3", y: "16", width: "18", height: "2", rx: "1" })] }));
|
|
65
|
-
// Ширина панели меняется за 200 мс (CSS), вложенные пункты ждут её окончания
|
|
66
|
-
const WIDTH_MS = 220;
|
|
67
|
-
/**
|
|
68
|
-
* Смена рейки и панели в две стадии, без рывка: разворачиваем — сначала ширина, потом раскрываются ветки;
|
|
69
|
-
* сворачиваем — ветки закрываются одновременно с сужением, и только потом рисуется рейка.
|
|
70
|
-
* Анимации делает CSS (ширина, высота `CollapseBox`), здесь только два флага с таймером.
|
|
71
|
-
*/
|
|
72
|
-
function useRailStages(rail) {
|
|
73
|
-
const [railSettled, setRailSettled] = (0, react_1.useState)(rail);
|
|
74
|
-
const [branchesOpen, setBranchesOpen] = (0, react_1.useState)(!rail);
|
|
75
|
-
(0, react_1.useEffect)(() => {
|
|
76
|
-
if (rail) {
|
|
77
|
-
setBranchesOpen(false);
|
|
78
|
-
const timer = setTimeout(() => setRailSettled(true), WIDTH_MS);
|
|
79
|
-
return () => clearTimeout(timer);
|
|
80
|
-
}
|
|
81
|
-
setRailSettled(false);
|
|
82
|
-
const timer = setTimeout(() => setBranchesOpen(true), WIDTH_MS);
|
|
83
|
-
return () => clearTimeout(timer);
|
|
84
|
-
}, [rail]);
|
|
85
|
-
return { showRail: rail && railSettled, branchesClosed: !branchesOpen };
|
|
86
|
-
}
|
|
87
33
|
/** Вертикальная панель или рейка: шапка, прокручиваемый список, подвал и кнопка сворачивания */
|
|
88
34
|
function NavigationPanel({ items, state, header, footer, slotState, collapsible, }) {
|
|
89
35
|
const { t } = (0, use_locale_1.useLocale)();
|
|
90
36
|
const classNames = (0, context_1.useNavigationClassNames)();
|
|
91
37
|
const rail = state.layout === 'rail';
|
|
92
|
-
const { showRail, branchesClosed } =
|
|
38
|
+
const { showRail, branchesClosed } = (0, use_navigation_panel_stages_1.useNavigationPanelStages)(rail);
|
|
93
39
|
const { start, end } = (0, utils_1.splitByPlacement)(items);
|
|
94
40
|
const panelHeader = (0, exports.renderSlot)(header, slotState);
|
|
95
41
|
const panelFooter = (0, exports.renderSlot)(footer, slotState);
|
|
@@ -73,7 +73,7 @@ const ClassNamesProvider = (0, compat_1.contextProvider)(context_1.NavigationCla
|
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
75
|
exports.Navigation = (0, compat_1.withRef)(function Navigation(props, ref) {
|
|
76
|
-
const { items, orientation = 'vertical', size = 'm', collapsible = true, breakpoint = 'lg', mobile = 'drawer', mobileBreakpoint = 'sm', layout: layoutProp, onLayoutChange, persistKey, submenuTrigger = 'click', nestedIndicator = true, indicator = 'line', container, drawerFullscreen, drawerSide, renderLink, header, footer, theme, classNames: classNamesProp, className, value, defaultValue, onUpdate, openKeys, defaultOpenKeys, onOpenChange, branchesOnExpand, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, 'aria-label': ariaLabel, ...rest } = props;
|
|
76
|
+
const { items, orientation = 'vertical', size = 'm', labelLines = 1, collapsible = true, breakpoint = 'lg', mobile = 'drawer', mobileBreakpoint = 'sm', layout: layoutProp, onLayoutChange, persistKey, submenuTrigger = 'click', nestedIndicator = true, indicator = 'line', container, drawerFullscreen, drawerSide, renderLink, header, footer, theme, classNames: classNamesProp, className, value, defaultValue, onUpdate, openKeys, defaultOpenKeys, onOpenChange, branchesOnExpand, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, 'aria-label': ariaLabel, ...rest } = props;
|
|
77
77
|
const { t } = (0, use_locale_1.useLocale)();
|
|
78
78
|
const baseId = (0, hooks_1.useUniqID)(5, 'navigation');
|
|
79
79
|
const classNames = (0, utils_1.useClassNames)('Navigation', classNamesProp);
|
|
@@ -123,6 +123,7 @@ exports.Navigation = (0, compat_1.withRef)(function Navigation(props, ref) {
|
|
|
123
123
|
'data-lt-ui': 'navigation',
|
|
124
124
|
'data-layout': layout,
|
|
125
125
|
'data-size': size,
|
|
126
|
+
'data-label-lines': labelLines,
|
|
126
127
|
'data-lt-ui-theme': themeAttribute,
|
|
127
128
|
'data-indicator': indicator,
|
|
128
129
|
};
|
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
.navigation,
|
|
2
2
|
.flyout {
|
|
3
3
|
--navigation-item-height: var(--lt-ui-navigation-item-height-m, var(--control-height-m));
|
|
4
|
-
--navigation-icon-size:
|
|
5
|
-
--navigation-padding:
|
|
6
|
-
--navigation-gap: 12px;
|
|
7
|
-
--navigation-indent: calc(var(--navigation-icon-size) + var(--navigation-gap));
|
|
8
|
-
--navigation-bg: var(--lt-ui-navigation-bg, var(--background-primary));
|
|
9
|
-
--navigation-text: var(--lt-ui-navigation-color, var(--text-secondary));
|
|
10
|
-
--navigation-text-strong: var(--lt-ui-navigation-active-color, var(--text-primary));
|
|
11
|
-
--navigation-hover-bg: var(--lt-ui-navigation-hover-bg, var(--background-secondary));
|
|
12
|
-
--navigation-selected-bg: var(--lt-ui-navigation-selected-bg, var(--accent-light));
|
|
13
|
-
--navigation-accent: var(--lt-ui-navigation-accent, var(--control-accent));
|
|
14
|
-
--navigation-border: var(--lt-ui-navigation-border-color, var(--background-secondary));
|
|
15
|
-
--navigation-rounding: var(--lt-ui-navigation-radius, var(--rounding-m));
|
|
4
|
+
--navigation-icon-size: var(--space-20);
|
|
5
|
+
--navigation-padding: var(--space-12);
|
|
16
6
|
box-sizing: border-box;
|
|
17
|
-
color: var(--navigation-text);
|
|
7
|
+
color: var(--lt-ui-navigation-color, var(--text-secondary));
|
|
18
8
|
}
|
|
19
9
|
.navigation[data-size=s], .navigation.sizeS,
|
|
20
10
|
.flyout[data-size=s],
|
|
21
11
|
.flyout.sizeS {
|
|
22
12
|
--navigation-item-height: var(--lt-ui-navigation-item-height-s, var(--control-height-s));
|
|
23
|
-
--navigation-icon-size:
|
|
24
|
-
--navigation-padding:
|
|
13
|
+
--navigation-icon-size: var(--space-16);
|
|
14
|
+
--navigation-padding: var(--space-8);
|
|
15
|
+
}
|
|
16
|
+
.navigation[data-size=m], .navigation.sizeM,
|
|
17
|
+
.flyout[data-size=m],
|
|
18
|
+
.flyout.sizeM {
|
|
19
|
+
--navigation-item-height: var(--lt-ui-navigation-item-height-m, var(--control-height-m));
|
|
20
|
+
--navigation-icon-size: var(--space-20);
|
|
21
|
+
--navigation-padding: var(--space-12);
|
|
25
22
|
}
|
|
26
23
|
.navigation[data-size=l], .navigation.sizeL,
|
|
27
24
|
.flyout[data-size=l],
|
|
28
25
|
.flyout.sizeL {
|
|
29
26
|
--navigation-item-height: var(--lt-ui-navigation-item-height-l, var(--control-height-l));
|
|
30
|
-
--navigation-icon-size:
|
|
31
|
-
--navigation-padding:
|
|
27
|
+
--navigation-icon-size: var(--space-24);
|
|
28
|
+
--navigation-padding: var(--space-16);
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
.expanded,
|
|
35
32
|
.rail {
|
|
36
33
|
height: 100%;
|
|
37
|
-
background: var(--navigation-bg);
|
|
38
|
-
border-inline-end: 1px solid var(--navigation-border);
|
|
39
|
-
transition: width
|
|
34
|
+
background: var(--lt-ui-navigation-bg, var(--background-primary));
|
|
35
|
+
border-inline-end: 1px solid var(--lt-ui-navigation-border-color, var(--background-secondary));
|
|
36
|
+
transition: width 200ms ease-in-out;
|
|
40
37
|
}
|
|
41
38
|
@media (prefers-reduced-motion: reduce) {
|
|
42
39
|
.expanded,
|
|
@@ -62,7 +59,7 @@
|
|
|
62
59
|
|
|
63
60
|
.header {
|
|
64
61
|
flex: none;
|
|
65
|
-
padding:
|
|
62
|
+
padding: var(--space-16) var(--navigation-padding);
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
.header,
|
|
@@ -76,14 +73,14 @@
|
|
|
76
73
|
.scroll {
|
|
77
74
|
flex: 1;
|
|
78
75
|
min-height: 0;
|
|
79
|
-
padding:
|
|
76
|
+
padding: var(--space-8);
|
|
80
77
|
overflow: hidden auto;
|
|
81
78
|
}
|
|
82
79
|
|
|
83
80
|
.footer {
|
|
84
81
|
flex: none;
|
|
85
|
-
padding:
|
|
86
|
-
border-block-start: 1px solid var(--navigation-border);
|
|
82
|
+
padding: var(--space-8) var(--navigation-padding);
|
|
83
|
+
border-block-start: 1px solid var(--lt-ui-navigation-border-color, var(--background-secondary));
|
|
87
84
|
}
|
|
88
85
|
|
|
89
86
|
.toggle::-moz-focus-inner {
|
|
@@ -115,11 +112,11 @@
|
|
|
115
112
|
align-items: center;
|
|
116
113
|
justify-content: center;
|
|
117
114
|
height: var(--navigation-item-height);
|
|
118
|
-
margin:
|
|
119
|
-
color: var(--navigation-text);
|
|
115
|
+
margin: var(--space-8);
|
|
116
|
+
color: var(--lt-ui-navigation-color, var(--text-secondary));
|
|
120
117
|
background: transparent;
|
|
121
118
|
border: 0;
|
|
122
|
-
border-radius: var(--navigation-rounding);
|
|
119
|
+
border-radius: var(--lt-ui-navigation-radius, var(--rounding-m));
|
|
123
120
|
}
|
|
124
121
|
.toggle > svg {
|
|
125
122
|
--icon-color: currentColor;
|
|
@@ -128,13 +125,13 @@
|
|
|
128
125
|
}
|
|
129
126
|
@media (hover: hover) and (min-width: 768px) {
|
|
130
127
|
.toggle:hover {
|
|
131
|
-
color: var(--navigation-text-
|
|
132
|
-
background: var(--navigation-hover-bg);
|
|
128
|
+
color: var(--lt-ui-navigation-active-color, var(--text-primary));
|
|
129
|
+
background: var(--lt-ui-navigation-hover-bg, var(--background-secondary));
|
|
133
130
|
}
|
|
134
131
|
}
|
|
135
132
|
.toggle:active {
|
|
136
|
-
color: var(--navigation-text-
|
|
137
|
-
background: var(--navigation-hover-bg);
|
|
133
|
+
color: var(--lt-ui-navigation-active-color, var(--text-primary));
|
|
134
|
+
background: var(--lt-ui-navigation-hover-bg, var(--background-secondary));
|
|
138
135
|
}
|
|
139
136
|
|
|
140
137
|
.list {
|
|
@@ -150,7 +147,7 @@
|
|
|
150
147
|
.group + .group,
|
|
151
148
|
.item + .group,
|
|
152
149
|
.group + .item {
|
|
153
|
-
margin-block-start:
|
|
150
|
+
margin-block-start: var(--space-16);
|
|
154
151
|
}
|
|
155
152
|
|
|
156
153
|
.group {
|
|
@@ -159,7 +156,7 @@
|
|
|
159
156
|
|
|
160
157
|
.groupTitle {
|
|
161
158
|
display: block;
|
|
162
|
-
padding:
|
|
159
|
+
padding: var(--space-8) var(--navigation-padding);
|
|
163
160
|
color: var(--text-minor);
|
|
164
161
|
font-size: 13px;
|
|
165
162
|
font-weight: 600;
|
|
@@ -169,9 +166,9 @@
|
|
|
169
166
|
|
|
170
167
|
.divider {
|
|
171
168
|
height: 1px;
|
|
172
|
-
margin:
|
|
169
|
+
margin: var(--space-8) var(--navigation-padding);
|
|
173
170
|
list-style: none;
|
|
174
|
-
background: var(--navigation-border);
|
|
171
|
+
background: var(--lt-ui-navigation-border-color, var(--background-secondary));
|
|
175
172
|
}
|
|
176
173
|
|
|
177
174
|
.control::-moz-focus-inner {
|
|
@@ -200,44 +197,53 @@
|
|
|
200
197
|
-webkit-tap-highlight-color: transparent;
|
|
201
198
|
box-sizing: border-box;
|
|
202
199
|
display: flex;
|
|
203
|
-
gap: var(--
|
|
200
|
+
gap: var(--space-12);
|
|
204
201
|
align-items: center;
|
|
205
202
|
width: 100%;
|
|
206
203
|
min-height: var(--navigation-item-height);
|
|
207
204
|
padding-block: 0;
|
|
208
|
-
padding-inline: calc(var(--navigation-padding) + var(--navigation-level, 0) * var(--navigation-
|
|
209
|
-
color: var(--navigation-text);
|
|
205
|
+
padding-inline: calc(var(--navigation-padding) + var(--navigation-level, 0) * (var(--navigation-icon-size) + var(--space-12))) var(--navigation-padding);
|
|
206
|
+
color: var(--lt-ui-navigation-color, var(--text-secondary));
|
|
210
207
|
text-align: start;
|
|
211
208
|
background: transparent;
|
|
212
209
|
border: 0;
|
|
213
|
-
border-radius: var(--navigation-rounding);
|
|
214
|
-
transition: background-color
|
|
210
|
+
border-radius: var(--lt-ui-navigation-radius, var(--rounding-m));
|
|
211
|
+
transition: background-color 150ms ease-in-out, color 150ms ease-in-out;
|
|
215
212
|
font-size: 17px;
|
|
216
213
|
font-weight: 600;
|
|
217
214
|
line-height: 1.2941176471;
|
|
218
215
|
letter-spacing: 0.2px;
|
|
219
216
|
}
|
|
217
|
+
:is(.navigation, .flyout)[data-size=s] .control, .sizeS .control {
|
|
218
|
+
font-size: 15px;
|
|
219
|
+
font-weight: 400;
|
|
220
|
+
line-height: 1.3333333333;
|
|
221
|
+
letter-spacing: 0.2px;
|
|
222
|
+
}
|
|
223
|
+
.navigation[data-label-lines="2"]:is([data-layout=expanded], [data-layout=drawer]) .control {
|
|
224
|
+
padding-block: var(--space-8);
|
|
225
|
+
}
|
|
220
226
|
@media (hover: hover) and (min-width: 768px) {
|
|
221
227
|
.control:hover {
|
|
222
|
-
color: var(--navigation-text-
|
|
223
|
-
background: var(--navigation-hover-bg);
|
|
228
|
+
color: var(--lt-ui-navigation-active-color, var(--text-primary));
|
|
229
|
+
background: var(--lt-ui-navigation-hover-bg, var(--background-secondary));
|
|
224
230
|
}
|
|
225
231
|
}
|
|
226
232
|
.control:active {
|
|
227
|
-
color: var(--navigation-text-
|
|
228
|
-
background: var(--navigation-hover-bg);
|
|
233
|
+
color: var(--lt-ui-navigation-active-color, var(--text-primary));
|
|
234
|
+
background: var(--lt-ui-navigation-hover-bg, var(--background-secondary));
|
|
229
235
|
}
|
|
230
236
|
.control:disabled, .control[aria-disabled=true] {
|
|
231
237
|
pointer-events: none;
|
|
232
238
|
opacity: 0.4;
|
|
233
239
|
}
|
|
234
240
|
.control.inPath {
|
|
235
|
-
color: var(--navigation-text-
|
|
241
|
+
color: var(--lt-ui-navigation-active-color, var(--text-primary));
|
|
236
242
|
}
|
|
237
243
|
.control.selected, .control[data-hidden-selection] {
|
|
238
|
-
color: var(--navigation-text-
|
|
239
|
-
background: var(--navigation-selected-bg);
|
|
240
|
-
box-shadow: inset 3px 0 0 var(--navigation-accent);
|
|
244
|
+
color: var(--lt-ui-navigation-active-color, var(--text-primary));
|
|
245
|
+
background: var(--lt-ui-navigation-selected-bg, var(--accent-light));
|
|
246
|
+
box-shadow: inset 3px 0 0 var(--lt-ui-navigation-accent, var(--control-accent));
|
|
241
247
|
}
|
|
242
248
|
@media (prefers-reduced-motion: reduce) {
|
|
243
249
|
.control {
|
|
@@ -267,6 +273,15 @@
|
|
|
267
273
|
text-overflow: ellipsis;
|
|
268
274
|
white-space: nowrap;
|
|
269
275
|
}
|
|
276
|
+
.selected .label {
|
|
277
|
+
font-weight: 600;
|
|
278
|
+
}
|
|
279
|
+
.navigation[data-label-lines="2"]:is([data-layout=expanded], [data-layout=drawer]) .label {
|
|
280
|
+
display: -webkit-box;
|
|
281
|
+
-webkit-line-clamp: 2;
|
|
282
|
+
white-space: normal;
|
|
283
|
+
-webkit-box-orient: vertical;
|
|
284
|
+
}
|
|
270
285
|
|
|
271
286
|
.labelHidden {
|
|
272
287
|
position: absolute !important;
|
|
@@ -285,16 +300,16 @@
|
|
|
285
300
|
|
|
286
301
|
.badgeCorner {
|
|
287
302
|
position: absolute;
|
|
288
|
-
inset-block-start: -
|
|
289
|
-
inset-inline-start: calc(100% -
|
|
303
|
+
inset-block-start: calc(-1 * var(--space-8));
|
|
304
|
+
inset-inline-start: calc(100% - var(--space-8));
|
|
290
305
|
line-height: 0;
|
|
291
306
|
pointer-events: none;
|
|
292
307
|
}
|
|
293
308
|
|
|
294
309
|
.nestedMark {
|
|
295
310
|
position: absolute;
|
|
296
|
-
inset-block-end: -
|
|
297
|
-
inset-inline-end: -
|
|
311
|
+
inset-block-end: calc(-1 * var(--space-4));
|
|
312
|
+
inset-inline-end: calc(-1 * var(--space-8));
|
|
298
313
|
width: 0;
|
|
299
314
|
height: 0;
|
|
300
315
|
border-block-end: 6px solid currentColor;
|
|
@@ -305,10 +320,10 @@
|
|
|
305
320
|
.chevron {
|
|
306
321
|
display: inline-flex;
|
|
307
322
|
flex: none;
|
|
308
|
-
width:
|
|
309
|
-
height:
|
|
323
|
+
width: var(--space-16);
|
|
324
|
+
height: var(--space-16);
|
|
310
325
|
margin-inline-start: auto;
|
|
311
|
-
transition: transform
|
|
326
|
+
transition: transform 200ms ease-in-out;
|
|
312
327
|
}
|
|
313
328
|
.chevron > svg {
|
|
314
329
|
--icon-color: currentColor;
|
|
@@ -326,8 +341,8 @@
|
|
|
326
341
|
}
|
|
327
342
|
|
|
328
343
|
.railControl.inPath[data-path] {
|
|
329
|
-
background: var(--navigation-selected-bg);
|
|
330
|
-
box-shadow: inset 3px 0 0 var(--navigation-accent);
|
|
344
|
+
background: var(--lt-ui-navigation-selected-bg, var(--accent-light));
|
|
345
|
+
box-shadow: inset 3px 0 0 var(--lt-ui-navigation-accent, var(--control-accent));
|
|
331
346
|
}
|
|
332
347
|
|
|
333
348
|
.panelList {
|
|
@@ -352,28 +367,29 @@
|
|
|
352
367
|
inset-inline: var(--navigation-padding);
|
|
353
368
|
height: 1px;
|
|
354
369
|
content: "";
|
|
355
|
-
background: var(--navigation-border);
|
|
370
|
+
background: var(--lt-ui-navigation-border-color, var(--background-secondary));
|
|
356
371
|
}
|
|
357
372
|
|
|
358
373
|
.bar,
|
|
359
374
|
.bottom {
|
|
360
|
-
background: var(--navigation-bg);
|
|
375
|
+
background: var(--lt-ui-navigation-bg, var(--background-primary));
|
|
361
376
|
}
|
|
362
377
|
|
|
363
378
|
.bar {
|
|
364
|
-
|
|
379
|
+
width: 100%;
|
|
380
|
+
border-block-end: 1px solid var(--lt-ui-navigation-border-color, var(--background-secondary));
|
|
365
381
|
}
|
|
366
382
|
|
|
367
383
|
.bottom {
|
|
368
384
|
padding-block-end: env(safe-area-inset-bottom);
|
|
369
|
-
border-block-start: 1px solid var(--navigation-border);
|
|
385
|
+
border-block-start: 1px solid var(--lt-ui-navigation-border-color, var(--background-secondary));
|
|
370
386
|
}
|
|
371
387
|
|
|
372
388
|
.row {
|
|
373
389
|
display: flex;
|
|
374
390
|
flex-wrap: nowrap;
|
|
375
391
|
min-width: 0;
|
|
376
|
-
padding: 0
|
|
392
|
+
padding: 0 var(--space-8);
|
|
377
393
|
margin: 0;
|
|
378
394
|
overflow: hidden;
|
|
379
395
|
list-style: none;
|
|
@@ -394,7 +410,7 @@
|
|
|
394
410
|
}
|
|
395
411
|
.barControl.selected, .barControl.inPath[data-path] {
|
|
396
412
|
background: transparent;
|
|
397
|
-
box-shadow: inset 0 -3px 0 var(--navigation-accent);
|
|
413
|
+
box-shadow: inset 0 -3px 0 var(--lt-ui-navigation-accent, var(--control-accent));
|
|
398
414
|
}
|
|
399
415
|
|
|
400
416
|
.bottomList {
|
|
@@ -404,12 +420,12 @@
|
|
|
404
420
|
.bottomControl {
|
|
405
421
|
position: relative;
|
|
406
422
|
flex-direction: column;
|
|
407
|
-
gap:
|
|
423
|
+
gap: var(--space-2);
|
|
408
424
|
justify-content: center;
|
|
409
425
|
width: auto;
|
|
410
|
-
min-width:
|
|
426
|
+
min-width: var(--space-64);
|
|
411
427
|
min-height: 56px;
|
|
412
|
-
padding: 6px
|
|
428
|
+
padding: 6px var(--space-8);
|
|
413
429
|
border-radius: 0;
|
|
414
430
|
font-size: 13px;
|
|
415
431
|
font-weight: 400;
|
|
@@ -421,7 +437,7 @@
|
|
|
421
437
|
}
|
|
422
438
|
.bottomControl.selected, .bottomControl.inPath[data-path] {
|
|
423
439
|
background: transparent;
|
|
424
|
-
box-shadow: inset 0 3px 0 var(--navigation-accent);
|
|
440
|
+
box-shadow: inset 0 3px 0 var(--lt-ui-navigation-accent, var(--control-accent));
|
|
425
441
|
}
|
|
426
442
|
|
|
427
443
|
.burger::-moz-focus-inner {
|
|
@@ -454,23 +470,23 @@
|
|
|
454
470
|
width: var(--navigation-item-height);
|
|
455
471
|
height: var(--navigation-item-height);
|
|
456
472
|
font-size: var(--navigation-icon-size);
|
|
457
|
-
color: var(--navigation-text-
|
|
473
|
+
color: var(--lt-ui-navigation-active-color, var(--text-primary));
|
|
458
474
|
background: transparent;
|
|
459
475
|
border: 0;
|
|
460
|
-
border-radius: var(--navigation-rounding);
|
|
476
|
+
border-radius: var(--lt-ui-navigation-radius, var(--rounding-m));
|
|
461
477
|
}
|
|
462
478
|
@media (hover: hover) and (min-width: 768px) {
|
|
463
479
|
.burger:hover {
|
|
464
|
-
background: var(--navigation-hover-bg);
|
|
480
|
+
background: var(--lt-ui-navigation-hover-bg, var(--background-secondary));
|
|
465
481
|
}
|
|
466
482
|
}
|
|
467
483
|
.burger:active {
|
|
468
|
-
background: var(--navigation-hover-bg);
|
|
484
|
+
background: var(--lt-ui-navigation-hover-bg, var(--background-secondary));
|
|
469
485
|
}
|
|
470
486
|
|
|
471
487
|
.drawerPanel {
|
|
472
488
|
height: 100%;
|
|
473
|
-
background: var(--navigation-bg);
|
|
489
|
+
background: var(--lt-ui-navigation-bg, var(--background-primary));
|
|
474
490
|
}
|
|
475
491
|
|
|
476
492
|
.drawerInContainer.drawerInContainer {
|
|
@@ -480,7 +496,7 @@
|
|
|
480
496
|
|
|
481
497
|
.drawerBar {
|
|
482
498
|
display: flex;
|
|
483
|
-
gap:
|
|
499
|
+
gap: var(--space-8);
|
|
484
500
|
align-items: center;
|
|
485
501
|
}
|
|
486
502
|
.drawerBar[data-burger=end] {
|
|
@@ -491,6 +507,7 @@
|
|
|
491
507
|
.barShell {
|
|
492
508
|
display: flex;
|
|
493
509
|
align-items: center;
|
|
510
|
+
width: 100%;
|
|
494
511
|
min-width: 0;
|
|
495
512
|
}
|
|
496
513
|
.barShell .row {
|
|
@@ -504,10 +521,10 @@
|
|
|
504
521
|
.drawerHeader {
|
|
505
522
|
display: flex;
|
|
506
523
|
flex: none;
|
|
507
|
-
gap:
|
|
524
|
+
gap: var(--space-8);
|
|
508
525
|
align-items: center;
|
|
509
526
|
justify-content: space-between;
|
|
510
|
-
padding:
|
|
527
|
+
padding: var(--space-8) var(--space-8) var(--space-8) 0;
|
|
511
528
|
}
|
|
512
529
|
.drawerHeader .header {
|
|
513
530
|
flex: 1;
|
|
@@ -517,12 +534,12 @@
|
|
|
517
534
|
.flyout {
|
|
518
535
|
min-width: 220px;
|
|
519
536
|
max-width: 320px;
|
|
520
|
-
padding:
|
|
537
|
+
padding: var(--space-8);
|
|
521
538
|
border-radius: var(--rounding-l);
|
|
522
539
|
}
|
|
523
540
|
|
|
524
541
|
.flyoutTitle {
|
|
525
|
-
padding:
|
|
542
|
+
padding: var(--space-8) var(--space-12);
|
|
526
543
|
color: var(--text-minor);
|
|
527
544
|
font-size: 13px;
|
|
528
545
|
font-weight: 600;
|
|
@@ -538,15 +555,15 @@
|
|
|
538
555
|
|
|
539
556
|
.navigation[data-indicator=fill] .barControl,
|
|
540
557
|
.navigation[data-indicator=fill] .bottomControl {
|
|
541
|
-
border-radius: var(--navigation-rounding);
|
|
558
|
+
border-radius: var(--lt-ui-navigation-radius, var(--rounding-m));
|
|
542
559
|
}
|
|
543
560
|
.navigation[data-indicator=fill] .barControl.selected, .navigation[data-indicator=fill] .barControl.inPath[data-path],
|
|
544
561
|
.navigation[data-indicator=fill] .bottomControl.selected,
|
|
545
562
|
.navigation[data-indicator=fill] .bottomControl.inPath[data-path] {
|
|
546
|
-
background: var(--navigation-selected-bg);
|
|
563
|
+
background: var(--lt-ui-navigation-selected-bg, var(--accent-light));
|
|
547
564
|
box-shadow: none;
|
|
548
565
|
}
|
|
549
566
|
.navigation[data-indicator=fill] .row {
|
|
550
|
-
gap:
|
|
551
|
-
padding: 6px
|
|
567
|
+
gap: var(--space-4);
|
|
568
|
+
padding: 6px var(--space-8);
|
|
552
569
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useNavigationFlyout = useNavigationFlyout;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const hooks_1 = require("../hooks");
|
|
7
|
+
const OPEN_KEY = {
|
|
8
|
+
bar: 'ArrowDown',
|
|
9
|
+
bottom: 'ArrowUp',
|
|
10
|
+
rail: 'ArrowRight',
|
|
11
|
+
};
|
|
12
|
+
function useNavigationFlyout(item, variant) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
15
|
+
const keyboardOpen = (0, react_1.useRef)(false);
|
|
16
|
+
const menuId = (0, hooks_1.useUniqID)(5, 'navigation-menu');
|
|
17
|
+
const entries = item.href
|
|
18
|
+
? [{ ...item, children: undefined, key: `${item.key}__self` }, ...((_a = item.children) !== null && _a !== void 0 ? _a : [])]
|
|
19
|
+
: ((_b = item.children) !== null && _b !== void 0 ? _b : []);
|
|
20
|
+
const onKeyDown = (event) => {
|
|
21
|
+
if (event.key !== OPEN_KEY[variant] || item.disabled)
|
|
22
|
+
return;
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
keyboardOpen.current = true;
|
|
25
|
+
setOpen(true);
|
|
26
|
+
};
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
if (!open || !keyboardOpen.current)
|
|
29
|
+
return undefined;
|
|
30
|
+
keyboardOpen.current = false;
|
|
31
|
+
const frame = requestAnimationFrame(() => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
(_b = (_a = document
|
|
34
|
+
.getElementById(menuId)) === null || _a === void 0 ? void 0 : _a.querySelector('[data-lt-ui="navigation-item"]:not(:disabled)')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
35
|
+
});
|
|
36
|
+
return () => cancelAnimationFrame(frame);
|
|
37
|
+
}, [open, menuId]);
|
|
38
|
+
return { open, setOpen, menuId, entries, onKeyDown };
|
|
39
|
+
}
|