@primer/react 0.0.0-20260720205022 → 0.0.0-20260721213500
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 +31 -3
- package/dist/ActionBar/ActionBar-3767d551.css +2 -0
- package/dist/ActionBar/ActionBar-3767d551.css.map +1 -0
- package/dist/ActionBar/ActionBar.js +1 -1
- package/dist/ActionBar/ActionBar.module.css.js +1 -1
- package/dist/ActionList/Group.js +2 -2
- package/dist/ActionList/Item.js +1 -1
- package/dist/ActionList/List.js +15 -21
- package/dist/ActionMenu/ActionMenu.js +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +5 -7
- package/dist/Autocomplete/AutocompleteInput.js +7 -10
- package/dist/Autocomplete/AutocompleteMenu.js +3 -2
- package/dist/Breadcrumbs/Breadcrumbs.js +4 -1
- package/dist/ButtonGroup/ButtonGroup.js +8 -15
- package/dist/Checkbox/Checkbox.js +9 -16
- package/dist/Dialog/Dialog.js +6 -13
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -2
- package/dist/FeatureFlags/useFeatureFlag.js +2 -1
- package/dist/FilteredActionList/FilteredActionList.js +20 -31
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/FilteredActionList/useAnnouncements.js +20 -14
- package/dist/LabelGroup/LabelGroup-db41f443.css +2 -0
- package/dist/LabelGroup/LabelGroup-db41f443.css.map +1 -0
- package/dist/LabelGroup/LabelGroup.module.css.js +1 -1
- package/dist/NavList/NavList.js +1 -1
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/PageHeader/PageHeader.js +22 -31
- package/dist/PageLayout/DragHandle.d.ts +45 -0
- package/dist/PageLayout/DragHandle.js +224 -0
- package/dist/PageLayout/PageLayout.js +54 -248
- package/dist/PageLayout/index.d.ts +3 -1
- package/dist/PageLayout/usePaneWidth.d.ts +63 -1
- package/dist/PageLayout/usePaneWidth.js +52 -36
- package/dist/SegmentedControl/{SegmentedControl-a004561f.css → SegmentedControl-de65527b.css} +2 -2
- package/dist/SegmentedControl/{SegmentedControl-a004561f.css.map → SegmentedControl-de65527b.css.map} +1 -1
- package/dist/SegmentedControl/SegmentedControl.module.css.js +1 -1
- package/dist/SegmentedControl/SegmentedControlButton.js +1 -1
- package/dist/SegmentedControl/SegmentedControlIconButton.js +1 -1
- package/dist/SelectPanel/SelectPanel.js +1 -1
- package/dist/TextInput/TextInput.js +6 -13
- package/dist/TextInputWithTokens/TextInputWithTokens.js +1 -1
- package/dist/TooltipV2/Tooltip.js +13 -19
- package/dist/TreeView/TreeView.js +6 -3
- package/dist/experimental/SelectPanel2/SelectPanel.js +2 -2
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +10 -18
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -1
- package/dist/experimental/index.js +4 -4
- package/dist/hooks/useAnchoredPosition.js +14 -1
- package/dist/hooks/useDialog.js +2 -1
- package/dist/hooks/useMergedRefs.d.ts +4 -4
- package/dist/hooks/useMergedRefs.js +5 -8
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.js +10 -7
- package/dist/hooks/useScrollFlash.js +2 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -5
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +1 -1
- package/dist/internal/components/OverflowObserverProvider.js +5 -5
- package/dist/internal/components/UnderlineTabbedInterface-798ef3cb.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-798ef3cb.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/utils/warning.js +3 -2
- package/generated/components.json +2 -8
- package/package.json +2 -2
- package/dist/ActionBar/ActionBar-e63def3c.css +0 -2
- package/dist/ActionBar/ActionBar-e63def3c.css.map +0 -1
- package/dist/LabelGroup/LabelGroup-7d19205a.css +0 -2
- package/dist/LabelGroup/LabelGroup-7d19205a.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SegmentedControl/SegmentedControl.module.css.js"],"names":[],"mappings":"AAAA,6CAEE,mCAAoC,CASpC,yDAAkD,CAClD,8FAAuF,CACvF,gDAAyC,CATzC,mBAAoB,CAMpB,8CAAuC,CAHvC,WAAY,CAEZ,QAAS,CADT,SA0HF,CAlHE,mEACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,oEACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CAEA,wCACE,0EACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,2EACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAEA,yBACE,2EACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,4EACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAEA,2BACE,wEACE,YAAa,CACb,UAAW,CAEX,mCACF,CASA,qLACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAQA,2KACE,YACF,CAEA,wCAKE,yLACE,YACF,CACF,CAEA,yBAKE,2LACE,YACF,CACF,CAEA,2BAKE,qLACE,YACF,CACF,CAEA,sEAGE,4CAAsC,CADtC,WAEF,CAGF,8CACE,YAwBF,CArBE,qEACE,aACF,CAEA,wCACE,4EACE,aACF,CACF,CAEA,yBACE,6EACE,aACF,CACF,CAEA,2BACE,0EACE,aACF,CACF,CAGF,iCAEE,aAAc,CAKd,WAAY,CADZ,kBAAmB,CAFnB,eAAgB,CAHhB,iBA6CF,CArCE,kDAEE,gBAkBF,CAhBE,wDAQE,mDAA4C,CAJ5C,+BAA0B,CAE1B,UAAW,CALX,iBAAkB,CAElB,yCAAoC,CADpC,4BAAuB,CAGvB,SAIF,CAGA,6JAEE,4BACF,CAGF,6CAEE,gBACF,CAEA,4CAEE,iBACF,CAEA,qEAGE,kBAAmB,CADnB,YAAa,CADb,4CAGF,CAGF,mCAEE,6CAA8C,CAC9C,uCAAwC,CACxC,oEAA4D,CAW5D,4BAA6B,CAC7B,wBAAyB,CAGzB,mDAAoD,CAFpD,cAAe,CAJf,kBAAmB,CACnB,cAAe,CAJf,mBAAoB,CACpB,iBAAkB,CAClB,8CAA2C,CAL3C,WAAY,CAEZ,gDAAiD,CAHjD,UAmEF,CApDE,uCACE,iCAA0B,CAC1B,kCACF,CAGA,wDAGE,eAAgB,CAFhB,sEAAuD,CACvD,mBAOF,CAHE,4EACE,6BACF,CAIF,gEAGE,eAAgB,CAFhB,sEAAuD,CACvD,mBAEF,CAGA,8EAEE,OACF,CAEA,gFAGE,4BAA6B,CAD7B,qCAA8B,CAD9B,kBAQF,CAJE,oFACE,oCAA6B,CAC7B,qCACF,CAGF,wBACE,0CAME,UAAW,CAFX,MAAO,CACP,eAAgB,CAJhB,iBAAkB,CAElB,OAAQ,CADR,OAAQ,CAKR,0BACF,CACF,CAGF,uCACE,8CACF,CAEA,oCAiBE,kBAAmB,CAVnB,wBAAyB,CASzB,sGAAyG,CARzG,kBAAmB,CACnB,6CAAqC,CARrC,YAAa,CACb,WAAY,CAgBZ,sBAAuB,CAZvB,2GAA4G,CAF5G,4GAeF,CAEA,sDAEE,gDAA6C,CAD7C,SAaF,CAVE,0FAKE,qDAAiD,CACjD,wDAAiD,CAEjD,mDAAoD,CAJpD,0DAA2D,CAF3D,2DAOF,CAIA,2HACE,0DACF,CAEA,4HACE,2DACF,CAGF,uCAOE,uBAAwB,CANxB,aAAc,CAGd,gDAA6C,CAF7C,QAAS,CACT,eAAgB,CAEhB,mBAAoB,CAGpB,wBAAiB,CAAjB,gBAAiB,CAFjB,iBAGF,CAEA,wCACE,sCACF","file":"SegmentedControl-a004561f.css","sourcesContent":[".SegmentedControl {\n /* TODO: use primitive `control.medium.size` when it is available instead of '32px' */\n --segmented-control-icon-width: 32px;\n\n display: inline-flex;\n\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 32px;\n padding: 0;\n margin: 0;\n font-size: var(--text-body-size-medium);\n background-color: var(--controlTrack-bgColor-rest);\n border: var(--borderWidth-thin) solid var(--controlTrack-borderColor-rest, transparent);\n border-radius: var(--borderRadius-medium);\n\n /* Responsive full-width */\n &[data-full-width='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n @media (--viewportRange-narrow) {\n &[data-full-width-narrow='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-narrow='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-full-width-regular='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-regular='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-full-width-wide='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-wide='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n &[data-full-width-regular='true']:not([data-full-width-wide='true']) {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n /* Hide when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: none;\n }\n\n /* Handle hideLabels variant - hide button text */\n &[data-variant='hideLabels'] .Text {\n display: none;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: none;\n }\n\n &[data-variant-narrow='hideLabels'] .Text {\n display: none;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: none;\n }\n\n &[data-variant-regular='hideLabels'] .Text {\n display: none;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: none;\n }\n\n &[data-variant-wide='hideLabels'] .Text {\n display: none;\n }\n }\n\n &:where([data-size='small']) {\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 28px;\n font-size: var(--text-body-size-small);\n }\n}\n\n.DropdownContainer {\n display: none;\n\n /* Show when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: block;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: block;\n }\n }\n}\n\n.Item {\n position: relative;\n display: block;\n /* stylelint-disable-next-line primer/spacing */\n margin-top: -1px;\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: -1px;\n flex-grow: 1;\n\n &:not(:last-child) {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: 1px;\n\n &::after {\n position: absolute;\n top: var(--base-size-8);\n right: calc(-1 * var(--base-size-2));\n bottom: var(--base-size-8);\n width: 1px;\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-default);\n }\n\n /* stylelint-disable-next-line selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(+ [data-selected])::after,\n &:where([data-selected])::after {\n background-color: transparent;\n }\n }\n\n &:first-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-left: -1px;\n }\n\n &:last-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: -1px;\n }\n\n .Counter {\n margin-inline-start: var(--base-size-8);\n display: flex;\n align-items: center;\n }\n}\n\n.Button {\n /* TODO: use primitive `primer.control.medium.paddingInline.normal` when it is available */\n --segmented-control-button-inner-padding: 12px;\n --segmented-control-button-bg-inset: 4px;\n --segmented-control-outer-radius: var(--borderRadius-medium);\n\n width: 100%;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--segmented-control-button-bg-inset);\n font-family: inherit;\n font-size: inherit;\n font-weight: var(--base-text-weight-normal);\n color: currentColor;\n cursor: pointer;\n background-color: transparent;\n border-color: transparent;\n border-width: 0;\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n\n & svg {\n fill: var(--fgColor-muted);\n color: var(--fgColor-muted);\n }\n\n /* fallback :focus state */\n &:focus:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n }\n }\n\n /* default focus state */\n &:focus-visible:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n }\n\n /* stylelint-disable-next-line selector-max-specificity */\n &:focus:focus-visible:not(:last-child)::after {\n /* fixes an issue where the focus outline shows over the pseudo-element */\n width: 0;\n }\n\n &[aria-disabled='true']:not([aria-current='true']) {\n cursor: not-allowed;\n color: var(--fgColor-disabled);\n background-color: transparent;\n\n & svg {\n fill: var(--fgColor-disabled);\n color: var(--fgColor-disabled);\n }\n }\n\n @media (pointer: coarse) {\n &::before {\n position: absolute;\n top: 50%;\n right: 0;\n left: 0;\n min-height: 44px;\n content: '';\n transform: translateY(-50%);\n }\n }\n}\n\n.IconButton {\n width: var(--segmented-control-icon-width, 32px);\n}\n\n.Content {\n display: flex;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding-right: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n /* stylelint-disable-next-line primer/spacing */\n padding-left: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n border-color: transparent;\n border-style: solid;\n border-width: var(--borderWidth-thin);\n\n /*\n innerRadius = outerRadius - distance/2\n https://stackoverflow.com/questions/2932146/math-problem-determine-the-corner-radius-of-an-inner-border-based-on-outer-corn\n */\n /* stylelint-disable-next-line primer/borders */\n border-radius: calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset) / 2);\n align-items: center;\n justify-content: center;\n}\n\n.Button[aria-current='true'] {\n padding: 0;\n font-weight: var(--base-text-weight-semibold);\n\n .Content {\n /* stylelint-disable-next-line primer/spacing */\n padding-right: var(--segmented-control-button-inner-padding);\n /* stylelint-disable-next-line primer/spacing */\n padding-left: var(--segmented-control-button-inner-padding);\n background-color: var(--controlKnob-bgColor-rest);\n border-color: var(--controlKnob-borderColor-rest);\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n }\n}\n\n.Button:not([aria-current='true'], [aria-disabled='true']) {\n &:hover .Content {\n background-color: var(--controlTrack-bgColor-hover);\n }\n\n &:active .Content {\n background-color: var(--controlTrack-bgColor-active);\n }\n}\n\n.Text::after {\n display: block;\n height: 0;\n overflow: hidden;\n font-weight: var(--base-text-weight-semibold);\n pointer-events: none;\n visibility: hidden;\n content: attr(data-text);\n user-select: none;\n}\n\n.LeadingIcon {\n margin-right: var(--base-size-4);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/SegmentedControl/SegmentedControl.module.css.js"],"names":[],"mappings":"AAAA,6CAEE,mCAAoC,CASpC,yDAAkD,CAClD,8FAAuF,CACvF,gDAAyC,CATzC,mBAAoB,CAMpB,8CAAuC,CAHvC,WAAY,CAEZ,QAAS,CADT,SA0HF,CAlHE,mEACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,oEACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CAEA,wCACE,0EACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,2EACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAEA,yBACE,2EACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,4EACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAEA,2BACE,wEACE,YAAa,CACb,UAAW,CAEX,mCACF,CASA,qLACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAQA,2KACE,YACF,CAEA,wCAKE,yLACE,YACF,CACF,CAEA,yBAKE,2LACE,YACF,CACF,CAEA,2BAKE,qLACE,YACF,CACF,CAEA,sEAGE,4CAAsC,CADtC,WAEF,CAGF,8CACE,YAwBF,CArBE,qEACE,aACF,CAEA,wCACE,4EACE,aACF,CACF,CAEA,yBACE,6EACE,aACF,CACF,CAEA,2BACE,0EACE,aACF,CACF,CAGF,iCAEE,aAAc,CAKd,WAAY,CADZ,kBAAmB,CAFnB,eAAgB,CAHhB,iBA6CF,CArCE,kDAEE,gBAkBF,CAhBE,wDAQE,mDAA4C,CAJ5C,+BAA0B,CAE1B,UAAW,CALX,iBAAkB,CAElB,yCAAoC,CADpC,4BAAuB,CAGvB,SAIF,CAGA,6JAEE,4BACF,CAGF,6CAEE,gBACF,CAEA,4CAEE,iBACF,CAEA,qEAGE,kBAAmB,CADnB,YAAa,CADb,4CAGF,CAGF,mCAEE,6CAA8C,CAC9C,uCAAwC,CACxC,oEAA4D,CAW5D,4BAA6B,CAC7B,wBAAyB,CAGzB,mDAAoD,CAFpD,cAAe,CAJf,kBAAmB,CACnB,cAAe,CAJf,mBAAoB,CACpB,iBAAkB,CAClB,8CAA2C,CAL3C,WAAY,CAEZ,gDAAiD,CAHjD,UAmEF,CApDE,uCACE,iCAA0B,CAC1B,kCACF,CAGA,wDAGE,eAAgB,CAFhB,sEAAuD,CACvD,mBAOF,CAHE,4EACE,6BACF,CAIF,gEAGE,eAAgB,CAFhB,sEAAuD,CACvD,mBAEF,CAGA,8EAEE,OACF,CAEA,gFAGE,4BAA6B,CAD7B,qCAA8B,CAD9B,kBAQF,CAJE,oFACE,oCAA6B,CAC7B,qCACF,CAGF,wBACE,0CAME,UAAW,CAFX,MAAO,CACP,eAAgB,CAJhB,iBAAkB,CAElB,OAAQ,CADR,OAAQ,CAKR,0BACF,CACF,CAGF,uCACE,8CACF,CAEA,oCAiBE,kBAAmB,CAVnB,wBAAyB,CASzB,sGAAyG,CARzG,kBAAmB,CACnB,6CAAqC,CARrC,YAAa,CACb,WAAY,CAgBZ,sBAAuB,CAZvB,2GAA4G,CAF5G,4GAeF,CAEA,sDAEE,gDAA6C,CAD7C,SAaF,CAVE,0FAKE,qDAAiD,CACjD,wDAAiD,CAEjD,mDAAoD,CAJpD,0DAA2D,CAF3D,2DAOF,CAIA,2HACE,0DACF,CAEA,4HACE,2DACF,CAGF,uCAOE,uBAAwB,CANxB,aAAc,CAGd,gDAA6C,CAF7C,QAAS,CACT,eAAgB,CAEhB,mBAAoB,CAGpB,wBAAiB,CAAjB,gBAAiB,CAFjB,iBAGF,CAEA,wCACE,sCACF","file":"SegmentedControl-de65527b.css","sourcesContent":[".SegmentedControl {\n /* TODO: use primitive `control.medium.size` when it is available instead of '32px' */\n --segmented-control-icon-width: 32px;\n\n display: inline-flex;\n\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 32px;\n padding: 0;\n margin: 0;\n font-size: var(--text-body-size-medium);\n background-color: var(--controlTrack-bgColor-rest);\n border: var(--borderWidth-thin) solid var(--controlTrack-borderColor-rest, transparent);\n border-radius: var(--borderRadius-medium);\n\n /* Responsive full-width */\n &[data-full-width='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n @media (--viewportRange-narrow) {\n &[data-full-width-narrow='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-narrow='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-full-width-regular='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-regular='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-full-width-wide='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-wide='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n &[data-full-width-regular='true']:not([data-full-width-wide='true']) {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n /* Hide when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: none;\n }\n\n /* Handle hideLabels variant - hide button text */\n &[data-variant='hideLabels'] .Text {\n display: none;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: none;\n }\n\n &[data-variant-narrow='hideLabels'] .Text {\n display: none;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: none;\n }\n\n &[data-variant-regular='hideLabels'] .Text {\n display: none;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: none;\n }\n\n &[data-variant-wide='hideLabels'] .Text {\n display: none;\n }\n }\n\n &:where([data-size='small']) {\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 28px;\n font-size: var(--text-body-size-small);\n }\n}\n\n.DropdownContainer {\n display: none;\n\n /* Show when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: block;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: block;\n }\n }\n}\n\n.Item {\n position: relative;\n display: block;\n /* stylelint-disable-next-line primer/spacing */\n margin-top: -1px;\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: -1px;\n flex-grow: 1;\n\n &:not(:last-child) {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: 1px;\n\n &::after {\n position: absolute;\n top: var(--base-size-8);\n right: calc(-1 * var(--base-size-2));\n bottom: var(--base-size-8);\n width: 1px;\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-default);\n }\n\n /* stylelint-disable-next-line selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(+ [data-selected])::after,\n &:where([data-selected])::after {\n background-color: transparent;\n }\n }\n\n &:first-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-left: -1px;\n }\n\n &:last-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: -1px;\n }\n\n .Counter {\n margin-inline-start: var(--base-size-8);\n display: flex;\n align-items: center;\n }\n}\n\n.Button {\n /* TODO: use primitive `primer.control.medium.paddingInline.normal` when it is available */\n --segmented-control-button-inner-padding: 12px;\n --segmented-control-button-bg-inset: 4px;\n --segmented-control-outer-radius: var(--borderRadius-medium);\n\n width: 100%;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--segmented-control-button-bg-inset);\n font-family: inherit;\n font-size: inherit;\n font-weight: var(--base-text-weight-normal);\n color: currentColor;\n cursor: pointer;\n background-color: transparent;\n border-color: transparent;\n border-width: 0;\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n\n & svg {\n fill: var(--fgColor-muted);\n color: var(--fgColor-muted);\n }\n\n /* fallback :focus state */\n &:focus:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n }\n }\n\n /* default focus state */\n &:focus-visible:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n }\n\n /* stylelint-disable-next-line selector-max-specificity */\n &:focus:focus-visible:not(:last-child)::after {\n /* fixes an issue where the focus outline shows over the pseudo-element */\n width: 0;\n }\n\n &[aria-disabled='true']:not([aria-pressed='true']) {\n cursor: not-allowed;\n color: var(--fgColor-disabled);\n background-color: transparent;\n\n & svg {\n fill: var(--fgColor-disabled);\n color: var(--fgColor-disabled);\n }\n }\n\n @media (pointer: coarse) {\n &::before {\n position: absolute;\n top: 50%;\n right: 0;\n left: 0;\n min-height: 44px;\n content: '';\n transform: translateY(-50%);\n }\n }\n}\n\n.IconButton {\n width: var(--segmented-control-icon-width, 32px);\n}\n\n.Content {\n display: flex;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding-right: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n /* stylelint-disable-next-line primer/spacing */\n padding-left: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n border-color: transparent;\n border-style: solid;\n border-width: var(--borderWidth-thin);\n\n /*\n innerRadius = outerRadius - distance/2\n https://stackoverflow.com/questions/2932146/math-problem-determine-the-corner-radius-of-an-inner-border-based-on-outer-corn\n */\n /* stylelint-disable-next-line primer/borders */\n border-radius: calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset) / 2);\n align-items: center;\n justify-content: center;\n}\n\n.Button[aria-pressed='true'] {\n padding: 0;\n font-weight: var(--base-text-weight-semibold);\n\n .Content {\n /* stylelint-disable-next-line primer/spacing */\n padding-right: var(--segmented-control-button-inner-padding);\n /* stylelint-disable-next-line primer/spacing */\n padding-left: var(--segmented-control-button-inner-padding);\n background-color: var(--controlKnob-bgColor-rest);\n border-color: var(--controlKnob-borderColor-rest);\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n }\n}\n\n.Button:not([aria-pressed='true'], [aria-disabled='true']) {\n &:hover .Content {\n background-color: var(--controlTrack-bgColor-hover);\n }\n\n &:active .Content {\n background-color: var(--controlTrack-bgColor-active);\n }\n}\n\n.Text::after {\n display: block;\n height: 0;\n overflow: hidden;\n font-weight: var(--base-text-weight-semibold);\n pointer-events: none;\n visibility: hidden;\n content: attr(data-text);\n user-select: none;\n}\n\n.LeadingIcon {\n margin-right: var(--base-size-4);\n}\n"]}
|
|
@@ -126,7 +126,7 @@ const SegmentedControlButton = (t0) => {
|
|
|
126
126
|
let t11;
|
|
127
127
|
if ($[27] !== rest || $[28] !== selected || $[29] !== t10 || $[30] !== t3 || $[31] !== t4) {
|
|
128
128
|
t11 = /*#__PURE__*/ jsx("button", {
|
|
129
|
-
"aria-
|
|
129
|
+
"aria-pressed": selected,
|
|
130
130
|
"aria-disabled": t3,
|
|
131
131
|
className: t4,
|
|
132
132
|
type: "button",
|
|
@@ -87,7 +87,7 @@ const SegmentedControlIconButton = (t0) => {
|
|
|
87
87
|
if ($[20] !== rest || $[21] !== selected || $[22] !== t10 || $[23] !== t5 || $[24] !== t6) {
|
|
88
88
|
t11 = /*#__PURE__*/ jsx("button", {
|
|
89
89
|
type: "button",
|
|
90
|
-
"aria-
|
|
90
|
+
"aria-pressed": selected,
|
|
91
91
|
"aria-label": t5,
|
|
92
92
|
"aria-disabled": t6,
|
|
93
93
|
className: t7,
|
|
@@ -2,13 +2,13 @@ import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
|
2
2
|
import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
|
|
3
3
|
import { isAlphabetKey } from "../hooks/useMnemonics.js";
|
|
4
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
5
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
6
5
|
import useSafeTimeout from "../hooks/useSafeTimeout.js";
|
|
7
6
|
import { IconButton } from "../Button/IconButton.js";
|
|
8
7
|
import { LinkButton } from "../Button/LinkButton.js";
|
|
9
8
|
import { ButtonComponent } from "../Button/Button.js";
|
|
10
9
|
import { useResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
11
10
|
import Heading from "../Heading/Heading.js";
|
|
11
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
12
12
|
import { AnchoredOverlay } from "../AnchoredOverlay/AnchoredOverlay.js";
|
|
13
13
|
import { Banner } from "../Banner/index.js";
|
|
14
14
|
import { useFormControlContext } from "../FormControl/_FormControlContext.js";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
2
|
import { AriaStatus } from "../live-region/AriaStatus.js";
|
|
4
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
5
3
|
import Text_default from "../Text/Text.js";
|
|
6
4
|
import _VisuallyHidden_module_css_default from "../_VisuallyHidden.module.css.js";
|
|
7
5
|
import VisuallyHidden from "../_VisuallyHidden.js";
|
|
@@ -13,19 +11,14 @@ import UnstyledTextInput from "../internal/components/UnstyledTextInput.js";
|
|
|
13
11
|
import { getCharacterCountState } from "../utils/character-counter.js";
|
|
14
12
|
import { clsx } from "clsx";
|
|
15
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
import React, { useCallback, useId,
|
|
14
|
+
import React, { useCallback, useId, useState } from "react";
|
|
17
15
|
import { isValidElementType } from "react-is";
|
|
18
16
|
import { AlertFillIcon } from "@primer/octicons-react";
|
|
19
17
|
//#region src/TextInput/TextInput.tsx
|
|
20
18
|
const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leadingVisual: LeadingVisual, trailingVisual: TrailingVisual, trailingAction, block, className, contrast, disabled, loading, loaderPosition = "auto", loaderText = "Loading", monospace, validationStatus, size: sizeProp, onFocus, onBlur, variant: variantProp, width: widthProp, minWidth: minWidthProp, maxWidth: maxWidthProp, type = "text", required, characterLimit, onChange, value, defaultValue, "data-component": dataComponent, ...inputProps }, ref) => {
|
|
21
19
|
var _counter$isOverLimit;
|
|
22
20
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
23
|
-
const
|
|
24
|
-
const inputRef = useRef(null);
|
|
25
|
-
const mergedRef = useMergedRefs(inputRef, ref);
|
|
26
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(ref);
|
|
27
|
-
const readRef = mergedRefEnabled ? inputRef : providedOrCreatedRef;
|
|
28
|
-
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
21
|
+
const inputRef = useProvidedRefOrCreate(ref);
|
|
29
22
|
const isControlled = value !== void 0;
|
|
30
23
|
const [uncontrolledLength, setUncontrolledLength] = useState(() => defaultValue !== void 0 ? String(defaultValue).length : 0);
|
|
31
24
|
const currentLength = isControlled ? String(value).length : uncontrolledLength;
|
|
@@ -36,9 +29,9 @@ const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leading
|
|
|
36
29
|
const showTrailingLoadingIndicator = loading && (loaderPosition === "trailing" || Boolean(loaderPosition === "auto" && !LeadingVisual));
|
|
37
30
|
const isSegmentedInputType = type === "date" || type === "time" || type === "datetime-local";
|
|
38
31
|
const focusInput = (e) => {
|
|
39
|
-
if (e.target !==
|
|
40
|
-
var
|
|
41
|
-
(
|
|
32
|
+
if (e.target !== inputRef.current || !isSegmentedInputType) {
|
|
33
|
+
var _inputRef$current;
|
|
34
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
42
35
|
}
|
|
43
36
|
};
|
|
44
37
|
const leadingVisualId = useId();
|
|
@@ -95,7 +88,7 @@ const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leading
|
|
|
95
88
|
children: typeof LeadingVisual !== "string" && isValidElementType(LeadingVisual) ? /*#__PURE__*/ jsx(LeadingVisual, {}) : LeadingVisual
|
|
96
89
|
}),
|
|
97
90
|
/*#__PURE__*/ jsx(UnstyledTextInput, {
|
|
98
|
-
ref:
|
|
91
|
+
ref: inputRef,
|
|
99
92
|
disabled,
|
|
100
93
|
onFocus: handleInputFocus,
|
|
101
94
|
onBlur: handleInputBlur,
|
|
@@ -12,8 +12,8 @@ import { c } from "react-compiler-runtime";
|
|
|
12
12
|
import { clsx } from "clsx";
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
import React, { useRef, useState } from "react";
|
|
15
|
-
import { FocusKeys } from "@primer/behaviors";
|
|
16
15
|
import { isFocusable } from "@primer/behaviors/utils";
|
|
16
|
+
import { FocusKeys } from "@primer/behaviors";
|
|
17
17
|
import { isValidElementType } from "react-is";
|
|
18
18
|
//#region src/TextInputWithTokens/TextInputWithTokens.tsx
|
|
19
19
|
/**
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
2
|
import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
|
|
4
3
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
5
4
|
import { warning } from "../utils/warning.js";
|
|
6
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
7
5
|
import { invariant } from "../utils/invariant.js";
|
|
8
6
|
import Tooltip_module_css_default from "./Tooltip.module.css.js";
|
|
9
7
|
import VisuallyHidden from "../_VisuallyHidden.js";
|
|
@@ -82,12 +80,7 @@ const emptyKeybindingHints = [];
|
|
|
82
80
|
const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type = "description", children, id, className, keybindingHint = emptyKeybindingHints, delay = "short", _privateDisableTooltip = false, ...rest }, forwardedRef) => {
|
|
83
81
|
const tooltipId = useId$1(id);
|
|
84
82
|
const child = Children.only(children);
|
|
85
|
-
const
|
|
86
|
-
const triggerRef = useRef(null);
|
|
87
|
-
const mergedTriggerRef = useMergedRefs(triggerRef, forwardedRef);
|
|
88
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
|
|
89
|
-
const readTriggerRef = mergedRefEnabled ? triggerRef : providedOrCreatedRef;
|
|
90
|
-
const appliedTriggerRef = mergedRefEnabled ? mergedTriggerRef : providedOrCreatedRef;
|
|
83
|
+
const triggerRef = useProvidedRefOrCreate(forwardedRef);
|
|
91
84
|
const tooltipElRef = useRef(null);
|
|
92
85
|
const [calculatedDirection, setCalculatedDirection] = useState(direction);
|
|
93
86
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
@@ -95,9 +88,9 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
|
|
|
95
88
|
const { safeSetTimeout, safeClearTimeout } = useSafeTimeout();
|
|
96
89
|
const openTooltip = () => {
|
|
97
90
|
try {
|
|
98
|
-
if (tooltipElRef.current &&
|
|
91
|
+
if (tooltipElRef.current && triggerRef.current && tooltipElRef.current.hasAttribute("popover") && !tooltipElRef.current.matches(":popover-open") && !_privateDisableTooltip) {
|
|
99
92
|
const tooltip = tooltipElRef.current;
|
|
100
|
-
const trigger =
|
|
93
|
+
const trigger = triggerRef.current;
|
|
101
94
|
tooltip.showPopover();
|
|
102
95
|
setIsPopoverOpen(true);
|
|
103
96
|
const { top, left, anchorAlign, anchorSide } = getAnchoredPosition(tooltip, trigger, {
|
|
@@ -119,7 +112,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
|
|
|
119
112
|
openTimeoutRef.current = null;
|
|
120
113
|
}
|
|
121
114
|
try {
|
|
122
|
-
if (tooltipElRef.current &&
|
|
115
|
+
if (tooltipElRef.current && triggerRef.current && tooltipElRef.current.hasAttribute("popover") && tooltipElRef.current.matches(":popover-open")) {
|
|
123
116
|
tooltipElRef.current.hidePopover();
|
|
124
117
|
setIsPopoverOpen(false);
|
|
125
118
|
} else setIsPopoverOpen(false);
|
|
@@ -129,16 +122,16 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
|
|
|
129
122
|
};
|
|
130
123
|
const value = useMemo(() => ({ tooltipId }), [tooltipId]);
|
|
131
124
|
useEffect(() => {
|
|
132
|
-
if (!tooltipElRef.current || !
|
|
133
|
-
const isTriggerInteractive = isInteractive(
|
|
134
|
-
const triggerChildren =
|
|
125
|
+
if (!tooltipElRef.current || !triggerRef.current) return;
|
|
126
|
+
const isTriggerInteractive = isInteractive(triggerRef.current);
|
|
127
|
+
const triggerChildren = triggerRef.current.childNodes;
|
|
135
128
|
const hasInteractiveDescendant = Array.from(triggerChildren).some((child) => {
|
|
136
129
|
return child instanceof HTMLElement && isInteractive(child) || Array.from(child.childNodes).some((grandChild) => grandChild instanceof HTMLElement && isInteractive(grandChild));
|
|
137
130
|
});
|
|
138
131
|
!(isTriggerInteractive || hasInteractiveDescendant) && invariant(false, "The `Tooltip` component expects a single React element that contains interactive content. Consider using a `<button>` or equivalent interactive element instead.");
|
|
139
132
|
if (type === "label") {
|
|
140
|
-
const hasAriaLabel =
|
|
141
|
-
const hasAriaLabelInChildren = Array.from(
|
|
133
|
+
const hasAriaLabel = triggerRef.current.hasAttribute("aria-label");
|
|
134
|
+
const hasAriaLabelInChildren = Array.from(triggerRef.current.childNodes).some((child) => child instanceof HTMLElement && child.hasAttribute("aria-label"));
|
|
142
135
|
warning(hasAriaLabel || hasAriaLabelInChildren, "The label type `Tooltip` is going to be used here to label the trigger element. Please remove the aria-label from the trigger element.");
|
|
143
136
|
}
|
|
144
137
|
if (typeof window !== "undefined") {
|
|
@@ -147,7 +140,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
|
|
|
147
140
|
tooltipElRef.current.setAttribute("popover", "auto");
|
|
148
141
|
}, [
|
|
149
142
|
tooltipElRef,
|
|
150
|
-
|
|
143
|
+
triggerRef,
|
|
151
144
|
direction,
|
|
152
145
|
type
|
|
153
146
|
]);
|
|
@@ -164,7 +157,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
|
|
|
164
157
|
return /*#__PURE__*/ jsx(TooltipContext.Provider, {
|
|
165
158
|
value,
|
|
166
159
|
children: /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ React.isValidElement(child) && /*#__PURE__*/ React.cloneElement(child, {
|
|
167
|
-
ref:
|
|
160
|
+
ref: triggerRef,
|
|
168
161
|
"aria-describedby": (() => {
|
|
169
162
|
if (type !== "description") return child.props["aria-describedby"];
|
|
170
163
|
const existingDescribedBy = child.props["aria-describedby"];
|
|
@@ -191,12 +184,13 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
|
|
|
191
184
|
(_child$props$onFocus = (_child$props3 = child.props).onFocus) === null || _child$props$onFocus === void 0 || _child$props$onFocus.call(_child$props3, event);
|
|
192
185
|
},
|
|
193
186
|
onMouseOverCapture: (event) => {
|
|
187
|
+
const delayTime = delayTimeMap[delay] || 50;
|
|
194
188
|
openTimeoutRef.current = safeSetTimeout(() => {
|
|
195
189
|
var _child$props$onMouseE, _child$props4;
|
|
196
190
|
if (!openTimeoutRef.current) return;
|
|
197
191
|
openTooltip();
|
|
198
192
|
(_child$props$onMouseE = (_child$props4 = child.props).onMouseEnter) === null || _child$props$onMouseE === void 0 || _child$props$onMouseE.call(_child$props4, event);
|
|
199
|
-
},
|
|
193
|
+
}, delayTime);
|
|
200
194
|
},
|
|
201
195
|
onMouseLeave: (event) => {
|
|
202
196
|
var _child$props$onMouseL, _child$props5;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
2
|
+
import { isSlot } from "../utils/is-slot.js";
|
|
3
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
2
4
|
import Spinner from "../Spinner/Spinner.js";
|
|
3
5
|
import { AriaStatus } from "../live-region/AriaStatus.js";
|
|
4
6
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
@@ -10,8 +12,6 @@ import useSafeTimeout from "../hooks/useSafeTimeout.js";
|
|
|
10
12
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
11
13
|
import { IconButton } from "../Button/IconButton.js";
|
|
12
14
|
import { ButtonComponent } from "../Button/Button.js";
|
|
13
|
-
import { isSlot } from "../utils/is-slot.js";
|
|
14
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
15
15
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
16
16
|
import { ConfirmationDialog } from "../ConfirmationDialog/ConfirmationDialog.js";
|
|
17
17
|
import { ActionList } from "../ActionList/index.js";
|
|
@@ -349,7 +349,10 @@ const SubTree = ({ count, state, children, "aria-label": ariaLabel }) => {
|
|
|
349
349
|
});
|
|
350
350
|
setLoadingFocused(false);
|
|
351
351
|
}
|
|
352
|
-
} else if (state === "loading")
|
|
352
|
+
} else if (state === "loading") {
|
|
353
|
+
const parentName = getAccessibleName(parentElement);
|
|
354
|
+
announceUpdate(`${parentName} content loading`);
|
|
355
|
+
}
|
|
353
356
|
}, [
|
|
354
357
|
loadingFocused,
|
|
355
358
|
previousState,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useProvidedRefOrCreate } from "../../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import { useAnchoredPosition } from "../../hooks/useAnchoredPosition.js";
|
|
3
3
|
import { useId as useId$1 } from "../../hooks/useId.js";
|
|
4
|
+
import { isSlot } from "../../utils/is-slot.js";
|
|
5
|
+
import { useSlots } from "../../hooks/useSlots.js";
|
|
4
6
|
import Spinner from "../../Spinner/Spinner.js";
|
|
5
7
|
import { AriaStatus } from "../../live-region/AriaStatus.js";
|
|
6
8
|
import { invariant } from "../../utils/invariant.js";
|
|
7
9
|
import { IconButton } from "../../Button/IconButton.js";
|
|
8
10
|
import { ButtonComponent } from "../../Button/Button.js";
|
|
9
11
|
import { useResponsiveValue } from "../../hooks/useResponsiveValue.js";
|
|
10
|
-
import { isSlot } from "../../utils/is-slot.js";
|
|
11
|
-
import { useSlots } from "../../hooks/useSlots.js";
|
|
12
12
|
import { ActionListContainerContext } from "../../ActionList/ActionListContainerContext.js";
|
|
13
13
|
import Heading from "../../Heading/Heading.js";
|
|
14
14
|
import Link from "../../Link/Link.js";
|
|
@@ -73,7 +73,7 @@ type TabPanelProps = {
|
|
|
73
73
|
value: string;
|
|
74
74
|
};
|
|
75
75
|
type TabListHookProps<T extends HTMLElement> = TabListProps & {
|
|
76
|
-
/** Optional ref to use for the tablist. If none is provided, one will be generated automatically */ref?: React.
|
|
76
|
+
/** Optional ref to use for the tablist. If none is provided, one will be generated automatically */ref?: React.RefObject<T>;
|
|
77
77
|
};
|
|
78
78
|
type TabListHookResult<T extends HTMLElement> = {
|
|
79
79
|
/** Props to be spread onto the tablist element */tabListProps: {
|
|
@@ -81,7 +81,7 @@ type TabListHookResult<T extends HTMLElement> = {
|
|
|
81
81
|
'aria-orientation': AriaAttributes['aria-orientation'];
|
|
82
82
|
'aria-label': AriaAttributes['aria-label'];
|
|
83
83
|
'aria-labelledby': AriaAttributes['aria-labelledby'];
|
|
84
|
-
ref: React.
|
|
84
|
+
ref: React.RefObject<T | null>;
|
|
85
85
|
role: 'tablist';
|
|
86
86
|
};
|
|
87
87
|
};
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import { useMergedRefs } from "../../hooks/useMergedRefs.js";
|
|
2
1
|
import { useProvidedRefOrCreate } from "../../hooks/useProvidedRefOrCreate.js";
|
|
3
|
-
import { useFeatureFlag } from "../../FeatureFlags/useFeatureFlag.js";
|
|
4
2
|
import { c } from "react-compiler-runtime";
|
|
5
|
-
import { useRef } from "react";
|
|
6
3
|
//#region src/experimental/Tabs/useTabList.ts
|
|
7
4
|
function useTabList(props) {
|
|
8
5
|
const $ = c(9);
|
|
9
6
|
const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-orientation": ariaOrientation } = props;
|
|
10
|
-
const
|
|
11
|
-
const tabListRef = useRef(null);
|
|
12
|
-
const mergedRef = useMergedRefs(tabListRef, props.ref);
|
|
13
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(props.ref);
|
|
14
|
-
const readRef = mergedRefEnabled ? tabListRef : providedOrCreatedRef;
|
|
15
|
-
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
7
|
+
const ref = useProvidedRefOrCreate(props.ref);
|
|
16
8
|
let t0;
|
|
17
|
-
if ($[0] !== ariaOrientation || $[1] !==
|
|
9
|
+
if ($[0] !== ariaOrientation || $[1] !== ref) {
|
|
18
10
|
t0 = (event) => {
|
|
19
|
-
const { current: tablist } =
|
|
11
|
+
const { current: tablist } = ref;
|
|
20
12
|
if (tablist === null) return;
|
|
21
13
|
const tabs = getFocusableTabs(tablist);
|
|
22
14
|
const isVertical = ariaOrientation === "vertical";
|
|
@@ -41,25 +33,25 @@ function useTabList(props) {
|
|
|
41
33
|
}
|
|
42
34
|
};
|
|
43
35
|
$[0] = ariaOrientation;
|
|
44
|
-
$[1] =
|
|
36
|
+
$[1] = ref;
|
|
45
37
|
$[2] = t0;
|
|
46
38
|
} else t0 = $[2];
|
|
47
39
|
const onKeyDown = t0;
|
|
48
40
|
const t1 = ariaOrientation !== null && ariaOrientation !== void 0 ? ariaOrientation : "horizontal";
|
|
49
41
|
let t2;
|
|
50
|
-
if ($[3] !==
|
|
42
|
+
if ($[3] !== ariaLabel || $[4] !== ariaLabelledby || $[5] !== onKeyDown || $[6] !== ref || $[7] !== t1) {
|
|
51
43
|
t2 = { tabListProps: {
|
|
52
|
-
ref
|
|
44
|
+
ref,
|
|
53
45
|
"aria-label": ariaLabel,
|
|
54
46
|
"aria-labelledby": ariaLabelledby,
|
|
55
47
|
"aria-orientation": t1,
|
|
56
48
|
role: "tablist",
|
|
57
49
|
onKeyDown
|
|
58
50
|
} };
|
|
59
|
-
$[3] =
|
|
60
|
-
$[4] =
|
|
61
|
-
$[5] =
|
|
62
|
-
$[6] =
|
|
51
|
+
$[3] = ariaLabel;
|
|
52
|
+
$[4] = ariaLabelledby;
|
|
53
|
+
$[5] = onKeyDown;
|
|
54
|
+
$[6] = ref;
|
|
63
55
|
$[7] = t1;
|
|
64
56
|
$[8] = t2;
|
|
65
57
|
} else t2 = $[8];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import useIsomorphicLayoutEffect from "../../utils/useIsomorphicLayoutEffect.js";
|
|
2
2
|
import { useResizeObserver } from "../../hooks/useResizeObserver.js";
|
|
3
3
|
import { useId as useId$1 } from "../../hooks/useId.js";
|
|
4
|
-
import { invariant } from "../../utils/invariant.js";
|
|
5
4
|
import { isSlot } from "../../utils/is-slot.js";
|
|
5
|
+
import { invariant } from "../../utils/invariant.js";
|
|
6
6
|
import { createComponent } from "../../utils/create-component.js";
|
|
7
7
|
import { UnderlineItem, UnderlineItemList, UnderlineWrapper } from "../../internal/components/UnderlineTabbedInterface.js";
|
|
8
8
|
import UnderlinePanels_module_css_default from "./UnderlinePanels.module.css.js";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
2
3
|
import { Announce } from "../live-region/Announce.js";
|
|
3
4
|
import { AriaAlert } from "../live-region/AriaAlert.js";
|
|
4
5
|
import { AriaStatus } from "../live-region/AriaStatus.js";
|
|
5
6
|
import { ButtonBase } from "../Button/ButtonBase.js";
|
|
6
|
-
import { DefaultFeatureFlags } from "../FeatureFlags/DefaultFeatureFlags.js";
|
|
7
|
-
import { FeatureFlags } from "../FeatureFlags/FeatureFlags.js";
|
|
8
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
9
7
|
import { KeybindingHint } from "../KeybindingHint/KeybindingHint.js";
|
|
10
8
|
import { getAccessibleKeybindingHintString } from "../KeybindingHint/utils.js";
|
|
11
9
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
12
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
13
10
|
import { useOverflow } from "../hooks/useOverflow.js";
|
|
14
11
|
import { ScrollableRegion } from "../ScrollableRegion/ScrollableRegion.js";
|
|
15
12
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
13
|
+
import { DefaultFeatureFlags } from "../FeatureFlags/DefaultFeatureFlags.js";
|
|
14
|
+
import { FeatureFlags } from "../FeatureFlags/FeatureFlags.js";
|
|
15
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
16
16
|
import { Stack } from "../Stack/index.js";
|
|
17
17
|
import { SkeletonBox } from "../Skeleton/SkeletonBox.js";
|
|
18
18
|
import { FilteredActionListLoadingTypes } from "../FilteredActionList/constants.js";
|
|
@@ -106,6 +106,10 @@ function useAnchoredPosition(settings, dependencies = []) {
|
|
|
106
106
|
}, [updatePosition]);
|
|
107
107
|
useResizeObserver(updatePosition, void 0, [], enabled);
|
|
108
108
|
useResizeObserver(updatePosition, floatingElementRef, [], enabled);
|
|
109
|
+
const scrollAncestorsCacheRef = React.useRef({
|
|
110
|
+
anchor: null,
|
|
111
|
+
scrollables: []
|
|
112
|
+
});
|
|
109
113
|
React.useEffect(() => {
|
|
110
114
|
if (!enabled) return;
|
|
111
115
|
const anchorEl = anchorElementRef.current;
|
|
@@ -118,7 +122,16 @@ function useAnchoredPosition(settings, dependencies = []) {
|
|
|
118
122
|
updatePosition();
|
|
119
123
|
});
|
|
120
124
|
};
|
|
121
|
-
const
|
|
125
|
+
const cache = scrollAncestorsCacheRef.current;
|
|
126
|
+
let scrollables;
|
|
127
|
+
if (cache.anchor === anchorEl) scrollables = cache.scrollables;
|
|
128
|
+
else {
|
|
129
|
+
scrollables = getScrollableAncestors(anchorEl);
|
|
130
|
+
scrollAncestorsCacheRef.current = {
|
|
131
|
+
anchor: anchorEl,
|
|
132
|
+
scrollables
|
|
133
|
+
};
|
|
134
|
+
}
|
|
122
135
|
for (const scrollable of scrollables) scrollable.addEventListener("scroll", handleScroll);
|
|
123
136
|
return () => {
|
|
124
137
|
for (const scrollable of scrollables) scrollable.removeEventListener("scroll", handleScroll);
|
package/dist/hooks/useDialog.js
CHANGED
|
@@ -91,7 +91,8 @@ function useDialog(t0) {
|
|
|
91
91
|
let t8;
|
|
92
92
|
if ($[15] !== getFocusableItem) {
|
|
93
93
|
t8 = (e_1) => {
|
|
94
|
-
const
|
|
94
|
+
const movement_0 = e_1.shiftKey ? -1 : 1;
|
|
95
|
+
const focusableItem_0 = getFocusableItem(e_1, movement_0);
|
|
95
96
|
if (!focusableItem_0) return;
|
|
96
97
|
focusableItem_0.focus();
|
|
97
98
|
};
|
|
@@ -17,18 +17,18 @@ import { ForwardedRef, Ref } from "react";
|
|
|
17
17
|
* // React 18
|
|
18
18
|
* const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
|
|
19
19
|
* const ref = useRef<HTMLButtonElement>(null)
|
|
20
|
-
* const
|
|
20
|
+
* const combinedRef = useMergedRefs(forwardedRef, ref)
|
|
21
21
|
*
|
|
22
|
-
* return <button ref={
|
|
22
|
+
* return <button ref={combinedRef} />
|
|
23
23
|
* })
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* // React 19
|
|
27
27
|
* const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
|
|
28
28
|
* const ref = useRef<HTMLButtonElement>(null)
|
|
29
|
-
* const
|
|
29
|
+
* const combinedRef = useMergedRefs(externalRef, ref)
|
|
30
30
|
*
|
|
31
|
-
* return <button ref={
|
|
31
|
+
* return <button ref={combinedRef} />
|
|
32
32
|
* }
|
|
33
33
|
*/
|
|
34
34
|
declare function useMergedRefs<T>(refA: Ref$1<T | null>, refB: Ref$1<T | null>): (value: T | null) => (() => void) | undefined;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { isExperimentalReactVersion, reactMajorVersion } from "../utils/environment.js";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import
|
|
3
|
+
import "react";
|
|
4
4
|
//#region src/hooks/useMergedRefs.ts
|
|
5
|
-
var _version$split$;
|
|
6
|
-
const majorReactVersion = parseInt((_version$split$ = version.split(".")[0]) !== null && _version$split$ !== void 0 ? _version$split$ : "18", 10);
|
|
7
5
|
/**
|
|
8
6
|
* Cleanup functions for refs were introduced in React 19. For feature detection,
|
|
9
7
|
* we look to see if current version of React is >= 19 or if it is an
|
|
@@ -28,18 +26,18 @@ const supportsRefCleanup = reactMajorVersion >= 19 || isExperimentalReactVersion
|
|
|
28
26
|
* // React 18
|
|
29
27
|
* const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
|
|
30
28
|
* const ref = useRef<HTMLButtonElement>(null)
|
|
31
|
-
* const
|
|
29
|
+
* const combinedRef = useMergedRefs(forwardedRef, ref)
|
|
32
30
|
*
|
|
33
|
-
* return <button ref={
|
|
31
|
+
* return <button ref={combinedRef} />
|
|
34
32
|
* })
|
|
35
33
|
*
|
|
36
34
|
* @example
|
|
37
35
|
* // React 19
|
|
38
36
|
* const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
|
|
39
37
|
* const ref = useRef<HTMLButtonElement>(null)
|
|
40
|
-
* const
|
|
38
|
+
* const combinedRef = useMergedRefs(externalRef, ref)
|
|
41
39
|
*
|
|
42
|
-
* return <button ref={
|
|
40
|
+
* return <button ref={combinedRef} />
|
|
43
41
|
* }
|
|
44
42
|
*/
|
|
45
43
|
function useMergedRefs(refA, refB) {
|
|
@@ -50,7 +48,6 @@ function useMergedRefs(refA, refB) {
|
|
|
50
48
|
const cleanupA = setRef(refA, value);
|
|
51
49
|
const cleanupB = setRef(refB, value);
|
|
52
50
|
if (!supportsRefCleanup) return;
|
|
53
|
-
if (majorReactVersion <= 18) return;
|
|
54
51
|
return () => {
|
|
55
52
|
if (cleanupA) cleanupA();
|
|
56
53
|
else setRef(refA, null);
|
|
@@ -9,14 +9,17 @@ import React from "react";
|
|
|
9
9
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
10
10
|
* @type TRef The type of the RefObject which should be created.
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
13
|
-
*
|
|
14
|
-
* {@linkcode useMergedRefs} instead.
|
|
12
|
+
* @deprecated This hook is incompatible with forwarded callback refs. Prefer `useMergedRefs` with an internally
|
|
13
|
+
* created ref instead.
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* ```diff
|
|
16
|
+
* - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
|
|
17
|
+
* + const ref = useRef(null)
|
|
18
|
+
* + const mergedRef = useMergedRefs(forwardedRef, ref)
|
|
19
|
+
*
|
|
20
|
+
* - return <div ref={ref} />
|
|
21
|
+
* + return <div ref={mergedRef} />
|
|
22
|
+
* ```
|
|
20
23
|
*/
|
|
21
24
|
declare function useProvidedRefOrCreate<TRef>(providedRef?: React.RefObject<TRef | null>): React.RefObject<TRef | null>;
|
|
22
25
|
//#endregion
|
|
@@ -8,14 +8,17 @@ import React from "react";
|
|
|
8
8
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
9
9
|
* @type TRef The type of the RefObject which should be created.
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
13
|
-
* {@linkcode useMergedRefs} instead.
|
|
11
|
+
* @deprecated This hook is incompatible with forwarded callback refs. Prefer `useMergedRefs` with an internally
|
|
12
|
+
* created ref instead.
|
|
14
13
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* ```diff
|
|
15
|
+
* - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
|
|
16
|
+
* + const ref = useRef(null)
|
|
17
|
+
* + const mergedRef = useMergedRefs(forwardedRef, ref)
|
|
18
|
+
*
|
|
19
|
+
* - return <div ref={ref} />
|
|
20
|
+
* + return <div ref={mergedRef} />
|
|
21
|
+
* ```
|
|
19
22
|
*/
|
|
20
23
|
function useProvidedRefOrCreate(providedRef) {
|
|
21
24
|
const createdRef = React.useRef(null);
|
|
@@ -15,7 +15,8 @@ function useScrollFlash(scrollContainerRef) {
|
|
|
15
15
|
if (!scrollContainer) return;
|
|
16
16
|
const id = requestAnimationFrame(() => {
|
|
17
17
|
const currentScroll = scrollContainer.scrollTop;
|
|
18
|
-
|
|
18
|
+
const altScroll = currentScroll < 1 ? currentScroll + 1 : currentScroll - 1;
|
|
19
|
+
scrollContainer.scrollTop = altScroll;
|
|
19
20
|
scrollContainer.scrollTop = currentScroll;
|
|
20
21
|
});
|
|
21
22
|
return () => cancelAnimationFrame(id);
|