@domicile-desktop/component-library 0.0.0-alpha-341debf31d08 → 0.0.0-alpha-be59aae76f2f

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/package.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "dependencies": {
3
3
  "@base-ui/react": "^1.8.0",
4
4
  "@cprussin/option-result": "^2.0.1",
5
- "@domicile-desktop/sdk": "0.0.0-alpha-341debf31d08",
6
- "@domicile-desktop/system-apps": "0.0.0-alpha-341debf31d08",
5
+ "@domicile-desktop/sdk": "0.0.0-alpha-be59aae76f2f",
6
+ "@domicile-desktop/system-apps": "0.0.0-alpha-be59aae76f2f",
7
7
  "@pandacss/dev": "^1.12.1",
8
8
  "@phosphor-icons/react": "^2.1.10"
9
9
  },
@@ -121,5 +121,5 @@
121
121
  "test:unit": "bun test"
122
122
  },
123
123
  "type": "module",
124
- "version": "0.0.0-alpha-341debf31d08"
124
+ "version": "0.0.0-alpha-be59aae76f2f"
125
125
  }
@@ -1,4 +1,5 @@
1
1
  import { Dialog as BaseDialog } from "@base-ui/react/dialog";
2
+ import { CaretLeftIcon } from "@phosphor-icons/react/dist/ssr/CaretLeft";
2
3
  import { XIcon } from "@phosphor-icons/react/dist/ssr/X";
3
4
  import type { ReactElement, ReactNode } from "react";
4
5
  import { css, cva } from "../../styled-system/css";
@@ -20,6 +21,13 @@ type Props = ExtendProps<
20
21
  {
21
22
  children: ReactNode;
22
23
  footer?: ReactNode | undefined;
24
+ /**
25
+ * Keeps the panel in the page, hidden, while closed, so what it holds
26
+ * keeps running, such as a web page.
27
+ */
28
+ keepMounted?: boolean | undefined;
29
+ /** Shows a back button before the title, for a page within the panel. */
30
+ onBack?: (() => void) | undefined;
23
31
  /**
24
32
  * Name of the display to slide in on and dim. Without it, a page spanning
25
33
  * several monitors uses the rightmost edge and dims them all. Needs a
@@ -28,22 +36,27 @@ type Props = ExtendProps<
28
36
  screen?: string | undefined;
29
37
  title?: ReactNode | undefined;
30
38
  trigger?: ReactElement | undefined;
39
+ /** Wider, for a page with a list and its content side by side. */
40
+ wide?: boolean | undefined;
31
41
  }
32
42
  >;
33
43
 
34
44
  const SlideOverComponent = ({
35
45
  children,
36
46
  footer,
47
+ keepMounted = false,
48
+ onBack,
37
49
  screen,
38
50
  title,
39
51
  trigger,
52
+ wide = false,
40
53
  ...rootProps
41
54
  }: Props) => {
42
55
  const region = useScreenRegion(screen);
43
56
  return (
44
57
  <BaseDialog.Root {...rootProps}>
45
58
  {trigger !== undefined && <BaseDialog.Trigger render={trigger} />}
46
- <BaseDialog.Portal>
59
+ <BaseDialog.Portal keepMounted={keepMounted}>
47
60
  {/*
48
61
  On the panel's screen only, as in `ModalDialog`. Data attribute for
49
62
  tests.
@@ -54,8 +67,16 @@ const SlideOverComponent = ({
54
67
  style={region}
55
68
  />
56
69
  <BaseDialog.Viewport className={viewportStyles} style={region}>
57
- <BaseDialog.Popup className={popupStyles}>
70
+ <BaseDialog.Popup
71
+ className={popupStyles}
72
+ data-wide={wide ? "" : undefined}
73
+ >
58
74
  <header className={headerStyles}>
75
+ {onBack !== undefined && (
76
+ <Button label="Back" onClick={onBack} variant="ghost">
77
+ <CaretLeftIcon />
78
+ </Button>
79
+ )}
59
80
  {title !== undefined && (
60
81
  <BaseDialog.Title className={titleStyles}>
61
82
  {title}
@@ -126,6 +147,7 @@ const popupStyles = flex({
126
147
  transform: "translateX(100%)",
127
148
  transition: "transform {durations.fast} {easings.in}",
128
149
  },
150
+ "&[data-wide]": { inlineSize: "min({spacing.240}, 92cqw)" },
129
151
  backgroundColor: "card",
130
152
  blockSize: "100%",
131
153
  borderInlineStartColor: "border",
@@ -147,8 +169,10 @@ const headerStyles = flex({
147
169
  paddingInline: 4,
148
170
  });
149
171
 
172
+ // Fills the header between the back and close buttons.
150
173
  const titleStyles = css({
151
174
  color: "foreground",
175
+ flex: 1,
152
176
  fontSize: "md",
153
177
  fontWeight: "semibold",
154
178
  lineHeight: "snug",