@primer/react 38.25.1-rc.c82500a2c → 38.26.0-rc.28aabd458
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 +30 -1
- package/dist/ActionList/index.d.ts +6 -6
- package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.js +0 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +1 -1
- package/dist/Button/{ButtonBase-713ecf3d.css → ButtonBase-311501b9.css} +2 -2
- package/dist/Button/{ButtonBase-713ecf3d.css.map → ButtonBase-311501b9.css.map} +1 -1
- package/dist/Button/ButtonBase.d.ts.map +1 -1
- package/dist/Button/ButtonBase.js +1 -0
- package/dist/Button/ButtonBase.module.css.js +1 -1
- package/dist/CheckboxGroup/CheckboxGroup.js +0 -1
- package/dist/DataTable/index.d.ts.map +1 -1
- package/dist/DataTable/index.js +0 -1
- package/dist/Dialog/Dialog.d.ts +0 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +0 -1
- package/dist/FormControl/FormControl.d.ts +3 -3
- package/dist/NavList/NavList.d.ts +4 -4
- package/dist/NavList/NavList.d.ts.map +1 -1
- package/dist/NavList/NavList.js +7 -6
- package/dist/PageLayout/PageLayout.d.ts +0 -1
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +0 -1
- package/dist/RadioGroup/RadioGroup.d.ts +3 -4
- package/dist/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup/RadioGroup.js +0 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts +2 -3
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +0 -1
- package/dist/Timeline/Timeline-0c88f21b.css +2 -0
- package/dist/Timeline/Timeline-0c88f21b.css.map +1 -0
- package/dist/Timeline/Timeline.d.ts +16 -0
- package/dist/Timeline/Timeline.d.ts.map +1 -1
- package/dist/Timeline/Timeline.js +85 -1
- package/dist/Timeline/Timeline.module.css.js +2 -2
- package/dist/Timeline/index.d.ts +1 -1
- package/dist/Timeline/index.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.d.ts.map +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +101 -58
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useSlots.d.ts.map +1 -1
- package/dist/hooks/useSlots.js +24 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.d.ts +3 -3
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.d.ts.map +1 -1
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +3 -4
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupCaption.js +1 -1
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupLabel.js +1 -1
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupValidation.js +1 -1
- package/dist/internal/components/TextInputWrapper-b2f7f9fa.css +2 -0
- package/dist/internal/components/TextInputWrapper-b2f7f9fa.css.map +1 -0
- package/dist/internal/components/TextInputWrapper.d.ts.map +1 -1
- package/dist/internal/components/TextInputWrapper.js +33 -24
- package/dist/internal/components/TextInputWrapper.module.css.js +1 -1
- package/dist/utils/as-slot.d.ts +20 -0
- package/dist/utils/as-slot.d.ts.map +1 -0
- package/dist/utils/as-slot.js +30 -0
- package/generated/components.json +16 -0
- package/package.json +2 -2
- package/dist/Timeline/Timeline-05decc91.css +0 -2
- package/dist/Timeline/Timeline-05decc91.css.map +0 -1
- package/dist/internal/components/TextInputWrapper-889df5d3.css +0 -2
- package/dist/internal/components/TextInputWrapper-889df5d3.css.map +0 -1
|
@@ -17,14 +17,13 @@ export declare const RadioGroupContext: React.Context<{
|
|
|
17
17
|
name: string;
|
|
18
18
|
} | null>;
|
|
19
19
|
declare const _default: FC<React.PropsWithChildren<RadioGroupProps>> & {
|
|
20
|
-
|
|
21
|
-
Caption: import("../utils/types").FCWithSlotMarker<{
|
|
20
|
+
Caption: import("..").FCWithSlotMarker<{
|
|
22
21
|
className?: string;
|
|
23
22
|
} & {
|
|
24
23
|
children?: React.ReactNode | undefined;
|
|
25
24
|
}>;
|
|
26
|
-
Label: import("
|
|
27
|
-
Validation: import("
|
|
25
|
+
Label: import("..").FCWithSlotMarker<React.PropsWithChildren<import("../internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupLabel").CheckboxOrRadioGroupLabelProps>>;
|
|
26
|
+
Validation: import("..").FCWithSlotMarker<React.PropsWithChildren<import("../internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupValidation").CheckboxOrRadioGroupValidationProps>>;
|
|
28
27
|
};
|
|
29
28
|
export default _default;
|
|
30
29
|
//# sourceMappingURL=RadioGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../src/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAE,kBAAkB,EAAE,EAAE,EAAC,MAAM,OAAO,CAAA;AAC9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,6CAA6C,CAAA;AAO1F,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;IAC/E;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,yBAAyB,CAAA;AAE7B,eAAO,MAAM,iBAAiB;eACjB,OAAO;eACP,kBAAkB,CAAC,gBAAgB,CAAC;UACzC,MAAM;SACC,CAAA
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../src/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAE,kBAAkB,EAAE,EAAE,EAAC,MAAM,OAAO,CAAA;AAC9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,6CAA6C,CAAA;AAO1F,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;IAC/E;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,yBAAyB,CAAA;AAE7B,eAAO,MAAM,iBAAiB;eACjB,OAAO;eACP,kBAAkB,CAAC,gBAAgB,CAAC;UACzC,MAAM;SACC,CAAA;;;;;;;;;;AAkCf,wBAIE"}
|
|
@@ -113,7 +113,6 @@ const RadioGroup = t0 => {
|
|
|
113
113
|
return t5;
|
|
114
114
|
};
|
|
115
115
|
var RadioGroup_default = Object.assign(RadioGroup, {
|
|
116
|
-
__SLOT__: Symbol('RadioGroup'),
|
|
117
116
|
Caption: CheckboxOrRadioGroupCaption,
|
|
118
117
|
Label: CheckboxOrRadioGroupLabel,
|
|
119
118
|
Validation: CheckboxOrRadioGroupValidation
|
|
@@ -18,8 +18,7 @@ export type SegmentedControlProps = {
|
|
|
18
18
|
className?: string;
|
|
19
19
|
};
|
|
20
20
|
export declare const SegmentedControl: React.FC<React.PropsWithChildren<SegmentedControlProps>> & {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
IconButton: import("../utils/types").FCWithSlotMarker<React.PropsWithChildren<SegmentedControlIconButtonProps>>;
|
|
21
|
+
Button: import("..").FCWithSlotMarker<React.PropsWithChildren<SegmentedControlButtonProps>>;
|
|
22
|
+
IconButton: import("..").FCWithSlotMarker<React.PropsWithChildren<SegmentedControlIconButtonProps>>;
|
|
24
23
|
};
|
|
25
24
|
//# sourceMappingURL=SegmentedControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../src/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAA;AAC7C,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,0BAA0B,CAAA;AAEzE,OAAO,KAAK,EAAC,+BAA+B,EAAC,MAAM,8BAA8B,CAAA;AAIjF,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAEhE,OAAO,KAAK,EAAC,0BAA0B,EAAC,MAAM,kCAAkC,CAAA;AAMhF,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;IAC9C,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,8BAA8B;IAC9B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IACzB,6FAA6F;IAC7F,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,0BAA0B,EAAE,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC,CAAC,CAAA;IACxG,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAsMD,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../src/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAA;AAC7C,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,0BAA0B,CAAA;AAEzE,OAAO,KAAK,EAAC,+BAA+B,EAAC,MAAM,8BAA8B,CAAA;AAIjF,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAEhE,OAAO,KAAK,EAAC,0BAA0B,EAAC,MAAM,kCAAkC,CAAA;AAMhF,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;IAC9C,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,8BAA8B;IAC9B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IACzB,6FAA6F;IAC7F,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,0BAA0B,EAAE,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC,CAAC,CAAA;IACxG,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAsMD,eAAO,MAAM,gBAAgB;;;CAG3B,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-Timeline-Timeline-awSoC{display:flex;flex-direction:column}:is(.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=start]),.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both])) .prc-Timeline-TimelineItem-QwDVH:first-child{padding-top:0}:is(:is(.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=start]),.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both])) .prc-Timeline-TimelineItem-QwDVH:first-child) .prc-Timeline-TimelineItemAvatar-4zO8f{top:var(--base-size-16,1rem)}:is(:is(.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=start]),.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both])) .prc-Timeline-TimelineItem-QwDVH:first-child):where([data-condensed]):before{top:var(--base-size-12,.75rem)}:is(:is(.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=start]),.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both])) .prc-Timeline-TimelineItem-QwDVH:first-child):where([data-condensed]) .prc-Timeline-TimelineItemAvatar-4zO8f{top:calc(var(--base-size-8,.5rem) + var(--base-size-8,.5rem))}:is(.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=end]),.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both])) .prc-Timeline-TimelineItem-QwDVH:last-child{padding-bottom:0}:is(:is(.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=end]),.prc-Timeline-Timeline-awSoC:where([data-clip-sidebar=both])) .prc-Timeline-TimelineItem-QwDVH:last-child):where([data-condensed]):before{height:var(--base-size-12,.75rem)}.prc-Timeline-TimelineItem-QwDVH{display:flex;margin-left:var(--base-size-16,1rem);padding:var(--base-size-16,1rem) 0;position:relative}.prc-Timeline-TimelineItem-QwDVH:before{background-color:var(--borderColor-muted,#d1d9e0b3);bottom:0;content:"";display:block;left:0;position:absolute;top:0;width:2px}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]){padding-bottom:0;padding-top:var(--base-size-4,.25rem)}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]):last-child{padding-bottom:var(--base-size-16,1rem)}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]) .prc-Timeline-TimelineBadge-u0qSm{background-color:var(--bgColor-default,#fff);border:0;color:var(--fgColor-muted,#59636e);height:16px;margin-bottom:var(--base-size-8,.5rem);margin-top:var(--base-size-8,.5rem)}.prc-Timeline-TimelineItem-QwDVH:where([data-condensed]) .prc-Timeline-TimelineItemAvatar-4zO8f{top:calc(var(--base-size-4,.25rem) + var(--base-size-8,.5rem) + var(--base-size-8,.5rem))}.prc-Timeline-TimelineItemAvatar-4zO8f{left:calc((var(--base-size-40,2.5rem) + var(--base-size-32,2rem))*-1);position:absolute;top:calc(var(--base-size-16,1rem) + var(--base-size-16,1rem));transform:translateY(-50%);z-index:1}.prc-Timeline-TimelineBadgeWrapper-SZw4k{position:relative;z-index:1}.prc-Timeline-TimelineBadge-u0qSm{align-items:center;background-color:var(--timelineBadge-bgColor,#f6f8fa);border-color:var(--bgColor-default,#fff);border-radius:50%;border-style:solid;border-width:var(--borderWidth-thick,.125rem);color:var(--fgColor-muted,#59636e);display:flex;flex-shrink:0;height:32px;justify-content:center;margin-left:-15px;margin-right:var(--base-size-8,.5rem);overflow:hidden;width:32px}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant]){color:var(--fgColor-onEmphasis,#fff)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=accent]){background-color:var(--bgColor-accent-emphasis,#0969da)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=success]){background-color:var(--bgColor-success-emphasis,#1f883d)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=attention]){background-color:var(--bgColor-attention-emphasis,#9a6700)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=severe]){background-color:var(--bgColor-severe-emphasis,#bc4c00)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=danger]){background-color:var(--bgColor-danger-emphasis,#cf222e)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=done]){background-color:var(--bgColor-done-emphasis,#8250df)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=open]){background-color:var(--bgColor-open-emphasis,#1f883d)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=closed]){background-color:var(--bgColor-closed-emphasis,#cf222e)}.prc-Timeline-TimelineBadge-u0qSm:where([data-variant=sponsors]){background-color:var(--bgColor-sponsors-emphasis,#bf3989)}.prc-Timeline-TimelineBody-tjOtb{color:var(--fgColor-muted,#59636e);flex:auto;font-size:var(--text-body-size-medium,.875rem);margin-top:calc(var(--base-size-4,.25rem) + 1px);max-width:100%;min-width:0}.prc-Timeline-TimelineBreak-X8eti{background-color:var(--bgColor-default,#fff);border:0;border-top:var(--borderWidth-thicker,.25rem) solid var(--borderColor-default,#d1d9e0);height:var(--base-size-24,1.5rem);margin:0;margin-bottom:calc(var(--base-size-16,1rem)*-1);margin-left:0;position:relative;z-index:1}.prc-Timeline-TimelineBreak-X8eti:has(+[data-condensed]){margin-bottom:calc(var(--base-size-12,.75rem)*-1)}.prc-Timeline-TimelineItemActions-56Y7h{align-items:center;align-self:flex-start;display:flex;flex-shrink:0;gap:var(--base-size-8,.5rem);margin-left:auto;min-height:var(--base-size-32,2rem)}
|
|
2
|
+
/*# sourceMappingURL=Timeline-0c88f21b.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Timeline/Timeline.module.css.js"],"names":[],"mappings":"AAAA,6BACE,YAAa,CACb,qBAiCF,CA7BI,6KACE,aAeF,CAbE,yNAEE,4BACF,CAEA,iNACE,8BACF,CAEA,iPAEE,6DACF,CAMF,0KACE,gBAKF,CAHE,8MACE,iCACF,CAKN,iCAEE,YAAa,CAEb,oCAAgC,CADhC,kCAA8B,CAF9B,iBAuCF,CAlCE,wCASE,mDAA0C,CAN1C,QAAS,CAIT,UAAW,CAFX,aAAc,CADd,MAAO,CAHP,iBAAkB,CAClB,KAAM,CAIN,SAIF,CAEA,yDAEE,gBAAiB,CADjB,qCAoBF,CAjBE,oEACE,uCACF,CAEA,2FAKE,4CAAwC,CACxC,QAAS,CAFT,kCAA2B,CAH3B,WAAY,CAEZ,sCAAiC,CADjC,mCAKF,CAEA,gGAEE,yFACF,CAIJ,uCAGE,qEAA4D,CAF5D,iBAAkB,CAIlB,6DAAoD,CAEpD,0BAA2B,CAD3B,SAEF,CAEA,yCACE,iBAAkB,CAClB,SACF,CAEA,kCAkBE,kBAAmB,CANnB,qDAA8C,CAE9C,wCAAoC,CAGpC,iBAAkB,CAFlB,kBAAmB,CACnB,6CAAsC,CAPtC,kCAA2B,CAR3B,YAAa,CAMb,aAAc,CAJd,WAAY,CAgBZ,sBAAuB,CAbvB,iBAAkB,CAFlB,qCAAgC,CAIhC,eAAgB,CANhB,UA0DF,CAvCE,wDACE,oCACF,CAEA,+DACE,uDACF,CAEA,gEACE,wDACF,CAEA,kEACE,0DACF,CAEA,+DACE,uDACF,CAEA,+DACE,uDACF,CAEA,6DACE,qDACF,CAEA,6DACE,qDACF,CAEA,+DACE,uDACF,CAEA,iEACE,yDACF,CAGF,iCAME,kCAA2B,CAC3B,SAAU,CAFV,8CAAuC,CADvC,gDAA0C,CAF1C,cAAe,CADf,WAOF,CAEA,kCAOE,4CAAwC,CACxC,QAAS,CACT,qFAAuE,CANvE,iCAA2B,CAC3B,QAAS,CACT,+CAA6C,CAC7C,aAAc,CALd,iBAAkB,CAClB,SAaF,CAHE,yDACE,iDACF,CAGF,wCAEE,kBAAmB,CACnB,qBAAsB,CAFtB,YAAa,CAOb,aAAc,CADd,4BAAuB,CADvB,gBAAiB,CADjB,mCAIF","file":"Timeline-0c88f21b.css","sourcesContent":[".Timeline {\n display: flex;\n flex-direction: column;\n\n &:where([data-clip-sidebar='start']),\n &:where([data-clip-sidebar='both']) {\n .TimelineItem:first-child {\n padding-top: 0;\n\n .TimelineItemAvatar {\n /* No padding-top on first item: badge center is at 0 + 16px (half-badge) */\n top: var(--base-size-16);\n }\n\n &:where([data-condensed])::before {\n top: var(--base-size-12);\n }\n\n &:where([data-condensed]) .TimelineItemAvatar {\n /* No padding-top + condensed: badge center is at 0 + 8px margin + 8px half-badge */\n top: calc(var(--base-size-8) + var(--base-size-8));\n }\n }\n }\n\n &:where([data-clip-sidebar='end']),\n &:where([data-clip-sidebar='both']) {\n .TimelineItem:last-child {\n padding-bottom: 0;\n\n &:where([data-condensed])::before {\n height: var(--base-size-12);\n }\n }\n }\n}\n\n.TimelineItem {\n position: relative;\n display: flex;\n padding: var(--base-size-16) 0;\n margin-left: var(--base-size-16);\n\n &::before {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n display: block;\n width: 2px;\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-muted);\n }\n\n &:where([data-condensed]) {\n padding-top: var(--base-size-4);\n padding-bottom: 0;\n\n &:last-child {\n padding-bottom: var(--base-size-16);\n }\n\n .TimelineBadge {\n height: 16px;\n margin-top: var(--base-size-8);\n margin-bottom: var(--base-size-8);\n color: var(--fgColor-muted);\n background-color: var(--bgColor-default);\n border: 0;\n }\n\n .TimelineItemAvatar {\n /* Vertically center against the condensed badge (4px padding-top + 8px badge top margin + 8px half-badge) */\n top: calc(var(--base-size-4) + var(--base-size-8) + var(--base-size-8));\n }\n }\n}\n\n.TimelineItemAvatar {\n position: absolute;\n /* Place avatar in the left gutter, aligned with surrounding actor avatars (~72px from item content) */\n left: calc(-1 * (var(--base-size-40) + var(--base-size-32)));\n /* Vertically center against the default badge (16px padding-top + 16px half-badge) */\n top: calc(var(--base-size-16) + var(--base-size-16));\n z-index: 1;\n transform: translateY(-50%);\n}\n\n.TimelineBadgeWrapper {\n position: relative;\n z-index: 1;\n}\n\n.TimelineBadge {\n display: flex;\n width: 32px;\n height: 32px;\n margin-right: var(--base-size-8);\n /* stylelint-disable-next-line primer/spacing */\n margin-left: -15px;\n flex-shrink: 0;\n overflow: hidden;\n color: var(--fgColor-muted);\n\n /* TODOl not quite sure if this is the correct migration for this line */\n background-color: var(--timelineBadge-bgColor);\n /* stylelint-disable-next-line primer/colors */\n border-color: var(--bgColor-default);\n border-style: solid;\n border-width: var(--borderWidth-thick);\n border-radius: 50%;\n align-items: center;\n justify-content: center;\n\n &:where([data-variant]) {\n color: var(--fgColor-onEmphasis);\n }\n\n &:where([data-variant='accent']) {\n background-color: var(--bgColor-accent-emphasis);\n }\n\n &:where([data-variant='success']) {\n background-color: var(--bgColor-success-emphasis);\n }\n\n &:where([data-variant='attention']) {\n background-color: var(--bgColor-attention-emphasis);\n }\n\n &:where([data-variant='severe']) {\n background-color: var(--bgColor-severe-emphasis);\n }\n\n &:where([data-variant='danger']) {\n background-color: var(--bgColor-danger-emphasis);\n }\n\n &:where([data-variant='done']) {\n background-color: var(--bgColor-done-emphasis);\n }\n\n &:where([data-variant='open']) {\n background-color: var(--bgColor-open-emphasis);\n }\n\n &:where([data-variant='closed']) {\n background-color: var(--bgColor-closed-emphasis);\n }\n\n &:where([data-variant='sponsors']) {\n background-color: var(--bgColor-sponsors-emphasis);\n }\n}\n\n.TimelineBody {\n min-width: 0;\n max-width: 100%;\n /* stylelint-disable-next-line primer/spacing */\n margin-top: calc(var(--base-size-4) + 1px);\n font-size: var(--text-body-size-medium);\n color: var(--fgColor-muted);\n flex: auto;\n}\n\n.TimelineBreak {\n position: relative;\n z-index: 1;\n height: var(--base-size-24);\n margin: 0;\n margin-bottom: calc(-1 * var(--base-size-16));\n margin-left: 0;\n background-color: var(--bgColor-default);\n border: 0;\n border-top: var(--borderWidth-thicker) solid var(--borderColor-default);\n\n /* stylelint-disable-next-line selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(+ [data-condensed]) {\n margin-bottom: calc(-1 * var(--base-size-12));\n }\n}\n\n.TimelineItemActions {\n display: flex;\n align-items: center;\n align-self: flex-start;\n /* Match the badge wrapper height (32px in both default and condensed) so contents vertically center against the badge */\n min-height: var(--base-size-32);\n margin-left: auto;\n gap: var(--base-size-8);\n flex-shrink: 0;\n}\n"]}
|
|
@@ -28,8 +28,20 @@ export type TimelineBreakProps = {
|
|
|
28
28
|
/** Class name for custom styling */
|
|
29
29
|
className?: string;
|
|
30
30
|
} & React.ComponentPropsWithoutRef<'div'>;
|
|
31
|
+
export type TimelineActionsProps = {
|
|
32
|
+
/** Class name for custom styling */
|
|
33
|
+
className?: string;
|
|
34
|
+
} & React.ComponentPropsWithoutRef<'div'>;
|
|
35
|
+
export type TimelineAvatarProps = {
|
|
36
|
+
/** Class name for custom styling */
|
|
37
|
+
className?: string;
|
|
38
|
+
} & React.ComponentPropsWithoutRef<'div'>;
|
|
31
39
|
declare const _default: React.ForwardRefExoticComponent<StyledTimelineProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>> & {
|
|
32
40
|
Item: React.ForwardRefExoticComponent<StyledTimelineItemProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
41
|
+
Avatar: React.ForwardRefExoticComponent<{
|
|
42
|
+
/** Class name for custom styling */
|
|
43
|
+
className?: string;
|
|
44
|
+
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
33
45
|
Badge: {
|
|
34
46
|
({ className, variant, ...props }: TimelineBadgeProps): React.JSX.Element;
|
|
35
47
|
displayName: string;
|
|
@@ -42,6 +54,10 @@ declare const _default: React.ForwardRefExoticComponent<StyledTimelineProps & Om
|
|
|
42
54
|
/** Class name for custom styling */
|
|
43
55
|
className?: string;
|
|
44
56
|
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
57
|
+
Actions: React.ForwardRefExoticComponent<{
|
|
58
|
+
/** Class name for custom styling */
|
|
59
|
+
className?: string;
|
|
60
|
+
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
45
61
|
};
|
|
46
62
|
export default _default;
|
|
47
63
|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AAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAA;AAQzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAA;AAQzC,MAAM,MAAM,oBAAoB,GAAG;IACjC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAA;AAQzC,MAAM,MAAM,mBAAmB,GAAG;IAChC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAA;;;;QAFvC,oCAAoC;oBACxB,MAAM;;;2CA7CmC,kBAAkB;;;;QAWvE,oCAAoC;oBACxB,MAAM;;;QAUlB,oCAAoC;oBACxB,MAAM;;;QAUlB,oCAAoC;oBACxB,MAAM;;;AAoBpB,wBAOE"}
|
|
@@ -248,11 +248,95 @@ const TimelineBreak = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
|
248
248
|
return t2;
|
|
249
249
|
});
|
|
250
250
|
TimelineBreak.displayName = 'TimelineBreak';
|
|
251
|
+
const TimelineActions = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
252
|
+
const $ = c(9);
|
|
253
|
+
let className;
|
|
254
|
+
let props;
|
|
255
|
+
if ($[0] !== t0) {
|
|
256
|
+
({
|
|
257
|
+
className,
|
|
258
|
+
...props
|
|
259
|
+
} = t0);
|
|
260
|
+
$[0] = t0;
|
|
261
|
+
$[1] = className;
|
|
262
|
+
$[2] = props;
|
|
263
|
+
} else {
|
|
264
|
+
className = $[1];
|
|
265
|
+
props = $[2];
|
|
266
|
+
}
|
|
267
|
+
let t1;
|
|
268
|
+
if ($[3] !== className) {
|
|
269
|
+
t1 = clsx(className, classes.TimelineItemActions);
|
|
270
|
+
$[3] = className;
|
|
271
|
+
$[4] = t1;
|
|
272
|
+
} else {
|
|
273
|
+
t1 = $[4];
|
|
274
|
+
}
|
|
275
|
+
let t2;
|
|
276
|
+
if ($[5] !== forwardRef || $[6] !== props || $[7] !== t1) {
|
|
277
|
+
t2 = /*#__PURE__*/jsx("div", {
|
|
278
|
+
...props,
|
|
279
|
+
className: t1,
|
|
280
|
+
ref: forwardRef
|
|
281
|
+
});
|
|
282
|
+
$[5] = forwardRef;
|
|
283
|
+
$[6] = props;
|
|
284
|
+
$[7] = t1;
|
|
285
|
+
$[8] = t2;
|
|
286
|
+
} else {
|
|
287
|
+
t2 = $[8];
|
|
288
|
+
}
|
|
289
|
+
return t2;
|
|
290
|
+
});
|
|
291
|
+
TimelineActions.displayName = 'Timeline.Actions';
|
|
292
|
+
const TimelineAvatar = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
293
|
+
const $ = c(9);
|
|
294
|
+
let className;
|
|
295
|
+
let props;
|
|
296
|
+
if ($[0] !== t0) {
|
|
297
|
+
({
|
|
298
|
+
className,
|
|
299
|
+
...props
|
|
300
|
+
} = t0);
|
|
301
|
+
$[0] = t0;
|
|
302
|
+
$[1] = className;
|
|
303
|
+
$[2] = props;
|
|
304
|
+
} else {
|
|
305
|
+
className = $[1];
|
|
306
|
+
props = $[2];
|
|
307
|
+
}
|
|
308
|
+
let t1;
|
|
309
|
+
if ($[3] !== className) {
|
|
310
|
+
t1 = clsx(className, classes.TimelineItemAvatar);
|
|
311
|
+
$[3] = className;
|
|
312
|
+
$[4] = t1;
|
|
313
|
+
} else {
|
|
314
|
+
t1 = $[4];
|
|
315
|
+
}
|
|
316
|
+
let t2;
|
|
317
|
+
if ($[5] !== forwardRef || $[6] !== props || $[7] !== t1) {
|
|
318
|
+
t2 = /*#__PURE__*/jsx("div", {
|
|
319
|
+
...props,
|
|
320
|
+
className: t1,
|
|
321
|
+
ref: forwardRef
|
|
322
|
+
});
|
|
323
|
+
$[5] = forwardRef;
|
|
324
|
+
$[6] = props;
|
|
325
|
+
$[7] = t1;
|
|
326
|
+
$[8] = t2;
|
|
327
|
+
} else {
|
|
328
|
+
t2 = $[8];
|
|
329
|
+
}
|
|
330
|
+
return t2;
|
|
331
|
+
});
|
|
332
|
+
TimelineAvatar.displayName = 'Timeline.Avatar';
|
|
251
333
|
var Timeline_default = Object.assign(Timeline, {
|
|
252
334
|
Item: TimelineItem,
|
|
335
|
+
Avatar: TimelineAvatar,
|
|
253
336
|
Badge: TimelineBadge,
|
|
254
337
|
Body: TimelineBody,
|
|
255
|
-
Break: TimelineBreak
|
|
338
|
+
Break: TimelineBreak,
|
|
339
|
+
Actions: TimelineActions
|
|
256
340
|
});
|
|
257
341
|
|
|
258
342
|
export { Timeline_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import './Timeline-
|
|
1
|
+
import './Timeline-0c88f21b.css';
|
|
2
2
|
|
|
3
|
-
var classes = {"Timeline":"prc-Timeline-Timeline-awSoC","TimelineItem":"prc-Timeline-TimelineItem-QwDVH","TimelineBadge":"prc-Timeline-TimelineBadge-u0qSm","TimelineBadgeWrapper":"prc-Timeline-TimelineBadgeWrapper-SZw4k","TimelineBody":"prc-Timeline-TimelineBody-tjOtb","TimelineBreak":"prc-Timeline-TimelineBreak-X8eti"};
|
|
3
|
+
var classes = {"Timeline":"prc-Timeline-Timeline-awSoC","TimelineItem":"prc-Timeline-TimelineItem-QwDVH","TimelineItemAvatar":"prc-Timeline-TimelineItemAvatar-4zO8f","TimelineBadge":"prc-Timeline-TimelineBadge-u0qSm","TimelineBadgeWrapper":"prc-Timeline-TimelineBadgeWrapper-SZw4k","TimelineBody":"prc-Timeline-TimelineBody-tjOtb","TimelineBreak":"prc-Timeline-TimelineBreak-X8eti","TimelineItemActions":"prc-Timeline-TimelineItemActions-56Y7h"};
|
|
4
4
|
|
|
5
5
|
export { classes as default };
|
package/dist/Timeline/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default } from './Timeline';
|
|
2
|
-
export type { TimelineProps, TimelineItemsProps, TimelineItemProps, TimelineBadgeVariant, TimelineBadgeProps, TimelineBodyProps, TimelineBreakProps, } from './Timeline';
|
|
2
|
+
export type { TimelineProps, TimelineItemsProps, TimelineItemProps, TimelineAvatarProps, TimelineBadgeVariant, TimelineBadgeProps, TimelineBodyProps, TimelineBreakProps, TimelineActionsProps, } from './Timeline';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Timeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAA;AAClC,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Timeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAA;AAClC,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,YAAY,CAAA"}
|
package/dist/Tooltip/Tooltip.js
CHANGED
|
@@ -54,6 +54,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip({
|
|
|
54
54
|
});
|
|
55
55
|
Tooltip.alignments = ['left', 'right'];
|
|
56
56
|
Tooltip.directions = ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'];
|
|
57
|
-
Tooltip.__SLOT__ = Symbol('
|
|
57
|
+
Tooltip.__SLOT__ = Symbol('Tooltip');
|
|
58
58
|
|
|
59
59
|
export { TooltipContext, Tooltip as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlinePanels.d.ts","sourceRoot":"","sources":["../../../src/experimental/UnderlinePanels/UnderlinePanels.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"UnderlinePanels.d.ts","sourceRoot":"","sources":["../../../src/experimental/UnderlinePanels/UnderlinePanels.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAQZ,KAAK,EAAE,EACP,KAAK,iBAAiB,EAGvB,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAerD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AAEvD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD;;OAEG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAC3D;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,iBAAiB,CAAC;IACvC;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IACxG;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAA;CACrB,CAAC,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAA;;;;;AA8M7D,wBAA2D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React, { useState, useRef,
|
|
2
|
+
import React, { useState, useRef, useMemo, Children, isValidElement, cloneElement, createContext, useContext } from 'react';
|
|
3
3
|
import { TabContainerElement } from '@github/tab-container-element';
|
|
4
4
|
import { createComponent } from '../../utils/create-component.js';
|
|
5
5
|
import { UnderlineWrapper, UnderlineItemList, UnderlineItem } from '../../internal/components/UnderlineTabbedInterface.js';
|
|
@@ -9,10 +9,21 @@ import useIsomorphicLayoutEffect from '../../utils/useIsomorphicLayoutEffect.js'
|
|
|
9
9
|
import classes from './UnderlinePanels.module.css.js';
|
|
10
10
|
import { clsx } from 'clsx';
|
|
11
11
|
import { isSlot } from '../../utils/is-slot.js';
|
|
12
|
-
import {
|
|
12
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
13
|
import { useId } from '../../hooks/useId.js';
|
|
14
14
|
|
|
15
15
|
const TabContainerComponent = createComponent(TabContainerElement, 'tab-container');
|
|
16
|
+
|
|
17
|
+
// Carries flags that affect every Tab's rendering but that don't belong on the
|
|
18
|
+
// consumer-facing Tab API. Passing them via context (instead of cloneElement)
|
|
19
|
+
// keeps each Tab element's props referentially stable across UnderlinePanels
|
|
20
|
+
// re-renders, so React.memo(Tab) can skip work when an unrelated piece of
|
|
21
|
+
// state changes.
|
|
22
|
+
|
|
23
|
+
const UnderlinePanelsContext = /*#__PURE__*/createContext({
|
|
24
|
+
iconsVisible: true,
|
|
25
|
+
loadingCounters: undefined
|
|
26
|
+
});
|
|
16
27
|
const UnderlinePanels = ({
|
|
17
28
|
'aria-label': ariaLabel,
|
|
18
29
|
'aria-labelledby': ariaLabelledBy,
|
|
@@ -27,21 +38,22 @@ const UnderlinePanels = ({
|
|
|
27
38
|
// We need to always call useId() because React Hooks must be
|
|
28
39
|
// called in the exact same order in every component render
|
|
29
40
|
const parentId = useId(props.id);
|
|
30
|
-
const [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
//
|
|
41
|
+
const [tabs_0, tabPanels_0, tabsHaveIcons_0] = useMemo(() => {
|
|
42
|
+
// Walk children, clone each Tab with a generated id, and each Panel with a
|
|
43
|
+
// matching aria-labelledby. Derive in render so we never ship a
|
|
44
|
+
// "before-the-effect-ran" empty-tablist frame and so that re-renders of
|
|
45
|
+
// UnderlinePanels don't churn through an extra commit cycle.
|
|
46
|
+
//
|
|
47
|
+
// iconsVisible / loadingCounters are NOT baked into the cloned Tab
|
|
48
|
+
// elements — they flow through UnderlinePanelsContext, so this memo's deps
|
|
49
|
+
// can stay tight ([children, parentId]) and Tab elements stay
|
|
50
|
+
// referentially stable across resize-driven iconsVisible toggles.
|
|
37
51
|
let tabIndex = 0;
|
|
38
52
|
let panelIndex = 0;
|
|
39
53
|
const childrenWithProps = Children.map(children, child => {
|
|
40
54
|
if (/*#__PURE__*/isValidElement(child) && (child.type === Tab || isSlot(child, Tab))) {
|
|
41
55
|
return /*#__PURE__*/cloneElement(child, {
|
|
42
|
-
id: `${parentId}-tab-${tabIndex++}
|
|
43
|
-
loadingCounters,
|
|
44
|
-
iconsVisible
|
|
56
|
+
id: `${parentId}-tab-${tabIndex++}`
|
|
45
57
|
});
|
|
46
58
|
}
|
|
47
59
|
if (/*#__PURE__*/isValidElement(child) && (child.type === Panel || isSlot(child, Panel))) {
|
|
@@ -52,64 +64,81 @@ const UnderlinePanels = ({
|
|
|
52
64
|
}
|
|
53
65
|
return child;
|
|
54
66
|
});
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, [children, parentId
|
|
64
|
-
const
|
|
67
|
+
const tabs = [];
|
|
68
|
+
const tabPanels = [];
|
|
69
|
+
for (const child_0 of Children.toArray(childrenWithProps)) {
|
|
70
|
+
if (! /*#__PURE__*/isValidElement(child_0)) continue;
|
|
71
|
+
if (child_0.type === Tab || isSlot(child_0, Tab)) tabs.push(child_0);else if (child_0.type === Panel || isSlot(child_0, Panel)) tabPanels.push(child_0);
|
|
72
|
+
}
|
|
73
|
+
const tabsHaveIcons = tabs.some(tab => /*#__PURE__*/React.isValidElement(tab) && tab.props.icon);
|
|
74
|
+
return [tabs, tabPanels, tabsHaveIcons];
|
|
75
|
+
}, [children, parentId]);
|
|
76
|
+
const contextValue = useMemo(() => ({
|
|
77
|
+
iconsVisible,
|
|
78
|
+
loadingCounters
|
|
79
|
+
}), [iconsVisible, loadingCounters]);
|
|
65
80
|
|
|
66
|
-
//
|
|
67
|
-
|
|
81
|
+
// Mirror iconsVisible into a ref so the list observer below can read it
|
|
82
|
+
// without being re-created on every toggle (re-creating the observer
|
|
83
|
+
// would re-trigger its initial callback and churn extra work).
|
|
84
|
+
const iconsVisibleRef = useRef(iconsVisible);
|
|
68
85
|
useIsomorphicLayoutEffect(() => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
86
|
+
iconsVisibleRef.current = iconsVisible;
|
|
87
|
+
}, [iconsVisible]);
|
|
88
|
+
|
|
89
|
+
// The list's natural width (icons + labels), kept in sync via a
|
|
90
|
+
// ResizeObserver on the list — never read in render, so updates don't
|
|
91
|
+
// cause commits. Only refreshed while icons are visible: when icons are
|
|
92
|
+
// hidden the list is at its compressed width, which is not the value we
|
|
93
|
+
// want to compare against. The ResizeObserver fires synchronously on
|
|
94
|
+
// observe, which seeds the ref on mount for free.
|
|
95
|
+
const listWidthRef = useRef(0);
|
|
96
|
+
useResizeObserver(entries => {
|
|
97
|
+
if (!tabsHaveIcons_0) return;
|
|
98
|
+
if (!iconsVisibleRef.current) return;
|
|
99
|
+
listWidthRef.current = entries[0].contentRect.width;
|
|
100
|
+
}, listRef, []);
|
|
75
101
|
|
|
76
102
|
// when the wrapper resizes, check if the icons should be visible
|
|
77
103
|
// by comparing the wrapper width to the list width
|
|
78
104
|
useResizeObserver(resizeObserverEntries => {
|
|
79
|
-
if (!
|
|
105
|
+
if (!tabsHaveIcons_0) {
|
|
80
106
|
return;
|
|
81
107
|
}
|
|
82
108
|
const wrapperWidth = resizeObserverEntries[0].contentRect.width;
|
|
83
|
-
setIconsVisible(wrapperWidth >
|
|
109
|
+
setIconsVisible(wrapperWidth > listWidthRef.current);
|
|
84
110
|
}, wrapperRef, []);
|
|
85
111
|
if (process.env.NODE_ENV !== "production") {
|
|
86
|
-
const selectedTabs =
|
|
112
|
+
const selectedTabs = tabs_0.filter(tab_0 => {
|
|
87
113
|
const ariaSelected = /*#__PURE__*/React.isValidElement(tab_0) && tab_0.props['aria-selected'];
|
|
88
114
|
return ariaSelected === true || ariaSelected === 'true';
|
|
89
115
|
});
|
|
90
116
|
!(selectedTabs.length <= 1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Only one tab can be selected at a time.') : invariant(false) : void 0;
|
|
91
|
-
!(
|
|
117
|
+
!(tabs_0.length === tabPanels_0.length) ? process.env.NODE_ENV !== "production" ? invariant(false, `The number of tabs and panels must be equal. Counted ${tabs_0.length} tabs and ${tabPanels_0.length} panels.`) : invariant(false) : void 0;
|
|
92
118
|
}
|
|
93
|
-
return /*#__PURE__*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
return /*#__PURE__*/jsx(UnderlinePanelsContext.Provider, {
|
|
120
|
+
value: contextValue,
|
|
121
|
+
children: /*#__PURE__*/jsxs(TabContainerComponent, {
|
|
122
|
+
children: [/*#__PURE__*/jsx(UnderlineWrapper, {
|
|
123
|
+
ref: wrapperRef,
|
|
124
|
+
slot: "tablist-wrapper",
|
|
125
|
+
"data-icons-visible": iconsVisible,
|
|
126
|
+
className: clsx(className, classes.StyledUnderlineWrapper),
|
|
127
|
+
...props,
|
|
128
|
+
children: /*#__PURE__*/jsx(UnderlineItemList, {
|
|
129
|
+
ref: listRef,
|
|
130
|
+
"aria-label": ariaLabel,
|
|
131
|
+
"aria-labelledby": ariaLabelledBy,
|
|
132
|
+
role: "tablist",
|
|
133
|
+
children: tabs_0
|
|
134
|
+
})
|
|
135
|
+
}), tabPanels_0]
|
|
136
|
+
})
|
|
108
137
|
});
|
|
109
138
|
};
|
|
110
139
|
UnderlinePanels.displayName = "UnderlinePanels";
|
|
111
|
-
const
|
|
112
|
-
const $ = c(
|
|
140
|
+
const TabImpl = t0 => {
|
|
141
|
+
const $ = c(16);
|
|
113
142
|
let ariaSelected;
|
|
114
143
|
let onSelect;
|
|
115
144
|
let props;
|
|
@@ -128,6 +157,10 @@ const Tab = t0 => {
|
|
|
128
157
|
onSelect = $[2];
|
|
129
158
|
props = $[3];
|
|
130
159
|
}
|
|
160
|
+
const {
|
|
161
|
+
iconsVisible,
|
|
162
|
+
loadingCounters
|
|
163
|
+
} = useContext(UnderlinePanelsContext);
|
|
131
164
|
let t1;
|
|
132
165
|
if ($[4] !== onSelect) {
|
|
133
166
|
t1 = event => {
|
|
@@ -156,7 +189,7 @@ const Tab = t0 => {
|
|
|
156
189
|
const keyDownHandler = t2;
|
|
157
190
|
const t3 = ariaSelected ? 0 : -1;
|
|
158
191
|
let t4;
|
|
159
|
-
if ($[8] !== ariaSelected || $[9] !== clickHandler || $[10] !==
|
|
192
|
+
if ($[8] !== ariaSelected || $[9] !== clickHandler || $[10] !== iconsVisible || $[11] !== keyDownHandler || $[12] !== loadingCounters || $[13] !== props || $[14] !== t3) {
|
|
160
193
|
t4 = /*#__PURE__*/jsx(UnderlineItem, {
|
|
161
194
|
as: "button",
|
|
162
195
|
role: "tab",
|
|
@@ -165,19 +198,30 @@ const Tab = t0 => {
|
|
|
165
198
|
type: "button",
|
|
166
199
|
onClick: clickHandler,
|
|
167
200
|
onKeyDown: keyDownHandler,
|
|
201
|
+
iconsVisible: iconsVisible,
|
|
202
|
+
loadingCounters: loadingCounters,
|
|
168
203
|
...props
|
|
169
204
|
});
|
|
170
205
|
$[8] = ariaSelected;
|
|
171
206
|
$[9] = clickHandler;
|
|
172
|
-
$[10] =
|
|
173
|
-
$[11] =
|
|
174
|
-
$[12] =
|
|
175
|
-
$[13] =
|
|
207
|
+
$[10] = iconsVisible;
|
|
208
|
+
$[11] = keyDownHandler;
|
|
209
|
+
$[12] = loadingCounters;
|
|
210
|
+
$[13] = props;
|
|
211
|
+
$[14] = t3;
|
|
212
|
+
$[15] = t4;
|
|
176
213
|
} else {
|
|
177
|
-
t4 = $[
|
|
214
|
+
t4 = $[15];
|
|
178
215
|
}
|
|
179
216
|
return t4;
|
|
180
217
|
};
|
|
218
|
+
|
|
219
|
+
// Memoized so that UnderlinePanels re-rendering (e.g. when iconsVisible flips)
|
|
220
|
+
// only re-renders Tabs whose own props actually changed. iconsVisible and
|
|
221
|
+
// loadingCounters reach Tab via UnderlinePanelsContext, so Tabs still react
|
|
222
|
+
// to those changes through context propagation.
|
|
223
|
+
TabImpl.displayName = 'UnderlinePanels.Tab';
|
|
224
|
+
const Tab = /*#__PURE__*/React.memo(TabImpl);
|
|
181
225
|
Tab.displayName = 'UnderlinePanels.Tab';
|
|
182
226
|
const Panel = t0 => {
|
|
183
227
|
const $ = c(6);
|
|
@@ -215,7 +259,6 @@ var UnderlinePanels_default = Object.assign(UnderlinePanels, {
|
|
|
215
259
|
Panel,
|
|
216
260
|
Tab
|
|
217
261
|
});
|
|
218
|
-
UnderlinePanels.__SLOT__ = Symbol('UnderlinePanels');
|
|
219
262
|
Tab.__SLOT__ = Symbol('UnderlinePanels.Tab');
|
|
220
263
|
Panel.__SLOT__ = Symbol('UnderlinePanels.Panel');
|
|
221
264
|
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -17,4 +17,5 @@ export { useRefObjectAsForwardedRef } from './useRefObjectAsForwardedRef';
|
|
|
17
17
|
export { useId } from './useId';
|
|
18
18
|
export { useIsMacOS } from './useIsMacOS';
|
|
19
19
|
export { useMergedRefs } from './useMergedRefs';
|
|
20
|
+
export { useSlots } from './useSlots';
|
|
20
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AACrD,YAAY,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AACrF,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAC3D,YAAY,EAAC,4BAA4B,EAAC,MAAM,wBAAwB,CAAA;AACxE,YAAY,EAAC,4BAA4B,EAAC,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,YAAY,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAA;AACpD,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB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AAE,WAAW,CAAC,GAC5E,KAAK,CAAA;AAeX,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,MAAM,SAAS,UAAU,EAChD,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,MAAM,EAAE,MAAM,GACb,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAwDpD"}
|
package/dist/hooks/useSlots.js
CHANGED
|
@@ -101,6 +101,9 @@ function useSlots(children, config) {
|
|
|
101
101
|
// Try to match child against a slot
|
|
102
102
|
const matchedIndex = findMatchingSlot(child, values, totalSlots);
|
|
103
103
|
if (matchedIndex === -1) {
|
|
104
|
+
if (process.env.NODE_ENV !== "production") {
|
|
105
|
+
warnIfDisplayNameMatchesWithoutMarker(child, keys, values, totalSlots);
|
|
106
|
+
}
|
|
104
107
|
rest.push(child);
|
|
105
108
|
return;
|
|
106
109
|
}
|
|
@@ -147,4 +150,25 @@ function warnIfDuplicate(child, keys, values, totalSlots) {
|
|
|
147
150
|
return false;
|
|
148
151
|
}
|
|
149
152
|
|
|
153
|
+
/**
|
|
154
|
+
* Dev-only: detect children whose displayName matches a slot's component
|
|
155
|
+
* displayName but that don't share the `__SLOT__` marker. Catches a common
|
|
156
|
+
* footgun where a wrapper around a slot component forgets to copy the marker.
|
|
157
|
+
*/
|
|
158
|
+
function warnIfDisplayNameMatchesWithoutMarker(child, keys, values, totalSlots) {
|
|
159
|
+
const childType = child.type;
|
|
160
|
+
if (typeof childType !== 'function' && typeof childType !== 'object') return;
|
|
161
|
+
const childName = childType.displayName;
|
|
162
|
+
if (!childName) return;
|
|
163
|
+
for (let i = 0; i < totalSlots; i++) {
|
|
164
|
+
const slotValue = values[i];
|
|
165
|
+
const component = Array.isArray(slotValue) ? slotValue[0] : slotValue;
|
|
166
|
+
const slotName = component.displayName;
|
|
167
|
+
if (slotName && slotName === childName) {
|
|
168
|
+
process.env.NODE_ENV !== "production" ? warning(true, `useSlots: child with displayName "${childName}" matches slot "${String(keys[i])}" by name but is missing the \`__SLOT__\` marker. ` + `Did you forget to copy the marker? Use \`asSlot(wrapper, ParentSlotComponent)\` to copy it.`) : void 0;
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
150
174
|
export { useSlots };
|
package/dist/index.d.ts
CHANGED
|
@@ -30,7 +30,10 @@ export { useId } from './hooks/useId';
|
|
|
30
30
|
export { useSyncedState } from './hooks/useSyncedState';
|
|
31
31
|
export { useAnchoredPosition, type AnchoredPositionHookSettings } from './hooks/useAnchoredPosition';
|
|
32
32
|
export { createComponent } from './utils/create-component';
|
|
33
|
-
export type { SlotMarker } from './utils/types';
|
|
33
|
+
export type { SlotMarker, WithSlotMarker, FCWithSlotMarker } from './utils/types';
|
|
34
|
+
export { asSlot } from './utils/as-slot';
|
|
35
|
+
export { isSlot } from './utils/is-slot';
|
|
36
|
+
export { useSlots } from './hooks/useSlots';
|
|
34
37
|
export { default as Radio } from './Radio';
|
|
35
38
|
export type { RadioProps } from './Radio';
|
|
36
39
|
export { ActionList } from './ActionList';
|
|
@@ -119,7 +122,7 @@ export type { TextInputWithTokensProps } from './TextInputWithTokens';
|
|
|
119
122
|
export { default as Text } from './Text';
|
|
120
123
|
export type { TextProps } from './Text';
|
|
121
124
|
export { default as Timeline } from './Timeline';
|
|
122
|
-
export type { TimelineProps, TimelineBadgeVariant, TimelineBadgeProps, TimelineBodyProps, TimelineBreakProps, TimelineItemsProps, TimelineItemProps, } from './Timeline';
|
|
125
|
+
export type { TimelineProps, TimelineActionsProps, TimelineAvatarProps, TimelineBadgeVariant, TimelineBadgeProps, TimelineBodyProps, TimelineBreakProps, TimelineItemsProps, TimelineItemProps, } from './Timeline';
|
|
123
126
|
export { default as Token, IssueLabelToken } from './Token';
|
|
124
127
|
export type { TokenProps, IssueLabelTokenProps } from './Token';
|
|
125
128
|
export { Tooltip } from './TooltipV2';
|