@graphprotocol/gds-react 0.1.2 → 0.2.0
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/dist/GDSProvider.d.ts +12 -10
- package/dist/GDSProvider.d.ts.map +1 -1
- package/dist/GDSProvider.js +10 -8
- package/dist/GDSProvider.js.map +1 -1
- package/dist/components/Address.js +2 -2
- package/dist/components/Address.meta.d.ts +1 -13
- package/dist/components/Address.meta.d.ts.map +1 -1
- package/dist/components/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar.js +2 -10
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Avatar.meta.d.ts +0 -2
- package/dist/components/Avatar.meta.d.ts.map +1 -1
- package/dist/components/AvatarGroup.meta.d.ts +8 -2
- package/dist/components/AvatarGroup.meta.d.ts.map +1 -1
- package/dist/components/Breadcrumbs.meta.d.ts +2 -3
- package/dist/components/Breadcrumbs.meta.d.ts.map +1 -1
- package/dist/components/Breadcrumbs.meta.js +3 -1
- package/dist/components/Breadcrumbs.meta.js.map +1 -1
- package/dist/components/Breadcrumbs.parts.d.ts.map +1 -1
- package/dist/components/Breadcrumbs.parts.js +13 -21
- package/dist/components/Breadcrumbs.parts.js.map +1 -1
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +10 -9
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Button.meta.d.ts +1 -4
- package/dist/components/Button.meta.d.ts.map +1 -1
- package/dist/components/ButtonGroup.d.ts.map +1 -1
- package/dist/components/ButtonGroup.js +1 -5
- package/dist/components/ButtonGroup.js.map +1 -1
- package/dist/components/ButtonGroup.meta.d.ts +1 -5
- package/dist/components/ButtonGroup.meta.d.ts.map +1 -1
- package/dist/components/ButtonGroup.meta.js +8 -0
- package/dist/components/ButtonGroup.meta.js.map +1 -1
- package/dist/components/Card.meta.d.ts +1 -2
- package/dist/components/Card.meta.d.ts.map +1 -1
- package/dist/components/Card.meta.js +1 -0
- package/dist/components/Card.meta.js.map +1 -1
- package/dist/components/Checkbox.meta.d.ts +1 -6
- package/dist/components/Checkbox.meta.d.ts.map +1 -1
- package/dist/components/Checkbox.meta.js +1 -5
- package/dist/components/Checkbox.meta.js.map +1 -1
- package/dist/components/Chip.meta.d.ts +2 -4
- package/dist/components/Chip.meta.d.ts.map +1 -1
- package/dist/components/Chip.parts.d.ts.map +1 -1
- package/dist/components/Chip.parts.js +1 -9
- package/dist/components/Chip.parts.js.map +1 -1
- package/dist/components/Cluster.meta.d.ts +8 -2
- package/dist/components/Cluster.meta.d.ts.map +1 -1
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.meta.d.ts +2 -4
- package/dist/components/CodeBlock.meta.d.ts.map +1 -1
- package/dist/components/CodeBlock.parts.d.ts +6 -7
- package/dist/components/CodeBlock.parts.d.ts.map +1 -1
- package/dist/components/CodeBlock.parts.js +28 -10
- package/dist/components/CodeBlock.parts.js.map +1 -1
- package/dist/components/CodeInline.js +3 -3
- package/dist/components/CodeInline.meta.d.ts +1 -1
- package/dist/components/CodeInline.meta.d.ts.map +1 -1
- package/dist/components/CopyButton.d.ts.map +1 -1
- package/dist/components/CopyButton.js +2 -4
- package/dist/components/CopyButton.js.map +1 -1
- package/dist/components/CopyButton.meta.d.ts +1 -12
- package/dist/components/CopyButton.meta.d.ts.map +1 -1
- package/dist/components/CopyButton.meta.js +1 -6
- package/dist/components/CopyButton.meta.js.map +1 -1
- package/dist/components/CurrencyInput.meta.d.ts +1 -6
- package/dist/components/CurrencyInput.meta.d.ts.map +1 -1
- package/dist/components/CurrencyInput.meta.js +1 -5
- package/dist/components/CurrencyInput.meta.js.map +1 -1
- package/dist/components/DescriptionList.meta.d.ts +2 -5
- package/dist/components/DescriptionList.meta.d.ts.map +1 -1
- package/dist/components/DescriptionList.parts.d.ts +3 -0
- package/dist/components/DescriptionList.parts.d.ts.map +1 -1
- package/dist/components/DescriptionList.parts.js +1 -0
- package/dist/components/DescriptionList.parts.js.map +1 -1
- package/dist/components/Divider.meta.d.ts +1 -3
- package/dist/components/Divider.meta.d.ts.map +1 -1
- package/dist/components/Icon.js +4 -4
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/Icon.meta.d.ts +0 -2
- package/dist/components/Icon.meta.d.ts.map +1 -1
- package/dist/components/Icon.meta.js +1 -0
- package/dist/components/Icon.meta.js.map +1 -1
- package/dist/components/Input.d.ts +5 -4
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +1 -0
- package/dist/components/Input.js.map +1 -1
- package/dist/components/Input.meta.d.ts +1 -6
- package/dist/components/Input.meta.d.ts.map +1 -1
- package/dist/components/Input.meta.js +1 -5
- package/dist/components/Input.meta.js.map +1 -1
- package/dist/components/Keyboard.js +1 -1
- package/dist/components/Keyboard.meta.d.ts +0 -1
- package/dist/components/Keyboard.meta.d.ts.map +1 -1
- package/dist/components/Label.meta.d.ts +1 -3
- package/dist/components/Label.meta.d.ts.map +1 -1
- package/dist/components/Link.d.ts +1 -1
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +1 -2
- package/dist/components/Link.js.map +1 -1
- package/dist/components/Link.meta.d.ts +1 -2
- package/dist/components/Link.meta.d.ts.map +1 -1
- package/dist/components/Link.meta.js +1 -0
- package/dist/components/Link.meta.js.map +1 -1
- package/dist/components/Menu.meta.d.ts +31 -2
- package/dist/components/Menu.meta.d.ts.map +1 -1
- package/dist/components/Menu.meta.js +39 -1
- package/dist/components/Menu.meta.js.map +1 -1
- package/dist/components/Menu.parts.d.ts +23 -32
- package/dist/components/Menu.parts.d.ts.map +1 -1
- package/dist/components/Menu.parts.js +284 -303
- package/dist/components/Menu.parts.js.map +1 -1
- package/dist/components/Modal.d.ts +1 -1
- package/dist/components/Modal.meta.d.ts +1 -3
- package/dist/components/Modal.meta.d.ts.map +1 -1
- package/dist/components/Modal.meta.js +1 -1
- package/dist/components/Modal.meta.js.map +1 -1
- package/dist/components/Modal.parts.d.ts +14 -15
- package/dist/components/Modal.parts.d.ts.map +1 -1
- package/dist/components/Modal.parts.js +36 -32
- package/dist/components/Modal.parts.js.map +1 -1
- package/dist/components/OTCInput.js +1 -1
- package/dist/components/OTCInput.meta.d.ts +1 -6
- package/dist/components/OTCInput.meta.d.ts.map +1 -1
- package/dist/components/OTCInput.meta.js +1 -5
- package/dist/components/OTCInput.meta.js.map +1 -1
- package/dist/components/Radio.meta.d.ts +1 -6
- package/dist/components/Radio.meta.d.ts.map +1 -1
- package/dist/components/Radio.meta.js +1 -5
- package/dist/components/Radio.meta.js.map +1 -1
- package/dist/components/Search.meta.d.ts +1 -3
- package/dist/components/Search.meta.d.ts.map +1 -1
- package/dist/components/SegmentedControl.meta.d.ts +2 -3
- package/dist/components/SegmentedControl.meta.d.ts.map +1 -1
- package/dist/components/SegmentedControl.meta.js +3 -1
- package/dist/components/SegmentedControl.meta.js.map +1 -1
- package/dist/components/SegmentedControl.parts.d.ts.map +1 -1
- package/dist/components/SegmentedControl.parts.js +4 -9
- package/dist/components/SegmentedControl.parts.js.map +1 -1
- package/dist/components/Status.meta.d.ts +0 -2
- package/dist/components/Status.meta.d.ts.map +1 -1
- package/dist/components/Stepper.meta.d.ts +1 -2
- package/dist/components/Stepper.meta.d.ts.map +1 -1
- package/dist/components/Stepper.meta.js +1 -0
- package/dist/components/Stepper.meta.js.map +1 -1
- package/dist/components/Stepper.parts.d.ts.map +1 -1
- package/dist/components/Stepper.parts.js +1 -1
- package/dist/components/Stepper.parts.js.map +1 -1
- package/dist/components/Switch.meta.d.ts +1 -6
- package/dist/components/Switch.meta.d.ts.map +1 -1
- package/dist/components/Switch.meta.js +1 -5
- package/dist/components/Switch.meta.js.map +1 -1
- package/dist/components/TabSet.meta.d.ts +2 -5
- package/dist/components/TabSet.meta.d.ts.map +1 -1
- package/dist/components/TabSet.meta.js +3 -1
- package/dist/components/TabSet.meta.js.map +1 -1
- package/dist/components/Tag.meta.d.ts +0 -2
- package/dist/components/Tag.meta.d.ts.map +1 -1
- package/dist/components/TextArea.meta.d.ts +1 -6
- package/dist/components/TextArea.meta.d.ts.map +1 -1
- package/dist/components/TextArea.meta.js +1 -5
- package/dist/components/TextArea.meta.js.map +1 -1
- package/dist/components/ToggleButton.js +2 -2
- package/dist/components/ToggleButton.js.map +1 -1
- package/dist/components/ToggleButton.meta.d.ts +1 -12
- package/dist/components/ToggleButton.meta.d.ts.map +1 -1
- package/dist/components/ToggleButton.meta.js +1 -6
- package/dist/components/ToggleButton.meta.js.map +1 -1
- package/dist/components/Tooltip.d.ts +2 -2
- package/dist/components/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip.js +2 -2
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/Tooltip.meta.d.ts +12 -7
- package/dist/components/Tooltip.meta.d.ts.map +1 -1
- package/dist/components/Tooltip.meta.js +13 -2
- package/dist/components/Tooltip.meta.js.map +1 -1
- package/dist/components/Tooltip.parts.d.ts +20 -20
- package/dist/components/Tooltip.parts.d.ts.map +1 -1
- package/dist/components/Tooltip.parts.js +129 -88
- package/dist/components/Tooltip.parts.js.map +1 -1
- package/dist/components/base/Addon.meta.d.ts +1 -1
- package/dist/components/base/Addon.meta.d.ts.map +1 -1
- package/dist/components/base/Addon.meta.js +3 -1
- package/dist/components/base/Addon.meta.js.map +1 -1
- package/dist/components/base/ButtonOrLink.d.ts +1 -1
- package/dist/components/base/ButtonOrLink.parts.d.ts +6 -5
- package/dist/components/base/ButtonOrLink.parts.d.ts.map +1 -1
- package/dist/components/base/ButtonOrLink.parts.js +28 -31
- package/dist/components/base/ButtonOrLink.parts.js.map +1 -1
- package/dist/components/base/Checkable.meta.d.ts +1 -2
- package/dist/components/base/Checkable.meta.d.ts.map +1 -1
- package/dist/components/base/Checkable.parts.d.ts +6 -6
- package/dist/components/base/Checkable.parts.d.ts.map +1 -1
- package/dist/components/base/Checkable.parts.js +2 -2
- package/dist/components/base/Checkable.parts.js.map +1 -1
- package/dist/components/base/Field.meta.d.ts +1 -2
- package/dist/components/base/Field.meta.d.ts.map +1 -1
- package/dist/components/base/Field.parts.d.ts +5 -4
- package/dist/components/base/Field.parts.d.ts.map +1 -1
- package/dist/components/base/Field.parts.js +1 -1
- package/dist/components/base/Field.parts.js.map +1 -1
- package/dist/components/base/MaybeButtonOrLink.d.ts +1 -1
- package/dist/components/base/MaybeButtonOrLink.d.ts.map +1 -1
- package/dist/components/base/Portal.d.ts +1 -1
- package/dist/components/base/Portal.d.ts.map +1 -1
- package/dist/components/base/Portal.js +3 -6
- package/dist/components/base/Portal.js.map +1 -1
- package/dist/components/base/Render.d.ts +21 -6
- package/dist/components/base/Render.d.ts.map +1 -1
- package/dist/components/base/Render.js +3 -2
- package/dist/components/base/Render.js.map +1 -1
- package/dist/components/base/Transition.js +2 -2
- package/dist/components/base/Transition.meta.d.ts +1 -1
- package/dist/components/base/Transition.meta.d.ts.map +1 -1
- package/dist/components/base/Transition.meta.js +1 -0
- package/dist/components/base/Transition.meta.js.map +1 -1
- package/dist/components/base/index.d.ts +1 -2
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/base/index.js +1 -2
- package/dist/components/base/index.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useCSSProp.d.ts.map +1 -1
- package/dist/hooks/useCSSProp.js +6 -6
- package/dist/hooks/useCSSProp.js.map +1 -1
- package/dist/hooks/useCSSProps.d.ts +11 -13
- package/dist/hooks/useCSSProps.d.ts.map +1 -1
- package/dist/hooks/useCSSProps.js +11 -19
- package/dist/hooks/useCSSProps.js.map +1 -1
- package/dist/hooks/useCSSPropsPolyfill.d.ts +1 -1
- package/dist/hooks/useCSSPropsPolyfill.d.ts.map +1 -1
- package/dist/hooks/useCSSPropsPolyfill.js +12 -20
- package/dist/hooks/useCSSPropsPolyfill.js.map +1 -1
- package/dist/hooks/useCSSState.d.ts.map +1 -1
- package/dist/hooks/useCSSState.js +7 -3
- package/dist/hooks/useCSSState.js.map +1 -1
- package/dist/hooks/useEffectWithRefDeps.d.ts +2 -2
- package/dist/hooks/useEffectWithRefDeps.d.ts.map +1 -1
- package/dist/hooks/useEffectWithRefDeps.js +1 -1
- package/dist/hooks/useEffectWithRefDeps.js.map +1 -1
- package/dist/hooks/useFirstRender.d.ts +14 -0
- package/dist/hooks/useFirstRender.d.ts.map +1 -0
- package/dist/hooks/useFirstRender.js +20 -0
- package/dist/hooks/useFirstRender.js.map +1 -0
- package/dist/hooks/useGDS.d.ts +1 -1
- package/dist/hooks/usePrevious.d.ts +6 -4
- package/dist/hooks/usePrevious.d.ts.map +1 -1
- package/dist/hooks/usePrevious.js +6 -4
- package/dist/hooks/usePrevious.js.map +1 -1
- package/dist/hooks/useRefWithInit.d.ts +2 -2
- package/dist/hooks/useRefWithInit.d.ts.map +1 -1
- package/dist/hooks/useRefWithInit.js.map +1 -1
- package/dist/hooks/useStyleObserver.d.ts +2 -2
- package/dist/hooks/useStyleObserver.d.ts.map +1 -1
- package/dist/hooks/useStyleObserver.js.map +1 -1
- package/dist/icons/CalendarDynamicIcon.d.ts +8 -5
- package/dist/icons/CalendarDynamicIcon.d.ts.map +1 -1
- package/dist/icons/CalendarDynamicIcon.js +5 -2
- package/dist/icons/CalendarDynamicIcon.js.map +1 -1
- package/dist/icons/CopyInteractiveIcon.d.ts +5 -4
- package/dist/icons/CopyInteractiveIcon.d.ts.map +1 -1
- package/dist/icons/CopyInteractiveIcon.js +2 -2
- package/dist/icons/CopyInteractiveIcon.js.map +1 -1
- package/dist/icons/SidebarLeftInteractiveIcon.d.ts +4 -3
- package/dist/icons/SidebarLeftInteractiveIcon.d.ts.map +1 -1
- package/dist/icons/SidebarLeftInteractiveIcon.js +2 -2
- package/dist/icons/SidebarLeftInteractiveIcon.js.map +1 -1
- package/dist/icons/SidebarRightInteractiveIcon.d.ts +4 -3
- package/dist/icons/SidebarRightInteractiveIcon.d.ts.map +1 -1
- package/dist/icons/SidebarRightInteractiveIcon.js +2 -2
- package/dist/icons/SidebarRightInteractiveIcon.js.map +1 -1
- package/dist/tailwind-plugin.js +5 -5
- package/dist/tailwind-plugin.js.map +1 -1
- package/dist/utils/cn.d.ts +3 -1
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/cn.js +3 -1
- package/dist/utils/cn.js.map +1 -1
- package/dist/utils/getCSSPropsAttributes.d.ts +10 -3
- package/dist/utils/getCSSPropsAttributes.d.ts.map +1 -1
- package/dist/utils/getCSSPropsAttributes.js +4 -5
- package/dist/utils/getCSSPropsAttributes.js.map +1 -1
- package/dist/utils/splitProps.d.ts +1 -4
- package/dist/utils/splitProps.d.ts.map +1 -1
- package/dist/utils/splitProps.js +2 -7
- package/dist/utils/splitProps.js.map +1 -1
- package/dist/utils/trimReactNode.d.ts +10 -8
- package/dist/utils/trimReactNode.d.ts.map +1 -1
- package/dist/utils/trimReactNode.js +10 -8
- package/dist/utils/trimReactNode.js.map +1 -1
- package/package.json +17 -17
- package/src/GDSProvider.tsx +11 -9
- package/src/components/Address.tsx +2 -2
- package/src/components/Avatar.tsx +5 -10
- package/src/components/Breadcrumbs.meta.ts +3 -1
- package/src/components/Breadcrumbs.parts.tsx +16 -28
- package/src/components/Button.tsx +14 -10
- package/src/components/ButtonGroup.meta.ts +8 -0
- package/src/components/ButtonGroup.tsx +1 -5
- package/src/components/Card.meta.ts +1 -0
- package/src/components/Checkbox.meta.ts +1 -5
- package/src/components/Chip.parts.tsx +1 -11
- package/src/components/CodeBlock.parts.tsx +75 -50
- package/src/components/CodeInline.tsx +3 -3
- package/src/components/CopyButton.meta.ts +1 -6
- package/src/components/CopyButton.tsx +3 -4
- package/src/components/CurrencyInput.meta.ts +1 -5
- package/src/components/DescriptionList.parts.tsx +1 -0
- package/src/components/Icon.meta.ts +1 -0
- package/src/components/Icon.tsx +4 -4
- package/src/components/Input.meta.ts +1 -5
- package/src/components/Input.tsx +5 -6
- package/src/components/Keyboard.tsx +1 -1
- package/src/components/Link.meta.ts +1 -0
- package/src/components/Link.tsx +2 -3
- package/src/components/Menu.meta.ts +39 -1
- package/src/components/Menu.parts.tsx +553 -549
- package/src/components/Modal.meta.ts +1 -1
- package/src/components/Modal.parts.tsx +67 -68
- package/src/components/OTCInput.meta.ts +1 -5
- package/src/components/OTCInput.tsx +1 -1
- package/src/components/Radio.meta.ts +1 -5
- package/src/components/SegmentedControl.meta.ts +3 -1
- package/src/components/SegmentedControl.parts.tsx +7 -10
- package/src/components/Stepper.meta.ts +1 -0
- package/src/components/Stepper.parts.tsx +3 -1
- package/src/components/Switch.meta.ts +1 -5
- package/src/components/TabSet.meta.ts +3 -1
- package/src/components/TextArea.meta.ts +1 -5
- package/src/components/ToggleButton.meta.ts +1 -6
- package/src/components/ToggleButton.tsx +1 -1
- package/src/components/Tooltip.meta.ts +13 -2
- package/src/components/Tooltip.parts.tsx +215 -158
- package/src/components/Tooltip.tsx +2 -2
- package/src/components/base/Addon.meta.ts +3 -1
- package/src/components/base/ButtonOrLink.parts.tsx +52 -51
- package/src/components/base/Checkable.parts.tsx +6 -13
- package/src/components/base/Field.parts.tsx +5 -5
- package/src/components/base/Portal.tsx +5 -7
- package/src/components/base/Render.tsx +37 -15
- package/src/components/base/Transition.meta.ts +1 -0
- package/src/components/base/Transition.tsx +2 -2
- package/src/components/base/index.ts +8 -2
- package/src/components/index.ts +1 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useCSSProp.ts +6 -8
- package/src/hooks/useCSSProps.ts +13 -22
- package/src/hooks/useCSSPropsPolyfill.ts +15 -23
- package/src/hooks/useCSSState.ts +11 -6
- package/src/hooks/useEffectWithRefDeps.ts +2 -2
- package/src/hooks/useFirstRender.ts +36 -0
- package/src/hooks/usePrevious.ts +6 -4
- package/src/hooks/useRefWithInit.ts +2 -2
- package/src/hooks/useStyleObserver.ts +5 -1
- package/src/icons/CalendarDynamicIcon.tsx +16 -6
- package/src/icons/CopyInteractiveIcon.tsx +10 -5
- package/src/icons/SidebarLeftInteractiveIcon.tsx +9 -5
- package/src/icons/SidebarRightInteractiveIcon.tsx +9 -5
- package/src/tailwind-plugin.ts +5 -5
- package/src/utils/cn.ts +3 -1
- package/src/utils/getCSSPropsAttributes.ts +13 -8
- package/src/utils/splitProps.ts +9 -9
- package/src/utils/trimReactNode.tsx +10 -8
- package/dist/components/base/ButtonOrLink.meta.d.ts +0 -2
- package/dist/components/base/ButtonOrLink.meta.d.ts.map +0 -1
- package/dist/components/base/ButtonOrLink.meta.js +0 -6
- package/dist/components/base/ButtonOrLink.meta.js.map +0 -1
- package/src/components/base/ButtonOrLink.meta.ts +0 -6
|
@@ -2,7 +2,7 @@ import { createComponent } from '@graphprotocol/gds-css'
|
|
|
2
2
|
|
|
3
3
|
export const ModalMeta = createComponent('Modal', {
|
|
4
4
|
cssProps: {
|
|
5
|
-
/** @default 'dialog' */
|
|
5
|
+
/** @default 'dialog' // or on small screens (i.e. `max-xs`), 'drawer' */
|
|
6
6
|
variant: {
|
|
7
7
|
type: 'values',
|
|
8
8
|
values: ['dialog', 'drawer'],
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
useRef,
|
|
8
8
|
useState,
|
|
9
9
|
type ComponentProps,
|
|
10
|
-
type ReactElement,
|
|
11
10
|
type ReactNode,
|
|
12
11
|
} from 'react'
|
|
13
12
|
import { Dialog } from '@base-ui/react/dialog'
|
|
@@ -18,12 +17,14 @@ import { ArrowLeftIcon, XIcon } from '@graphprotocol/gds-react/icons'
|
|
|
18
17
|
import { useControlled, useCSSPropsPolyfill, useGDS } from '../hooks/index.ts'
|
|
19
18
|
import { cn, getCSSPropsAttributes } from '../utils/index.ts'
|
|
20
19
|
import { Portal } from './base/Portal.tsx'
|
|
20
|
+
import type { RenderProp } from './base/Render.tsx'
|
|
21
21
|
import { Transition } from './base/Transition.tsx'
|
|
22
22
|
import { Button } from './Button.tsx'
|
|
23
23
|
import { ButtonGroup } from './ButtonGroup.tsx'
|
|
24
24
|
import { Divider } from './Divider.tsx'
|
|
25
25
|
import { ModalMeta } from './Modal.meta.ts'
|
|
26
26
|
import { Stepper, type StepperProps } from './Stepper.tsx'
|
|
27
|
+
import { Tooltip } from './Tooltip.tsx'
|
|
27
28
|
|
|
28
29
|
const ModalContext = createContext<{
|
|
29
30
|
open: boolean
|
|
@@ -42,35 +43,29 @@ export interface ModalProps<
|
|
|
42
43
|
Steps extends readonly string[] ? Steps[number] : number,
|
|
43
44
|
>
|
|
44
45
|
extends Omit<ComponentProps<'div'>, 'children'>, GDSComponentProps<typeof ModalMeta> {
|
|
45
|
-
open?: boolean | undefined
|
|
46
|
-
/** Defaults to `false` if `trigger` is provided, or `true` otherwise. */
|
|
47
|
-
defaultOpen?: boolean | undefined
|
|
48
|
-
onOpenChange?: ((open: boolean) => void) | undefined
|
|
49
46
|
/**
|
|
50
|
-
* Element that opens the modal when clicked, or function that returns such an element (where
|
|
51
|
-
* can customize the
|
|
52
|
-
*
|
|
53
|
-
* controlled API (the `open` and `onOpenChange` props) that doesn't require any state in the
|
|
54
|
-
* parent component.
|
|
47
|
+
* Element that opens the modal when clicked, or a function that returns such an element (where
|
|
48
|
+
* you can fully customize the interaction that opens the modal, e.g. `trigger={(renderProps, {
|
|
49
|
+
* openModal }) => <button {...renderProps} onMouseEnter={openModal} />}`).
|
|
55
50
|
*/
|
|
56
51
|
trigger?:
|
|
57
|
-
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
currentStep: Step
|
|
65
|
-
setCurrentStep: (step: Step) => void
|
|
66
|
-
},
|
|
67
|
-
) => ReactElement)
|
|
52
|
+
| RenderProp<{
|
|
53
|
+
open: boolean
|
|
54
|
+
setOpen: (open: boolean) => void
|
|
55
|
+
openModal: () => void
|
|
56
|
+
currentStep: Step
|
|
57
|
+
setCurrentStep: (step: Step) => void
|
|
58
|
+
}>
|
|
68
59
|
| undefined
|
|
60
|
+
open?: boolean | undefined
|
|
61
|
+
/** Defaults to `false` if `trigger` is provided, or `true` otherwise. */
|
|
62
|
+
defaultOpen?: boolean | undefined
|
|
63
|
+
onOpenChange?: ((open: boolean) => void) | undefined
|
|
69
64
|
/**
|
|
70
65
|
* Whether the user should be able to close the modal on their own, either by clicking outside of
|
|
71
66
|
* it, by pressing Escape, or by clicking the close button that gets rendered in `Modal.Header`
|
|
72
67
|
* when `dismissible` is `true` (though it can be replaced or removed altogether with the
|
|
73
|
-
* `buttonAfter` prop). Defaults to `true` if either `
|
|
68
|
+
* `buttonAfter` prop). Defaults to `true` if either `trigger` or `onOpenChange` is provided, or
|
|
74
69
|
* `false` otherwise.
|
|
75
70
|
*/
|
|
76
71
|
dismissible?: boolean | undefined
|
|
@@ -84,7 +79,7 @@ export interface ModalProps<
|
|
|
84
79
|
onCurrentStepChange?: ((step: Step) => void) | undefined
|
|
85
80
|
children?:
|
|
86
81
|
| ReactNode
|
|
87
|
-
| ((
|
|
82
|
+
| ((state: {
|
|
88
83
|
open: boolean
|
|
89
84
|
setOpen: (open: boolean) => void
|
|
90
85
|
closeModal: () => void
|
|
@@ -101,10 +96,10 @@ export const ModalRoot = <
|
|
|
101
96
|
ref: passedRef,
|
|
102
97
|
variant,
|
|
103
98
|
size,
|
|
99
|
+
trigger,
|
|
104
100
|
open: controlledOpen,
|
|
105
101
|
defaultOpen,
|
|
106
102
|
onOpenChange,
|
|
107
|
-
trigger,
|
|
108
103
|
dismissible: passedDismissible,
|
|
109
104
|
role,
|
|
110
105
|
steps: passedSteps = 1 as Steps,
|
|
@@ -121,11 +116,21 @@ export const ModalRoot = <
|
|
|
121
116
|
variant,
|
|
122
117
|
size,
|
|
123
118
|
})
|
|
119
|
+
const cssPropsAttributes = getCSSPropsAttributes(ModalMeta, { variant, size }, style)
|
|
120
|
+
const cssPropsClassName = cn(`
|
|
121
|
+
u:default-size-medium
|
|
122
|
+
u:default-variant-dialog
|
|
123
|
+
u:max-xs:default-variant-drawer
|
|
124
|
+
u:max-2xs:prop-size-small
|
|
125
|
+
`)
|
|
124
126
|
|
|
125
|
-
const
|
|
127
|
+
const hasTrigger = trigger !== undefined
|
|
128
|
+
const triggerIsElement = hasTrigger && typeof trigger !== 'function'
|
|
129
|
+
|
|
130
|
+
const [open, setOpen] = useControlled(controlledOpen, defaultOpen ?? !hasTrigger, onOpenChange)
|
|
126
131
|
|
|
127
132
|
// TODO: Allow swiping down to close when `variant` is `drawer` and `dismissible` is `true`
|
|
128
|
-
const dismissible = passedDismissible ??
|
|
133
|
+
const dismissible = passedDismissible ?? (hasTrigger || onOpenChange !== undefined)
|
|
129
134
|
|
|
130
135
|
const steps = (
|
|
131
136
|
typeof passedSteps === 'number'
|
|
@@ -151,15 +156,6 @@ export const ModalRoot = <
|
|
|
151
156
|
previousStepIndex.current = currentStepIndex
|
|
152
157
|
}
|
|
153
158
|
|
|
154
|
-
const defaultVariantClasses = cn(`
|
|
155
|
-
u:default-size-medium
|
|
156
|
-
u:default-variant-drawer
|
|
157
|
-
u:max-2xs:prop-size-small
|
|
158
|
-
u:xs:default-variant-dialog
|
|
159
|
-
`)
|
|
160
|
-
const cssPropsAttributes = getCSSPropsAttributes(ModalMeta, { variant, size }, style)
|
|
161
|
-
const triggerIsFunction = typeof trigger === 'function'
|
|
162
|
-
|
|
163
159
|
return (
|
|
164
160
|
<ModalContext.Provider
|
|
165
161
|
value={{
|
|
@@ -187,42 +183,45 @@ export const ModalRoot = <
|
|
|
187
183
|
}}
|
|
188
184
|
disablePointerDismissal={!dismissible}
|
|
189
185
|
>
|
|
190
|
-
{
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
prop
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
186
|
+
{hasTrigger ? (
|
|
187
|
+
// Hoist any tooltip used in `trigger` for its interactions to work properly
|
|
188
|
+
<Tooltip>
|
|
189
|
+
<Dialog.Trigger
|
|
190
|
+
render={
|
|
191
|
+
triggerIsElement
|
|
192
|
+
? trigger
|
|
193
|
+
: (renderProps) => {
|
|
194
|
+
// Don't pass event handlers and other potentially too specific props (e.g. `type`)
|
|
195
|
+
const filteredRenderProps = Object.fromEntries(
|
|
196
|
+
Object.entries(renderProps).filter(
|
|
197
|
+
([prop]) =>
|
|
198
|
+
prop === 'ref' ||
|
|
199
|
+
prop === 'id' ||
|
|
200
|
+
prop === 'className' ||
|
|
201
|
+
prop.startsWith('aria-') ||
|
|
202
|
+
prop.startsWith('data-'),
|
|
203
|
+
),
|
|
204
|
+
)
|
|
205
|
+
return trigger(filteredRenderProps, {
|
|
206
|
+
open,
|
|
207
|
+
setOpen,
|
|
208
|
+
openModal: () => setOpen(true),
|
|
209
|
+
currentStep,
|
|
210
|
+
setCurrentStep,
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/>
|
|
215
|
+
</Tooltip>
|
|
218
216
|
) : null}
|
|
219
217
|
{/* Ensure the CSS props polyfill works even when the modal is not mounted */}
|
|
220
218
|
<Portal>
|
|
221
219
|
<div
|
|
222
220
|
ref={cssPropsPolyfillRef}
|
|
223
|
-
className={cn('gds-modal i:invisible',
|
|
221
|
+
className={cn('gds-modal i:invisible', cssPropsClassName, className)}
|
|
224
222
|
{...cssPropsAttributes}
|
|
225
223
|
{...cssPropsPolyfillAttributes}
|
|
224
|
+
{...dirProps}
|
|
226
225
|
{...props}
|
|
227
226
|
/>
|
|
228
227
|
</Portal>
|
|
@@ -240,7 +239,7 @@ export const ModalRoot = <
|
|
|
240
239
|
*/
|
|
241
240
|
className={cn(
|
|
242
241
|
`gds-modal @container-[size] pointer-events-none absolute top-0 left-0 u:text-16 u:text-muted i:invisible i:*:visible`,
|
|
243
|
-
|
|
242
|
+
cssPropsClassName,
|
|
244
243
|
className,
|
|
245
244
|
)}
|
|
246
245
|
{...cssPropsAttributes}
|
|
@@ -359,7 +358,7 @@ export const ModalHeader = ({
|
|
|
359
358
|
? { count: stepCount, currentIndex: currentStepIndex }
|
|
360
359
|
: null
|
|
361
360
|
|
|
362
|
-
const
|
|
361
|
+
const buttonTransitionClassName = cn(`
|
|
363
362
|
min-w-5 shrink-0
|
|
364
363
|
**:button:default-variant-naked
|
|
365
364
|
style-nested/transition-content:items-center
|
|
@@ -406,7 +405,7 @@ export const ModalHeader = ({
|
|
|
406
405
|
layout="flex-col"
|
|
407
406
|
mode="exit-enter"
|
|
408
407
|
animateSize={false}
|
|
409
|
-
className={
|
|
408
|
+
className={buttonTransitionClassName}
|
|
410
409
|
>
|
|
411
410
|
{buttonBefore}
|
|
412
411
|
</Transition>
|
|
@@ -435,7 +434,7 @@ export const ModalHeader = ({
|
|
|
435
434
|
layout="flex-col"
|
|
436
435
|
mode="exit-enter"
|
|
437
436
|
animateSize={false}
|
|
438
|
-
className={
|
|
437
|
+
className={buttonTransitionClassName}
|
|
439
438
|
>
|
|
440
439
|
{buttonAfter}
|
|
441
440
|
</Transition>
|
|
@@ -3,9 +3,5 @@ import { createComponent } from '@graphprotocol/gds-css'
|
|
|
3
3
|
import { FieldMeta } from './base/Field.meta.ts'
|
|
4
4
|
|
|
5
5
|
export const OTCInputMeta = createComponent('OTCInput', {
|
|
6
|
-
|
|
7
|
-
cssProps: {
|
|
8
|
-
/** @default 'medium' */
|
|
9
|
-
size: FieldMeta.cssProps.size,
|
|
10
|
-
},
|
|
6
|
+
extends: FieldMeta,
|
|
11
7
|
})
|
|
@@ -45,7 +45,7 @@ export function OTCInput({
|
|
|
45
45
|
const inputRef = useRef<HTMLInputElement>(null)
|
|
46
46
|
const inputPassedRef = useMergedRefs(inputRef, passedRef)
|
|
47
47
|
|
|
48
|
-
const length = Math.min(Math.max(passedLength, 1),
|
|
48
|
+
const length = Math.min(Math.max(passedLength, 1), 16)
|
|
49
49
|
|
|
50
50
|
const [value, privateSetValue] = useControlled(controlledValue, defaultValue ?? '', onChange)
|
|
51
51
|
const privatePaddedValue = useRef('')
|
|
@@ -3,9 +3,5 @@ import { createComponent } from '@graphprotocol/gds-css'
|
|
|
3
3
|
import { CheckableMeta } from './base/Checkable.meta.ts'
|
|
4
4
|
|
|
5
5
|
export const RadioMeta = createComponent('Radio', {
|
|
6
|
-
|
|
7
|
-
cssProps: {
|
|
8
|
-
/** @default 'medium' */
|
|
9
|
-
size: CheckableMeta.cssProps.size,
|
|
10
|
-
},
|
|
6
|
+
extends: CheckableMeta,
|
|
11
7
|
})
|
|
@@ -11,4 +11,6 @@ export const SegmentedControlMeta = createComponent('SegmentedControl', {
|
|
|
11
11
|
},
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
export const SegmentedControlOptionMeta = createComponent('SegmentedControlOption'
|
|
14
|
+
export const SegmentedControlOptionMeta = createComponent('SegmentedControlOption', {
|
|
15
|
+
isolate: 'allow-inheritance',
|
|
16
|
+
})
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
} from '../utils/index.ts'
|
|
31
31
|
import { renderAddon, type AddonValue } from './base/Addon.tsx'
|
|
32
32
|
import { SegmentedControlMeta, type SegmentedControlOptionMeta } from './SegmentedControl.meta.ts'
|
|
33
|
-
import { Tooltip,
|
|
33
|
+
import { Tooltip, type TooltipProps } from './Tooltip.tsx'
|
|
34
34
|
|
|
35
35
|
export interface SegmentedControlProps<T extends OptionValue = OptionValue>
|
|
36
36
|
extends
|
|
@@ -88,7 +88,10 @@ export function SegmentedControlRoot<T extends OptionValue>({
|
|
|
88
88
|
setValue(newValue as T)
|
|
89
89
|
setValueJustChanged(true)
|
|
90
90
|
}}
|
|
91
|
-
className={cn(
|
|
91
|
+
className={cn(
|
|
92
|
+
'gds-segmented-control root-block [anchor-scope:all] u:w-max u:max-w-full i:h-max',
|
|
93
|
+
className,
|
|
94
|
+
)}
|
|
92
95
|
{...getCSSPropsAttributes(SegmentedControlMeta, { size }, style)}
|
|
93
96
|
{...cssPropsPolyfillAttributes}
|
|
94
97
|
{...props}
|
|
@@ -156,12 +159,6 @@ export function SegmentedControlOption<T extends OptionValue>({
|
|
|
156
159
|
'is-toggle': undefined,
|
|
157
160
|
})
|
|
158
161
|
|
|
159
|
-
const { onCollect, collectedContent } = useCollectedTooltip()
|
|
160
|
-
let tooltipProps: Omit<TooltipProps, 'children'> = { content: collectedContent }
|
|
161
|
-
if (tooltip !== undefined) {
|
|
162
|
-
tooltipProps = isReactNode(tooltip) ? { content: tooltip } : { ...tooltipProps, ...tooltip }
|
|
163
|
-
}
|
|
164
|
-
|
|
165
162
|
const toggle = (event: MouseEvent | KeyboardEvent) => {
|
|
166
163
|
if (!buttonRef.current) return
|
|
167
164
|
const optionButtons =
|
|
@@ -187,7 +184,7 @@ export function SegmentedControlOption<T extends OptionValue>({
|
|
|
187
184
|
}
|
|
188
185
|
|
|
189
186
|
return (
|
|
190
|
-
<Tooltip {...
|
|
187
|
+
<Tooltip {...(isReactNode(tooltip) ? { content: tooltip } : tooltip)}>
|
|
191
188
|
{/**
|
|
192
189
|
* This wrapper is necessary to ensure this component returns a single element (which some Tailwind
|
|
193
190
|
* classes might assume) because `Radio.Root` renders a `<input type="radio">` as a sibling of the
|
|
@@ -252,7 +249,7 @@ export function SegmentedControlOption<T extends OptionValue>({
|
|
|
252
249
|
) : null}
|
|
253
250
|
{children ? (
|
|
254
251
|
<span className="truncate px-1">
|
|
255
|
-
<Tooltip.Collector
|
|
252
|
+
<Tooltip.Collector>{children}</Tooltip.Collector>
|
|
256
253
|
</span>
|
|
257
254
|
) : null}
|
|
258
255
|
{addonAfter ? (
|
|
@@ -39,7 +39,9 @@ export const StepperRoot = ({
|
|
|
39
39
|
|
|
40
40
|
const childrenArray = children
|
|
41
41
|
? flattenChildren(children)
|
|
42
|
-
: Array.from({ length: Math.max(1, count) }, (_, index) =>
|
|
42
|
+
: Array.from({ length: Math.min(Math.max(1, count), 16) }, (_, index) => (
|
|
43
|
+
<StepperStep key={index} />
|
|
44
|
+
))
|
|
43
45
|
const currentIndex = Math.min(
|
|
44
46
|
Math.max(
|
|
45
47
|
Number.isInteger(passedCurrentIndex) ? passedCurrentIndex : Math.round(passedCurrentIndex),
|
|
@@ -3,9 +3,5 @@ import { createComponent } from '@graphprotocol/gds-css'
|
|
|
3
3
|
import { CheckableMeta } from './base/Checkable.meta.ts'
|
|
4
4
|
|
|
5
5
|
export const SwitchMeta = createComponent('Switch', {
|
|
6
|
-
|
|
7
|
-
cssProps: {
|
|
8
|
-
/** @default 'medium' */
|
|
9
|
-
size: CheckableMeta.cssProps.size,
|
|
10
|
-
},
|
|
6
|
+
extends: CheckableMeta,
|
|
11
7
|
})
|
|
@@ -3,9 +3,5 @@ import { createComponent } from '@graphprotocol/gds-css'
|
|
|
3
3
|
import { FieldMeta } from './base/Field.meta.ts'
|
|
4
4
|
|
|
5
5
|
export const TextAreaMeta = createComponent('TextArea', {
|
|
6
|
-
|
|
7
|
-
cssProps: {
|
|
8
|
-
/** @default 'medium' */
|
|
9
|
-
size: FieldMeta.cssProps.size,
|
|
10
|
-
},
|
|
6
|
+
extends: FieldMeta,
|
|
11
7
|
})
|
|
@@ -5,18 +5,13 @@ import { ButtonMeta } from './Button.meta.ts'
|
|
|
5
5
|
type ButtonVariant = (typeof ButtonMeta.cssProps.variant.values)[number]
|
|
6
6
|
|
|
7
7
|
export const ToggleButtonMeta = createComponent('ToggleButton', {
|
|
8
|
-
|
|
8
|
+
extends: ButtonMeta,
|
|
9
9
|
cssProps: {
|
|
10
|
-
/** @default 'secondary' */
|
|
11
10
|
variant: {
|
|
12
11
|
type: 'values',
|
|
13
12
|
values: ['secondary', 'tertiary', 'naked'] as const satisfies ButtonVariant[],
|
|
14
13
|
defaultValue: 'secondary',
|
|
15
14
|
},
|
|
16
|
-
/** @default 'medium' */
|
|
17
|
-
size: ButtonMeta.cssProps.size,
|
|
18
|
-
/** @default false */
|
|
19
|
-
hideLabel: ButtonMeta.cssProps.hideLabel,
|
|
20
15
|
},
|
|
21
16
|
vars: {
|
|
22
17
|
fg: {
|
|
@@ -34,13 +34,13 @@ export function ToggleButton({
|
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
36
|
<InternalButton
|
|
37
|
-
{...props}
|
|
38
37
|
checked={checked}
|
|
39
38
|
onClick={(event) => {
|
|
40
39
|
setChecked(!checked)
|
|
41
40
|
onClick?.(event)
|
|
42
41
|
}}
|
|
43
42
|
className={cn('gds-toggle-button', className)}
|
|
43
|
+
{...props}
|
|
44
44
|
/>
|
|
45
45
|
)
|
|
46
46
|
}
|
|
@@ -3,9 +3,9 @@ import { createComponent } from '@graphprotocol/gds-css'
|
|
|
3
3
|
export const TooltipMeta = createComponent('Tooltip', {
|
|
4
4
|
cssProps: {
|
|
5
5
|
/** @default 'top' */
|
|
6
|
-
|
|
6
|
+
side: {
|
|
7
7
|
type: 'values',
|
|
8
|
-
values: ['top', 'bottom', '
|
|
8
|
+
values: ['top', 'bottom', 'start', 'end'],
|
|
9
9
|
defaultValue: 'top',
|
|
10
10
|
},
|
|
11
11
|
/** @default 1 */
|
|
@@ -19,11 +19,22 @@ export const TooltipMeta = createComponent('Tooltip', {
|
|
|
19
19
|
values: ['start', 'center', 'end'],
|
|
20
20
|
defaultValue: 'center',
|
|
21
21
|
},
|
|
22
|
+
/** @default 0 */
|
|
23
|
+
alignOffset: {
|
|
24
|
+
type: 'number',
|
|
25
|
+
defaultValue: 0,
|
|
26
|
+
},
|
|
22
27
|
/** @default false */
|
|
23
28
|
disabled: {
|
|
24
29
|
type: 'values',
|
|
25
30
|
values: [false, true],
|
|
26
31
|
defaultValue: false,
|
|
27
32
|
},
|
|
33
|
+
/** @default true */
|
|
34
|
+
overrideDescendants: {
|
|
35
|
+
type: 'values',
|
|
36
|
+
values: [false, true],
|
|
37
|
+
defaultValue: true,
|
|
38
|
+
},
|
|
28
39
|
},
|
|
29
40
|
})
|