@ssa-ui-kit/core 3.26.1 → 3.26.2
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/ai/source-map.md
CHANGED
|
@@ -1584,9 +1584,11 @@ The app sidebar: a logo, a menu, and three layouts.
|
|
|
1584
1584
|
- `subMenuMaxWidth?: Property.MaxWidth<string | number>` — Max width for submenu panels (e.g. 220).
|
|
1585
1585
|
- `showIconTooltip?: boolean` — When true, show tooltips on nav icons when sidebar is collapsed.
|
|
1586
1586
|
- `useMatchPattern?: (prefix: string) => string | PathPattern<string>` — Custom route matching for active state (e.g. for React Router): given a group's `prefix`, return the pattern…
|
|
1587
|
-
- `onChange?: (isChecked: boolean) => void` — Called when the sidebar expand/collapse state changes
|
|
1587
|
+
- `onChange?: (isChecked: boolean) => void` — Called when the sidebar expand/collapse state changes — on user toggles, the collapse on viewport resize, and…
|
|
1588
|
+
- `onToggle?: (isOpen: boolean) => void` — Called when the user opens or closes the panel with its toggle. Unlike `onChange`, it does not fire on mount,…
|
|
1588
1589
|
- `exactMatch?: boolean` `= false` — If true, only exact path matches will be considered active. If false, sub-routes will also be considered…
|
|
1589
1590
|
- `defaultExpanded?: boolean` `= false` — Initial expanded state (sidebar shows icon + text). When false, only icons are shown until the user toggles.
|
|
1591
|
+
- `isOpen?: boolean` — Controlled expanded state. When passed, the sidebar renders from it and keeps no state of its own; toggles…
|
|
1590
1592
|
|
|
1591
1593
|
#### CollapsibleNavBarCustomIconSVG
|
|
1592
1594
|
|
|
@@ -34,5 +34,8 @@ import { CollapsibleNavBarExtendedProps } from './types';
|
|
|
34
34
|
* onChange={(isExpanded) => console.log(isExpanded)}
|
|
35
35
|
* />
|
|
36
36
|
* ```
|
|
37
|
+
*
|
|
38
|
+
* Pass `isOpen` to own the expanded state (e.g. to persist it): the bar then
|
|
39
|
+
* renders from it and reports toggles through `onChange` for you to apply.
|
|
37
40
|
*/
|
|
38
|
-
export declare const CollapsibleNavBar: (
|
|
41
|
+
export declare const CollapsibleNavBar: (props: CollapsibleNavBarExtendedProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -63,8 +63,22 @@ export interface CollapsibleNavBarExtendedProps<T extends NavBarExtendedSubItem
|
|
|
63
63
|
* loses a group.
|
|
64
64
|
*/
|
|
65
65
|
useMatchPattern?: (prefix: string) => string | PathPattern<string>;
|
|
66
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Called when the sidebar expand/collapse state changes — on user toggles,
|
|
68
|
+
* the collapse on viewport resize, and the mobile overlay closing on
|
|
69
|
+
* navigation.
|
|
70
|
+
*
|
|
71
|
+
* Uncontrolled, it also fires once on mount with the initial state.
|
|
72
|
+
* Controlled (`isOpen` passed), it never fires on mount and only reports a
|
|
73
|
+
* value that differs from `isOpen`.
|
|
74
|
+
*/
|
|
67
75
|
onChange?: (isChecked: boolean) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Called when the user opens or closes the panel with its toggle. Unlike
|
|
78
|
+
* `onChange`, it does not fire on mount, on the resize collapse, on mobile
|
|
79
|
+
* navigation, or when `isOpen` changes from outside.
|
|
80
|
+
*/
|
|
81
|
+
onToggle?: (isOpen: boolean) => void;
|
|
68
82
|
/**
|
|
69
83
|
* If true, only exact path matches will be considered active.
|
|
70
84
|
* If false, sub-routes will also be considered active.
|
|
@@ -76,4 +90,13 @@ export interface CollapsibleNavBarExtendedProps<T extends NavBarExtendedSubItem
|
|
|
76
90
|
* @default false
|
|
77
91
|
*/
|
|
78
92
|
defaultExpanded?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Controlled expanded state. When passed, the sidebar renders from it and
|
|
95
|
+
* keeps no state of its own; toggles are reported through `onChange` for the
|
|
96
|
+
* caller to apply. Omit it for the uncontrolled `defaultExpanded` behaviour.
|
|
97
|
+
*
|
|
98
|
+
* The bar still asks to collapse (`onChange(false)`) when the viewport
|
|
99
|
+
* resizes, as it does uncontrolled.
|
|
100
|
+
*/
|
|
101
|
+
isOpen?: boolean;
|
|
79
102
|
}
|
package/dist/index.js
CHANGED
|
@@ -70721,27 +70721,45 @@ const SCREEN_SIZES = {
|
|
|
70721
70721
|
* onChange={(isExpanded) => console.log(isExpanded)}
|
|
70722
70722
|
* />
|
|
70723
70723
|
* ```
|
|
70724
|
+
*
|
|
70725
|
+
* Pass `isOpen` to own the expanded state (e.g. to persist it): the bar then
|
|
70726
|
+
* renders from it and reports toggles through `onChange` for you to apply.
|
|
70724
70727
|
*/
|
|
70725
70728
|
|
|
70726
|
-
const CollapsibleNavBar =
|
|
70727
|
-
|
|
70728
|
-
|
|
70729
|
-
|
|
70730
|
-
|
|
70731
|
-
|
|
70732
|
-
|
|
70733
|
-
|
|
70734
|
-
|
|
70735
|
-
|
|
70736
|
-
|
|
70737
|
-
|
|
70738
|
-
|
|
70739
|
-
|
|
70729
|
+
const CollapsibleNavBar = props => {
|
|
70730
|
+
const {
|
|
70731
|
+
items,
|
|
70732
|
+
renderLogo,
|
|
70733
|
+
header,
|
|
70734
|
+
theme = 'default',
|
|
70735
|
+
activeColor,
|
|
70736
|
+
subMenuMaxWidth,
|
|
70737
|
+
showIconTooltip = false,
|
|
70738
|
+
className,
|
|
70739
|
+
useMatchPattern,
|
|
70740
|
+
onChange,
|
|
70741
|
+
onToggle,
|
|
70742
|
+
exactMatch = false,
|
|
70743
|
+
defaultExpanded = false,
|
|
70744
|
+
isOpen
|
|
70745
|
+
} = props;
|
|
70740
70746
|
const toggleId = (0,external_react_.useId)();
|
|
70741
70747
|
const {
|
|
70742
70748
|
width
|
|
70743
70749
|
} = (0,hooks_namespaceObject.useWindowSize)();
|
|
70744
|
-
|
|
70750
|
+
// Controlled by the prop's presence, per the kit convention — see
|
|
70751
|
+
// `useControllableState`. Uncontrolled mode reports through the effect below
|
|
70752
|
+
// (which also fires on mount, as it always has), so the hook only notifies
|
|
70753
|
+
// when controlled.
|
|
70754
|
+
const controlled = 'isOpen' in props;
|
|
70755
|
+
const [rawChecked, setChecked] = (0,hooks_namespaceObject.useControllableState)({
|
|
70756
|
+
controlled,
|
|
70757
|
+
value: isOpen,
|
|
70758
|
+
defaultValue: defaultExpanded,
|
|
70759
|
+
finalValue: false,
|
|
70760
|
+
onChange: controlled ? onChange : undefined
|
|
70761
|
+
});
|
|
70762
|
+
const isChecked = Boolean(rawChecked);
|
|
70745
70763
|
const isMobile = width < SCREEN_SIZES['900'].width;
|
|
70746
70764
|
const treeItems = (0,external_react_.useMemo)(() => toTreeItems(items), [items]);
|
|
70747
70765
|
const [expandedIds, setExpandedIds] = (0,external_react_.useState)([]);
|
|
@@ -70757,14 +70775,16 @@ const CollapsibleNavBar = ({
|
|
|
70757
70775
|
hasMeasured.current = true;
|
|
70758
70776
|
return;
|
|
70759
70777
|
}
|
|
70760
|
-
|
|
70778
|
+
setChecked(false);
|
|
70761
70779
|
}, [width]);
|
|
70762
70780
|
(0,external_react_.useEffect)(() => {
|
|
70763
|
-
|
|
70781
|
+
if (!controlled) {
|
|
70782
|
+
onChange?.(isChecked);
|
|
70783
|
+
}
|
|
70764
70784
|
}, [isChecked]);
|
|
70765
70785
|
const handleCloseMobileMenu = () => {
|
|
70766
70786
|
if (isMobile) {
|
|
70767
|
-
|
|
70787
|
+
setChecked(!isChecked);
|
|
70768
70788
|
}
|
|
70769
70789
|
};
|
|
70770
70790
|
return (0,jsx_runtime_namespaceObject.jsx)(CollapsibleNavBarProvider, {
|
|
@@ -70780,7 +70800,8 @@ const CollapsibleNavBar = ({
|
|
|
70780
70800
|
id: toggleId,
|
|
70781
70801
|
checked: isChecked,
|
|
70782
70802
|
onChange: () => {
|
|
70783
|
-
|
|
70803
|
+
setChecked(!isChecked);
|
|
70804
|
+
onToggle?.(!isChecked);
|
|
70784
70805
|
}
|
|
70785
70806
|
}), (0,jsx_runtime_namespaceObject.jsx)(CollapsibleNavToggle, {
|
|
70786
70807
|
id: toggleId
|
package/dist/index.mjs
CHANGED
|
@@ -70381,27 +70381,45 @@ const SCREEN_SIZES = {
|
|
|
70381
70381
|
* onChange={(isExpanded) => console.log(isExpanded)}
|
|
70382
70382
|
* />
|
|
70383
70383
|
* ```
|
|
70384
|
+
*
|
|
70385
|
+
* Pass `isOpen` to own the expanded state (e.g. to persist it): the bar then
|
|
70386
|
+
* renders from it and reports toggles through `onChange` for you to apply.
|
|
70384
70387
|
*/
|
|
70385
70388
|
|
|
70386
|
-
const CollapsibleNavBar =
|
|
70387
|
-
|
|
70388
|
-
|
|
70389
|
-
|
|
70390
|
-
|
|
70391
|
-
|
|
70392
|
-
|
|
70393
|
-
|
|
70394
|
-
|
|
70395
|
-
|
|
70396
|
-
|
|
70397
|
-
|
|
70398
|
-
|
|
70399
|
-
|
|
70389
|
+
const CollapsibleNavBar = props => {
|
|
70390
|
+
const {
|
|
70391
|
+
items,
|
|
70392
|
+
renderLogo,
|
|
70393
|
+
header,
|
|
70394
|
+
theme = 'default',
|
|
70395
|
+
activeColor,
|
|
70396
|
+
subMenuMaxWidth,
|
|
70397
|
+
showIconTooltip = false,
|
|
70398
|
+
className,
|
|
70399
|
+
useMatchPattern,
|
|
70400
|
+
onChange,
|
|
70401
|
+
onToggle,
|
|
70402
|
+
exactMatch = false,
|
|
70403
|
+
defaultExpanded = false,
|
|
70404
|
+
isOpen
|
|
70405
|
+
} = props;
|
|
70400
70406
|
const toggleId = (0,external_react_.useId)();
|
|
70401
70407
|
const {
|
|
70402
70408
|
width
|
|
70403
70409
|
} = __WEBPACK_EXTERNAL_MODULE__ssa_ui_kit_hooks_615bc432_useWindowSize__();
|
|
70404
|
-
|
|
70410
|
+
// Controlled by the prop's presence, per the kit convention — see
|
|
70411
|
+
// `useControllableState`. Uncontrolled mode reports through the effect below
|
|
70412
|
+
// (which also fires on mount, as it always has), so the hook only notifies
|
|
70413
|
+
// when controlled.
|
|
70414
|
+
const controlled = 'isOpen' in props;
|
|
70415
|
+
const [rawChecked, setChecked] = __WEBPACK_EXTERNAL_MODULE__ssa_ui_kit_hooks_615bc432_useControllableState__({
|
|
70416
|
+
controlled,
|
|
70417
|
+
value: isOpen,
|
|
70418
|
+
defaultValue: defaultExpanded,
|
|
70419
|
+
finalValue: false,
|
|
70420
|
+
onChange: controlled ? onChange : undefined
|
|
70421
|
+
});
|
|
70422
|
+
const isChecked = Boolean(rawChecked);
|
|
70405
70423
|
const isMobile = width < SCREEN_SIZES['900'].width;
|
|
70406
70424
|
const treeItems = (0,external_react_.useMemo)(() => toTreeItems(items), [items]);
|
|
70407
70425
|
const [expandedIds, setExpandedIds] = (0,external_react_.useState)([]);
|
|
@@ -70417,14 +70435,16 @@ const CollapsibleNavBar = ({
|
|
|
70417
70435
|
hasMeasured.current = true;
|
|
70418
70436
|
return;
|
|
70419
70437
|
}
|
|
70420
|
-
|
|
70438
|
+
setChecked(false);
|
|
70421
70439
|
}, [width]);
|
|
70422
70440
|
(0,external_react_.useEffect)(() => {
|
|
70423
|
-
|
|
70441
|
+
if (!controlled) {
|
|
70442
|
+
onChange?.(isChecked);
|
|
70443
|
+
}
|
|
70424
70444
|
}, [isChecked]);
|
|
70425
70445
|
const handleCloseMobileMenu = () => {
|
|
70426
70446
|
if (isMobile) {
|
|
70427
|
-
|
|
70447
|
+
setChecked(!isChecked);
|
|
70428
70448
|
}
|
|
70429
70449
|
};
|
|
70430
70450
|
return __WEBPACK_EXTERNAL_MODULE__emotion_react_jsx_runtime_ea06233c_jsx__(CollapsibleNavBarProvider, {
|
|
@@ -70440,7 +70460,8 @@ const CollapsibleNavBar = ({
|
|
|
70440
70460
|
id: toggleId,
|
|
70441
70461
|
checked: isChecked,
|
|
70442
70462
|
onChange: () => {
|
|
70443
|
-
|
|
70463
|
+
setChecked(!isChecked);
|
|
70464
|
+
onToggle?.(!isChecked);
|
|
70444
70465
|
}
|
|
70445
70466
|
}), __WEBPACK_EXTERNAL_MODULE__emotion_react_jsx_runtime_ea06233c_jsx__(CollapsibleNavToggle, {
|
|
70446
70467
|
id: toggleId
|