@datalayer/primer-addons 1.0.38 → 1.0.40
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/README.md +52 -20
- package/lib/components/appearance/AppearanceControls.d.ts +6 -1
- package/lib/components/appearance/AppearanceControls.js +7 -3
- package/lib/components/appearance/AppearanceControlsWithStore.d.ts +4 -0
- package/lib/components/appearance/AppearanceControlsWithStore.js +4 -4
- package/lib/components/appearance/CollaboratorPalette.js +7 -20
- package/lib/components/box/Box.d.ts +103 -16
- package/lib/components/box/Box.js +157 -2
- package/lib/components/box/boxCss.d.ts +805 -0
- package/lib/components/box/boxCss.js +508 -0
- package/lib/components/box/boxTokens.d.ts +130 -0
- package/lib/components/box/boxTokens.js +125 -0
- package/lib/components/calendar-picker/CalendarPicker.js +2 -1
- package/lib/components/card/Card.d.ts +119 -5
- package/lib/components/card/Card.js +64 -41
- package/lib/components/card/Card.stories.d.ts +6 -0
- package/lib/components/card/Card.stories.js +26 -0
- package/lib/components/color/ColorSwatch.js +2 -1
- package/lib/components/color-picker/ColorPicker.js +8 -4
- package/lib/components/date-picker/DatePicker.d.ts +12 -3
- package/lib/components/date-picker/DatePicker.js +24 -8
- package/lib/components/entity-avatar/EntityAvatar.d.ts +73 -0
- package/lib/components/entity-avatar/EntityAvatar.js +63 -0
- package/lib/components/entity-avatar/index.d.ts +1 -0
- package/lib/components/entity-avatar/index.js +5 -0
- package/lib/components/hover-card/HoverCard.d.ts +63 -0
- package/lib/components/hover-card/HoverCard.js +55 -0
- package/lib/components/hover-card/HoverCardAnchor.d.ts +33 -0
- package/lib/components/hover-card/HoverCardAnchor.js +26 -0
- package/lib/components/hover-card/HoverCardDetails.d.ts +36 -0
- package/lib/components/hover-card/HoverCardDetails.js +65 -0
- package/lib/components/hover-card/HoverCardLayer.d.ts +34 -0
- package/lib/components/hover-card/HoverCardLayer.js +57 -0
- package/lib/components/hover-card/index.d.ts +12 -0
- package/lib/components/hover-card/index.js +16 -0
- package/lib/components/hover-card/useHoverCard.d.ts +57 -0
- package/lib/components/hover-card/useHoverCard.js +200 -0
- package/lib/components/hover-card/usePrefersReducedMotion.d.ts +10 -0
- package/lib/components/hover-card/usePrefersReducedMotion.js +28 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +3 -0
- package/lib/components/sheet/Sheet.d.ts +15 -0
- package/lib/components/sheet/Sheet.js +21 -0
- package/lib/reactor/page-layout/PageLayout.js +4 -6
- package/lib/story-helpers.d.ts +2 -2
- package/lib/theme/DatalayerThemeProvider.d.ts +21 -0
- package/lib/theme/DatalayerThemeProvider.js +8 -2
- package/lib/theme/colors/index.d.ts +2 -1
- package/lib/theme/colors/index.js +2 -1
- package/lib/theme/colors/loopColors.d.ts +2 -48
- package/lib/theme/colors/loopColors.js +2 -98
- package/lib/theme/colors/themeAccents.d.ts +81 -0
- package/lib/theme/colors/themeAccents.js +139 -0
- package/lib/theme/css/createThemeCSSVars.d.ts +18 -1
- package/lib/theme/css/createThemeCSSVars.js +20 -1
- package/lib/theme/css/primerBaseVars.d.ts +1 -0
- package/lib/theme/css/primerBaseVars.js +72 -0
- package/lib/theme/css/primerComponentsCss.d.ts +47 -0
- package/lib/theme/css/primerComponentsCss.js +72 -0
- package/lib/theme/index.d.ts +2 -0
- package/lib/theme/index.js +2 -0
- package/lib/theme/themes/loopThemeStyles.d.ts +4 -37
- package/lib/theme/themes/loopThemeStyles.js +39 -56
- package/package.json +1 -1
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Unlike the other themes it also sets **shape**: rounder corners, and
|
|
17
17
|
* its own `--loop-*` properties for what an application is drawn with —
|
|
18
|
-
*
|
|
18
|
+
* a bubble, a frame, a face. Its accent and stage are the theme system's
|
|
19
|
+
* (`--theme-accent`, `--theme-stage` and the rest, `themeAccents`): mint.
|
|
19
20
|
*/
|
|
20
|
-
import {
|
|
21
|
+
import { loopColors } from '../colors/loopColors';
|
|
22
|
+
import { themeAccentTints, themeAccents } from '../colors/themeAccents';
|
|
21
23
|
import { buildThemeStyles } from '../css/createThemeCSSVars';
|
|
22
24
|
/* ── Light-mode colour definitions ───────────────────────────────────── */
|
|
23
25
|
export const loopLight = {
|
|
@@ -386,11 +388,15 @@ export const loopTypeVars = (font) => {
|
|
|
386
388
|
};
|
|
387
389
|
};
|
|
388
390
|
/**
|
|
389
|
-
* The
|
|
390
|
-
*
|
|
391
|
-
* the accent's, so an application's own colour lights its stage.
|
|
391
|
+
* The accent's properties in a mode, mint's (`themeAccents.green`): the
|
|
392
|
+
* stage and the quiet tint are mint's own, not derived from the colours.
|
|
392
393
|
*/
|
|
393
|
-
|
|
394
|
+
const loopTints = (mode) => themeAccentTints({
|
|
395
|
+
accent: themeAccents.green.accent,
|
|
396
|
+
on: themeAccents.green.on,
|
|
397
|
+
stage: themeAccents.green.stage[mode],
|
|
398
|
+
quiet: themeAccents.green.quiet[mode],
|
|
399
|
+
});
|
|
394
400
|
/* ── Exports ─────────────────────────────────────────────────────────── */
|
|
395
401
|
/**
|
|
396
402
|
* Inter, then its metric-matched fallback, then the system's own sans-serif
|
|
@@ -425,50 +431,15 @@ export const loopMotionVars = {
|
|
|
425
431
|
*/
|
|
426
432
|
export const loopFocusRing = { light: loopColors.loopRing, dark: '#636363' };
|
|
427
433
|
/**
|
|
428
|
-
* The
|
|
429
|
-
*
|
|
430
|
-
* each segment), a button group's two ends, a toggle switch, an underline
|
|
431
|
-
* tab's hover. A multi-line text area keeps `--borderRadius-medium`: a pill
|
|
432
|
-
* of many lines is a lozenge. Menus and overlays keep the card's radius,
|
|
433
|
-
* `--borderRadius-large`, which the theme already sets.
|
|
434
|
-
*
|
|
435
|
-
* Primer takes every control's corners from `--borderRadius-medium`, which
|
|
436
|
-
* cards and list items take too, so this cannot be a token: it is a
|
|
437
|
-
* stylesheet, scoped by the theme provider (`ThemeStyles.css`). Primer's
|
|
438
|
-
* class names are CSS-module hashes (`prc-Button-ButtonBase-c50BI`), so the
|
|
439
|
-
* selectors match their stable prefix; the toggle switch is a
|
|
440
|
-
* styled-component, matched by its display name, which styled-components
|
|
441
|
-
* puts in its class (`ToggleSwitch__SwitchButton-sc-e6gszy-0`). A test reads each of them
|
|
442
|
-
* back from the installed `@primer/react`.
|
|
434
|
+
* The loop theme's own stylesheet, beside what its shape draws: bold is the
|
|
435
|
+
* theme's semibold, its second and last weight.
|
|
443
436
|
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
437
|
+
* Its controls are pills and its tables rounder by its shape
|
|
438
|
+
* (`radiusControl`, `radiusTable`), which `primerComponentsCss` draws for
|
|
439
|
+
* any theme that sets them: menus and overlays keep the card's radius,
|
|
440
|
+
* `--borderRadius-large`, which the theme already sets.
|
|
447
441
|
*/
|
|
448
|
-
|
|
449
|
-
button: '[class*="prc-Button-ButtonBase"]',
|
|
450
|
-
textInput: '[class*="prc-components-TextInputBaseWrapper"]',
|
|
451
|
-
textArea: '[class*="prc-Textarea-TextArea"]',
|
|
452
|
-
segmentedControl: '[class*="prc-SegmentedControl-SegmentedControl"]',
|
|
453
|
-
buttonGroup: '[class*="prc-ButtonGroup-ButtonGroup"]',
|
|
454
|
-
underlineTab: '[class*="prc-components-UnderlineItem"]',
|
|
455
|
-
toggleTrack: '[class*="ToggleSwitch__SwitchButton-"]',
|
|
456
|
-
toggleKnob: '[class*="ToggleSwitch__ToggleKnob-"]',
|
|
457
|
-
};
|
|
458
|
-
const sel = loopControlsSelectors;
|
|
459
|
-
export const loopControlsCss = `
|
|
460
|
-
:scope ${sel.button},
|
|
461
|
-
:scope ${sel.textInput}:not(:has(${sel.textArea})),
|
|
462
|
-
:scope ${sel.segmentedControl},
|
|
463
|
-
:scope ${sel.underlineTab},
|
|
464
|
-
:scope ${sel.toggleTrack},
|
|
465
|
-
:scope ${sel.toggleKnob} {
|
|
466
|
-
--borderRadius-medium: var(--loop-radius-control);
|
|
467
|
-
border-radius: var(--loop-radius-control);
|
|
468
|
-
}
|
|
469
|
-
:scope ${sel.buttonGroup} {
|
|
470
|
-
--borderRadius-medium: var(--loop-radius-control);
|
|
471
|
-
}
|
|
442
|
+
const loopOwnCss = `
|
|
472
443
|
:scope b,
|
|
473
444
|
:scope strong {
|
|
474
445
|
font-weight: var(--base-text-weight-semibold);
|
|
@@ -477,10 +448,13 @@ export const loopControlsCss = `
|
|
|
477
448
|
/** Comprehensive Primer CSS-variable overrides for light & dark mode. */
|
|
478
449
|
export const loopThemeStyles = buildThemeStyles(loopLight, loopDark, {
|
|
479
450
|
fontFamily: loopFontFamily,
|
|
480
|
-
css:
|
|
481
|
-
// Rounder than the others: a pill for a control, soft cards,
|
|
451
|
+
css: loopOwnCss,
|
|
452
|
+
// Rounder than the others: a pill for a control (LOOP T-09), soft cards,
|
|
453
|
+
// round bubbles, a table with the corners of a list item.
|
|
482
454
|
shape: {
|
|
483
455
|
radiusControl: loopShapeVars['--loop-radius-control'],
|
|
456
|
+
radiusTable: loopShapeVars['--borderRadius-medium'],
|
|
457
|
+
radiusOverlay: loopShapeVars['--loop-radius-card'],
|
|
484
458
|
radiusCard: loopShapeVars['--loop-radius-card'],
|
|
485
459
|
radiusBubble: loopShapeVars['--loop-radius-bubble'],
|
|
486
460
|
radiusFrame: loopShapeVars['--loop-radius-frame'],
|
|
@@ -495,27 +469,36 @@ export const loopThemeStyles = buildThemeStyles(loopLight, loopDark, {
|
|
|
495
469
|
variables: {
|
|
496
470
|
light: {
|
|
497
471
|
...loopShapeVars,
|
|
498
|
-
...
|
|
472
|
+
...loopTints('light'),
|
|
499
473
|
...loopMotionVars,
|
|
500
474
|
...loopShadows.light,
|
|
501
475
|
...loopTypeVars(loopFontFamily),
|
|
502
|
-
'--loop-stage-gradient': loopStageGradient,
|
|
503
476
|
'--loop-hairline': loopHairline.light,
|
|
477
|
+
// The hairline is Primer's default border: a card drawn with
|
|
478
|
+
// `borderColor="border.default"` gets it, no fallback chain at the call site.
|
|
479
|
+
'--borderColor-default': loopHairline.light,
|
|
504
480
|
'--focus-outlineColor': loopFocusRing.light,
|
|
505
481
|
// The selected tab underlined in the accent, not Primer's coral (LOOP T-14).
|
|
506
|
-
'--underlineNav-borderColor-active':
|
|
482
|
+
'--underlineNav-borderColor-active': themeAccents.green.accent,
|
|
507
483
|
},
|
|
508
484
|
dark: {
|
|
509
485
|
...loopShapeVars,
|
|
510
|
-
...
|
|
486
|
+
...loopTints('dark'),
|
|
511
487
|
...loopMotionVars,
|
|
512
488
|
...loopShadows.dark,
|
|
513
489
|
...loopTypeVars(loopFontFamily),
|
|
514
|
-
'--loop-stage-gradient': loopStageGradient,
|
|
515
490
|
'--loop-hairline': loopHairline.dark,
|
|
491
|
+
// The hairline is Primer's default border: a card drawn with
|
|
492
|
+
// `borderColor="border.default"` gets it, no fallback chain at the call site.
|
|
493
|
+
'--borderColor-default': loopHairline.dark,
|
|
516
494
|
'--focus-outlineColor': loopFocusRing.dark,
|
|
517
495
|
// The selected tab underlined in the accent, not Primer's coral (LOOP T-14).
|
|
518
|
-
'--underlineNav-borderColor-active':
|
|
496
|
+
'--underlineNav-borderColor-active': themeAccents.green.accent,
|
|
519
497
|
},
|
|
520
498
|
},
|
|
521
499
|
});
|
|
500
|
+
/**
|
|
501
|
+
* The loop theme's whole stylesheet (`ThemeStyles.css`): its controls as
|
|
502
|
+
* pills and its tables rounder, drawn from its shape, then its own rules.
|
|
503
|
+
*/
|
|
504
|
+
export const loopControlsCss = loopThemeStyles.css ?? '';
|