@datalayer/primer-addons 1.0.38 → 1.0.39

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.
Files changed (40) hide show
  1. package/README.md +52 -20
  2. package/lib/components/appearance/AppearanceControls.d.ts +6 -1
  3. package/lib/components/appearance/AppearanceControls.js +7 -3
  4. package/lib/components/appearance/AppearanceControlsWithStore.d.ts +4 -0
  5. package/lib/components/appearance/AppearanceControlsWithStore.js +4 -4
  6. package/lib/components/appearance/CollaboratorPalette.js +7 -20
  7. package/lib/components/box/Box.d.ts +103 -16
  8. package/lib/components/box/Box.js +157 -2
  9. package/lib/components/box/boxCss.d.ts +805 -0
  10. package/lib/components/box/boxCss.js +492 -0
  11. package/lib/components/box/boxTokens.d.ts +129 -0
  12. package/lib/components/box/boxTokens.js +124 -0
  13. package/lib/components/calendar-picker/CalendarPicker.js +2 -1
  14. package/lib/components/card/Card.js +19 -10
  15. package/lib/components/color/ColorSwatch.js +2 -1
  16. package/lib/components/color-picker/ColorPicker.js +8 -4
  17. package/lib/components/date-picker/DatePicker.d.ts +12 -3
  18. package/lib/components/date-picker/DatePicker.js +24 -8
  19. package/lib/components/index.d.ts +1 -0
  20. package/lib/components/index.js +1 -0
  21. package/lib/components/sheet/Sheet.d.ts +15 -0
  22. package/lib/components/sheet/Sheet.js +21 -0
  23. package/lib/reactor/page-layout/PageLayout.js +4 -6
  24. package/lib/story-helpers.d.ts +2 -2
  25. package/lib/theme/DatalayerThemeProvider.d.ts +21 -0
  26. package/lib/theme/DatalayerThemeProvider.js +8 -2
  27. package/lib/theme/colors/index.d.ts +2 -1
  28. package/lib/theme/colors/index.js +2 -1
  29. package/lib/theme/colors/loopColors.d.ts +2 -48
  30. package/lib/theme/colors/loopColors.js +2 -98
  31. package/lib/theme/colors/themeAccents.d.ts +81 -0
  32. package/lib/theme/colors/themeAccents.js +139 -0
  33. package/lib/theme/css/createThemeCSSVars.js +3 -0
  34. package/lib/theme/css/primerBaseVars.d.ts +1 -0
  35. package/lib/theme/css/primerBaseVars.js +72 -0
  36. package/lib/theme/index.d.ts +1 -0
  37. package/lib/theme/index.js +1 -0
  38. package/lib/theme/themes/loopThemeStyles.d.ts +0 -6
  39. package/lib/theme/themes/loopThemeStyles.js +22 -12
  40. package/package.json +1 -1
@@ -0,0 +1,124 @@
1
+ /*
2
+ * Copyright (c) 2023-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * The tokens `Box` resolves, taken from Primer React's own theme
7
+ * (`@primer/react` 37, `legacy-theme/ts/color-schemes.js`): each colour or
8
+ * shadow path is mapped to the first CSS variable Primer's theme object
9
+ * gives it — the variable Primer itself reads first — and emitted without
10
+ * the fallback chain that follows it. The scales are Primer's theme scales.
11
+ *
12
+ * Generated from Primer's color schemes; regenerate when `@primer/react`
13
+ * changes its theme.
14
+ */
15
+ export const BOX_COLOR_VARS = {
16
+ 'fg.default': '--fgColor-default',
17
+ 'fg.muted': '--fgColor-muted',
18
+ 'fg.subtle': '--fgColor-muted',
19
+ 'fg.onEmphasis': '--fgColor-onEmphasis',
20
+ 'canvas.default': '--bgColor-default',
21
+ 'canvas.overlay': '--overlay-bgColor',
22
+ 'canvas.inset': '--bgColor-inset',
23
+ 'canvas.subtle': '--bgColor-muted',
24
+ 'border.default': '--borderColor-default',
25
+ 'border.muted': '--borderColor-muted',
26
+ 'border.subtle': '--borderColor-muted',
27
+ 'neutral.emphasisPlus': '--bgColor-emphasis',
28
+ 'neutral.emphasis': '--bgColor-neutral-emphasis',
29
+ 'neutral.muted': '--bgColor-neutral-muted',
30
+ 'neutral.subtle': '--bgColor-neutral-muted',
31
+ 'accent.fg': '--fgColor-accent',
32
+ 'accent.emphasis': '--bgColor-accent-emphasis',
33
+ 'accent.muted': '--borderColor-accent-muted',
34
+ 'accent.subtle': '--bgColor-accent-muted',
35
+ 'success.fg': '--fgColor-success',
36
+ 'success.emphasis': '--bgColor-success-emphasis',
37
+ 'success.muted': '--borderColor-success-muted',
38
+ 'success.subtle': '--bgColor-success-muted',
39
+ 'attention.fg': '--fgColor-attention',
40
+ 'attention.emphasis': '--bgColor-attention-emphasis',
41
+ 'attention.muted': '--borderColor-attention-muted',
42
+ 'attention.subtle': '--bgColor-attention-muted',
43
+ 'severe.fg': '--fgColor-severe',
44
+ 'severe.emphasis': '--bgColor-severe-emphasis',
45
+ 'severe.muted': '--borderColor-severe-muted',
46
+ 'severe.subtle': '--bgColor-severe-muted',
47
+ 'danger.fg': '--fgColor-danger',
48
+ 'danger.emphasis': '--borderColor-danger-emphasis',
49
+ 'danger.muted': '--borderColor-danger-muted',
50
+ 'danger.subtle': '--bgColor-danger-muted',
51
+ 'open.fg': '--fgColor-open',
52
+ 'open.emphasis': '--bgColor-open-emphasis',
53
+ 'open.muted': '--borderColor-open-muted',
54
+ 'open.subtle': '--bgColor-open-muted',
55
+ 'closed.fg': '--fgColor-closed',
56
+ 'closed.emphasis': '--bgColor-closed-emphasis',
57
+ 'closed.muted': '--borderColor-closed-muted',
58
+ 'closed.subtle': '--bgColor-closed-muted',
59
+ 'done.fg': '--fgColor-done',
60
+ 'done.emphasis': '--bgColor-done-emphasis',
61
+ 'done.muted': '--borderColor-done-muted',
62
+ 'done.subtle': '--bgColor-done-muted',
63
+ 'sponsors.fg': '--fgColor-sponsors',
64
+ 'sponsors.emphasis': '--bgColor-sponsors-emphasis',
65
+ 'sponsors.muted': '--borderColor-sponsors-muted',
66
+ 'sponsors.subtle': '--bgColor-sponsors-muted',
67
+ 'actionListItem.default.hoverBg': '--control-transparent-bgColor-hover',
68
+ 'actionListItem.default.activeBg': '--control-transparent-bgColor-active',
69
+ };
70
+ export const BOX_SHADOW_VARS = {
71
+ 'shadow.small': '--shadow-resting-small',
72
+ 'shadow.medium': '--shadow-resting-medium',
73
+ 'shadow.large': '--shadow-floating-large',
74
+ 'shadow.extraLarge': '--shadow-floating-xlarge',
75
+ };
76
+ /** Primer's breakpoints: a responsive array's second value from 544px, … */
77
+ export const BOX_BREAKPOINTS = ['544px', '768px', '1012px', '1280px'];
78
+ /** Primer's space scale: `p={3}` is 16px. */
79
+ export const BOX_SPACE = ['0', '4px', '8px', '16px', '24px', '32px', '40px', '48px', '64px', '80px', '96px', '112px', '128px'];
80
+ /** Primer's font sizes: `fontSize={1}` is 14px. */
81
+ export const BOX_FONT_SIZES = ['12px', '14px', '16px', '20px', '24px', '32px', '40px', '48px', '56px'];
82
+ /** Primer's radii by index (`borderRadius={2}` is 6px). */
83
+ export const BOX_RADII = ['0', '3px', '6px', '100px'];
84
+ /** Radii by name: Primer's, and the theme's shapes (LOOP T-03). */
85
+ export const BOX_RADIUS_VARS = {
86
+ small: '--borderRadius-small',
87
+ medium: '--borderRadius-medium',
88
+ large: '--borderRadius-large',
89
+ full: '--borderRadius-full',
90
+ control: '--theme-radius-control',
91
+ card: '--theme-radius-card',
92
+ bubble: '--theme-radius-bubble',
93
+ frame: '--theme-radius-frame',
94
+ };
95
+ /** Primer's border widths by index. */
96
+ export const BOX_BORDER_WIDTHS = ['0', '1px'];
97
+ /** Primer's sizes by name (`maxWidth="large"` is 1012px). */
98
+ export const BOX_SIZES = { small: '544px', medium: '768px', large: '1012px', xlarge: '1280px' };
99
+ /**
100
+ * Font weights by name, as the theme's weight variables. Primer's theme
101
+ * names its weights 300, 400, 500, 600 — `light`, `normal`, `semibold`,
102
+ * `bold` — which are the primitives' `light`, `normal`, `medium` and
103
+ * `semibold`: so `semibold` is `--base-text-weight-medium` (500, and 600 in
104
+ * the `loop` theme, which has two weights), as it reads today.
105
+ */
106
+ export const BOX_FONT_WEIGHT_VARS = {
107
+ light: '--base-text-weight-light',
108
+ normal: '--base-text-weight-normal',
109
+ medium: '--base-text-weight-medium',
110
+ semibold: '--base-text-weight-medium',
111
+ bold: '--base-text-weight-semibold',
112
+ };
113
+ /** Primer's line heights by name. */
114
+ export const BOX_LINE_HEIGHTS = { condensedUltra: '1', condensed: '1.25', default: '1.5' };
115
+ /** Font families by name. */
116
+ export const BOX_FONT_VARS = { normal: '--fontStack-system', mono: '--fontStack-monospace' };
117
+ /** Every CSS variable `Box` can emit: the theme provider must set them all. */
118
+ export const BOX_EMITTED_VARS = [
119
+ ...Object.values(BOX_COLOR_VARS),
120
+ ...Object.values(BOX_SHADOW_VARS),
121
+ ...Object.values(BOX_RADIUS_VARS),
122
+ ...Object.values(BOX_FONT_WEIGHT_VARS),
123
+ ...Object.values(BOX_FONT_VARS),
124
+ ];
@@ -117,7 +117,8 @@ export function CalendarPicker({ value, defaultMonth, onChange, min, max, isDisa
117
117
  : isToday
118
118
  ? "var(--borderColor-default)"
119
119
  : "transparent",
120
- borderRadius: 2,
120
+ // The theme's control corner: a pill in loop, Primer's medium elsewhere.
121
+ borderRadius: "var(--theme-radius-control)",
121
122
  height: 30,
122
123
  cursor: disabled ? "not-allowed" : "pointer",
123
124
  fontSize: 1,
@@ -1,11 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, IconButton, Text } from "@primer/react";
3
+ /**
4
+ * The corners, read from the theme: each theme sets Primer's radii (loop's
5
+ * are rounder), and a card left unsaid takes the theme's card corner.
6
+ */
3
7
  const roundedVals = {
4
- small: "3px",
5
- medium: "6px",
6
- large: "12px",
7
- full: "100vh",
8
+ small: "var(--borderRadius-small)",
9
+ medium: "var(--borderRadius-medium)",
10
+ large: "var(--borderRadius-large)",
11
+ full: "var(--borderRadius-full)",
8
12
  };
13
+ const CARD_RADIUS = "var(--theme-radius-card)";
9
14
  const shadowVals = {
10
15
  small: '0 1px 0 rgba(31,35,40,0.04)',
11
16
  medium: '0 3px 6px rgba(140,149,159,0.15)',
@@ -15,12 +20,16 @@ const shadowVals = {
15
20
  export const Card = (props) => {
16
21
  const { sx, rounded, border, shadow, children, ...otherProps } = props;
17
22
  return (_jsx(Box, { sx: {
23
+ // A column, so the actions stand at the bottom however long the
24
+ // text above them: cards side by side end on one line.
25
+ display: "flex",
26
+ flexDirection: "column",
18
27
  ...(sx ? sx : undefined),
19
- ...(rounded ? typeof rounded === "string" ? {
20
- borderRadius: roundedVals[rounded]
21
- } : {
22
- borderRadius: props.rounded
23
- } : undefined),
28
+ borderRadius: rounded === undefined
29
+ ? CARD_RADIUS
30
+ : typeof rounded === "string"
31
+ ? roundedVals[rounded]
32
+ : rounded,
24
33
  ...(border ? {
25
34
  borderWidth: 1,
26
35
  borderStyle: 'solid',
@@ -49,5 +58,5 @@ Card.Content = ({ children }) => {
49
58
  return (_jsx(Box, { display: "block", sx: { p: 3 }, children: children }));
50
59
  };
51
60
  Card.Actions = ({ children }) => {
52
- return _jsx(Box, { display: "block", sx: { p: 3 }, children: children });
61
+ return _jsx(Box, { display: "block", sx: { p: 3, mt: "auto" }, children: children });
53
62
  };
@@ -48,7 +48,8 @@ export function ColorSwatch({ color, label, showValue = true, height = 54, }) {
48
48
  gridTemplateRows: `${height}px auto`,
49
49
  border: "1px solid",
50
50
  borderColor: "var(--borderColor-default)",
51
- borderRadius: 2,
51
+ // The theme's card corner: 20px in loop, Primer's medium elsewhere.
52
+ borderRadius: "var(--theme-radius-card)",
52
53
  overflow: "hidden",
53
54
  minWidth: 0,
54
55
  }, children: [_jsx(Box, { ref: ref, style: { backgroundColor: color } }), _jsxs(Box, { sx: { p: 2, display: "grid", gap: 1 }, children: [_jsx(Text, { sx: {
@@ -283,13 +283,17 @@ export function ColorPicker({ color, onChange, presets = DEFAULT_COLOR_PRESETS,
283
283
  return (_jsxs(Box, { role: "group", "aria-label": ariaLabel, sx: { display: "grid", gap: 2, width, minWidth: 0 }, children: [_jsx(Box, { ref: field.ref, role: "slider", tabIndex: 0, "aria-label": "Saturation and brightness", "aria-valuetext": `saturation ${Math.round(hsv.s)}%, brightness ${Math.round(hsv.v)}%`, onPointerDown: field.onPointerDown, onKeyDown: (event) => nudge(event, event.key === "ArrowUp" || event.key === "ArrowDown" ? "v" : "s"), sx: {
284
284
  position: "relative",
285
285
  height: FIELD_HEIGHT,
286
- borderRadius: 2,
286
+ borderRadius: "var(--theme-radius-card)",
287
287
  border: "1px solid",
288
288
  borderColor: "var(--borderColor-default)",
289
289
  cursor: "crosshair",
290
290
  touchAction: "none",
291
291
  backgroundColor: toHex(hsvToRgb({ h: hsv.h, s: 100, v: 100 })),
292
292
  backgroundImage: "linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent)",
293
+ // Sized from the border's outer edge, not repeated into it: a
294
+ // gradient tiled from the padding box drew its black bottom row
295
+ // again in the top border, a dark line over the field.
296
+ backgroundOrigin: "border-box",
293
297
  "&:focus-visible": {
294
298
  outline: "2px solid var(--borderColor-accent-emphasis)",
295
299
  outlineOffset: "1px",
@@ -302,7 +306,7 @@ export function ColorPicker({ color, onChange, presets = DEFAULT_COLOR_PRESETS,
302
306
  } }) }), _jsx(Box, { ref: rail.ref, role: "slider", tabIndex: 0, "aria-label": "Hue", "aria-valuemin": 0, "aria-valuemax": 360, "aria-valuenow": Math.round(hsv.h), onPointerDown: rail.onPointerDown, onKeyDown: (event) => nudge(event, "h"), sx: {
303
307
  position: "relative",
304
308
  height: RAIL_HEIGHT,
305
- borderRadius: 6,
309
+ borderRadius: "var(--theme-radius-control)",
306
310
  border: "1px solid",
307
311
  borderColor: "var(--borderColor-default)",
308
312
  cursor: "ew-resize",
@@ -321,7 +325,7 @@ export function ColorPicker({ color, onChange, presets = DEFAULT_COLOR_PRESETS,
321
325
  width: 28,
322
326
  height: 28,
323
327
  flex: "0 0 auto",
324
- borderRadius: 2,
328
+ borderRadius: "var(--borderRadius-medium)",
325
329
  border: "1px solid",
326
330
  borderColor: "var(--borderColor-default)",
327
331
  backgroundColor: hex,
@@ -338,7 +342,7 @@ export function ColorPicker({ color, onChange, presets = DEFAULT_COLOR_PRESETS,
338
342
  const chosen = preset.toLowerCase() === hex.toLowerCase();
339
343
  return (_jsx(Box, { as: "button", type: "button", "aria-label": preset, "aria-pressed": chosen, onClick: () => setFromText(preset), sx: {
340
344
  height: 22,
341
- borderRadius: 2,
345
+ borderRadius: "var(--theme-radius-control)",
342
346
  cursor: "pointer",
343
347
  backgroundColor: preset,
344
348
  border: "1px solid",
@@ -1,4 +1,6 @@
1
1
  import { type CalendarPickerProps } from "../calendar-picker/CalendarPicker";
2
+ /** Where the time stands against the calendar in the overlay. */
3
+ export type DatePickerTimePosition = "north" | "east" | "south" | "west";
2
4
  /** `YYYY-MM-DD`, the one format that means the same thing everywhere. */
3
5
  export declare function formatISODate(date: Date): string;
4
6
  /** `YYYY-MM-DD HH:mm`, the same date with the minute it holds. */
@@ -53,10 +55,17 @@ export interface DatePickerProps extends Pick<CalendarPickerProps, "min" | "max"
53
55
  * Whether the field holds a time as well as a day.
54
56
  *
55
57
  * With it, the field reads and writes `YYYY-MM-DD HH:mm`, and the overlay
56
- * carries a time beneath the calendar. Without it — the default — nothing
57
- * about the field changes, because most dates are days.
58
+ * carries a time beside the calendar (see `timePosition`). Without it —
59
+ * the default — nothing about the field changes, because most dates are
60
+ * days.
58
61
  */
59
62
  withTime?: boolean;
63
+ /**
64
+ * Where the time stands against the calendar, with `withTime`: `east`
65
+ * (to its right, the default), `west` (to its left), `south` (under it)
66
+ * or `north` (above it).
67
+ */
68
+ timePosition?: DatePickerTimePosition;
60
69
  /**
61
70
  * Minutes between the options the minute column offers. Default: five.
62
71
  *
@@ -77,5 +86,5 @@ export interface DatePickerProps extends Pick<CalendarPickerProps, "min" | "max"
77
86
  * Controlled: `value` is the caller's, and every pick and every parsed entry
78
87
  * arrives through `onChange`.
79
88
  */
80
- export declare function DatePicker({ value, onChange, placeholder, "aria-label": ariaLabel, disabled, size, validationStatus, format, id, min, max, isDisabled, weekStartsOn, locale, withTime, timeStep, defaultTime, }: DatePickerProps): import("react").JSX.Element;
89
+ export declare function DatePicker({ value, onChange, placeholder, "aria-label": ariaLabel, disabled, size, validationStatus, format, id, min, max, isDisabled, weekStartsOn, locale, withTime, timePosition, timeStep, defaultTime, }: DatePickerProps): import("react").JSX.Element;
81
90
  export default DatePicker;
@@ -4,6 +4,20 @@ import { AnchoredOverlay, Box, Button, TextInput } from "@primer/react";
4
4
  import { CalendarIcon } from "@primer/octicons-react";
5
5
  import { CalendarPicker } from "../calendar-picker/CalendarPicker";
6
6
  import { TimeColumns } from "./TimeColumns";
7
+ /** The overlay's flow for each position: the calendar first, the time where it was asked. */
8
+ const TIME_FLOW = {
9
+ east: "row",
10
+ west: "row-reverse",
11
+ south: "column",
12
+ north: "column-reverse",
13
+ };
14
+ /** The hairline between the time and the calendar, on the side that faces it. */
15
+ const TIME_SEPARATOR = {
16
+ east: { pl: 3, borderLeft: "1px solid", borderColor: "border.default", alignSelf: "stretch" },
17
+ west: { pr: 3, borderRight: "1px solid", borderColor: "border.default", alignSelf: "stretch" },
18
+ south: { pt: 3, borderTop: "1px solid", borderColor: "border.default", alignSelf: "stretch" },
19
+ north: { pb: 3, borderBottom: "1px solid", borderColor: "border.default", alignSelf: "stretch" },
20
+ };
7
21
  /** `YYYY-MM-DD`, the one format that means the same thing everywhere. */
8
22
  export function formatISODate(date) {
9
23
  const month = `${date.getMonth() + 1}`.padStart(2, "0");
@@ -81,7 +95,7 @@ export function parseISODateTime(text) {
81
95
  * Controlled: `value` is the caller's, and every pick and every parsed entry
82
96
  * arrives through `onChange`.
83
97
  */
84
- export function DatePicker({ value = null, onChange, placeholder, "aria-label": ariaLabel = "Date", disabled = false, size = "medium", validationStatus, format, id, min, max, isDisabled, weekStartsOn, locale, withTime = false, timeStep = 5, defaultTime = "00:00", }) {
98
+ export function DatePicker({ value = null, onChange, placeholder, "aria-label": ariaLabel = "Date", disabled = false, size = "medium", validationStatus, format, id, min, max, isDisabled, weekStartsOn, locale, withTime = false, timePosition = "east", timeStep = 5, defaultTime = "00:00", }) {
85
99
  // The two shapes, chosen once: a caller that passed a `format` keeps it,
86
100
  // and a caller that asked for a time gets the one that carries a time.
87
101
  const writeDate = format ?? (withTime ? formatISODateTime : formatISODate);
@@ -138,7 +152,13 @@ export function DatePicker({ value = null, onChange, placeholder, "aria-label":
138
152
  next.setHours(hour, minute, 0, 0);
139
153
  return next;
140
154
  };
141
- const calendar = useMemo(() => (_jsxs(Box, { sx: { p: 3 }, children: [_jsx(CalendarPicker, { value: value, defaultMonth: value ?? undefined, onChange: (date) => {
155
+ const calendar = useMemo(() => (_jsxs(Box, { sx: {
156
+ p: 3,
157
+ display: "flex",
158
+ flexDirection: TIME_FLOW[timePosition],
159
+ alignItems: "flex-start",
160
+ gap: 3,
161
+ }, children: [_jsx(CalendarPicker, { value: value, defaultMonth: value ?? undefined, onChange: (date) => {
142
162
  // A day picked while a time is held keeps that time: somebody
143
163
  // moving a window from the 3rd to the 4th did not mean to move
144
164
  // it to midnight.
@@ -148,12 +168,7 @@ export function DatePicker({ value = null, onChange, placeholder, "aria-label":
148
168
  if (!withTime) {
149
169
  setOpen(false);
150
170
  }
151
- }, min: min, max: max, isDisabled: isDisabled, weekStartsOn: weekStartsOn, locale: locale, "aria-label": `${ariaLabel}, choose a day` }), withTime && (_jsxs(Box, { sx: {
152
- mt: 3,
153
- pt: 3,
154
- borderTop: "1px solid",
155
- borderColor: "border.default",
156
- }, children: [_jsx(TimeColumns, { hour: held.hour, minute: held.minute, step: timeStep, disabled: disabled, labelPrefix: ariaLabel, onChange: (hour, minute) => {
171
+ }, min: min, max: max, isDisabled: isDisabled, weekStartsOn: weekStartsOn, locale: locale, "aria-label": `${ariaLabel}, choose a day` }), withTime && (_jsxs(Box, { sx: TIME_SEPARATOR[timePosition], children: [_jsx(TimeColumns, { hour: held.hour, minute: held.minute, step: timeStep, disabled: disabled, labelPrefix: ariaLabel, onChange: (hour, minute) => {
157
172
  const next = atTime(hour, minute);
158
173
  onChange?.(next);
159
174
  setText(writeDate(next));
@@ -178,6 +193,7 @@ export function DatePicker({ value = null, onChange, placeholder, "aria-label":
178
193
  size,
179
194
  timeStep,
180
195
  value,
196
+ timePosition,
181
197
  weekStartsOn,
182
198
  withTime,
183
199
  writeDate,
@@ -9,6 +9,7 @@ export * from "./appearance/ThemeCircle";
9
9
  export * from "./box/Box";
10
10
  export * from "./calendar-picker";
11
11
  export * from "./card/Card";
12
+ export * from "./sheet/Sheet";
12
13
  export * from "./color";
13
14
  export * from "./color-picker";
14
15
  export * from "./content-loader/ContentLoader";
@@ -13,6 +13,7 @@ export * from "./appearance/ThemeCircle";
13
13
  export * from "./box/Box";
14
14
  export * from "./calendar-picker";
15
15
  export * from "./card/Card";
16
+ export * from "./sheet/Sheet";
16
17
  export * from "./color";
17
18
  export * from "./color-picker";
18
19
  export * from "./content-loader/ContentLoader";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `Sheet`: a page on a canvas — the canvas colour, its hairline, the theme's
3
+ * card corner (20px in loop) and the shadow a sheet of paper has, lifted off
4
+ * what is under it. The page layout draws its page with it; anything that
5
+ * shows a page of its own (a document, a gallery entry, a preview) can too.
6
+ *
7
+ * It owns its look only. Its size, padding and layout are the caller's,
8
+ * given as Box props (or `sx` while the migration lasts).
9
+ */
10
+ import { type BoxProps } from "../box/Box";
11
+ /** The shadow of a sheet: a hairline close under it, a soft fall far below. */
12
+ export declare const SHEET_SHADOW = "0 1px 2px rgba(0,0,0,0.06), 0 24px 48px -28px rgba(0,0,0,0.35)";
13
+ export type SheetProps = BoxProps;
14
+ export declare function Sheet(props: SheetProps): import("react").JSX.Element;
15
+ export default Sheet;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2023-2026 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ */
6
+ /**
7
+ * `Sheet`: a page on a canvas — the canvas colour, its hairline, the theme's
8
+ * card corner (20px in loop) and the shadow a sheet of paper has, lifted off
9
+ * what is under it. The page layout draws its page with it; anything that
10
+ * shows a page of its own (a document, a gallery entry, a preview) can too.
11
+ *
12
+ * It owns its look only. Its size, padding and layout are the caller's,
13
+ * given as Box props (or `sx` while the migration lasts).
14
+ */
15
+ import { Box } from "../box/Box";
16
+ /** The shadow of a sheet: a hairline close under it, a soft fall far below. */
17
+ export const SHEET_SHADOW = "0 1px 2px rgba(0,0,0,0.06), 0 24px 48px -28px rgba(0,0,0,0.35)";
18
+ export function Sheet(props) {
19
+ return (_jsx(Box, { bg: "canvas.default", border: "1px solid", borderColor: "border.default", borderRadius: "card", boxShadow: SHEET_SHADOW, ...props }));
20
+ }
21
+ export default Sheet;
@@ -45,6 +45,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
45
45
  */
46
46
  import { useEffect } from "react";
47
47
  import { Box, Text } from "@primer/react";
48
+ import { Sheet } from "../../components/sheet/Sheet";
48
49
  import { useSignalValue } from "@datalayer/reactor/react";
49
50
  import { pageLayoutActivity, pageLayoutPanelOpen, pageLayoutSheet, } from "./panelState";
50
51
  /** A page reads best at about this width; wider and lines run too long. */
@@ -212,7 +213,7 @@ export function PageLayout({ page, hasPage = page !== undefined && page !== null
212
213
  display: "flex",
213
214
  justifyContent: "flex-end",
214
215
  mb: 2,
215
- }, children: _jsx(ActivityLine, { label: activityLabel }) })) : null, _jsx(Box, { "data-page-sheet": "", sx: {
216
+ }, children: _jsx(ActivityLine, { label: activityLabel }) })) : null, _jsx(Sheet, { "data-page-sheet": "", sx: {
216
217
  width: "100%",
217
218
  maxWidth: pageWidth,
218
219
  /*
@@ -226,11 +227,8 @@ export function PageLayout({ page, hasPage = page !== undefined && page !== null
226
227
  change in the layout's height reaches the page at once.
227
228
  */
228
229
  flex: hasPage ? "1 0 auto" : "1 1 auto",
229
- bg: "canvas.default",
230
- border: "1px solid",
231
- borderColor: "border.default",
232
- borderRadius: "10px",
233
- boxShadow: "0 1px 2px rgba(0,0,0,0.06), 0 24px 48px -28px rgba(0,0,0,0.35)",
230
+ // Its look — canvas, hairline, the theme's card corner, the
231
+ // shadow — is the Sheet's.
234
232
  // The page's own margins. A page fills the sheet and reads
235
233
  // against these, as text on paper does; a panel's content
236
234
  // brings its own gutters, so it sits closer.
@@ -7,8 +7,8 @@ type StoryContext = Record<string, unknown> & {
7
7
  };
8
8
  parameters: Record<string, unknown>;
9
9
  };
10
- export declare const colormodeFromScheme: (colorScheme: string) => "light" | "dark";
11
- export declare const withThemeProvider: (Story: React.FC<React.PropsWithChildren<StoryContext>>, context: StoryContext) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<React.ReactNode> | React.JSX.Element | null | undefined;
10
+ export declare const colormodeFromScheme: (colorScheme: string) => "dark" | "light";
11
+ export declare const withThemeProvider: (Story: React.FC<React.PropsWithChildren<StoryContext>>, context: StoryContext) => string | number | bigint | boolean | Iterable<React.ReactNode> | React.JSX.Element | Promise<React.ReactNode> | null | undefined;
12
12
  export declare const toolbarTypes: {
13
13
  colorScheme: {
14
14
  name: string;
@@ -1,6 +1,27 @@
1
1
  import { type CSSProperties } from "react";
2
2
  import { ThemeProviderProps } from "@primer/react";
3
3
  import { type ThemeStyles } from "./css/createThemeCSSVars";
4
+ /**
5
+ * System sans-serif font stack — shared between `fontFamily` and
6
+ * the Primer `--fontStack-*` CSS custom properties so that
7
+ * components using the CSS `font` shorthand (e.g. `Blankslate`)
8
+ * also pick up the themed typeface.
9
+ */
10
+ /**
11
+ * Shared typographic rhythm — clean, spacious feel inspired by
12
+ * modern developer-blog aesthetics (generous line-height, open
13
+ * letter-spacing on headings, crisp body text).
14
+ *
15
+ * Primer components like `Blankslate` use the CSS `font` shorthand
16
+ * through `--text-title-shorthand-*` / `--text-body-shorthand-*`.
17
+ * Those shorthand variables reference `--fontStack-sansSerif` (and
18
+ * `--fontStack-sansSerifDisplay`). If the `@primer/primitives`
19
+ * typography CSS isn't loaded, the shorthand vars are undefined and
20
+ * components fall back to a hardcoded system font stack baked into
21
+ * their CSS. We define the full set here so **every** theme gets
22
+ * correct font inheritance — no primitives CSS import required.
23
+ */
24
+ export declare const typographyVars: CSSProperties;
4
25
  export interface IDatalayerThemeProviderProps extends Omit<ThemeProviderProps, "theme" | "colorMode"> {
5
26
  /**
6
27
  * Color mode to use.
@@ -8,6 +8,7 @@ import { BaseStyles, ThemeProvider } from "@primer/react";
8
8
  import { useSystemColorMode } from "./useSystemColorMode";
9
9
  import { datalayerTheme, datalayerThemeStyles } from "./themes/datalayerTheme";
10
10
  import { systemFontStack } from "./fontStacks";
11
+ import { primerBaseVars } from "./css/primerBaseVars";
11
12
  import { APP_ROOT_ATTRIBUTE, THEME_SCOPE_ATTRIBUTE, injectThemeStylesheet, setupPrimerPortals, syncPortalThemeStyles, } from "../utils/Portals";
12
13
  /**
13
14
  * System sans-serif font stack — shared between `fontFamily` and
@@ -29,7 +30,7 @@ import { APP_ROOT_ATTRIBUTE, THEME_SCOPE_ATTRIBUTE, injectThemeStylesheet, setup
29
30
  * their CSS. We define the full set here so **every** theme gets
30
31
  * correct font inheritance — no primitives CSS import required.
31
32
  */
32
- const typographyVars = {
33
+ export const typographyVars = {
33
34
  /* ── Font stacks ───────────────────────────────────────────────── */
34
35
  "--fontStack-monospace": "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
35
36
  "--fontStack-sansSerif": systemFontStack,
@@ -151,14 +152,18 @@ export function DatalayerThemeProvider(props) {
151
152
  const resolvedTheme = theme ?? datalayerTheme;
152
153
  const styles = themeStyles ?? datalayerThemeStyles;
153
154
  const resolvedStyles = isDark ? styles.dark : styles.light;
155
+ // Primer's variables no theme sets (radii, neutrals, shadows…), under the
156
+ // theme's own: `Box` emits them with no fallback (see primerBaseVars).
157
+ const baseVars = (isDark ? primerBaseVars.dark : primerBaseVars.light);
154
158
  // The full set of styles that <BaseStyles> receives — we also push
155
159
  // these to document.body so Primer portal content inherits theme
156
160
  // tokens, fonts, and colors.
157
161
  const portalStyles = useMemo(() => ({
158
162
  ...typographyVars,
163
+ ...baseVars,
159
164
  ...resolvedStyles,
160
165
  ...baseStyles,
161
- }), [resolvedStyles, baseStyles]);
166
+ }), [baseVars, resolvedStyles, baseStyles]);
162
167
  // Keep document.body portal-root attributes AND theme styles in sync
163
168
  // so that Primer portals (modals, dialogs, overlays) inherit the
164
169
  // correct color mode **and** theme tokens (fonts, colors, CSS vars).
@@ -200,6 +205,7 @@ export function DatalayerThemeProvider(props) {
200
205
  lineHeight: "1.7",
201
206
  transition: "background-color 0.25s ease, color 0.25s ease",
202
207
  ...typographyVars,
208
+ ...baseVars,
203
209
  ...resolvedStyles,
204
210
  ...baseStyles,
205
211
  }, children: [_jsx("span", { ref: sentinel, hidden: true, "data-datalayer-theme-root": "" }), children] }) }));
@@ -6,7 +6,8 @@ export { earthColors } from './earthColors';
6
6
  export { sandColors } from './sandColors';
7
7
  export { ivoryColors } from './ivoryColors';
8
8
  export { sunColors } from './sunColors';
9
- export { loopColors, loopAccents, loopAccentNames, loopAccentVars, loopAccentStyles, type LoopAccent, type LoopAccentName, } from './loopColors';
9
+ export { loopColors } from './loopColors';
10
+ export { themeAccents, themeAccentNames, themeAccentVars, themeAccentTints, themeStageGradient, themeTintVars, type ThemeAccent, type ThemeAccentName, } from './themeAccents';
10
11
  import type { ThemeVariant } from '../themeRegistry';
11
12
  /**
12
13
  * Themed color palettes — maps each `ThemeVariant` to its corresponding
@@ -10,7 +10,8 @@ export { earthColors } from './earthColors';
10
10
  export { sandColors } from './sandColors';
11
11
  export { ivoryColors } from './ivoryColors';
12
12
  export { sunColors } from './sunColors';
13
- export { loopColors, loopAccents, loopAccentNames, loopAccentVars, loopAccentStyles, } from './loopColors';
13
+ export { loopColors } from './loopColors';
14
+ export { themeAccents, themeAccentNames, themeAccentVars, themeAccentTints, themeStageGradient, themeTintVars, } from './themeAccents';
14
15
  import { datalayerColors } from './datalayerColors';
15
16
  import { spatialColors } from './spatialColors';
16
17
  import { lovelyColors } from './lovelyColors';
@@ -8,10 +8,8 @@
8
8
  *
9
9
  * The accent of the theme itself is mint — a soft green, lighter than
10
10
  * the platform's (decided 2026-10-03, after a day on sky). An
11
- * application may take one of five others (`loopAccents`); each is four
12
- * values: the accent, the text that sits
13
- * on it, the tint of the stage behind an application, and a quiet tint.
14
- * Dark text on every accent: the lowest contrast of the six is 8.8 to 1.
11
+ * application may take one of five others: the accents are the theme
12
+ * system's, over every theme (`themeAccents`, decided 2026-10-07).
15
13
  */
16
14
  export declare const loopColors: {
17
15
  black: string;
@@ -64,47 +62,3 @@ export declare const loopColors: {
64
62
  brightLightFlame: string;
65
63
  brightLightGold: string;
66
64
  };
67
- /** The accents an application may take, by name. */
68
- export type LoopAccentName = 'green' | 'rose' | 'sky' | 'lime' | 'sun' | 'violet';
69
- /** An accent: four values, in light and in dark. */
70
- export interface LoopAccent {
71
- /** The accent itself: a bubble, a send button. The same in both modes. */
72
- accent: string;
73
- /** The text that sits on the accent. */
74
- on: string;
75
- /** The stage behind an application. */
76
- stage: {
77
- light: string;
78
- dark: string;
79
- };
80
- /** A quiet tint: a draft, something waiting. */
81
- quiet: {
82
- light: string;
83
- dark: string;
84
- };
85
- /**
86
- * The accent as text: a link, a starter, an accent's word — deep enough on
87
- * white (4.5 to 1), and the pastel itself on dark.
88
- */
89
- text: {
90
- light: string;
91
- dark: string;
92
- };
93
- }
94
- /** The six accents. One per application; everything else is neutral. Green — mint — is the theme's own. */
95
- export declare const loopAccents: Record<LoopAccentName, LoopAccent>;
96
- /** The names of the accents, in the order a picker shows them. */
97
- export declare const loopAccentNames: LoopAccentName[];
98
- /**
99
- * An accent as CSS custom properties, for a color mode: what an
100
- * application sets on its root to take its colour.
101
- */
102
- export declare function loopAccentVars(name: LoopAccentName, mode?: 'light' | 'dark'): Record<string, string>;
103
- /**
104
- * An application's accent as everything it colours (LOOP T-05): the four
105
- * `--loop-*` properties of `loopAccentVars`, and Primer's accent fill and
106
- * filled button — the person's bubble, the assistant's avatar, the one
107
- * button to press — in the accent with the text that sits on it. Set on an
108
- * application's root, it wears its own colour; the page around keeps mint.
109
- */
110
- export declare function loopAccentStyles(name: LoopAccentName, mode?: 'light' | 'dark'): Record<string, string>;