@manakind/ui-core 0.28.0 → 0.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,9 @@
5
5
  * `lg` step the panel goes above the content, in the flow, as a band across
6
6
  * the layout's width: the layout sits outside the page's padding, so the
7
7
  * panel squares its corners and keeps only its top and bottom borders, and
8
- * the page's own padding spaces the content from it. Breakpoints are
8
+ * the page's own padding spaces the content from it. The content is a
9
+ * column that fills the layout's height, so an app's footer placed in it
10
+ * after a growing page sits at the foot of a short one. Breakpoints are
9
11
  * viewport tokens written as literals (`check:breakpoints`).
10
12
  */
11
13
  .ds-side-panel-layout {
@@ -14,6 +16,9 @@
14
16
  min-width: 0;
15
17
 
16
18
  & > .ds-side-panel-layout__main {
19
+ display: flex;
20
+ flex-direction: column;
21
+ flex-grow: 1;
17
22
  min-width: 0;
18
23
  }
19
24
 
@@ -31,6 +36,17 @@
31
36
  border-inline-width: 0;
32
37
  border-radius: 0;
33
38
  }
39
+
40
+ /*
41
+ * A panel that replaces another opens while the one it closed is still
42
+ * in the slot for a render; the newer is portalled in last. Taking the
43
+ * older out of the layout at once lets the newer scroll into view
44
+ * against the page as it will be, rather than scroll past the older
45
+ * and then jump back when it leaves.
46
+ */
47
+ & > .ds-dialog:not(:last-child) {
48
+ display: none;
49
+ }
34
50
  }
35
51
  }
36
52
 
@@ -19,10 +19,13 @@ export type SidePanelLayoutProps = Omit<ComponentProps<typeof ark.div>, 'asChild
19
19
  * header and with nothing after it in the page: the drawer is as tall as the
20
20
  * viewport below the header and can't leave the layout, so content above the
21
21
  * layout pushes its foot off the screen and content after it lifts its top
22
- * under the header. Below `lg` the panel goes above the content, in the
23
- * page's flow, and pushes it down. With no panel open the content takes the
24
- * whole width. One panel shows at a time: opening another closes the one
25
- * that was open.
22
+ * under the header. An app's footer therefore goes inside the layout, after
23
+ * the page, where the drawer narrows it as it does the page; the content is a
24
+ * column that fills the layout's height, so with the page growing
25
+ * (`Frame grow`) the footer sits at the foot of a short page. Below `lg` the
26
+ * panel goes above the content, in the page's flow, and pushes it down. With
27
+ * no panel open the content takes the whole width. One panel shows at a time:
28
+ * opening another closes the one that was open.
26
29
  *
27
30
  * ```tsx
28
31
  * <SidePanelLayout>
@@ -1 +1 @@
1
- {"version":3,"file":"side-panel-layout.d.ts","sourceRoot":"","sources":["../../src/side-panel-layout/side-panel-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,KAAK,cAAc,EAA0C,MAAM,OAAO,CAAC;AAGpF,OAAO,yBAAyB,CAAC;AAEjC;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAqBtF"}
1
+ {"version":3,"file":"side-panel-layout.d.ts","sourceRoot":"","sources":["../../src/side-panel-layout/side-panel-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,KAAK,cAAc,EAA0C,MAAM,OAAO,CAAC;AAGpF,OAAO,yBAAyB,CAAC;AAEjC;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAqBtF"}
@@ -17,10 +17,13 @@ import './side-panel-layout.css';
17
17
  * header and with nothing after it in the page: the drawer is as tall as the
18
18
  * viewport below the header and can't leave the layout, so content above the
19
19
  * layout pushes its foot off the screen and content after it lifts its top
20
- * under the header. Below `lg` the panel goes above the content, in the
21
- * page's flow, and pushes it down. With no panel open the content takes the
22
- * whole width. One panel shows at a time: opening another closes the one
23
- * that was open.
20
+ * under the header. An app's footer therefore goes inside the layout, after
21
+ * the page, where the drawer narrows it as it does the page; the content is a
22
+ * column that fills the layout's height, so with the page growing
23
+ * (`Frame grow`) the footer sits at the foot of a short page. Below `lg` the
24
+ * panel goes above the content, in the page's flow, and pushes it down. With
25
+ * no panel open the content takes the whole width. One panel shows at a time:
26
+ * opening another closes the one that was open.
24
27
  *
25
28
  * ```tsx
26
29
  * <SidePanelLayout>
@@ -1 +1 @@
1
- {"version":3,"file":"side-panel-layout.js","sourceRoot":"","sources":["../../src/side-panel-layout/side-panel-layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAuB,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAsB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,yBAAyB,CAAC;AAQjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAwB;IACrF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAwB,IAAI,CAAC,CAAC;IACxE,MAAM,WAAW,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,KAAiB,EAAE,EAAE;QAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC;QACrC,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;QAC5B,QAAQ,EAAE,EAAE,CAAC;QACb,OAAO,GAAG,EAAE;YACV,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK;gBAAE,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,MAAM,IAAI,GAAG,OAAO,CAAgB,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAEtF,OAAO,CACL,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YACxC,MAAC,GAAG,CAAC,GAAG,IAAC,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,KAAM,KAAK,aAClE,cAAK,SAAS,EAAC,4BAA4B,YAAE,QAAQ,GAAO,EAC5D,cAAK,GAAG,EAAE,YAAY,EAAE,SAAS,EAAC,6BAA6B,GAAG,IAC1D,GACoB,CACjC,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport { type ComponentProps, useCallback, useMemo, useRef, useState } from 'react';\nimport { cx } from '../cx';\nimport { type SidePanelSlot, SidePanelSlotContext } from './side-panel-context';\nimport './side-panel-layout.css';\n\n/**\n * No `asChild`: the layout renders its content and its panel slot, and Ark's\n * `asChild` clones exactly one.\n */\nexport type SidePanelLayoutProps = Omit<ComponentProps<typeof ark.div>, 'asChild'>;\n\n/**\n * Content with room for a side panel: a `Dialog` with `presentation=\"side\"`\n * opened anywhere inside it opens beside the content and narrows it, so the\n * list it was opened from stays in view and usable.\n *\n * From the `lg` viewport step up the panel is a drawer at the layout's end\n * edge, from under the app's header (`--ds-sticky-offset-top`) to the bottom\n * of the viewport, and the content gives up its width rather than being\n * covered. Put the layout outside the page's own padding, around the page\n * template, so the drawer meets the window's edge, directly under the app's\n * header and with nothing after it in the page: the drawer is as tall as the\n * viewport below the header and can't leave the layout, so content above the\n * layout pushes its foot off the screen and content after it lifts its top\n * under the header. Below `lg` the panel goes above the content, in the\n * page's flow, and pushes it down. With no panel open the content takes the\n * whole width. One panel shows at a time: opening another closes the one\n * that was open.\n *\n * ```tsx\n * <SidePanelLayout>\n * <PageLayout>\n * <ActionList />\n * <Dialog presentation=\"side\" title=\"Add action\" trigger={<Button>Add action</Button>}>\n * <ActionForm />\n * </Dialog>\n * </PageLayout>\n * </SidePanelLayout>\n * ```\n */\nexport function SidePanelLayout({ className, children, ...props }: SidePanelLayoutProps) {\n const [container, setContainer] = useState<HTMLDivElement | null>(null);\n const closeHolder = useRef<(() => void) | null>(null);\n const claim = useCallback((close: () => void) => {\n const previous = closeHolder.current;\n closeHolder.current = close;\n previous?.();\n return () => {\n if (closeHolder.current === close) closeHolder.current = null;\n };\n }, []);\n const slot = useMemo<SidePanelSlot>(() => ({ container, claim }), [container, claim]);\n\n return (\n <SidePanelSlotContext.Provider value={slot}>\n <ark.div className={cx('ds-side-panel-layout', className)} {...props}>\n <div className=\"ds-side-panel-layout__main\">{children}</div>\n <div ref={setContainer} className=\"ds-side-panel-layout__panel\" />\n </ark.div>\n </SidePanelSlotContext.Provider>\n );\n}\n"]}
1
+ {"version":3,"file":"side-panel-layout.js","sourceRoot":"","sources":["../../src/side-panel-layout/side-panel-layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAuB,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAsB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,yBAAyB,CAAC;AAQjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAwB;IACrF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAwB,IAAI,CAAC,CAAC;IACxE,MAAM,WAAW,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,KAAiB,EAAE,EAAE;QAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC;QACrC,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;QAC5B,QAAQ,EAAE,EAAE,CAAC;QACb,OAAO,GAAG,EAAE;YACV,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK;gBAAE,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,MAAM,IAAI,GAAG,OAAO,CAAgB,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAEtF,OAAO,CACL,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YACxC,MAAC,GAAG,CAAC,GAAG,IAAC,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,KAAM,KAAK,aAClE,cAAK,SAAS,EAAC,4BAA4B,YAAE,QAAQ,GAAO,EAC5D,cAAK,GAAG,EAAE,YAAY,EAAE,SAAS,EAAC,6BAA6B,GAAG,IAC1D,GACoB,CACjC,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport { type ComponentProps, useCallback, useMemo, useRef, useState } from 'react';\nimport { cx } from '../cx';\nimport { type SidePanelSlot, SidePanelSlotContext } from './side-panel-context';\nimport './side-panel-layout.css';\n\n/**\n * No `asChild`: the layout renders its content and its panel slot, and Ark's\n * `asChild` clones exactly one.\n */\nexport type SidePanelLayoutProps = Omit<ComponentProps<typeof ark.div>, 'asChild'>;\n\n/**\n * Content with room for a side panel: a `Dialog` with `presentation=\"side\"`\n * opened anywhere inside it opens beside the content and narrows it, so the\n * list it was opened from stays in view and usable.\n *\n * From the `lg` viewport step up the panel is a drawer at the layout's end\n * edge, from under the app's header (`--ds-sticky-offset-top`) to the bottom\n * of the viewport, and the content gives up its width rather than being\n * covered. Put the layout outside the page's own padding, around the page\n * template, so the drawer meets the window's edge, directly under the app's\n * header and with nothing after it in the page: the drawer is as tall as the\n * viewport below the header and can't leave the layout, so content above the\n * layout pushes its foot off the screen and content after it lifts its top\n * under the header. An app's footer therefore goes inside the layout, after\n * the page, where the drawer narrows it as it does the page; the content is a\n * column that fills the layout's height, so with the page growing\n * (`Frame grow`) the footer sits at the foot of a short page. Below `lg` the\n * panel goes above the content, in the page's flow, and pushes it down. With\n * no panel open the content takes the whole width. One panel shows at a time:\n * opening another closes the one that was open.\n *\n * ```tsx\n * <SidePanelLayout>\n * <PageLayout>\n * <ActionList />\n * <Dialog presentation=\"side\" title=\"Add action\" trigger={<Button>Add action</Button>}>\n * <ActionForm />\n * </Dialog>\n * </PageLayout>\n * </SidePanelLayout>\n * ```\n */\nexport function SidePanelLayout({ className, children, ...props }: SidePanelLayoutProps) {\n const [container, setContainer] = useState<HTMLDivElement | null>(null);\n const closeHolder = useRef<(() => void) | null>(null);\n const claim = useCallback((close: () => void) => {\n const previous = closeHolder.current;\n closeHolder.current = close;\n previous?.();\n return () => {\n if (closeHolder.current === close) closeHolder.current = null;\n };\n }, []);\n const slot = useMemo<SidePanelSlot>(() => ({ container, claim }), [container, claim]);\n\n return (\n <SidePanelSlotContext.Provider value={slot}>\n <ark.div className={cx('ds-side-panel-layout', className)} {...props}>\n <div className=\"ds-side-panel-layout__main\">{children}</div>\n <div ref={setContainer} className=\"ds-side-panel-layout__panel\" />\n </ark.div>\n </SidePanelSlotContext.Provider>\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manakind/ui-core",
3
- "version": "0.28.0",
3
+ "version": "0.28.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {