@aortl/admin-react 0.4.0 → 0.5.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.
@@ -1,5 +1,16 @@
1
1
  import { ComponentProps } from 'react';
2
2
  export interface AdminRootProps extends ComponentProps<"div"> {
3
+ /**
4
+ * Force a color scheme for this subtree. Sets `data-theme`, which flips the
5
+ * semantic tokens and `color-scheme`. Omit to follow the OS preference.
6
+ */
7
+ theme?: "light" | "dark";
8
+ /**
9
+ * CSS color (e.g. `var(--color-purple-600)`) applied as `--color-system-accent`
10
+ * to brand-shift the navbar + footer stripes and `<BrandTile>`. See
11
+ * [Customize › System accent](https://digital-udvikling.github.io/admin-design-system/basics/customize/#system-accent).
12
+ */
13
+ systemAccent?: string;
3
14
  }
4
- export declare function AdminRoot({ className, ...rest }: AdminRootProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function AdminRoot({ className, theme, systemAccent, style, ...rest }: AdminRootProps): import("react/jsx-runtime").JSX.Element;
5
16
  //# sourceMappingURL=AdminRoot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminRoot.d.ts","sourceRoot":"","sources":["../src/AdminRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,KAAK,CAAC;CAAG;AAEhE,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,2CAE/D"}
1
+ {"version":3,"file":"AdminRoot.d.ts","sourceRoot":"","sources":["../src/AdminRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,OAAO,CAAC;AAG3D,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC3D;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,2CAc3F"}
@@ -178,7 +178,7 @@
178
178
  }
179
179
  @scope (._ao-admin-root) {
180
180
  @layer theme {
181
- :scope, :host {
181
+ :scope, :scope:host, :scope :host {
182
182
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
183
183
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono",
184
184
  monospace;
@@ -383,13 +383,13 @@
383
383
  }
384
384
  }
385
385
  @layer base {
386
- *, ::after, ::before, ::backdrop, ::file-selector-button {
386
+ :scope, :scope *, :scope::after, :scope ::after, :scope::before, :scope ::before, :scope::backdrop, :scope ::backdrop, :scope::file-selector-button, :scope ::file-selector-button {
387
387
  box-sizing: border-box;
388
388
  margin: 0;
389
389
  padding: 0;
390
390
  border: 0 solid;
391
391
  }
392
- :scope, :host {
392
+ :scope, :scope:host, :scope :host {
393
393
  line-height: 1.5;
394
394
  -webkit-text-size-adjust: 100%;
395
395
  tab-size: 4;
@@ -398,74 +398,74 @@
398
398
  font-variation-settings: var(--default-font-variation-settings, normal);
399
399
  -webkit-tap-highlight-color: transparent;
400
400
  }
401
- hr {
401
+ :scope hr {
402
402
  height: 0;
403
403
  color: inherit;
404
404
  border-top-width: 1px;
405
405
  }
406
- abbr:where([title]) {
406
+ :scope abbr:where([title]) {
407
407
  -webkit-text-decoration: underline dotted;
408
408
  text-decoration: underline dotted;
409
409
  }
410
- h1, h2, h3, h4, h5, h6 {
410
+ :scope h1, :scope h2, :scope h3, :scope h4, :scope h5, :scope h6 {
411
411
  font-size: inherit;
412
412
  font-weight: inherit;
413
413
  }
414
- a {
414
+ :scope a {
415
415
  color: inherit;
416
416
  -webkit-text-decoration: inherit;
417
417
  text-decoration: inherit;
418
418
  }
419
- b, strong {
419
+ :scope b, :scope strong {
420
420
  font-weight: bolder;
421
421
  }
422
- code, kbd, samp, pre {
422
+ :scope code, :scope kbd, :scope samp, :scope pre {
423
423
  font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
424
424
  font-feature-settings: var(--default-mono-font-feature-settings, normal);
425
425
  font-variation-settings: var(--default-mono-font-variation-settings, normal);
426
426
  font-size: 1em;
427
427
  }
428
- small {
428
+ :scope small {
429
429
  font-size: 80%;
430
430
  }
431
- sub, sup {
431
+ :scope sub, :scope sup {
432
432
  font-size: 75%;
433
433
  line-height: 0;
434
434
  position: relative;
435
435
  vertical-align: baseline;
436
436
  }
437
- sub {
437
+ :scope sub {
438
438
  bottom: -0.25em;
439
439
  }
440
- sup {
440
+ :scope sup {
441
441
  top: -0.5em;
442
442
  }
443
- table {
443
+ :scope table {
444
444
  text-indent: 0;
445
445
  border-color: inherit;
446
446
  border-collapse: collapse;
447
447
  }
448
- :-moz-focusring {
448
+ :scope:-moz-focusring, :scope :-moz-focusring {
449
449
  outline: auto;
450
450
  }
451
- progress {
451
+ :scope progress {
452
452
  vertical-align: baseline;
453
453
  }
454
- summary {
454
+ :scope summary {
455
455
  display: list-item;
456
456
  }
457
- ol, ul, menu {
457
+ :scope ol, :scope ul, :scope menu {
458
458
  list-style: none;
459
459
  }
460
- img, svg, video, canvas, audio, iframe, embed, object {
460
+ :scope img, :scope svg, :scope video, :scope canvas, :scope audio, :scope iframe, :scope embed, :scope object {
461
461
  display: block;
462
462
  vertical-align: middle;
463
463
  }
464
- img, video {
464
+ :scope img, :scope video {
465
465
  max-width: 100%;
466
466
  height: auto;
467
467
  }
468
- button, input, select, optgroup, textarea, ::file-selector-button {
468
+ :scope button, :scope input, :scope select, :scope optgroup, :scope textarea, :scope::file-selector-button, :scope ::file-selector-button {
469
469
  font: inherit;
470
470
  font-feature-settings: inherit;
471
471
  font-variation-settings: inherit;
@@ -475,58 +475,58 @@
475
475
  background-color: transparent;
476
476
  opacity: 1;
477
477
  }
478
- :where(select:is([multiple], [size])) optgroup {
478
+ :scope:where(select:is([multiple], [size])) optgroup, :scope :where(select:is([multiple], [size])) optgroup {
479
479
  font-weight: bolder;
480
480
  }
481
- :where(select:is([multiple], [size])) optgroup option {
481
+ :scope:where(select:is([multiple], [size])) optgroup option, :scope :where(select:is([multiple], [size])) optgroup option {
482
482
  padding-inline-start: 20px;
483
483
  }
484
- ::file-selector-button {
484
+ :scope::file-selector-button, :scope ::file-selector-button {
485
485
  margin-inline-end: 4px;
486
486
  }
487
- ::placeholder {
487
+ :scope::placeholder, :scope ::placeholder {
488
488
  opacity: 1;
489
489
  }
490
490
  @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
491
- ::placeholder {
491
+ :scope::placeholder, :scope ::placeholder {
492
492
  color: currentcolor;
493
493
  @supports (color: color-mix(in lab, red, red)) {
494
494
  color: color-mix(in oklab, currentcolor 50%, transparent);
495
495
  }
496
496
  }
497
497
  }
498
- textarea {
498
+ :scope textarea {
499
499
  resize: vertical;
500
500
  }
501
- ::-webkit-search-decoration {
501
+ :scope::-webkit-search-decoration, :scope ::-webkit-search-decoration {
502
502
  -webkit-appearance: none;
503
503
  }
504
- ::-webkit-date-and-time-value {
504
+ :scope::-webkit-date-and-time-value, :scope ::-webkit-date-and-time-value {
505
505
  min-height: 1lh;
506
506
  text-align: inherit;
507
507
  }
508
- ::-webkit-datetime-edit {
508
+ :scope::-webkit-datetime-edit, :scope ::-webkit-datetime-edit {
509
509
  display: inline-flex;
510
510
  }
511
- ::-webkit-datetime-edit-fields-wrapper {
511
+ :scope::-webkit-datetime-edit-fields-wrapper, :scope ::-webkit-datetime-edit-fields-wrapper {
512
512
  padding: 0;
513
513
  }
514
- ::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {
514
+ :scope::-webkit-datetime-edit, :scope ::-webkit-datetime-edit, :scope::-webkit-datetime-edit-year-field, :scope ::-webkit-datetime-edit-year-field, :scope::-webkit-datetime-edit-month-field, :scope ::-webkit-datetime-edit-month-field, :scope::-webkit-datetime-edit-day-field, :scope ::-webkit-datetime-edit-day-field, :scope::-webkit-datetime-edit-hour-field, :scope ::-webkit-datetime-edit-hour-field, :scope::-webkit-datetime-edit-minute-field, :scope ::-webkit-datetime-edit-minute-field, :scope::-webkit-datetime-edit-second-field, :scope ::-webkit-datetime-edit-second-field, :scope::-webkit-datetime-edit-millisecond-field, :scope ::-webkit-datetime-edit-millisecond-field, :scope::-webkit-datetime-edit-meridiem-field, :scope ::-webkit-datetime-edit-meridiem-field {
515
515
  padding-block: 0;
516
516
  }
517
- ::-webkit-calendar-picker-indicator {
517
+ :scope::-webkit-calendar-picker-indicator, :scope ::-webkit-calendar-picker-indicator {
518
518
  line-height: 1;
519
519
  }
520
- :-moz-ui-invalid {
520
+ :scope:-moz-ui-invalid, :scope :-moz-ui-invalid {
521
521
  box-shadow: none;
522
522
  }
523
- button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button {
523
+ :scope button, :scope input:where([type="button"], [type="reset"], [type="submit"]), :scope::file-selector-button, :scope ::file-selector-button {
524
524
  appearance: button;
525
525
  }
526
- ::-webkit-inner-spin-button, ::-webkit-outer-spin-button {
526
+ :scope::-webkit-inner-spin-button, :scope ::-webkit-inner-spin-button, :scope::-webkit-outer-spin-button, :scope ::-webkit-outer-spin-button {
527
527
  height: auto;
528
528
  }
529
- [hidden]:where(:not([hidden="until-found"])) {
529
+ :scope[hidden]:where(:not([hidden="until-found"])), :scope [hidden]:where(:not([hidden="until-found"])) {
530
530
  display: none !important;
531
531
  }
532
532
  }
@@ -606,10 +606,10 @@
606
606
  :scope {
607
607
  color-scheme: light dark;
608
608
  }
609
- [data-theme="dark"] {
609
+ :scope[data-theme="dark"], :scope [data-theme="dark"] {
610
610
  color-scheme: dark;
611
611
  }
612
- [data-theme="light"] {
612
+ :scope[data-theme="light"], :scope [data-theme="light"] {
613
613
  color-scheme: light;
614
614
  }
615
615
  @layer base {
@@ -624,7 +624,7 @@
624
624
  line-height: var(--tw-leading, var(--text-sm--line-height));
625
625
  line-height: 1.5;
626
626
  }
627
- h1 {
627
+ :scope h1 {
628
628
  font-size: var(--text-xl);
629
629
  line-height: var(--tw-leading, var(--text-xl--line-height));
630
630
  --tw-leading: var(--leading-tight);
@@ -632,7 +632,7 @@
632
632
  --tw-font-weight: var(--font-weight-semibold);
633
633
  font-weight: var(--font-weight-semibold);
634
634
  }
635
- h2 {
635
+ :scope h2 {
636
636
  font-size: var(--text-base);
637
637
  line-height: var(--tw-leading, var(--text-base--line-height));
638
638
  --tw-leading: var(--leading-tight);
@@ -640,7 +640,7 @@
640
640
  --tw-font-weight: var(--font-weight-semibold);
641
641
  font-weight: var(--font-weight-semibold);
642
642
  }
643
- h3 {
643
+ :scope h3 {
644
644
  font-size: var(--text-sm);
645
645
  line-height: var(--tw-leading, var(--text-sm--line-height));
646
646
  --tw-leading: var(--leading-snug);
@@ -3512,7 +3512,7 @@
3512
3512
  }
3513
3513
  @layer properties {
3514
3514
  @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
3515
- *, ::before, ::after, ::backdrop {
3515
+ :scope, :scope *, :scope::before, :scope ::before, :scope::after, :scope ::after, :scope::backdrop, :scope ::backdrop {
3516
3516
  --tw-ordinal: initial;
3517
3517
  --tw-slashed-zero: initial;
3518
3518
  --tw-numeric-figure: initial;
package/dist/index.cjs CHANGED
@@ -66,10 +66,16 @@ var Accordion = Object.assign(AccordionRoot, {
66
66
  });
67
67
  //#endregion
68
68
  //#region src/AdminRoot.tsx
69
- function AdminRoot({ className, ...rest }) {
69
+ function AdminRoot({ className, theme, systemAccent, style, ...rest }) {
70
+ const rootStyle = systemAccent !== void 0 ? {
71
+ ...style,
72
+ "--color-system-accent": systemAccent
73
+ } : style;
70
74
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
71
75
  className: cn("admin-root", className),
72
- ...rest
76
+ style: rootStyle,
77
+ ...rest,
78
+ ...theme !== void 0 && { "data-theme": theme }
73
79
  });
74
80
  }
75
81
  //#endregion