@primer/react 0.0.0-20260805165233 → 0.0.0-20260805190128
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/CHANGELOG.md +9 -3
- package/dist/ActionList/Group-efcb39da.css +2 -0
- package/dist/ActionList/Group-efcb39da.css.map +1 -0
- package/dist/ActionList/Group.module.css.js +2 -2
- package/dist/NavList/NavList.d.ts +2 -2
- package/dist/NavList/NavList.js +36 -45
- package/dist/ThemeProvider.d.ts +1 -4
- package/dist/ThemeProvider.js +43 -76
- package/dist/index.d.ts +2 -2
- package/dist/theme.d.ts +1 -1142
- package/dist/theme.js +1 -3
- package/dist/useTheme.d.ts +1 -3
- package/generated/hooks.json +0 -15
- package/package.json +1 -4
- package/dist/ActionList/Group-d89306a8.css +0 -2
- package/dist/ActionList/Group-d89306a8.css.map +0 -1
- package/dist/legacy-theme/ts/color-schemes.js +0 -4252
- package/dist/utils/types/KeyPaths.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260805190128
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#8212](https://github.com/primer/react/pull/8212) [`6a4c131`](https://github.com/primer/react/commit/6a4c1319a70a5f3b5abc7b81b044bd26d042aa75) Thanks [@mattcosta7](https://github.com/mattcosta7)! - ThemeProvider: Remove `colorSchemes` from the default `theme` and stop merging
|
|
8
|
+
color scheme values into the theme context. Color schemes are applied via CSS
|
|
9
|
+
variables instead, and passing an unknown color scheme no longer logs an error.
|
|
10
|
+
`useTheme()` no longer returns `theme` or `resolvedColorScheme`. The
|
|
11
|
+
`ThemeColorPaths` and `ThemeShadowPaths` types are also no longer exported.
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
6
14
|
|
|
@@ -8,8 +16,6 @@
|
|
|
8
16
|
|
|
9
17
|
- [#8258](https://github.com/primer/react/pull/8258) [`edbcd94`](https://github.com/primer/react/commit/edbcd942354ff45148c2623be8b543ef8789a20f) Thanks [@llastflowers](https://github.com/llastflowers)! - Update `AvatarStack` to not reserve space when collapsed
|
|
10
18
|
|
|
11
|
-
- [#8273](https://github.com/primer/react/pull/8273) [`8243fbd`](https://github.com/primer/react/commit/8243fbd6276cd00e2f693d45990ae4fe89057c84) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - NavList: Exclude group headings from navigation list item counts
|
|
12
|
-
|
|
13
19
|
## 38.35.0
|
|
14
20
|
|
|
15
21
|
### Minor Changes
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-ActionList-Group-lMIPQ{list-style:none}.prc-ActionList-Group-lMIPQ:not(:first-child){margin-block-start:var(--base-size-8,.5rem)}.prc-ActionList-Group-lMIPQ:not(:first-child):has(.prc-ActionList-GroupHeadingWrap-laXcX+ul>.prc-ActionList-GroupHeadingWrap-laXcX)>.prc-ActionList-GroupHeadingWrap-laXcX{display:none}.prc-ActionList-GroupList-V5B3-{padding-inline-start:0}.prc-ActionList-GroupHeadingWrap-laXcX{color:var(--fgColor-muted,#59636e);display:flex;flex-direction:column;font-size:var(--text-body-size-small,.75rem);font-weight:var(--base-text-weight-semibold,600);line-height:18px;padding-block:var(--base-size-6,.375rem);padding-inline:var(--base-size-16,1rem)}.prc-ActionList-GroupHeadingWrap-laXcX:where([data-variant=filled]){background:var(--bgColor-muted,#f6f8fa);border-bottom:var(--borderWidth-thin,.0625rem) solid var(--borderColor-muted,#d1d9e0b3);border-top:var(--borderWidth-thin,.0625rem) solid var(--borderColor-muted,#d1d9e0b3);margin-block-end:var(--base-size-8,.5rem);margin-block-start:calc(var(--base-size-8,.5rem) - var(--borderWidth-thin,.0625rem));padding-inline:var(--base-size-16,1rem)}.prc-ActionList-GroupHeadingWrap-laXcX:where([data-variant=filled]):first-child{margin-block-start:0}.prc-ActionList-GroupHeading-STzxi{align-self:flex-start;color:var(--fgColor-muted,#59636e);font-size:var(--text-body-size-small,.75rem);font-weight:var(--base-text-weight-semibold,600);margin:0}.prc-ActionList-GroupHeadingWrap-laXcX[data-has-trailing-action]{align-items:center;flex-direction:row;gap:var(--base-size-8,.5rem);justify-content:space-between}.prc-ActionList-GroupHeadingWrap-laXcX[data-has-trailing-action]>.prc-ActionList-GroupHeading-STzxi{align-self:center}.prc-ActionList-GroupHeadingTrailingAction-jnb64{align-items:center;display:inline-flex;margin-inline-start:auto}
|
|
2
|
+
/*# sourceMappingURL=Group-efcb39da.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ActionList/Group.module.css.js"],"names":[],"mappings":"AAAA,4BACE,eAcF,CAZE,8CACE,2CAUF,CAJI,2KACE,YACF,CAKN,gCACE,sBACF,CAEA,uCAQE,kCAA2B,CAP3B,YAAa,CAQb,qBAAsB,CAPtB,4CAAsC,CACtC,gDAA6C,CAI7C,gBAAiB,CAIjB,wCAAiC,CADjC,uCAoBF,CAjBE,oEAIE,uCAAgC,CAEhC,uFAAqE,CADrE,oFAAkE,CAFlE,yCAAoC,CADpC,oFAAsE,CAKtE,uCAKF,CAHE,gFACE,oBACF,CAQJ,mCAKE,qBAAsB,CADtB,kCAA2B,CAF3B,4CAAsC,CACtC,gDAA6C,CAF7C,QAKF,CAEA,iEAEE,kBAAmB,CADnB,kBAAmB,CAGnB,4BAAuB,CADvB,6BAMF,CAHE,oGACE,iBACF,CAGF,iDAEE,kBAAmB,CADnB,mBAAoB,CAEpB,wBACF","file":"Group-efcb39da.css","sourcesContent":[".Group {\n list-style: none;\n\n &:not(:first-child) {\n margin-block-start: var(--base-size-8);\n\n /* If somebody tries to pass the `title` prop AND a `NavList.GroupHeading` as a child, hide the `ActionList.GroupHeading */\n /* stylelint-disable-next-line selector-max-specificity, selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(.GroupHeadingWrap + ul > .GroupHeadingWrap) {\n /* stylelint-disable-next-line selector-max-specificity */\n & > .GroupHeadingWrap {\n display: none;\n }\n }\n }\n}\n\n.GroupList {\n padding-inline-start: 0;\n}\n\n.GroupHeadingWrap {\n display: flex;\n font-size: var(--text-body-size-small);\n font-weight: var(--base-text-weight-semibold);\n\n /* line-height: var(--text-body-lineHeight-small); use when FF rolls out */\n /* stylelint-disable-next-line primer/typography */\n line-height: 18px;\n color: var(--fgColor-muted);\n flex-direction: column;\n padding-inline: var(--base-size-16);\n padding-block: var(--base-size-6);\n\n &:where([data-variant='filled']) {\n /* stylelint-disable-next-line primer/spacing */\n margin-block-start: calc(var(--base-size-8) - var(--borderWidth-thin));\n margin-block-end: var(--base-size-8);\n background: var(--bgColor-muted);\n border-top: solid var(--borderWidth-thin) var(--borderColor-muted);\n border-bottom: solid var(--borderWidth-thin) var(--borderColor-muted);\n padding-inline: var(--base-size-16);\n\n &:first-child {\n margin-block-start: 0;\n }\n }\n\n /* & + ul:has(.GroupHeadingWrap) {\n outline: solid 1px red;\n } */\n}\n\n.GroupHeading {\n margin: 0;\n font-size: var(--text-body-size-small);\n font-weight: var(--base-text-weight-semibold);\n color: var(--fgColor-muted);\n align-self: flex-start;\n}\n\n.GroupHeadingWrap[data-has-trailing-action] {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: var(--base-size-8);\n\n & > .GroupHeading {\n align-self: center;\n }\n}\n\n.GroupHeadingTrailingAction {\n display: inline-flex;\n align-items: center;\n margin-inline-start: auto;\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./Group-
|
|
1
|
+
import "./Group-efcb39da.css";
|
|
2
2
|
//#region src/ActionList/Group.module.css.js
|
|
3
3
|
var Group_module_css_default = {
|
|
4
4
|
"Group": "prc-ActionList-Group-lMIPQ",
|
|
5
|
-
"GroupList": "prc-ActionList-GroupList-V5B3-",
|
|
6
5
|
"GroupHeadingWrap": "prc-ActionList-GroupHeadingWrap-laXcX",
|
|
6
|
+
"GroupList": "prc-ActionList-GroupList-V5B3-",
|
|
7
7
|
"GroupHeading": "prc-ActionList-GroupHeading-STzxi",
|
|
8
8
|
"GroupHeadingTrailingAction": "prc-ActionList-GroupHeadingTrailingAction-jnb64"
|
|
9
9
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FCWithSlotMarker
|
|
1
|
+
import { FCWithSlotMarker } from "../utils/types/Slots.js";
|
|
2
2
|
import { ForwardRefComponent } from "../utils/polymorphic.js";
|
|
3
3
|
import { DistributiveOmit, PolymorphicProps } from "../utils/modern-polymorphic.js";
|
|
4
4
|
import { ActionListTrailingActionProps } from "../ActionList/TrailingAction.js";
|
|
@@ -71,7 +71,7 @@ declare const NavList: React.ForwardRefExoticComponent<Omit<NavListProps, "ref">
|
|
|
71
71
|
Divider: FCWithSlotMarker<React.PropsWithChildren<ActionListDividerProps>>;
|
|
72
72
|
Group: React.FC<NavListGroupProps>;
|
|
73
73
|
GroupExpand: React.ForwardRefExoticComponent<NavListGroupExpandProps & React.RefAttributes<HTMLButtonElement>>;
|
|
74
|
-
GroupHeading:
|
|
74
|
+
GroupHeading: React.FC<ActionListGroupHeadingProps>;
|
|
75
75
|
};
|
|
76
76
|
//#endregion
|
|
77
77
|
export { NavList, NavListDividerProps, NavListGroupExpandProps, NavListGroupHeadingProps, NavListGroupProps, NavListHeadingProps, NavListItemProps, NavListLeadingVisualProps, NavListProps, NavListSubNavProps, NavListTrailingVisualProps };
|
package/dist/NavList/NavList.js
CHANGED
|
@@ -3,7 +3,6 @@ import { useId as useId$1 } from "../hooks/useId.js";
|
|
|
3
3
|
import { useSlots } from "../hooks/useSlots.js";
|
|
4
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
5
5
|
import _VisuallyHidden_module_css_default from "../_VisuallyHidden.module.css.js";
|
|
6
|
-
import { asSlot } from "../utils/as-slot.js";
|
|
7
6
|
import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
|
|
8
7
|
import Heading$1 from "../Heading/Heading.js";
|
|
9
8
|
import ActionList_module_css_default from "../ActionList/ActionList.module.css.js";
|
|
@@ -376,7 +375,7 @@ Divider.displayName = "NavList.Divider";
|
|
|
376
375
|
const TrailingAction = ActionList.TrailingAction;
|
|
377
376
|
TrailingAction.displayName = "NavList.TrailingAction";
|
|
378
377
|
const Group = (t0) => {
|
|
379
|
-
const $ = c(
|
|
378
|
+
const $ = c(19);
|
|
380
379
|
let children;
|
|
381
380
|
let hideDivider;
|
|
382
381
|
let props;
|
|
@@ -396,55 +395,48 @@ const Group = (t0) => {
|
|
|
396
395
|
}
|
|
397
396
|
const headingLevel = React.useContext(NavListHeadingLevelContext);
|
|
398
397
|
let t1;
|
|
399
|
-
if ($[5]
|
|
400
|
-
t1 =
|
|
401
|
-
$[5] =
|
|
402
|
-
|
|
403
|
-
|
|
398
|
+
if ($[5] !== headingLevel) {
|
|
399
|
+
t1 = headingLevel ? levelToHeadingTag(headingLevel + 1) : "h3";
|
|
400
|
+
$[5] = headingLevel;
|
|
401
|
+
$[6] = t1;
|
|
402
|
+
} else t1 = $[6];
|
|
403
|
+
const groupHeadingAs = t1;
|
|
404
404
|
let t2;
|
|
405
|
-
if ($[
|
|
406
|
-
t2 =
|
|
407
|
-
$[
|
|
408
|
-
$[
|
|
409
|
-
} else t2 = $[
|
|
410
|
-
const groupHeadingAs = t2;
|
|
405
|
+
if ($[7] !== hideDivider) {
|
|
406
|
+
t2 = !hideDivider && /*#__PURE__*/ jsx(ActionList.Divider, {});
|
|
407
|
+
$[7] = hideDivider;
|
|
408
|
+
$[8] = t2;
|
|
409
|
+
} else t2 = $[8];
|
|
411
410
|
let t3;
|
|
412
|
-
if ($[
|
|
413
|
-
t3 =
|
|
414
|
-
$[8] = hideDivider;
|
|
415
|
-
$[9] = t3;
|
|
416
|
-
} else t3 = $[9];
|
|
417
|
-
let t4;
|
|
418
|
-
if ($[10] !== groupHeadingAs || $[11] !== slots.groupHeading || $[12] !== title) {
|
|
419
|
-
t4 = slots.groupHeading ? /*#__PURE__*/ React.cloneElement(slots.groupHeading, { headingWrapElement: "div" }) : title ? /*#__PURE__*/ jsx(ActionList.GroupHeading, {
|
|
411
|
+
if ($[9] !== groupHeadingAs || $[10] !== title) {
|
|
412
|
+
t3 = title ? /*#__PURE__*/ jsx(ActionList.GroupHeading, {
|
|
420
413
|
as: groupHeadingAs,
|
|
421
414
|
"data-component": "ActionList.GroupHeading",
|
|
422
415
|
children: title
|
|
423
416
|
}) : null;
|
|
424
|
-
$[
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
t5 = /*#__PURE__*/ jsxs(ActionList.Group, {
|
|
417
|
+
$[9] = groupHeadingAs;
|
|
418
|
+
$[10] = title;
|
|
419
|
+
$[11] = t3;
|
|
420
|
+
} else t3 = $[11];
|
|
421
|
+
let t4;
|
|
422
|
+
if ($[12] !== children || $[13] !== props || $[14] !== t3) {
|
|
423
|
+
t4 = /*#__PURE__*/ jsxs(ActionList.Group, {
|
|
432
424
|
...props,
|
|
433
|
-
children: [
|
|
425
|
+
children: [t3, children]
|
|
434
426
|
});
|
|
435
|
-
$[
|
|
436
|
-
$[
|
|
437
|
-
$[
|
|
438
|
-
$[
|
|
439
|
-
} else
|
|
440
|
-
let
|
|
441
|
-
if ($[
|
|
442
|
-
|
|
443
|
-
$[
|
|
444
|
-
$[
|
|
445
|
-
$[
|
|
446
|
-
} else
|
|
447
|
-
return
|
|
427
|
+
$[12] = children;
|
|
428
|
+
$[13] = props;
|
|
429
|
+
$[14] = t3;
|
|
430
|
+
$[15] = t4;
|
|
431
|
+
} else t4 = $[15];
|
|
432
|
+
let t5;
|
|
433
|
+
if ($[16] !== t2 || $[17] !== t4) {
|
|
434
|
+
t5 = /*#__PURE__*/ jsxs(Fragment, { children: [t2, t4] });
|
|
435
|
+
$[16] = t2;
|
|
436
|
+
$[17] = t4;
|
|
437
|
+
$[18] = t5;
|
|
438
|
+
} else t5 = $[18];
|
|
439
|
+
return t5;
|
|
448
440
|
};
|
|
449
441
|
const GroupExpand = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
450
442
|
const $ = c(23);
|
|
@@ -542,7 +534,7 @@ const GroupExpand = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
542
534
|
* This is an alternative to the `title` prop on `NavList.Group`.
|
|
543
535
|
* It was primarily added to allow links in group headings.
|
|
544
536
|
*/
|
|
545
|
-
const
|
|
537
|
+
const GroupHeading = (t0) => {
|
|
546
538
|
const $ = c(13);
|
|
547
539
|
let as;
|
|
548
540
|
let className;
|
|
@@ -590,7 +582,6 @@ const GroupHeadingImpl = (t0) => {
|
|
|
590
582
|
} else t3 = $[12];
|
|
591
583
|
return t3;
|
|
592
584
|
};
|
|
593
|
-
const GroupHeading = asSlot(GroupHeadingImpl, ActionList.GroupHeading);
|
|
594
585
|
const NavList = Object.assign(Root, {
|
|
595
586
|
Description: ActionList.Description,
|
|
596
587
|
Heading,
|
package/dist/ThemeProvider.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/ThemeProvider.d.ts
|
|
4
|
-
type Theme = {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
};
|
|
7
4
|
type ColorMode = 'day' | 'night' | 'light' | 'dark';
|
|
8
5
|
type ColorModeWithAuto = ColorMode | 'auto';
|
|
9
6
|
type ThemeProviderProps = {
|
|
@@ -23,4 +20,4 @@ type ThemeProviderProps = {
|
|
|
23
20
|
};
|
|
24
21
|
declare const ThemeProvider: React.FC<React.PropsWithChildren<ThemeProviderProps>>;
|
|
25
22
|
//#endregion
|
|
26
|
-
export { ColorMode, ColorModeWithAuto,
|
|
23
|
+
export { ColorMode, ColorModeWithAuto, ThemeProvider, ThemeProvider as default, ThemeProviderProps };
|
package/dist/ThemeProvider.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import theme from "./theme.js";
|
|
2
1
|
import { useSyncedState } from "./hooks/useSyncedState.js";
|
|
3
2
|
import { ThemeContext } from "./ThemeContext.js";
|
|
4
3
|
import { useTheme } from "./useTheme.js";
|
|
5
4
|
import { c } from "react-compiler-runtime";
|
|
6
5
|
import { jsx } from "react/jsx-runtime";
|
|
7
6
|
import React from "react";
|
|
8
|
-
import deepmerge from "deepmerge";
|
|
9
7
|
const defaultDayScheme = "light";
|
|
10
8
|
const defaultNightScheme = "dark";
|
|
11
9
|
const ThemeProvider = (t0) => {
|
|
12
10
|
var _ref, _props$colorMode, _ref2, _props$dayScheme, _ref3, _props$nightScheme;
|
|
13
|
-
const $ = c(
|
|
11
|
+
const $ = c(29);
|
|
14
12
|
let children;
|
|
15
13
|
let props;
|
|
16
14
|
if ($[0] !== t0) {
|
|
@@ -22,8 +20,7 @@ const ThemeProvider = (t0) => {
|
|
|
22
20
|
children = $[1];
|
|
23
21
|
props = $[2];
|
|
24
22
|
}
|
|
25
|
-
const {
|
|
26
|
-
const theme$1 = fallbackTheme !== null && fallbackTheme !== void 0 ? fallbackTheme : theme;
|
|
23
|
+
const { colorMode: fallbackColorMode, dayScheme: fallbackDayScheme, nightScheme: fallbackNightScheme } = useTheme();
|
|
27
24
|
const [colorMode, setColorMode] = useSyncedState((_ref = (_props$colorMode = props.colorMode) !== null && _props$colorMode !== void 0 ? _props$colorMode : fallbackColorMode) !== null && _ref !== void 0 ? _ref : "day");
|
|
28
25
|
const [dayScheme, setDayScheme] = useSyncedState((_ref2 = (_props$dayScheme = props.dayScheme) !== null && _props$dayScheme !== void 0 ? _props$dayScheme : fallbackDayScheme) !== null && _ref2 !== void 0 ? _ref2 : defaultDayScheme);
|
|
29
26
|
const [nightScheme, setNightScheme] = useSyncedState((_ref3 = (_props$nightScheme = props.nightScheme) !== null && _props$nightScheme !== void 0 ? _props$nightScheme : fallbackNightScheme) !== null && _ref3 !== void 0 ? _ref3 : defaultNightScheme);
|
|
@@ -45,80 +42,68 @@ const ThemeProvider = (t0) => {
|
|
|
45
42
|
}
|
|
46
43
|
const colorScheme = t1;
|
|
47
44
|
let t2;
|
|
48
|
-
if ($[9] !==
|
|
49
|
-
t2 =
|
|
50
|
-
$[9] = colorScheme;
|
|
51
|
-
$[10] = theme$1;
|
|
52
|
-
$[11] = t2;
|
|
53
|
-
} else t2 = $[11];
|
|
54
|
-
const { resolvedTheme, resolvedColorScheme } = t2;
|
|
55
|
-
let t3;
|
|
56
|
-
if ($[12] !== colorMode || $[13] !== colorScheme || $[14] !== dayScheme || $[15] !== nightScheme || $[16] !== resolvedColorMode || $[17] !== resolvedColorScheme || $[18] !== resolvedTheme || $[19] !== setColorMode || $[20] !== setDayScheme || $[21] !== setNightScheme) {
|
|
57
|
-
t3 = {
|
|
58
|
-
theme: resolvedTheme,
|
|
45
|
+
if ($[9] !== colorMode || $[10] !== colorScheme || $[11] !== dayScheme || $[12] !== nightScheme || $[13] !== resolvedColorMode || $[14] !== setColorMode || $[15] !== setDayScheme || $[16] !== setNightScheme) {
|
|
46
|
+
t2 = {
|
|
59
47
|
colorScheme,
|
|
60
48
|
colorMode,
|
|
61
49
|
resolvedColorMode,
|
|
62
|
-
resolvedColorScheme,
|
|
63
50
|
dayScheme,
|
|
64
51
|
nightScheme,
|
|
65
52
|
setColorMode,
|
|
66
53
|
setDayScheme,
|
|
67
54
|
setNightScheme
|
|
68
55
|
};
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
} else t3 = $[22];
|
|
81
|
-
const contextValue = t3;
|
|
56
|
+
$[9] = colorMode;
|
|
57
|
+
$[10] = colorScheme;
|
|
58
|
+
$[11] = dayScheme;
|
|
59
|
+
$[12] = nightScheme;
|
|
60
|
+
$[13] = resolvedColorMode;
|
|
61
|
+
$[14] = setColorMode;
|
|
62
|
+
$[15] = setDayScheme;
|
|
63
|
+
$[16] = setNightScheme;
|
|
64
|
+
$[17] = t2;
|
|
65
|
+
} else t2 = $[17];
|
|
66
|
+
const contextValue = t2;
|
|
82
67
|
if (props.contextOnly) {
|
|
83
|
-
let
|
|
84
|
-
if ($[
|
|
85
|
-
|
|
68
|
+
let t3;
|
|
69
|
+
if ($[18] !== children || $[19] !== contextValue) {
|
|
70
|
+
t3 = /*#__PURE__*/ jsx(ThemeContext.Provider, {
|
|
86
71
|
value: contextValue,
|
|
87
72
|
children
|
|
88
73
|
});
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
} else
|
|
93
|
-
return
|
|
74
|
+
$[18] = children;
|
|
75
|
+
$[19] = contextValue;
|
|
76
|
+
$[20] = t3;
|
|
77
|
+
} else t3 = $[20];
|
|
78
|
+
return t3;
|
|
94
79
|
}
|
|
95
|
-
const
|
|
96
|
-
let
|
|
97
|
-
if ($[
|
|
98
|
-
|
|
80
|
+
const t3 = colorMode === "auto" ? "auto" : colorScheme.includes("dark") ? "dark" : "light";
|
|
81
|
+
let t4;
|
|
82
|
+
if ($[21] !== children || $[22] !== dayScheme || $[23] !== nightScheme || $[24] !== t3) {
|
|
83
|
+
t4 = /*#__PURE__*/ jsx("div", {
|
|
99
84
|
"data-component": "ThemeProvider",
|
|
100
|
-
"data-color-mode":
|
|
85
|
+
"data-color-mode": t3,
|
|
101
86
|
"data-light-theme": dayScheme,
|
|
102
87
|
"data-dark-theme": nightScheme,
|
|
103
88
|
children
|
|
104
89
|
});
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
} else
|
|
111
|
-
let
|
|
112
|
-
if ($[
|
|
113
|
-
|
|
90
|
+
$[21] = children;
|
|
91
|
+
$[22] = dayScheme;
|
|
92
|
+
$[23] = nightScheme;
|
|
93
|
+
$[24] = t3;
|
|
94
|
+
$[25] = t4;
|
|
95
|
+
} else t4 = $[25];
|
|
96
|
+
let t5;
|
|
97
|
+
if ($[26] !== contextValue || $[27] !== t4) {
|
|
98
|
+
t5 = /*#__PURE__*/ jsx(ThemeContext.Provider, {
|
|
114
99
|
value: contextValue,
|
|
115
|
-
children:
|
|
100
|
+
children: t4
|
|
116
101
|
});
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
} else
|
|
121
|
-
return
|
|
102
|
+
$[26] = contextValue;
|
|
103
|
+
$[27] = t4;
|
|
104
|
+
$[28] = t5;
|
|
105
|
+
} else t5 = $[28];
|
|
106
|
+
return t5;
|
|
122
107
|
};
|
|
123
108
|
function subscribeToSystemColorMode(callback) {
|
|
124
109
|
var _window, _window$matchMedia;
|
|
@@ -150,23 +135,5 @@ function chooseColorScheme(colorMode, dayScheme, nightScheme) {
|
|
|
150
135
|
case "night": return nightScheme;
|
|
151
136
|
}
|
|
152
137
|
}
|
|
153
|
-
function applyColorScheme(theme, colorScheme) {
|
|
154
|
-
if (!theme.colorSchemes) return {
|
|
155
|
-
resolvedTheme: theme,
|
|
156
|
-
resolvedColorScheme: void 0
|
|
157
|
-
};
|
|
158
|
-
if (!theme.colorSchemes[colorScheme]) {
|
|
159
|
-
console.error(`\`${colorScheme}\` scheme not defined in \`theme.colorSchemes\``);
|
|
160
|
-
const defaultColorScheme = Object.keys(theme.colorSchemes)[0];
|
|
161
|
-
return {
|
|
162
|
-
resolvedTheme: deepmerge(theme, theme.colorSchemes[defaultColorScheme]),
|
|
163
|
-
resolvedColorScheme: defaultColorScheme
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
resolvedTheme: deepmerge(theme, theme.colorSchemes[colorScheme]),
|
|
168
|
-
resolvedColorScheme: colorScheme
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
138
|
//#endregion
|
|
172
139
|
export { ThemeProvider, ThemeProvider as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { useOnEscapePress } from "./hooks/useOnEscapePress.js";
|
|
|
5
5
|
import { useOpenAndCloseFocus } from "./hooks/useOpenAndCloseFocus.js";
|
|
6
6
|
import { AnchoredPositionHookSettings, useAnchoredPosition } from "./hooks/useAnchoredPosition.js";
|
|
7
7
|
import { useOverlay } from "./hooks/useOverlay.js";
|
|
8
|
-
import theme
|
|
8
|
+
import theme from "./theme.js";
|
|
9
9
|
import BaseStyles, { BaseStylesProps } from "./BaseStyles.js";
|
|
10
10
|
import { ThemeProvider, ThemeProviderProps } from "./ThemeProvider.js";
|
|
11
11
|
import { useColorSchemeVar, useTheme } from "./useTheme.js";
|
|
@@ -119,4 +119,4 @@ import { ActionsProps, ChildrenPropTypes, PageHeader, PageHeaderProps, TitleArea
|
|
|
119
119
|
import { SkeletonBox, SkeletonBoxProps } from "./Skeleton/SkeletonBox.js";
|
|
120
120
|
import { ActionMenu, ActionMenuAnchorProps, ActionMenuButtonProps, ActionMenuProps } from "./ActionMenu/ActionMenu.js";
|
|
121
121
|
import Overlay, { OverlayProps } from "./Overlay/Overlay.js";
|
|
122
|
-
export { ActionBar, type ActionBarProps, ActionList, type ActionListDescriptionProps, type ActionListDividerProps, type ActionListGroupHeadingProps, type ActionListGroupHeadingTrailingActionProps, type ActionListGroupProps, type ActionListItemProps, type ActionListLeadingVisualProps, type ActionListLinkItemProps, type ActionListProps, type ActionListTrailingActionProps, type ActionListTrailingVisualProps, ActionMenu, type ActionMenuAnchorProps, type ActionMenuButtonProps, type ActionMenuProps, AnchoredOverlay, type AnchoredOverlayProps, type AnchoredPositionHookSettings, _default as Autocomplete, type AutocompleteInputProps, type AutocompleteMenuProps, type AutocompleteOverlayProps, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Banner, type BannerProps, BaseStyles, type BaseStylesProps, _default$1 as BranchName, type BranchNameProps, Breadcrumb, type BreadcrumbItemProps, type BreadcrumbProps, _default$2 as Breadcrumbs, type BreadcrumbsItemProps, type BreadcrumbsProps, ButtonComponent as Button, ButtonBase, type ButtonBaseProps, ButtonGroup, type ButtonGroupProps, type ButtonProps, _default$3 as Checkbox, _default$4 as CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, _default$5 as CircleBadge, type CircleBadgeIconProps, type CircleBadgeProps, ConfirmationDialog, type ConfirmationDialogProps, CounterLabel, type CounterLabelProps, type CustomWidthOptions, Details, type DetailsProps, Dialog, type DialogButtonProps, type DialogHeaderProps, type DialogHeight, type DialogProps, type DialogWidth, DragHandle, type DragHandleProps, type FCWithSlotMarker, Flash, type FlashProps, FocusKeys, type FocusTrapHookSettings, type FocusZoneHookSettings, _default$6 as FormControl, type FormControlCaptionProps, type Props as FormControlLabelProps, type FormControlProps, type FormControlValidationProps, _default$7 as Header, type HeaderItemProps, type HeaderLinkProps, type HeaderProps, Heading, type HeadingProps, IconButton, type IconButtonProps, IssueLabelToken, type IssueLabelTokenProps, Label, type LabelColorOptions, LabelGroup, type LabelGroupProps, type LabelProps, Link, LinkButton, type LinkButtonProps, type LinkProps, NavList, type NavListDividerProps, type NavListGroupHeadingProps, type NavListGroupProps, type NavListItemProps, type NavListLeadingVisualProps, type NavListProps, type NavListSubNavProps, type NavListTrailingVisualProps, Overlay, type OverlayProps, PageHeader, type ActionsProps as PageHeaderActionsProps, type ChildrenPropTypes as PageHeaderChildrenPropTypes, type PageHeaderProps, type TitleAreaProps as PageHeaderTitleAreaProps, type TitleProps as PageHeaderTitleProps, PageLayout, type PageLayoutContentProps, type PageLayoutFooterProps, type PageLayoutHeaderProps, type PageLayoutPaneProps, type PageLayoutProps, Pagination, type PaginationProps, type PaneWidth, type PaneWidthValue, _default$8 as Popover, type PopoverContentProps, type PopoverProps, Portal, PortalContext, type PortalProps, ProgressBar, type ProgressBarItemProps, type ProgressBarProps, _default$9 as Radio, _default$10 as RadioGroup, type RadioGroupProps, type RadioProps, RelativeTime, type RelativeTimeProps, type ResponsiveValue, SegmentedControl, type SegmentedControlButtonProps, type SegmentedControlIconButtonProps, type SegmentedControlProps, _default$11 as Select, SelectPanel, type GroupedListProps as SelectPanelGroupedListProps, type ItemInput as SelectPanelItemInput, type FilteredActionListItemProps as SelectPanelItemProps, type SelectPanelProps, type SelectProps, _default$12 as SideNav, type SideNavLinkProps, type SideNavProps, SkeletonBox, type SkeletonBoxProps, type SlotMarker, Spinner, type SpinnerProps, SplitPageLayout, type SplitPageLayoutContentProps, type SplitPageLayoutFooterProps, type SplitPageLayoutHeaderProps, type SplitPageLayoutPaneProps, type SplitPageLayoutProps, Stack, type StackItemProps, type StackProps, StateLabel, type StateLabelProps, _default$13 as SubNav, type SubNavLinkProps, type SubNavLinksProps, type SubNavProps, _default$14 as Text, _default$15 as TextInput, type TextInputActionProps, type TextInputProps, _default$16 as TextInputWithTokens, type TextInputWithTokensProps, type TextProps, _default$17 as Textarea, type TextareaProps,
|
|
122
|
+
export { ActionBar, type ActionBarProps, ActionList, type ActionListDescriptionProps, type ActionListDividerProps, type ActionListGroupHeadingProps, type ActionListGroupHeadingTrailingActionProps, type ActionListGroupProps, type ActionListItemProps, type ActionListLeadingVisualProps, type ActionListLinkItemProps, type ActionListProps, type ActionListTrailingActionProps, type ActionListTrailingVisualProps, ActionMenu, type ActionMenuAnchorProps, type ActionMenuButtonProps, type ActionMenuProps, AnchoredOverlay, type AnchoredOverlayProps, type AnchoredPositionHookSettings, _default as Autocomplete, type AutocompleteInputProps, type AutocompleteMenuProps, type AutocompleteOverlayProps, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Banner, type BannerProps, BaseStyles, type BaseStylesProps, _default$1 as BranchName, type BranchNameProps, Breadcrumb, type BreadcrumbItemProps, type BreadcrumbProps, _default$2 as Breadcrumbs, type BreadcrumbsItemProps, type BreadcrumbsProps, ButtonComponent as Button, ButtonBase, type ButtonBaseProps, ButtonGroup, type ButtonGroupProps, type ButtonProps, _default$3 as Checkbox, _default$4 as CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, _default$5 as CircleBadge, type CircleBadgeIconProps, type CircleBadgeProps, ConfirmationDialog, type ConfirmationDialogProps, CounterLabel, type CounterLabelProps, type CustomWidthOptions, Details, type DetailsProps, Dialog, type DialogButtonProps, type DialogHeaderProps, type DialogHeight, type DialogProps, type DialogWidth, DragHandle, type DragHandleProps, type FCWithSlotMarker, Flash, type FlashProps, FocusKeys, type FocusTrapHookSettings, type FocusZoneHookSettings, _default$6 as FormControl, type FormControlCaptionProps, type Props as FormControlLabelProps, type FormControlProps, type FormControlValidationProps, _default$7 as Header, type HeaderItemProps, type HeaderLinkProps, type HeaderProps, Heading, type HeadingProps, IconButton, type IconButtonProps, IssueLabelToken, type IssueLabelTokenProps, Label, type LabelColorOptions, LabelGroup, type LabelGroupProps, type LabelProps, Link, LinkButton, type LinkButtonProps, type LinkProps, NavList, type NavListDividerProps, type NavListGroupHeadingProps, type NavListGroupProps, type NavListItemProps, type NavListLeadingVisualProps, type NavListProps, type NavListSubNavProps, type NavListTrailingVisualProps, Overlay, type OverlayProps, PageHeader, type ActionsProps as PageHeaderActionsProps, type ChildrenPropTypes as PageHeaderChildrenPropTypes, type PageHeaderProps, type TitleAreaProps as PageHeaderTitleAreaProps, type TitleProps as PageHeaderTitleProps, PageLayout, type PageLayoutContentProps, type PageLayoutFooterProps, type PageLayoutHeaderProps, type PageLayoutPaneProps, type PageLayoutProps, Pagination, type PaginationProps, type PaneWidth, type PaneWidthValue, _default$8 as Popover, type PopoverContentProps, type PopoverProps, Portal, PortalContext, type PortalProps, ProgressBar, type ProgressBarItemProps, type ProgressBarProps, _default$9 as Radio, _default$10 as RadioGroup, type RadioGroupProps, type RadioProps, RelativeTime, type RelativeTimeProps, type ResponsiveValue, SegmentedControl, type SegmentedControlButtonProps, type SegmentedControlIconButtonProps, type SegmentedControlProps, _default$11 as Select, SelectPanel, type GroupedListProps as SelectPanelGroupedListProps, type ItemInput as SelectPanelItemInput, type FilteredActionListItemProps as SelectPanelItemProps, type SelectPanelProps, type SelectProps, _default$12 as SideNav, type SideNavLinkProps, type SideNavProps, SkeletonBox, type SkeletonBoxProps, type SlotMarker, Spinner, type SpinnerProps, SplitPageLayout, type SplitPageLayoutContentProps, type SplitPageLayoutFooterProps, type SplitPageLayoutHeaderProps, type SplitPageLayoutPaneProps, type SplitPageLayoutProps, Stack, type StackItemProps, type StackProps, StateLabel, type StateLabelProps, _default$13 as SubNav, type SubNavLinkProps, type SubNavLinksProps, type SubNavProps, _default$14 as Text, _default$15 as TextInput, type TextInputActionProps, type TextInputProps, _default$16 as TextInputWithTokens, type TextInputWithTokensProps, type TextProps, _default$17 as Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, _default$18 as Timeline, type TimelineActionsProps, type TimelineAvatarProps, type TimelineBadgeProps, type TimelineBadgeVariant, type TimelineBodyProps, type TimelineBreakProps, type TimelineItemProps, type TimelineItemsProps, type TimelineProps, ToggleSwitch, type ToggleSwitchProps, Token, type TokenProps, Tooltip, type TooltipProps, type TouchOrMouseEvent, TreeView, type TreeViewErrorDialogProps, type TreeViewItemProps, type TreeViewProps, type TreeViewSubTreeProps, type TreeViewVisualProps, Truncate, type TruncateProps, UnderlineNav, type UnderlineNavItemProps, type UnderlineNavProps, type UsePaneWidthOptions, type UsePaneWidthResult, VisuallyHidden, type VisuallyHiddenProps, type WithSlotMarker, asSlot, createComponent, defaultPaneWidth, isSlot, registerPortalRoot, theme, useAnchoredPosition, useColorSchemeVar, useConfirm, useDetails, useFocusTrap, useFocusZone, useFormControlForwardedProps, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnEscapePress, useOnOutsideClick, useOpenAndCloseFocus, useOverlay, usePaneWidth, useProvidedRefOrCreate, useRefObjectAsForwardedRef, useResizeObserver, useResponsiveValue, useRovingTabIndex, useSafeTimeout, useSlots, useSyncedState, useTheme };
|