@aleph-alpha/ui-library 6.1.0 → 6.2.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/config.js +42 -0
- package/dist/system/components/core/sidebar/utils.d.ts +9 -0
- package/dist/system/icons/story-sidebar-icons.json +1 -0
- package/dist/system/lib.js +4945 -4880
- package/dist/system/patterns/UiLayout/UiLayoutContent.vue.d.ts +39 -0
- package/dist/system/patterns/UiLayout/index.d.ts +2 -0
- package/dist/system/patterns/UiLayout/layout-shell.d.ts +944 -0
- package/dist/system/patterns/UiLayout/types.d.ts +43 -0
- package/dist/system/patterns/index.d.ts +1 -0
- package/dist/system/story-sidebar-icons.json +1 -0
- package/package.json +5 -5
- package/src/components/core/sidebar/Sidebar.vue +21 -5
- package/src/components/core/sidebar/utils.ts +10 -0
- package/src/patterns/UiLayout/UiLayoutContent.stories.ts +1234 -0
- package/src/patterns/UiLayout/UiLayoutContent.vue +98 -0
- package/src/patterns/UiLayout/__tests__/UiLayoutContent.test.ts +97 -0
- package/src/patterns/UiLayout/index.ts +2 -0
- package/src/patterns/UiLayout/layout-shell.ts +64 -15
- package/src/patterns/UiLayout/types.ts +44 -0
- package/src/patterns/index.ts +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the content box is divided between the primary content and the sidebar
|
|
3
|
+
* when the `sidebar` slot is filled, in columns of the 12-column layout grid.
|
|
4
|
+
*/
|
|
5
|
+
export type UiLayoutContentSidebarMode = 'default' | 'wide' | 'max';
|
|
6
|
+
/**
|
|
7
|
+
* Container for the primary content area — the main part of an application
|
|
8
|
+
* layout. It renders the sheet surface (`background/surface/secondary`) and
|
|
9
|
+
* carries the design system's 48px margin on its left and right edges — 32px
|
|
10
|
+
* below the `desktop` breakpoint (1200px), toward the minimum desktop size of
|
|
11
|
+
* 1024px — so pages start from the same inset instead of each carrying its
|
|
12
|
+
* own spacing. Divide the space inside it with a 12-column grid and 24px
|
|
13
|
+
* gutters.
|
|
14
|
+
*
|
|
15
|
+
* Slots: `default` for the page content; `split` for a split view — a border
|
|
16
|
+
* divides the content box into two equal parts, each keeping a 28px margin
|
|
17
|
+
* from the divider and a 6-column grid of its own; and `sidebar` for
|
|
18
|
+
* secondary content — locked to the right edge and sized by `sidebarMode`.
|
|
19
|
+
* In the sidebar view the primary area is the rounded sheet (12px radius)
|
|
20
|
+
* while the sidebar has no surface of its own; both keep 48px margins.
|
|
21
|
+
* @category Layout
|
|
22
|
+
* @useCases main content area, page body, layout grid container, split view, secondary sidebar
|
|
23
|
+
* @keywords layout, content, main, margin, grid, page, split, sidebar
|
|
24
|
+
* @related UiSidebar, UiTopBar
|
|
25
|
+
*/
|
|
26
|
+
export interface UiLayoutContentProps {
|
|
27
|
+
/**
|
|
28
|
+
* The element the content area renders as. Defaults to `main`, so the
|
|
29
|
+
* content area is exposed as the page's main landmark; pass another tag
|
|
30
|
+
* when the page already has a `main` landmark.
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @default 'main'
|
|
33
|
+
*/
|
|
34
|
+
as?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Column split between the primary content and the sidebar, applied when
|
|
37
|
+
* the `sidebar` slot is filled: `default` is 8 to 4, `wide` is 7 to 5, and
|
|
38
|
+
* `max` is 6 to 6.
|
|
39
|
+
* @type {'default' | 'wide' | 'max'}
|
|
40
|
+
* @default 'default'
|
|
41
|
+
*/
|
|
42
|
+
sidebarMode?: UiLayoutContentSidebarMode;
|
|
43
|
+
}
|
|
@@ -6,6 +6,7 @@ export * from './UiDataTable';
|
|
|
6
6
|
export * from './UiDatePicker';
|
|
7
7
|
export * from './UiFileUpload';
|
|
8
8
|
export * from './UiFloatActions';
|
|
9
|
+
export * from './UiLayout';
|
|
9
10
|
export * from './UiPlaceholder';
|
|
10
11
|
export * from './UiProfileCard';
|
|
11
12
|
export * from './UiSidebar';
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"components-uiautocomplete--accessibility": "accessibility",
|
|
33
33
|
"components-uibreadcrumb--accessibility": "accessibility",
|
|
34
34
|
"patterns-uifloatactions--accessibility": "accessibility",
|
|
35
|
+
"patterns-uilayout-content--accessibility": "accessibility",
|
|
35
36
|
"patterns-uidatatable--accessibility": "accessibility",
|
|
36
37
|
"patterns-uitopbar--accessibility": "accessibility",
|
|
37
38
|
"patterns-uifileupload-uifileitem--accessibility": "accessibility",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/ui-library",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/system/lib.js",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"http-server": "14.1.1",
|
|
72
72
|
"playwright": "^1.57.0",
|
|
73
73
|
"postcss": "8.5.10",
|
|
74
|
-
"react": "
|
|
75
|
-
"react-dom": "
|
|
74
|
+
"react": "19.2.7",
|
|
75
|
+
"react-dom": "19.2.7",
|
|
76
76
|
"sb-addon-versions": "^1.0.12",
|
|
77
77
|
"storybook": "10.2.17",
|
|
78
78
|
"storybook-addon-tag-badges": "^3.1.0",
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"wait-on": "9.0.3",
|
|
90
90
|
"@aleph-alpha/eslint-config-frontend": "0.7.1",
|
|
91
91
|
"@aleph-alpha/prettier-config-frontend": "2.1.1",
|
|
92
|
+
"@aleph-alpha/storybook-addon-filters": "0.0.1",
|
|
92
93
|
"@aleph-alpha/storybook-addon-sidebar": "0.0.1",
|
|
93
94
|
"@aleph-alpha/storybook-addon-theming": "0.0.1",
|
|
94
|
-
"@aleph-alpha/storybook-addon-filters": "0.0.1",
|
|
95
95
|
"@aleph-alpha/tsconfig-frontend": "0.7.3"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"lint": "eslint 'src/**/*.{js,vue,ts}' --cache",
|
|
148
148
|
"test": "vitest --run --project=unit",
|
|
149
149
|
"test:watch": "vitest --project=unit",
|
|
150
|
-
"test:storybook": "pnpm concurrently -k --ks SIGKILL -s command-test -n \"storybook,test\" \"pnpm http-server ../../dist/storybook/ui-library --port 4400 --silent\" \"wait-on tcp:4400 && test-storybook --url http://127.0.0.1:4400 --junit\"",
|
|
150
|
+
"test:storybook": "pnpm concurrently -k --ks SIGKILL -s command-test -n \"storybook,test\" \"pnpm http-server ../../dist/storybook/ui-library --port 4400 --silent\" \"wait-on tcp:4400 && test-storybook --url http://127.0.0.1:4400 --junit $STORYBOOK_TEST_PATTERN\"",
|
|
151
151
|
"test:storybook:local": "pnpm build-storybook && pnpm concurrently -k --ks SIGKILL -s command-test -n \"storybook,test\" \"pnpm http-server storybook-static --port 4400 --silent\" \"wait-on tcp:4400 && test-storybook --url http://127.0.0.1:4400 --junit\"",
|
|
152
152
|
"test:all": "vitest --run",
|
|
153
153
|
"storybook": "storybook dev -p 6006",
|
|
@@ -17,12 +17,14 @@ import {
|
|
|
17
17
|
SIDEBAR_COOKIE_MAX_AGE,
|
|
18
18
|
SIDEBAR_COOKIE_NAME,
|
|
19
19
|
SIDEBAR_KEYBOARD_SHORTCUT,
|
|
20
|
+
SIDEBAR_MIN_DESKTOP_MEDIA_QUERY,
|
|
20
21
|
SIDEBAR_OFFSET_TOP_CLASS,
|
|
21
22
|
SIDEBAR_WIDTH,
|
|
22
23
|
SIDEBAR_WIDTH_DEFAULT,
|
|
23
24
|
SIDEBAR_WIDTH_ICON,
|
|
24
25
|
SIDEBAR_WIDTH_MAX,
|
|
25
26
|
SIDEBAR_WIDTH_MIN,
|
|
27
|
+
SIDEBAR_WIDTH_MIN_DESKTOP,
|
|
26
28
|
SIDEBAR_WIDTH_MOBILE,
|
|
27
29
|
SIDEBAR_WIDTH_STORAGE_KEY,
|
|
28
30
|
} from './utils';
|
|
@@ -153,10 +155,18 @@ const isResizing = ref(false);
|
|
|
153
155
|
let resizeStartX = 0;
|
|
154
156
|
let resizeStartWidth = 0;
|
|
155
157
|
|
|
158
|
+
// Toward the minimum desktop size (1024px) the sidebar narrows to a fixed
|
|
159
|
+
// 162px and its content truncates. The clamp lives on the width variable, so
|
|
160
|
+
// everything reading `--sidebar-width` — the column, the offcanvas collapse
|
|
161
|
+
// margin, a top bar aligning its gutter — follows along.
|
|
162
|
+
const isMinDesktop = useMediaQuery(SIDEBAR_MIN_DESKTOP_MEDIA_QUERY);
|
|
163
|
+
|
|
156
164
|
const canResize = computed(
|
|
157
165
|
() =>
|
|
158
166
|
resolvedResizable.value &&
|
|
159
167
|
!isMobile.value &&
|
|
168
|
+
// The compact-desktop clamp fixes the width, so a drag would not move it.
|
|
169
|
+
!isMinDesktop.value &&
|
|
160
170
|
(props.collapsible === 'none' || state.value === 'expanded'),
|
|
161
171
|
);
|
|
162
172
|
// The provider used to own these. The sidebar sets them on itself so it can be
|
|
@@ -169,12 +179,18 @@ const widthVars = computed(() => ({
|
|
|
169
179
|
'--sidebar-mobile-transition-duration': props.mobileTransitionDuration,
|
|
170
180
|
}));
|
|
171
181
|
|
|
172
|
-
const sidebarStyle = computed(() =>
|
|
173
|
-
|
|
174
|
-
'--sidebar-width': resolvedResizable.value
|
|
182
|
+
const sidebarStyle = computed(() => {
|
|
183
|
+
let width = resolvedResizable.value
|
|
175
184
|
? `${sidebarWidth.value}px`
|
|
176
|
-
: SIDEBAR_WIDTH
|
|
177
|
-
|
|
185
|
+
: SIDEBAR_WIDTH;
|
|
186
|
+
// The compact-desktop clamp overrides both the constant and a stored drag.
|
|
187
|
+
if (isMinDesktop.value) width = SIDEBAR_WIDTH_MIN_DESKTOP;
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
...widthVars.value,
|
|
191
|
+
'--sidebar-width': width,
|
|
192
|
+
};
|
|
193
|
+
});
|
|
178
194
|
|
|
179
195
|
const mobileStyle = computed(() => ({
|
|
180
196
|
...widthVars.value,
|
|
@@ -7,6 +7,16 @@ export const SIDEBAR_WIDTH = '16rem';
|
|
|
7
7
|
export const SIDEBAR_WIDTH_DEFAULT = 256;
|
|
8
8
|
export const SIDEBAR_WIDTH_MIN = 240;
|
|
9
9
|
export const SIDEBAR_WIDTH_MAX = 480;
|
|
10
|
+
/**
|
|
11
|
+
* Width on compact desktop viewports (from `md` up to below the `desktop`
|
|
12
|
+
* breakpoint, 1200px): toward the minimum desktop size of 1024px the sidebar
|
|
13
|
+
* narrows to 162px and its content truncates, leaving the room to the content
|
|
14
|
+
* area's grid.
|
|
15
|
+
*/
|
|
16
|
+
export const SIDEBAR_WIDTH_MIN_DESKTOP = '162px';
|
|
17
|
+
/** Matches compact desktop viewports — at or above `md`, below `desktop`. */
|
|
18
|
+
export const SIDEBAR_MIN_DESKTOP_MEDIA_QUERY =
|
|
19
|
+
'(min-width: 768px) and (max-width: 1199.9px)';
|
|
10
20
|
export const SIDEBAR_WIDTH_MOBILE = '16rem';
|
|
11
21
|
export const SIDEBAR_WIDTH_ICON = '3rem';
|
|
12
22
|
export const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|