@primer/react 0.0.0-20260707163630 → 0.0.0-20260707163701
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 +3 -3
- package/dist/SelectPanel/SelectPanel.js +4 -6
- package/dist/ToggleSwitch/ToggleSwitch.js +2 -2
- package/dist/experimental/SelectPanel2/SelectPanel-608e207e.css +2 -0
- package/dist/experimental/SelectPanel2/{SelectPanel-b5469dea.css.map → SelectPanel-608e207e.css.map} +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.js +1 -9
- package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
- package/dist/hooks/useMedia.js +44 -43
- package/dist/internal/components/ValidationAnimationContainer.js +16 -30
- package/package.json +3 -3
- package/dist/experimental/SelectPanel2/SelectPanel-b5469dea.css +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260707163701
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- [#8001](https://github.com/primer/react/pull/8001) [`4e6cf0d`](https://github.com/primer/react/commit/4e6cf0d1715e0371169b291be7a503f2d15f7bc5) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Derive state during render instead of in effects for `useMedia`, `ToggleSwitch`, `SelectPanel`, and the internal validation animation container, removing redundant render passes. Note: `useMedia` now returns the live `matchMedia` value on the first client render; `defaultState` is only used for the SSR/hydration snapshot (no public API changes).
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- Fake entry to force publishing
|
|
10
10
|
|
|
11
11
|
- [#8035](https://github.com/primer/react/pull/8035) [`723f4d6`](https://github.com/primer/react/commit/723f4d6db12710e2b94f56b945a937158fcbb127) Thanks [@mattcosta7](https://github.com/mattcosta7)! - UnderlineNav, ActionBar: Detect item overflow with a single shared IntersectionObserver per component instead of one observer per item, reducing observer churn during resize. No public API changes.
|
|
12
12
|
|
|
@@ -99,13 +99,11 @@ function Panel({ open, onOpenChange, renderAnchor = defaultRenderAnchor, anchorR
|
|
|
99
99
|
const selectedValueId = id ? `${id}-selected-value` : void 0;
|
|
100
100
|
const isSingleSelectModal = variant === "modal" && !isMultiSelectVariant(selected);
|
|
101
101
|
const [intermediateSelected, setIntermediateSelected] = useState(isSingleSelectModal ? selected : void 0);
|
|
102
|
-
|
|
102
|
+
const [prevOpen, setPrevOpen] = useState(open);
|
|
103
|
+
if (prevOpen !== open) {
|
|
104
|
+
setPrevOpen(open);
|
|
103
105
|
setIntermediateSelected(isSingleSelectModal ? selected : void 0);
|
|
104
|
-
}
|
|
105
|
-
isSingleSelectModal,
|
|
106
|
-
open,
|
|
107
|
-
selected
|
|
108
|
-
]);
|
|
106
|
+
}
|
|
109
107
|
const onListContainerRefChanged = useCallback((node) => {
|
|
110
108
|
setListContainerElement(node);
|
|
111
109
|
if (!node && needsNoItemsAnnouncement) setNeedsNoItemsAnnouncement(false);
|
|
@@ -179,12 +179,12 @@ const ToggleSwitch = /*#__PURE__*/ React.forwardRef(function ToggleSwitch(props,
|
|
|
179
179
|
t7 = $[30];
|
|
180
180
|
}
|
|
181
181
|
useEffect(t6, t7);
|
|
182
|
+
if (!loading && isLoadingLabelVisible) setIsLoadingLabelVisible(false);
|
|
182
183
|
let t8;
|
|
183
184
|
let t9;
|
|
184
185
|
if ($[31] !== isLoadingLabelVisible || $[32] !== loading || $[33] !== loadingLabelDelay || $[34] !== safeSetTimeout) {
|
|
185
186
|
t8 = () => {
|
|
186
|
-
if (
|
|
187
|
-
else if (loading && !isLoadingLabelVisible) safeSetTimeout(() => {
|
|
187
|
+
if (loading && !isLoadingLabelVisible) safeSetTimeout(() => {
|
|
188
188
|
setIsLoadingLabelVisible(true);
|
|
189
189
|
}, loadingLabelDelay);
|
|
190
190
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-SelectPanel2-Overlay--Q-FI{border:none;color:var(--fgColor-default,#1f2328);padding:0;--max-height:0;--position-top:0;--position-left:0}.prc-SelectPanel2-Overlay--Q-FI:where([open]){display:flex}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=anchored]),.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=full-screen]){left:var(--position-left);margin:0;top:var(--position-top)}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=anchored])::backdrop{background-color:transparent}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=full-screen])::backdrop{background-color:transparent}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=modal]){bottom:0;left:0;right:0;top:0}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=modal])::backdrop{background-color:var(--overlay-backdrop-bgColor,#c8d1da66)}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=full-screen]){border-radius:unset;height:100%;left:0;margin:0;max-height:100vh;max-width:100vw;top:0;width:100%}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=bottom-sheet]){border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:0;left:0;margin:0;max-height:calc(100vh - 64px);max-width:100vw;top:auto;width:100%}.prc-SelectPanel2-Form-bZ9HS{width:100%}.prc-SelectPanel2-Container-e5e6-,.prc-SelectPanel2-Form-bZ9HS{display:flex;flex-direction:column}.prc-SelectPanel2-Container-e5e6-{flex-grow:1;flex-shrink:1;justify-content:space-between;overflow:hidden}.prc-SelectPanel2-Container-e5e6- ul{flex-grow:1;overflow-y:auto}.prc-SelectPanel2-Container-e5e6- li:not(:focus,[data-is-active-descendant],[data-active]){contain-intrinsic-size:auto 32px;content-visibility:auto}.prc-SelectPanel2-HeaderContent-MsaAS{align-items:center;display:flex;justify-content:space-between;margin-bottom:0}.prc-SelectPanel2-HeaderContent-MsaAS:where([data-description]){align-items:flex-start}.prc-SelectPanel2-HeaderContent-MsaAS:where([data-search-input]){margin-bottom:var(--base-size-8,.5rem)}.prc-SelectPanel2-TitleWrapper-HzPu3{margin-left:var(--base-size-8,.5rem);margin-top:0}.prc-SelectPanel2-TitleWrapper-HzPu3:where([data-description]){margin-top:2px}.prc-SelectPanel2-TitleWrapper-HzPu3:where([data-on-back]){margin-left:var(--base-size-4,.25rem)}.prc-SelectPanel2-TextInput-lHH1n{padding-left:var(--base-size-8,.5rem)!important}.prc-SelectPanel2-TextInput-lHH1n:has(input:placeholder-shown) .TextInput-action{display:none}.prc-SelectPanel2-Checkbox-AYR38{margin-top:0}.prc-SelectPanel2-FlexBox-gWPRg{display:flex}.prc-SelectPanel2-Title-T-h3f{font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-semibold,600)}.prc-SelectPanel2-Description-qTXfi{display:block;font-size:var(--text-body-size-small,.75rem)}.prc-SelectPanel2-ClearAction-tQj-f,.prc-SelectPanel2-Description-qTXfi{color:var(--fgColor-muted,#59636e)}.prc-SelectPanel2-ClearAction-tQj-f{background:none}.prc-SelectPanel2-Footer-TibV0{align-items:center;border-top:var(--borderWidth-thin,.0625rem) solid;border-top-color:var(--borderColor-default,#d1d9e0);display:flex;flex-shrink:0;justify-content:space-between;min-height:44px;padding:var(--base-size-16,1rem)}.prc-SelectPanel2-Footer-TibV0:where([data-hide-primary-actions]){padding:var(--base-size-8,.5rem)}.prc-SelectPanel2-FooterContent-UjAOM{flex-grow:0}.prc-SelectPanel2-FooterContent-UjAOM:where([data-hide-primary-actions]){flex-grow:1}.prc-SelectPanel2-FooterActions-T6yQR,.prc-SelectPanel2-SecondaryCheckbox-omkf-{display:flex;gap:var(--stack-gap-condensed,.5rem)}.prc-SelectPanel2-SecondaryCheckbox-omkf-{align-items:center}.prc-SelectPanel2-SmallText-c42ay{font-size:var(--text-body-size-small,.75rem)}.prc-SelectPanel2-SelectPanelLoading-mtyhD{align-items:center;display:flex;flex-direction:column;gap:var(--stack-gap-normal,1rem);height:100%;justify-content:center;min-height:min(calc(var(--max-height) - 150px),324px)}.prc-SelectPanel2-LoadingText-DB0wN{color:var(--fgColor-muted,#59636e);font-size:var(--text-body-size-medium,.875rem)}.prc-SelectPanel2-MessageFull-nY-qF{align-items:center;display:flex;flex-direction:column;flex-grow:1;gap:var(--base-size-4,.25rem);height:100%;justify-content:center;min-height:min(calc(var(--max-height) - 150px),324px);padding-left:var(--base-size-24,1.5rem);padding-right:var(--base-size-24,1.5rem);text-align:center}.prc-SelectPanel2-MessageFull-nY-qF a{color:inherit;-webkit-text-decoration:underline;text-decoration:underline}.prc-SelectPanel2-Octicon-zt-zU{margin-bottom:var(--base-size-8,.5rem)}.prc-SelectPanel2-Octicon-zt-zU.prc-SelectPanel2-Error-ZrZQQ{color:var(--fgColor-danger,#d1242f)}.prc-SelectPanel2-Octicon-zt-zU.prc-SelectPanel2-Warning-PDsVF{color:var(--fgColor-attention,#9a6700)}.prc-SelectPanel2-MessageTitle-T7v9d{font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-medium,500)}.prc-SelectPanel2-MessageContent-UZ9vY{align-items:center;color:var(--fgColor-muted,#59636e);flex-direction:column;font-size:var(--text-body-size-medium,.875rem)}.prc-SelectPanel2-MessageContent-UZ9vY,.prc-SelectPanel2-MessageInline-sErQf{display:flex;gap:var(--stack-gap-condensed,.5rem)}.prc-SelectPanel2-MessageInline-sErQf{border-bottom:var(--borderWidth-thin,.0625rem) solid;font-size:var(--text-body-size-small,.75rem);padding:var(--base-size-12,.75rem) var(--base-size-16,1rem)}.prc-SelectPanel2-MessageInline-sErQf a{color:inherit;-webkit-text-decoration:underline;text-decoration:underline}.prc-SelectPanel2-MessageInline-sErQf:where([data-variant=error]){background-color:var(--bgColor-danger-muted,#ffebe9);border-color:var(--borderColor-danger-muted,#ff818266);color:var(--fgColor-danger,#d1242f)}.prc-SelectPanel2-MessageInline-sErQf:where([data-variant=warning]){background-color:var(--bgColor-attention-muted,#fff8c5);border-color:var(--borderColor-attention-muted,#d4a72c66);color:var(--fgColor-attention,#9a6700)}.prc-SelectPanel2-Header-LKyEJ{border-bottom:var(--borderWidth-thin,.0625rem) solid;border-bottom-color:var(--borderColor-default,#d1d9e0);display:flex;flex-direction:column;padding:var(--base-size-8,.5rem)}
|
|
2
|
+
/*# sourceMappingURL=SelectPanel-608e207e.css.map */
|
package/dist/experimental/SelectPanel2/{SelectPanel-b5469dea.css.map → SelectPanel-608e207e.css.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/experimental/SelectPanel2/SelectPanel.module.css.js"],"names":[],"mappings":"AAAA,gCAGE,WAAY,CADZ,oCAA6B,CAD7B,SAAU,CAKV,cAAe,CACf,gBAAiB,CACjB,iBAoDF,CAlDE,8CACE,YACF,CAEA,iIAKE,yBAA0B,CAC1B,QAAS,CAHT,uBAQF,CAHE,yEACE,4BACF,CAFA,4EACE,4BACF,CAGF,4DAIE,QAAS,CAFT,MAAO,CACP,OAAQ,CAFR,KAIF,CAEA,sEACE,0DACF,CAEA,kEAQE,mBAAoB,CAHpB,WAAY,CAHZ,MAAO,CAKP,QAAS,CADT,gBAAiB,CAFjB,eAAgB,CAHhB,KAAM,CAEN,UAMF,CAEA,mEASE,2BAA4B,CAD5B,4BAA6B,CAN7B,QAAS,CACT,MAAO,CAIP,QAAS,CADT,6BAA8B,CAD9B,eAAgB,CAJhB,QAAS,CAGT,UAMF,CAGF,6BAEE,UAEF,CAEA,+DALE,YAAa,CAEb,qBAwBF,CArBA,kCAKE,WAAY,CADZ,aAAc,CAEd,6BAA8B,CAJ9B,eAmBF,CAbE,qCAEE,WAAY,CADZ,eAEF,CAMA,2FAEE,gCAAiC,CADjC,uBAEF,CAGF,sCAGE,kBAAmB,CAFnB,YAAa,CACb,6BAA8B,CAE9B,eASF,CAPE,gEACE,sBACF,CAEA,iEACE,sCACF,CAGF,qCAEE,oCAA+B,CAD/B,YAWF,CARE,+DAEE,cACF,CAEA,2DACE,qCACF,CAGF,kCACE,+
|
|
1
|
+
{"version":3,"sources":["../../src/experimental/SelectPanel2/SelectPanel.module.css.js"],"names":[],"mappings":"AAAA,gCAGE,WAAY,CADZ,oCAA6B,CAD7B,SAAU,CAKV,cAAe,CACf,gBAAiB,CACjB,iBAoDF,CAlDE,8CACE,YACF,CAEA,iIAKE,yBAA0B,CAC1B,QAAS,CAHT,uBAQF,CAHE,yEACE,4BACF,CAFA,4EACE,4BACF,CAGF,4DAIE,QAAS,CAFT,MAAO,CACP,OAAQ,CAFR,KAIF,CAEA,sEACE,0DACF,CAEA,kEAQE,mBAAoB,CAHpB,WAAY,CAHZ,MAAO,CAKP,QAAS,CADT,gBAAiB,CAFjB,eAAgB,CAHhB,KAAM,CAEN,UAMF,CAEA,mEASE,2BAA4B,CAD5B,4BAA6B,CAN7B,QAAS,CACT,MAAO,CAIP,QAAS,CADT,6BAA8B,CAD9B,eAAgB,CAJhB,QAAS,CAGT,UAMF,CAGF,6BAEE,UAEF,CAEA,+DALE,YAAa,CAEb,qBAwBF,CArBA,kCAKE,WAAY,CADZ,aAAc,CAEd,6BAA8B,CAJ9B,eAmBF,CAbE,qCAEE,WAAY,CADZ,eAEF,CAMA,2FAEE,gCAAiC,CADjC,uBAEF,CAGF,sCAGE,kBAAmB,CAFnB,YAAa,CACb,6BAA8B,CAE9B,eASF,CAPE,gEACE,sBACF,CAEA,iEACE,sCACF,CAGF,qCAEE,oCAA+B,CAD/B,YAWF,CARE,+DAEE,cACF,CAEA,2DACE,qCACF,CAGF,kCACE,+CAMF,CAHE,iFACE,YACF,CAGF,iCACE,YACF,CAEA,gCACE,YACF,CAEA,8BACE,8CAAuC,CACvC,gDACF,CAEA,oCACE,aAAc,CACd,4CAEF,CAEA,wEAHE,kCAMF,CAHA,oCAEE,eACF,CAEA,+BAOE,kBAAmB,CAHnB,iDAAyC,CACzC,mDAA4C,CAJ5C,YAAa,CAOb,aAAc,CAFd,6BAA8B,CAJ9B,eAAgB,CAChB,gCAUF,CAHE,kEACE,gCACF,CAGF,sCACE,WAKF,CAHE,yEACE,WACF,CAQF,gFAJE,YAAa,CACb,oCAOF,CAJA,0CAEE,kBAEF,CAEA,kCACE,4CACF,CAEA,2CAQE,kBAAmB,CAPnB,YAAa,CAKb,qBAAsB,CAGtB,gCAA4B,CAP5B,WAAY,CAKZ,sBAAuB,CAFvB,qDAKF,CAEA,oCAEE,kCAA2B,CAD3B,8CAEF,CAEA,oCAWE,kBAAmB,CAVnB,YAAa,CAQb,qBAAsB,CAGtB,WAAY,CACZ,6BAAuB,CAXvB,WAAY,CAQZ,sBAAuB,CALvB,qDAAuD,CAEvD,uCAAiC,CADjC,wCAAkC,CAElC,iBAWF,CAJE,sCACE,aAAc,CACd,iCAA0B,CAA1B,yBACF,CAGF,gCACE,sCASF,CAPE,6DACE,mCACF,CAEA,+DACE,sCACF,CAGF,qCACE,8CAAuC,CACvC,8CACF,CAEA,uCAME,kBAAmB,CAHnB,kCAA2B,CAC3B,qBAAsB,CAFtB,8CAKF,CAEA,6EARE,YAAa,CAIb,oCA8BF,CA1BA,sCAOE,oDAA4C,CAD5C,4CAAsC,CADtC,2DAqBF,CAhBE,wCACE,aAAc,CACd,iCAA0B,CAA1B,yBACF,CAEA,kEAEE,oDAA6C,CAC7C,sDAA6C,CAF7C,mCAGF,CAEA,oEAEE,uDAAgD,CAChD,yDAAgD,CAFhD,sCAGF,CAGF,+BAIE,oDAA4C,CAC5C,sDAA+C,CAJ/C,YAAa,CAEb,qBAAsB,CADtB,gCAIF","file":"SelectPanel-608e207e.css","sourcesContent":[".Overlay {\n padding: 0;\n color: var(--fgColor-default);\n border: none;\n\n /* CSS variables values are passed in via styles */\n --max-height: 0;\n --position-top: 0;\n --position-left: 0;\n\n &:where([open]) {\n display: flex; /* to fit children */\n }\n\n &:where([data-variant='anchored']),\n &:where([data-variant='full-screen']) {\n /* stylelint-disable-next-line primer/spacing */\n top: var(--position-top);\n /* stylelint-disable-next-line primer/spacing */\n left: var(--position-left);\n margin: 0;\n\n &::backdrop {\n background-color: transparent;\n }\n }\n\n &:where([data-variant='modal']) {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n &:where([data-variant='modal'])::backdrop {\n background-color: var(--overlay-backdrop-bgColor);\n }\n\n &:where([data-variant='full-screen']) {\n top: 0;\n left: 0;\n width: 100%;\n max-width: 100vw;\n height: 100%;\n max-height: 100vh;\n margin: 0;\n border-radius: unset;\n }\n\n &:where([data-variant='bottom-sheet']) {\n top: auto;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: 100vw;\n max-height: calc(100vh - 64px);\n margin: 0;\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n }\n}\n\n.Form {\n display: flex;\n width: 100%;\n flex-direction: column;\n}\n\n.Container {\n display: flex;\n overflow: hidden;\n flex-direction: column;\n flex-shrink: 1;\n flex-grow: 1;\n justify-content: space-between;\n\n ul {\n overflow-y: auto;\n flex-grow: 1;\n }\n\n /* Allow the browser to skip rendering for off-screen items, reducing style recalc and layout costs in long lists.\n Exclude items that show the active indicator line, as content-visibility: auto applies paint containment\n which clips the absolutely-positioned ::after pseudo-element that renders outside the item bounds. */\n /* stylelint-disable-next-line selector-no-qualifying-type */\n li:not(:focus, [data-is-active-descendant], [data-active]) {\n content-visibility: auto;\n contain-intrinsic-size: auto 32px;\n }\n}\n\n.HeaderContent {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 0;\n\n &:where([data-description]) {\n align-items: flex-start;\n }\n\n &:where([data-search-input]) {\n margin-bottom: var(--base-size-8);\n }\n}\n\n.TitleWrapper {\n margin-top: 0;\n margin-left: var(--base-size-8);\n\n &:where([data-description]) {\n /* stylelint-disable-next-line primer/spacing */\n margin-top: 2px;\n }\n\n &:where([data-on-back]) {\n margin-left: var(--base-size-4);\n }\n}\n\n.TextInput {\n padding-left: var(--base-size-8) !important;\n\n /* stylelint-disable-next-line selector-class-pattern, selector-no-qualifying-type, selector-pseudo-class-disallowed-list -- :has() scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(input:placeholder-shown) :global(.TextInput-action) {\n display: none;\n }\n}\n\n.Checkbox {\n margin-top: 0;\n}\n\n.FlexBox {\n display: flex;\n}\n\n.Title {\n font-size: var(--text-body-size-medium);\n font-weight: var(--base-text-weight-semibold);\n}\n\n.Description {\n display: block;\n font-size: var(--text-body-size-small);\n color: var(--fgColor-muted);\n}\n\n.ClearAction {\n color: var(--fgColor-muted);\n background: none;\n}\n\n.Footer {\n display: flex;\n min-height: 44px;\n padding: var(--base-size-16);\n border-top: var(--borderWidth-thin) solid;\n border-top-color: var(--borderColor-default);\n justify-content: space-between;\n align-items: center;\n flex-shrink: 0;\n\n &:where([data-hide-primary-actions]) {\n padding: var(--base-size-8);\n }\n}\n\n.FooterContent {\n flex-grow: 0;\n\n &:where([data-hide-primary-actions]) {\n flex-grow: 1;\n }\n}\n\n.FooterActions {\n display: flex;\n gap: var(--stack-gap-condensed);\n}\n\n.SecondaryCheckbox {\n display: flex;\n align-items: center;\n gap: var(--stack-gap-condensed);\n}\n\n.SmallText {\n font-size: var(--text-body-size-small);\n}\n\n.SelectPanelLoading {\n display: flex;\n height: 100%;\n\n /* maxHeight of dialog - (header & footer) */\n min-height: min(calc(var(--max-height) - 150px), 324px);\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: var(--stack-gap-normal);\n}\n\n.LoadingText {\n font-size: var(--text-body-size-medium);\n color: var(--fgColor-muted);\n}\n\n.MessageFull {\n display: flex;\n height: 100%;\n\n /* maxHeight of dialog - (header & footer) */\n min-height: min(calc(var(--max-height) - 150px), 324px);\n padding-right: var(--base-size-24);\n padding-left: var(--base-size-24);\n text-align: center;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex-grow: 1;\n gap: var(--base-size-4);\n\n a {\n color: inherit;\n text-decoration: underline;\n }\n}\n\n.Octicon {\n margin-bottom: var(--base-size-8);\n\n &.Error {\n color: var(--fgColor-danger);\n }\n\n &.Warning {\n color: var(--fgColor-attention);\n }\n}\n\n.MessageTitle {\n font-size: var(--text-body-size-medium);\n font-weight: var(--base-text-weight-medium);\n}\n\n.MessageContent {\n display: flex;\n font-size: var(--text-body-size-medium);\n color: var(--fgColor-muted);\n flex-direction: column;\n gap: var(--stack-gap-condensed);\n align-items: center;\n}\n\n.MessageInline {\n display: flex;\n padding-top: var(--base-size-12);\n padding-right: var(--base-size-16);\n padding-bottom: var(--base-size-12);\n padding-left: var(--base-size-16);\n font-size: var(--text-body-size-small);\n border-bottom: var(--borderWidth-thin) solid;\n gap: var(--stack-gap-condensed);\n\n a {\n color: inherit;\n text-decoration: underline;\n }\n\n &:where([data-variant='error']) {\n color: var(--fgColor-danger);\n background-color: var(--bgColor-danger-muted);\n border-color: var(--borderColor-danger-muted);\n }\n\n &:where([data-variant='warning']) {\n color: var(--fgColor-attention);\n background-color: var(--bgColor-attention-muted);\n border-color: var(--borderColor-attention-muted);\n }\n}\n\n.Header {\n display: flex;\n padding: var(--base-size-8);\n flex-direction: column;\n border-bottom: var(--borderWidth-thin) solid;\n border-bottom-color: var(--borderColor-default);\n}\n"]}
|
|
@@ -276,15 +276,9 @@ SelectPanelHeader.__SLOT__ = Symbol("SelectPanel.Header");
|
|
|
276
276
|
const SelectPanelSearchInput = ({ onChange: propsOnChange, onKeyDown: propsOnKeyDown, className, ...props }) => {
|
|
277
277
|
const inputRef = /*#__PURE__*/ React.createRef();
|
|
278
278
|
const { setSearchQuery, moveFocusToList } = React.useContext(SelectPanelContext);
|
|
279
|
-
const [uncontrolledEmpty, setUncontrolledEmpty] = React.useState(() => {
|
|
280
|
-
var _ref, _props$value;
|
|
281
|
-
return ((_ref = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : props.defaultValue) !== null && _ref !== void 0 ? _ref : "") === "";
|
|
282
|
-
});
|
|
283
|
-
const isEmpty = props.value !== void 0 ? props.value === "" : uncontrolledEmpty;
|
|
284
279
|
const internalOnChange = (event) => {
|
|
285
280
|
if (typeof propsOnChange === "function") propsOnChange(event);
|
|
286
281
|
else setSearchQuery(event.target.value);
|
|
287
|
-
setUncontrolledEmpty(event.target.value === "");
|
|
288
282
|
};
|
|
289
283
|
const internalKeyDown = (event) => {
|
|
290
284
|
if (event.key === "ArrowDown") {
|
|
@@ -309,14 +303,12 @@ const SelectPanelSearchInput = ({ onChange: propsOnChange, onKeyDown: propsOnKey
|
|
|
309
303
|
target: inputRef.current,
|
|
310
304
|
currentTarget: inputRef.current
|
|
311
305
|
});
|
|
312
|
-
setUncontrolledEmpty(true);
|
|
313
306
|
}
|
|
314
307
|
}),
|
|
315
308
|
className: clsx(SelectPanel_module_css_default.TextInput, className),
|
|
316
309
|
onChange: internalOnChange,
|
|
317
310
|
onKeyDown: internalKeyDown,
|
|
318
|
-
...props
|
|
319
|
-
"data-empty": isEmpty || void 0
|
|
311
|
+
...props
|
|
320
312
|
});
|
|
321
313
|
};
|
|
322
314
|
SelectPanelSearchInput.displayName = "SelectPanelSearchInput";
|
package/dist/hooks/useMedia.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { canUseDOM } from "../utils/environment.js";
|
|
2
1
|
import { warning } from "../utils/warning.js";
|
|
3
2
|
import { MatchMediaContext } from "./MatchMediaContext.js";
|
|
4
3
|
import { c } from "react-compiler-runtime";
|
|
5
|
-
import
|
|
4
|
+
import { useContext, useSyncExternalStore } from "react";
|
|
6
5
|
//#region src/hooks/useMedia.ts
|
|
7
6
|
/**
|
|
8
7
|
* `useMedia` will use the given `mediaQueryString` with `matchMedia` to
|
|
@@ -18,52 +17,54 @@ import React, { useContext, useEffect } from "react";
|
|
|
18
17
|
* }
|
|
19
18
|
*/
|
|
20
19
|
function useMedia(mediaQueryString, defaultState) {
|
|
21
|
-
const $ = c(
|
|
22
|
-
const
|
|
20
|
+
const $ = c(9);
|
|
21
|
+
const contextValue = useContext(MatchMediaContext)[mediaQueryString];
|
|
23
22
|
let t0;
|
|
24
|
-
if ($[0] !==
|
|
25
|
-
t0 = () => {
|
|
26
|
-
if (
|
|
27
|
-
if (defaultState !== void 0) return defaultState;
|
|
28
|
-
if (canUseDOM) return window.matchMedia(mediaQueryString).matches;
|
|
29
|
-
warning(true, "`useMedia` When server side rendering, defaultState should be defined to prevent a hydration mismatches.");
|
|
30
|
-
return false;
|
|
31
|
-
};
|
|
32
|
-
$[0] = defaultState;
|
|
33
|
-
$[1] = features;
|
|
34
|
-
$[2] = mediaQueryString;
|
|
35
|
-
$[3] = t0;
|
|
36
|
-
} else t0 = $[3];
|
|
37
|
-
const [matches, setMatches] = React.useState(t0);
|
|
38
|
-
if (features[mediaQueryString] !== void 0 && matches !== features[mediaQueryString]) setMatches(features[mediaQueryString]);
|
|
39
|
-
let t1;
|
|
40
|
-
let t2;
|
|
41
|
-
if ($[4] !== features || $[5] !== mediaQueryString) {
|
|
42
|
-
t1 = () => {
|
|
43
|
-
if (features[mediaQueryString] !== void 0) return;
|
|
44
|
-
const listener = function listener(event) {
|
|
45
|
-
setMatches(event.matches);
|
|
46
|
-
};
|
|
23
|
+
if ($[0] !== contextValue || $[1] !== mediaQueryString) {
|
|
24
|
+
t0 = (onStoreChange) => {
|
|
25
|
+
if (contextValue !== void 0) return _temp;
|
|
47
26
|
const mediaQueryList = window.matchMedia(mediaQueryString);
|
|
48
|
-
if (mediaQueryList.addEventListener)
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
if (mediaQueryList.addEventListener) {
|
|
28
|
+
mediaQueryList.addEventListener("change", onStoreChange);
|
|
29
|
+
return () => {
|
|
30
|
+
mediaQueryList.removeEventListener("change", onStoreChange);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
mediaQueryList.addListener(onStoreChange);
|
|
51
34
|
return () => {
|
|
52
|
-
|
|
53
|
-
else mediaQueryList.removeListener(listener);
|
|
35
|
+
mediaQueryList.removeListener(onStoreChange);
|
|
54
36
|
};
|
|
55
37
|
};
|
|
56
|
-
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
38
|
+
$[0] = contextValue;
|
|
39
|
+
$[1] = mediaQueryString;
|
|
40
|
+
$[2] = t0;
|
|
41
|
+
} else t0 = $[2];
|
|
42
|
+
const subscribe = t0;
|
|
43
|
+
let t1;
|
|
44
|
+
if ($[3] !== contextValue || $[4] !== mediaQueryString) {
|
|
45
|
+
t1 = () => {
|
|
46
|
+
if (contextValue !== void 0) return contextValue;
|
|
47
|
+
return window.matchMedia(mediaQueryString).matches;
|
|
48
|
+
};
|
|
49
|
+
$[3] = contextValue;
|
|
50
|
+
$[4] = mediaQueryString;
|
|
51
|
+
$[5] = t1;
|
|
52
|
+
} else t1 = $[5];
|
|
53
|
+
const getSnapshot = t1;
|
|
54
|
+
let t2;
|
|
55
|
+
if ($[6] !== contextValue || $[7] !== defaultState) {
|
|
56
|
+
t2 = () => {
|
|
57
|
+
if (contextValue !== void 0) return contextValue;
|
|
58
|
+
if (defaultState !== void 0) return defaultState;
|
|
59
|
+
warning(typeof window === "undefined", "`useMedia` When server side rendering, defaultState should be defined to prevent a hydration mismatches.");
|
|
60
|
+
return false;
|
|
61
|
+
};
|
|
62
|
+
$[6] = contextValue;
|
|
63
|
+
$[7] = defaultState;
|
|
64
|
+
$[8] = t2;
|
|
65
|
+
} else t2 = $[8];
|
|
66
|
+
return useSyncExternalStore(subscribe, getSnapshot, t2);
|
|
67
67
|
}
|
|
68
|
+
function _temp() {}
|
|
68
69
|
//#endregion
|
|
69
70
|
export { useMedia };
|
|
@@ -1,39 +1,25 @@
|
|
|
1
1
|
import ValidationAnimationContainer_module_css_default from "./ValidationAnimationContainer.module.css.js";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { useState } from "react";
|
|
5
5
|
//#region src/internal/components/ValidationAnimationContainer.tsx
|
|
6
6
|
const ValidationAnimationContainer = (t0) => {
|
|
7
|
-
const $ = c(
|
|
7
|
+
const $ = c(7);
|
|
8
8
|
const { show, children } = t0;
|
|
9
9
|
const [shouldRender, setRender] = useState(show);
|
|
10
|
+
if (show && !shouldRender) setRender(true);
|
|
10
11
|
let t1;
|
|
11
|
-
let t2;
|
|
12
12
|
if ($[0] !== show) {
|
|
13
13
|
t1 = () => {
|
|
14
|
-
if (show) setRender(
|
|
14
|
+
if (!show) setRender(false);
|
|
15
15
|
};
|
|
16
|
-
t2 = [show];
|
|
17
16
|
$[0] = show;
|
|
18
17
|
$[1] = t1;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
useEffect(t1, t2);
|
|
25
|
-
let t3;
|
|
26
|
-
if ($[3] !== show) {
|
|
27
|
-
t3 = () => {
|
|
28
|
-
if (!show) setRender(false);
|
|
29
|
-
};
|
|
30
|
-
$[3] = show;
|
|
31
|
-
$[4] = t3;
|
|
32
|
-
} else t3 = $[4];
|
|
33
|
-
const onAnimationEnd = t3;
|
|
34
|
-
let t4;
|
|
35
|
-
if ($[5] !== children || $[6] !== onAnimationEnd || $[7] !== shouldRender || $[8] !== show) {
|
|
36
|
-
t4 = shouldRender ? /*#__PURE__*/ jsx("div", {
|
|
18
|
+
} else t1 = $[1];
|
|
19
|
+
const onAnimationEnd = t1;
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[2] !== children || $[3] !== onAnimationEnd || $[4] !== shouldRender || $[5] !== show) {
|
|
22
|
+
t2 = shouldRender ? /*#__PURE__*/ jsx("div", {
|
|
37
23
|
style: {
|
|
38
24
|
height: show ? "auto" : 0,
|
|
39
25
|
overflow: "hidden"
|
|
@@ -45,13 +31,13 @@ const ValidationAnimationContainer = (t0) => {
|
|
|
45
31
|
children
|
|
46
32
|
})
|
|
47
33
|
}) : null;
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
} else
|
|
54
|
-
return
|
|
34
|
+
$[2] = children;
|
|
35
|
+
$[3] = onAnimationEnd;
|
|
36
|
+
$[4] = shouldRender;
|
|
37
|
+
$[5] = show;
|
|
38
|
+
$[6] = t2;
|
|
39
|
+
} else t2 = $[6];
|
|
40
|
+
return t2;
|
|
55
41
|
};
|
|
56
42
|
//#endregion
|
|
57
43
|
export { ValidationAnimationContainer as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-20260707163701",
|
|
5
5
|
"description": "An implementation of GitHub's Primer Design System using React",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"lodash.isempty": "^4.4.0",
|
|
94
94
|
"lodash.isobject": "^3.0.2",
|
|
95
95
|
"react-compiler-runtime": "^1.0.0",
|
|
96
|
-
"react-intersection-observer": "^
|
|
96
|
+
"react-intersection-observer": "^10.0.3"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@actions/core": "1.11.1",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"@storybook/addon-docs": "^10.4.6",
|
|
114
114
|
"@storybook/addon-links": "^10.4.6",
|
|
115
115
|
"@storybook/addon-mcp": "^0.6.0",
|
|
116
|
-
"@storybook/icons": "^2.0
|
|
116
|
+
"@storybook/icons": "^2.1.0",
|
|
117
117
|
"@storybook/react-vite": "^10.4.6",
|
|
118
118
|
"@testing-library/dom": "^10.4.0",
|
|
119
119
|
"@testing-library/jest-dom": "^6.4.5",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.prc-SelectPanel2-Overlay--Q-FI{border:none;color:var(--fgColor-default,#1f2328);padding:0;--max-height:0;--position-top:0;--position-left:0}.prc-SelectPanel2-Overlay--Q-FI:where([open]){display:flex}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=anchored]),.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=full-screen]){left:var(--position-left);margin:0;top:var(--position-top)}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=anchored])::backdrop{background-color:transparent}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=full-screen])::backdrop{background-color:transparent}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=modal]){bottom:0;left:0;right:0;top:0}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=modal])::backdrop{background-color:var(--overlay-backdrop-bgColor,#c8d1da66)}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=full-screen]){border-radius:unset;height:100%;left:0;margin:0;max-height:100vh;max-width:100vw;top:0;width:100%}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=bottom-sheet]){border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:0;left:0;margin:0;max-height:calc(100vh - 64px);max-width:100vw;top:auto;width:100%}.prc-SelectPanel2-Form-bZ9HS{width:100%}.prc-SelectPanel2-Container-e5e6-,.prc-SelectPanel2-Form-bZ9HS{display:flex;flex-direction:column}.prc-SelectPanel2-Container-e5e6-{flex-grow:1;flex-shrink:1;justify-content:space-between;overflow:hidden}.prc-SelectPanel2-Container-e5e6- ul{flex-grow:1;overflow-y:auto}.prc-SelectPanel2-Container-e5e6- li:not(:focus,[data-is-active-descendant],[data-active]){contain-intrinsic-size:auto 32px;content-visibility:auto}.prc-SelectPanel2-HeaderContent-MsaAS{align-items:center;display:flex;justify-content:space-between;margin-bottom:0}.prc-SelectPanel2-HeaderContent-MsaAS:where([data-description]){align-items:flex-start}.prc-SelectPanel2-HeaderContent-MsaAS:where([data-search-input]){margin-bottom:var(--base-size-8,.5rem)}.prc-SelectPanel2-TitleWrapper-HzPu3{margin-left:var(--base-size-8,.5rem);margin-top:0}.prc-SelectPanel2-TitleWrapper-HzPu3:where([data-description]){margin-top:2px}.prc-SelectPanel2-TitleWrapper-HzPu3:where([data-on-back]){margin-left:var(--base-size-4,.25rem)}.prc-SelectPanel2-TextInput-lHH1n{padding-left:var(--base-size-8,.5rem)!important}.prc-SelectPanel2-TextInput-lHH1n input[data-empty]~.TextInput-action{display:none}.prc-SelectPanel2-Checkbox-AYR38{margin-top:0}.prc-SelectPanel2-FlexBox-gWPRg{display:flex}.prc-SelectPanel2-Title-T-h3f{font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-semibold,600)}.prc-SelectPanel2-Description-qTXfi{display:block;font-size:var(--text-body-size-small,.75rem)}.prc-SelectPanel2-ClearAction-tQj-f,.prc-SelectPanel2-Description-qTXfi{color:var(--fgColor-muted,#59636e)}.prc-SelectPanel2-ClearAction-tQj-f{background:none}.prc-SelectPanel2-Footer-TibV0{align-items:center;border-top:var(--borderWidth-thin,.0625rem) solid;border-top-color:var(--borderColor-default,#d1d9e0);display:flex;flex-shrink:0;justify-content:space-between;min-height:44px;padding:var(--base-size-16,1rem)}.prc-SelectPanel2-Footer-TibV0:where([data-hide-primary-actions]){padding:var(--base-size-8,.5rem)}.prc-SelectPanel2-FooterContent-UjAOM{flex-grow:0}.prc-SelectPanel2-FooterContent-UjAOM:where([data-hide-primary-actions]){flex-grow:1}.prc-SelectPanel2-FooterActions-T6yQR,.prc-SelectPanel2-SecondaryCheckbox-omkf-{display:flex;gap:var(--stack-gap-condensed,.5rem)}.prc-SelectPanel2-SecondaryCheckbox-omkf-{align-items:center}.prc-SelectPanel2-SmallText-c42ay{font-size:var(--text-body-size-small,.75rem)}.prc-SelectPanel2-SelectPanelLoading-mtyhD{align-items:center;display:flex;flex-direction:column;gap:var(--stack-gap-normal,1rem);height:100%;justify-content:center;min-height:min(calc(var(--max-height) - 150px),324px)}.prc-SelectPanel2-LoadingText-DB0wN{color:var(--fgColor-muted,#59636e);font-size:var(--text-body-size-medium,.875rem)}.prc-SelectPanel2-MessageFull-nY-qF{align-items:center;display:flex;flex-direction:column;flex-grow:1;gap:var(--base-size-4,.25rem);height:100%;justify-content:center;min-height:min(calc(var(--max-height) - 150px),324px);padding-left:var(--base-size-24,1.5rem);padding-right:var(--base-size-24,1.5rem);text-align:center}.prc-SelectPanel2-MessageFull-nY-qF a{color:inherit;-webkit-text-decoration:underline;text-decoration:underline}.prc-SelectPanel2-Octicon-zt-zU{margin-bottom:var(--base-size-8,.5rem)}.prc-SelectPanel2-Octicon-zt-zU.prc-SelectPanel2-Error-ZrZQQ{color:var(--fgColor-danger,#d1242f)}.prc-SelectPanel2-Octicon-zt-zU.prc-SelectPanel2-Warning-PDsVF{color:var(--fgColor-attention,#9a6700)}.prc-SelectPanel2-MessageTitle-T7v9d{font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-medium,500)}.prc-SelectPanel2-MessageContent-UZ9vY{align-items:center;color:var(--fgColor-muted,#59636e);flex-direction:column;font-size:var(--text-body-size-medium,.875rem)}.prc-SelectPanel2-MessageContent-UZ9vY,.prc-SelectPanel2-MessageInline-sErQf{display:flex;gap:var(--stack-gap-condensed,.5rem)}.prc-SelectPanel2-MessageInline-sErQf{border-bottom:var(--borderWidth-thin,.0625rem) solid;font-size:var(--text-body-size-small,.75rem);padding:var(--base-size-12,.75rem) var(--base-size-16,1rem)}.prc-SelectPanel2-MessageInline-sErQf a{color:inherit;-webkit-text-decoration:underline;text-decoration:underline}.prc-SelectPanel2-MessageInline-sErQf:where([data-variant=error]){background-color:var(--bgColor-danger-muted,#ffebe9);border-color:var(--borderColor-danger-muted,#ff818266);color:var(--fgColor-danger,#d1242f)}.prc-SelectPanel2-MessageInline-sErQf:where([data-variant=warning]){background-color:var(--bgColor-attention-muted,#fff8c5);border-color:var(--borderColor-attention-muted,#d4a72c66);color:var(--fgColor-attention,#9a6700)}.prc-SelectPanel2-Header-LKyEJ{border-bottom:var(--borderWidth-thin,.0625rem) solid;border-bottom-color:var(--borderColor-default,#d1d9e0);display:flex;flex-direction:column;padding:var(--base-size-8,.5rem)}
|
|
2
|
-
/*# sourceMappingURL=SelectPanel-b5469dea.css.map */
|