@datalayer/primer-addons 1.0.36 → 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 (90) hide show
  1. package/README.md +69 -19
  2. package/lib/components/appearance/AppearanceControls.d.ts +6 -1
  3. package/lib/components/appearance/AppearanceControls.js +12 -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/index.d.ts +1 -1
  24. package/lib/reactor/index.js +1 -1
  25. package/lib/reactor/page-layout/PageLayout.d.ts +6 -0
  26. package/lib/reactor/page-layout/PageLayout.js +30 -6
  27. package/lib/story-helpers.d.ts +2 -2
  28. package/lib/theme/DatalayerThemeProvider.d.ts +21 -0
  29. package/lib/theme/DatalayerThemeProvider.js +13 -4
  30. package/lib/theme/colors/index.d.ts +2 -1
  31. package/lib/theme/colors/index.js +2 -1
  32. package/lib/theme/colors/loopColors.d.ts +2 -48
  33. package/lib/theme/colors/loopColors.js +2 -98
  34. package/lib/theme/colors/themeAccents.d.ts +81 -0
  35. package/lib/theme/colors/themeAccents.js +139 -0
  36. package/lib/theme/css/createThemeCSSVars.d.ts +5 -0
  37. package/lib/theme/css/createThemeCSSVars.js +5 -0
  38. package/lib/theme/css/primerBaseVars.d.ts +1 -0
  39. package/lib/theme/css/primerBaseVars.js +72 -0
  40. package/lib/theme/index.d.ts +2 -0
  41. package/lib/theme/index.js +2 -0
  42. package/lib/theme/loopEyes.d.ts +84 -0
  43. package/lib/theme/loopEyes.js +82 -0
  44. package/lib/theme/portable.d.ts +16 -0
  45. package/lib/theme/portable.js +20 -0
  46. package/lib/theme/portableTheme.d.ts +1 -1
  47. package/lib/theme/portableTheme.js +2 -2
  48. package/lib/theme/themeRegistry.d.ts +3 -75
  49. package/lib/theme/themeRegistry.js +38 -509
  50. package/lib/theme/themeTokens.d.ts +101 -0
  51. package/lib/theme/themeTokens.js +494 -0
  52. package/lib/theme/themes/datalayerTheme.d.ts +2 -9
  53. package/lib/theme/themes/datalayerTheme.js +8 -236
  54. package/lib/theme/themes/datalayerThemeStyles.d.ts +2 -0
  55. package/lib/theme/themes/datalayerThemeStyles.js +234 -0
  56. package/lib/theme/themes/earthTheme.d.ts +2 -9
  57. package/lib/theme/themes/earthTheme.js +8 -235
  58. package/lib/theme/themes/earthThemeStyles.d.ts +2 -0
  59. package/lib/theme/themes/earthThemeStyles.js +233 -0
  60. package/lib/theme/themes/ivoryTheme.d.ts +2 -9
  61. package/lib/theme/themes/ivoryTheme.js +8 -249
  62. package/lib/theme/themes/ivoryThemeStyles.d.ts +2 -0
  63. package/lib/theme/themes/ivoryThemeStyles.js +247 -0
  64. package/lib/theme/themes/loopTheme.d.ts +13 -144
  65. package/lib/theme/themes/loopTheme.js +20 -517
  66. package/lib/theme/themes/loopThemeStyles.d.ts +129 -0
  67. package/lib/theme/themes/loopThemeStyles.js +531 -0
  68. package/lib/theme/themes/lovelyTheme.d.ts +2 -9
  69. package/lib/theme/themes/lovelyTheme.js +8 -231
  70. package/lib/theme/themes/lovelyThemeStyles.d.ts +2 -0
  71. package/lib/theme/themes/lovelyThemeStyles.js +229 -0
  72. package/lib/theme/themes/matrixTheme.d.ts +2 -9
  73. package/lib/theme/themes/matrixTheme.js +8 -237
  74. package/lib/theme/themes/matrixThemeStyles.d.ts +2 -0
  75. package/lib/theme/themes/matrixThemeStyles.js +235 -0
  76. package/lib/theme/themes/sandTheme.d.ts +2 -9
  77. package/lib/theme/themes/sandTheme.js +8 -248
  78. package/lib/theme/themes/sandThemeStyles.d.ts +2 -0
  79. package/lib/theme/themes/sandThemeStyles.js +246 -0
  80. package/lib/theme/themes/spatialTheme.d.ts +2 -9
  81. package/lib/theme/themes/spatialTheme.js +8 -231
  82. package/lib/theme/themes/spatialThemeStyles.d.ts +2 -0
  83. package/lib/theme/themes/spatialThemeStyles.js +229 -0
  84. package/lib/theme/themes/sunTheme.d.ts +2 -9
  85. package/lib/theme/themes/sunTheme.js +8 -249
  86. package/lib/theme/themes/sunThemeStyles.d.ts +2 -0
  87. package/lib/theme/themes/sunThemeStyles.js +247 -0
  88. package/lib/utils/Portals.d.ts +7 -0
  89. package/lib/utils/Portals.js +7 -0
  90. 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;
@@ -24,7 +24,7 @@
24
24
  export { ThemePlugin, THEME_PLUGIN_NAME, TOGGLE_COLOR_MODE_COMMAND, } from "./ThemePlugin";
25
25
  export { AppearancePlugin, APPEARANCE_PLUGIN_NAME, APPEARANCE_MENU_COMPONENT_ID, type AppearancePluginConfig, } from "./AppearancePlugin";
26
26
  export { PageLayoutPlugin, PAGE_LAYOUT_PLUGIN_NAME, PageLayoutSlots, type PageLayoutPluginConfig, } from "./page-layout/PageLayoutPlugin";
27
- export { PageLayout, PAGE_SHEET_WIDTH, PAGE_PANEL_WIDTH, PAGE_SIZE_FORMATS, resolvePageSize, type PageLayoutProps, type PageSize, type PageSizeFormat, } from "./page-layout/PageLayout";
27
+ export { PageLayout, panelOpening, PAGE_SHEET_WIDTH, PAGE_PANEL_WIDTH, PAGE_SIZE_FORMATS, resolvePageSize, type PageLayoutProps, type PageSize, type PageSizeFormat, } from "./page-layout/PageLayout";
28
28
  export { PagePanelToggle, type PagePanelToggleProps, } from "./page-layout/PagePanelToggle";
29
29
  export { SlotPageLayout, SlotPanelToggle, type SlotPageLayoutProps, } from "./page-layout/SlotPageLayout";
30
30
  export { pageLayoutPanelOpen, pageLayoutSheet, pageLayoutActivity, openPagePanel, closePagePanel, togglePagePanel, } from "./page-layout/panelState";
@@ -28,7 +28,7 @@
28
28
  export { ThemePlugin, THEME_PLUGIN_NAME, TOGGLE_COLOR_MODE_COMMAND, } from "./ThemePlugin";
29
29
  export { AppearancePlugin, APPEARANCE_PLUGIN_NAME, APPEARANCE_MENU_COMPONENT_ID, } from "./AppearancePlugin";
30
30
  export { PageLayoutPlugin, PAGE_LAYOUT_PLUGIN_NAME, PageLayoutSlots, } from "./page-layout/PageLayoutPlugin";
31
- export { PageLayout, PAGE_SHEET_WIDTH, PAGE_PANEL_WIDTH, PAGE_SIZE_FORMATS, resolvePageSize, } from "./page-layout/PageLayout";
31
+ export { PageLayout, panelOpening, PAGE_SHEET_WIDTH, PAGE_PANEL_WIDTH, PAGE_SIZE_FORMATS, resolvePageSize, } from "./page-layout/PageLayout";
32
32
  export { PagePanelToggle, } from "./page-layout/PagePanelToggle";
33
33
  export { SlotPageLayout, SlotPanelToggle, } from "./page-layout/SlotPageLayout";
34
34
  export { pageLayoutPanelOpen, pageLayoutSheet, pageLayoutActivity, openPagePanel, closePagePanel, togglePagePanel, } from "./page-layout/panelState";
@@ -79,6 +79,12 @@ export declare function resolvePageSize(size: PageSize | undefined, sheetWidth?:
79
79
  width: number;
80
80
  height?: number;
81
81
  };
82
+ /**
83
+ * A panel opening from its side at the theme's pace: `--theme-motion-pane`
84
+ * and `--theme-motion-easing`, which every theme sets — to no motion at all
85
+ * but in `loop` (LOOP T-10). The animation starts when the panel is shown.
86
+ */
87
+ export declare function panelOpening(side: "left" | "right"): Record<string, unknown>;
82
88
  export type PageLayoutProps = {
83
89
  /** The page: what lies on the sheet. */
84
90
  page?: ReactNode;
@@ -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. */
@@ -111,6 +112,25 @@ function ActivityLine({ label }) {
111
112
  },
112
113
  } }), _jsx(Text, { children: label })] }));
113
114
  }
115
+ /**
116
+ * A panel opening from its side at the theme's pace: `--theme-motion-pane`
117
+ * and `--theme-motion-easing`, which every theme sets — to no motion at all
118
+ * but in `loop` (LOOP T-10). The animation starts when the panel is shown.
119
+ */
120
+ export function panelOpening(side) {
121
+ const name = side === "left" ? "pagePanelOpenLeft" : "pagePanelOpenRight";
122
+ return {
123
+ animation: `${name} var(--theme-motion-pane, 0ms) var(--theme-motion-easing, ease) both`,
124
+ [`@keyframes ${name}`]: {
125
+ from: {
126
+ opacity: 0,
127
+ transform: `translateX(${side === "left" ? "-12px" : "12px"})`,
128
+ },
129
+ to: { opacity: 1, transform: "none" },
130
+ },
131
+ "@media (prefers-reduced-motion: reduce)": { animation: "none" },
132
+ };
133
+ }
114
134
  export function PageLayout({ page, hasPage = page !== undefined && page !== null, panel, band, chips, picker, transient, activity, bandMode = "docked", panelMode = "docked", panelSide = "right", sheetWidth = PAGE_SHEET_WIDTH, pageSize, panelWidth = PAGE_PANEL_WIDTH, }) {
115
135
  const bandInPanel = bandMode === "panel";
116
136
  const hasBand = band !== undefined && band !== null;
@@ -193,7 +213,7 @@ export function PageLayout({ page, hasPage = page !== undefined && page !== null
193
213
  display: "flex",
194
214
  justifyContent: "flex-end",
195
215
  mb: 2,
196
- }, 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: {
197
217
  width: "100%",
198
218
  maxWidth: pageWidth,
199
219
  /*
@@ -207,11 +227,8 @@ export function PageLayout({ page, hasPage = page !== undefined && page !== null
207
227
  change in the layout's height reaches the page at once.
208
228
  */
209
229
  flex: hasPage ? "1 0 auto" : "1 1 auto",
210
- bg: "canvas.default",
211
- border: "1px solid",
212
- borderColor: "border.default",
213
- borderRadius: "10px",
214
- 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.
215
232
  // The page's own margins. A page fills the sheet and reads
216
233
  // against these, as text on paper does; a panel's content
217
234
  // brings its own gutters, so it sits closer.
@@ -301,6 +318,13 @@ export function PageLayout({ page, hasPage = page !== undefined && page !== null
301
318
  display: "flex",
302
319
  flexDirection: "column",
303
320
  "& > *": { flex: "1 1 auto", minHeight: 0 },
321
+ // A pane opening, at the theme's pace (LOOP T-10): from its
322
+ // side, by the theme's motion tokens — none in a theme that
323
+ // sets no motion, none when motion is reduced. On the
324
+ // content, not the column: a transform on the column would
325
+ // hold the floating composer, which lives in it, while it
326
+ // runs.
327
+ ...(panelShown ? panelOpening(panelSide) : null),
304
328
  }, children: panel }), hasBand && bandMode !== "docked" ? (_jsxs(Box, { "data-page-panel-band": bandInPanel ? "" : undefined, sx: bandInPanel
305
329
  ? {
306
330
  flex: "0 0 auto",
@@ -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,7 +8,8 @@ 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 { THEME_SCOPE_ATTRIBUTE, injectThemeStylesheet, setupPrimerPortals, syncPortalThemeStyles, } from "../utils/Portals";
11
+ import { primerBaseVars } from "./css/primerBaseVars";
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
14
15
  * the Primer `--fontStack-*` CSS custom properties so that
@@ -29,7 +30,7 @@ import { THEME_SCOPE_ATTRIBUTE, injectThemeStylesheet, setupPrimerPortals, syncP
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,
@@ -117,7 +118,10 @@ export function DatalayerThemeProvider(props) {
117
118
  // The sentinel's parent is this provider's own element; anything themed
118
119
  // above *that* is another provider's.
119
120
  const own = sentinel.current?.parentElement;
120
- const ancestor = own?.parentElement?.closest("[data-color-mode]") ?? null;
121
+ const themed = own?.parentElement?.closest("[data-color-mode]") ?? null;
122
+ // The application's own Primer wrapper, marked so, is not a host page:
123
+ // the provider inside it owns the page (see APP_ROOT_ATTRIBUTE).
124
+ const ancestor = themed?.hasAttribute(APP_ROOT_ATTRIBUTE) ? null : themed;
121
125
  setThemedAncestor(ancestor);
122
126
  if (!ancestor) {
123
127
  setAncestorMode(null);
@@ -148,14 +152,18 @@ export function DatalayerThemeProvider(props) {
148
152
  const resolvedTheme = theme ?? datalayerTheme;
149
153
  const styles = themeStyles ?? datalayerThemeStyles;
150
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);
151
158
  // The full set of styles that <BaseStyles> receives — we also push
152
159
  // these to document.body so Primer portal content inherits theme
153
160
  // tokens, fonts, and colors.
154
161
  const portalStyles = useMemo(() => ({
155
162
  ...typographyVars,
163
+ ...baseVars,
156
164
  ...resolvedStyles,
157
165
  ...baseStyles,
158
- }), [resolvedStyles, baseStyles]);
166
+ }), [baseVars, resolvedStyles, baseStyles]);
159
167
  // Keep document.body portal-root attributes AND theme styles in sync
160
168
  // so that Primer portals (modals, dialogs, overlays) inherit the
161
169
  // correct color mode **and** theme tokens (fonts, colors, CSS vars).
@@ -197,6 +205,7 @@ export function DatalayerThemeProvider(props) {
197
205
  lineHeight: "1.7",
198
206
  transition: "background-color 0.25s ease, color 0.25s ease",
199
207
  ...typographyVars,
208
+ ...baseVars,
200
209
  ...resolvedStyles,
201
210
  ...baseStyles,
202
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';