@graphprotocol/gds-react 0.1.0 → 0.1.2
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/README.md +10 -11
- package/dist/GDSProvider.d.ts +6 -3
- package/dist/GDSProvider.d.ts.map +1 -1
- package/dist/GDSProvider.js +14 -6
- package/dist/GDSProvider.js.map +1 -1
- package/dist/components/Address.d.ts.map +1 -1
- package/dist/components/Address.js +8 -6
- package/dist/components/Address.js.map +1 -1
- package/dist/components/Avatar.d.ts +4 -2
- package/dist/components/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar.js +12 -5
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Breadcrumbs.parts.d.ts.map +1 -1
- package/dist/components/Breadcrumbs.parts.js +4 -4
- package/dist/components/Breadcrumbs.parts.js.map +1 -1
- package/dist/components/Button.js +11 -7
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.js +3 -3
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Checkbox.parts.js +1 -1
- package/dist/components/Checkbox.parts.js.map +1 -1
- package/dist/components/Chip.d.ts +6 -0
- package/dist/components/Chip.d.ts.map +1 -0
- package/dist/components/Chip.js +5 -0
- package/dist/components/Chip.js.map +1 -0
- package/dist/components/Chip.meta.d.ts +17 -0
- package/dist/components/Chip.meta.d.ts.map +1 -0
- package/dist/components/Chip.meta.js +22 -0
- package/dist/components/Chip.meta.js.map +1 -0
- package/dist/components/Chip.parts.d.ts +52 -0
- package/dist/components/Chip.parts.d.ts.map +1 -0
- package/dist/components/Chip.parts.js +122 -0
- package/dist/components/Chip.parts.js.map +1 -0
- package/dist/components/CodeBlock.parts.js +1 -1
- package/dist/components/CodeBlock.parts.js.map +1 -1
- package/dist/components/CopyButton.js +1 -1
- package/dist/components/CopyButton.js.map +1 -1
- package/dist/components/DescriptionList.parts.js +1 -1
- package/dist/components/Keyboard.js +1 -1
- package/dist/components/Label.d.ts.map +1 -1
- package/dist/components/Label.js +1 -1
- package/dist/components/Label.js.map +1 -1
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +1 -1
- package/dist/components/Link.js.map +1 -1
- package/dist/components/Menu.parts.d.ts.map +1 -1
- package/dist/components/Menu.parts.js +15 -10
- package/dist/components/Menu.parts.js.map +1 -1
- package/dist/components/Modal.parts.js +1 -1
- package/dist/components/Modal.parts.js.map +1 -1
- package/dist/components/OTCInput.js +1 -1
- package/dist/components/OTCInput.js.map +1 -1
- package/dist/components/Search.d.ts +16 -0
- package/dist/components/Search.d.ts.map +1 -0
- package/dist/components/Search.js +129 -0
- package/dist/components/Search.js.map +1 -0
- package/dist/components/Search.meta.d.ts +15 -0
- package/dist/components/Search.meta.d.ts.map +1 -0
- package/dist/components/Search.meta.js +24 -0
- package/dist/components/Search.meta.js.map +1 -0
- package/dist/components/SegmentedControl.parts.d.ts.map +1 -1
- package/dist/components/SegmentedControl.parts.js +16 -28
- package/dist/components/SegmentedControl.parts.js.map +1 -1
- package/dist/components/TabSet.parts.js +3 -3
- package/dist/components/TabSet.parts.js.map +1 -1
- package/dist/components/ToggleButton.d.ts +0 -2
- package/dist/components/ToggleButton.d.ts.map +1 -1
- package/dist/components/ToggleButton.js.map +1 -1
- package/dist/components/Tooltip.parts.d.ts.map +1 -1
- package/dist/components/Tooltip.parts.js +9 -5
- package/dist/components/Tooltip.parts.js.map +1 -1
- package/dist/components/base/ButtonOrLink.parts.d.ts +8 -5
- package/dist/components/base/ButtonOrLink.parts.d.ts.map +1 -1
- package/dist/components/base/ButtonOrLink.parts.js +42 -28
- package/dist/components/base/ButtonOrLink.parts.js.map +1 -1
- package/dist/components/base/Render.d.ts +1 -1
- package/dist/components/base/Render.d.ts.map +1 -1
- package/dist/components/base/Render.js +1 -1
- package/dist/components/base/Render.js.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/useCSSProp.js +1 -1
- package/dist/hooks/useCSSProp.js.map +1 -1
- package/dist/hooks/useEffectWithRefDeps.js +1 -1
- package/dist/hooks/useEffectWithRefDeps.js.map +1 -1
- package/dist/hooks/useGDS.d.ts +1 -1
- package/dist/hooks/useNumberInput.js +1 -1
- package/dist/hooks/useNumberInput.js.map +1 -1
- package/dist/hooks/useStyleObserver.js +1 -1
- package/dist/hooks/useStyleObserver.js.map +1 -1
- package/dist/tailwind-plugin.d.ts.map +1 -1
- package/dist/tailwind-plugin.js +5 -0
- package/dist/tailwind-plugin.js.map +1 -1
- package/package.json +19 -18
- package/src/GDSProvider.tsx +31 -14
- package/src/components/Address.tsx +11 -6
- package/src/components/Avatar.tsx +25 -13
- package/src/components/Breadcrumbs.parts.tsx +4 -5
- package/src/components/Button.tsx +16 -6
- package/src/components/Card.tsx +3 -3
- package/src/components/Checkbox.parts.tsx +1 -1
- package/src/components/Chip.meta.ts +23 -0
- package/src/components/Chip.parts.tsx +329 -0
- package/src/components/Chip.tsx +7 -0
- package/src/components/CodeBlock.parts.tsx +3 -3
- package/src/components/CopyButton.tsx +1 -1
- package/src/components/DescriptionList.parts.tsx +1 -1
- package/src/components/Keyboard.tsx +1 -1
- package/src/components/Label.tsx +2 -1
- package/src/components/Link.tsx +2 -1
- package/src/components/Menu.parts.tsx +20 -24
- package/src/components/Modal.parts.tsx +1 -1
- package/src/components/OTCInput.tsx +1 -1
- package/src/components/Search.meta.ts +24 -0
- package/src/components/Search.tsx +238 -0
- package/src/components/SegmentedControl.parts.tsx +38 -40
- package/src/components/TabSet.parts.tsx +3 -3
- package/src/components/ToggleButton.tsx +0 -2
- package/src/components/Tooltip.parts.tsx +14 -4
- package/src/components/base/ButtonOrLink.parts.tsx +65 -34
- package/src/components/base/Render.tsx +1 -1
- package/src/components/index.ts +4 -0
- package/src/hooks/useCSSProp.ts +1 -1
- package/src/hooks/useEffectWithRefDeps.ts +1 -1
- package/src/hooks/useNumberInput.ts +1 -1
- package/src/hooks/useStyleObserver.ts +1 -1
- package/src/tailwind-plugin.ts +5 -0
package/src/GDSProvider.tsx
CHANGED
|
@@ -4,13 +4,15 @@ import {
|
|
|
4
4
|
createContext,
|
|
5
5
|
useEffect,
|
|
6
6
|
useLayoutEffect,
|
|
7
|
+
useMemo,
|
|
7
8
|
useRef,
|
|
8
9
|
useState,
|
|
9
10
|
type ComponentProps,
|
|
10
11
|
} from 'react'
|
|
11
|
-
import { DirectionProvider } from '@base-ui
|
|
12
|
-
import { Tooltip } from '@base-ui
|
|
12
|
+
import { DirectionProvider } from '@base-ui/react/direction-provider'
|
|
13
|
+
import { Tooltip } from '@base-ui/react/tooltip'
|
|
13
14
|
|
|
15
|
+
import { ButtonOrLink, type ButtonOrLinkConfigProps } from './components/base/ButtonOrLink.tsx'
|
|
14
16
|
import { cn } from './utils/index.ts'
|
|
15
17
|
|
|
16
18
|
type Theme = 'dark' | 'light' | 'system'
|
|
@@ -48,6 +50,7 @@ export interface GDSProviderProps extends Omit<ComponentProps<'div'>, 'dir'> {
|
|
|
48
50
|
direction?: ComponentProps<typeof DirectionProvider>['direction'] | undefined
|
|
49
51
|
/** Defaults to `en` if `direction` is `ltr`, or `ar` if `direction` is `rtl`. */
|
|
50
52
|
language?: string | undefined
|
|
53
|
+
buttonOrLinkConfig?: Omit<ButtonOrLinkConfigProps, 'children'> | undefined
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
export interface GDSContextValue {
|
|
@@ -67,7 +70,8 @@ export const GDSContext = createContext<GDSContextValue | null>(null)
|
|
|
67
70
|
*
|
|
68
71
|
* Currently implements:
|
|
69
72
|
*
|
|
70
|
-
* - An easy way to configure the root theme (dark/light/system)
|
|
73
|
+
* - An easy way to configure the root theme (dark/light/system), text direction, and `ButtonOrLink`
|
|
74
|
+
* config.
|
|
71
75
|
* - Space key handler for improved `active` state behavior.
|
|
72
76
|
* - Shared delay for multiple tooltips (once a tooltip is visible, adjacent tooltips show instantly).
|
|
73
77
|
*
|
|
@@ -87,6 +91,7 @@ export function GDSProvider({
|
|
|
87
91
|
theme = DEFAULT_THEME,
|
|
88
92
|
direction = 'ltr',
|
|
89
93
|
language = direction === 'rtl' ? 'ar' : 'en',
|
|
94
|
+
buttonOrLinkConfig,
|
|
90
95
|
children,
|
|
91
96
|
className,
|
|
92
97
|
...props
|
|
@@ -203,20 +208,32 @@ export function GDSProvider({
|
|
|
203
208
|
}
|
|
204
209
|
}, [])
|
|
205
210
|
|
|
211
|
+
const gdsContextValue = useMemo(
|
|
212
|
+
() => ({
|
|
213
|
+
theme,
|
|
214
|
+
activeTheme,
|
|
215
|
+
direction,
|
|
216
|
+
language,
|
|
217
|
+
}),
|
|
218
|
+
[theme, activeTheme, direction, language],
|
|
219
|
+
)
|
|
220
|
+
|
|
206
221
|
return (
|
|
207
|
-
<GDSContext.Provider value={
|
|
222
|
+
<GDSContext.Provider value={gdsContextValue}>
|
|
208
223
|
<DirectionProvider direction={direction}>
|
|
209
224
|
<Tooltip.Provider timeout={300}>
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
225
|
+
<ButtonOrLink.Config {...buttonOrLinkConfig}>
|
|
226
|
+
{/* Prevent a flash of incorrect theme in server-side rendered apps (e.g. Next.js) */}
|
|
227
|
+
<PreHydrationStyle>{THEME_SSR_CSS[theme]}</PreHydrationStyle>
|
|
228
|
+
<div
|
|
229
|
+
dir={direction}
|
|
230
|
+
lang={language}
|
|
231
|
+
className={cn('gds-provider isolate', themeClass, className)}
|
|
232
|
+
{...props}
|
|
233
|
+
>
|
|
234
|
+
{children}
|
|
235
|
+
</div>
|
|
236
|
+
</ButtonOrLink.Config>
|
|
220
237
|
</Tooltip.Provider>
|
|
221
238
|
</DirectionProvider>
|
|
222
239
|
</GDSContext.Provider>
|
|
@@ -48,6 +48,8 @@ export function Address({
|
|
|
48
48
|
}: AddressProps) {
|
|
49
49
|
useGDS()
|
|
50
50
|
|
|
51
|
+
const { rootProps, nestedProps } = splitProps(props)
|
|
52
|
+
|
|
51
53
|
const [stateRef, state] = useCSSState({
|
|
52
54
|
pointer: undefined,
|
|
53
55
|
focus: undefined,
|
|
@@ -59,7 +61,6 @@ export function Address({
|
|
|
59
61
|
{ variant, size, copy },
|
|
60
62
|
{ ref: stateRef },
|
|
61
63
|
)
|
|
62
|
-
const { rootProps, nestedProps } = splitProps(props)
|
|
63
64
|
|
|
64
65
|
const address = passedAddress || ZERO_ADDRESS
|
|
65
66
|
|
|
@@ -67,7 +68,7 @@ export function Address({
|
|
|
67
68
|
<span
|
|
68
69
|
ref={cssPropsPolyfillStateRef}
|
|
69
70
|
className={cn(
|
|
70
|
-
`gds-address isolate root-grid *:col-span-full *:row-span-full u:
|
|
71
|
+
`gds-address isolate root-grid *:col-span-full *:row-span-full u:size-max u:max-w-full
|
|
71
72
|
u:state-[show-copy=false]
|
|
72
73
|
u:hover:state-[show-copy]
|
|
73
74
|
u:hover:state-hover
|
|
@@ -141,10 +142,14 @@ export function Address({
|
|
|
141
142
|
{avatar !== null ? (
|
|
142
143
|
<Avatar
|
|
143
144
|
shape="circle"
|
|
144
|
-
src={
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
src={
|
|
146
|
+
avatar && typeof avatar !== 'string' && !Array.isArray(avatar)
|
|
147
|
+
? avatar
|
|
148
|
+
: [
|
|
149
|
+
...(avatar ? (Array.isArray(avatar) ? avatar : [avatar]) : []),
|
|
150
|
+
createIdenticon(address),
|
|
151
|
+
]
|
|
152
|
+
}
|
|
148
153
|
alt=""
|
|
149
154
|
className={`
|
|
150
155
|
@prop-variant-enclosed/address:-ms-px
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import { useState } from 'react'
|
|
3
|
+
import { useState, type ReactElement } from 'react'
|
|
4
4
|
import { useDeepCompareEffect } from '@react-hookz/web'
|
|
5
5
|
|
|
6
6
|
import type { GDSComponentProps } from '@graphprotocol/gds-css'
|
|
@@ -20,9 +20,10 @@ export declare namespace AvatarProps {
|
|
|
20
20
|
interface BaseProps extends GDSComponentProps<typeof AvatarMeta> {
|
|
21
21
|
/**
|
|
22
22
|
* Image source URL or array of URLs to try as fallbacks. If an array is provided, each URL will
|
|
23
|
-
* be tried in order until one loads successfully.
|
|
23
|
+
* be tried in order until one loads successfully. Alternatively, this can be a React element
|
|
24
|
+
* (e.g. an icon) for custom avatar content.
|
|
24
25
|
*/
|
|
25
|
-
src: string | string[] | undefined
|
|
26
|
+
src: string | string[] | ReactElement | undefined
|
|
26
27
|
/**
|
|
27
28
|
* Text used as the avatar's accessible name (e.g. the username or address of the represented
|
|
28
29
|
* user). Necessary if the avatar is clickable, recommended otherwise (unless the same
|
|
@@ -101,7 +102,7 @@ export function Avatar({
|
|
|
101
102
|
<span className="nested/avatar-paint pointer-events-none shrink-0">
|
|
102
103
|
<span
|
|
103
104
|
className={`
|
|
104
|
-
block overflow-clip bg-
|
|
105
|
+
block overflow-clip bg-default
|
|
105
106
|
group-clickable-focus-visible/avatar:outline
|
|
106
107
|
@prop-size-xsmall/avatar:size-4
|
|
107
108
|
@prop-size-small/avatar:size-5
|
|
@@ -112,18 +113,29 @@ export function Avatar({
|
|
|
112
113
|
@prop-shape-rounded/avatar:rounded-4
|
|
113
114
|
@prop-shape-rounded/avatar:@prop-size-xsmall/avatar:rounded-2
|
|
114
115
|
@prop-shape-rounded/avatar:@prop-size-xlarge/avatar:rounded-8
|
|
116
|
+
uu:*:absolute
|
|
117
|
+
uu:*:inset-0
|
|
118
|
+
uu:*:m-auto
|
|
119
|
+
uu:*:size-full
|
|
120
|
+
uu:*:object-cover
|
|
121
|
+
i:@prop-size-xsmall/avatar:**:icon:default-size-2.5
|
|
122
|
+
i:@prop-size-small/avatar:**:icon:default-size-3
|
|
123
|
+
i:@prop-size-medium/avatar:**:icon:default-size-4
|
|
124
|
+
i:@prop-size-large/avatar:**:icon:default-size-5
|
|
125
|
+
i:@prop-size-xlarge/avatar:**:icon:default-size-8
|
|
115
126
|
`}
|
|
116
127
|
>
|
|
117
128
|
{src ? (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
typeof src === 'string' ? (
|
|
130
|
+
<img
|
|
131
|
+
src={src}
|
|
132
|
+
alt=""
|
|
133
|
+
onError={() => setCurrentSourceIndex(currentSourceIndex + 1)}
|
|
134
|
+
className="[[src^='data:image/bmp']]:[image-rendering:pixelated]"
|
|
135
|
+
/>
|
|
136
|
+
) : (
|
|
137
|
+
src
|
|
138
|
+
)
|
|
127
139
|
) : null}
|
|
128
140
|
{alt ? <span className="sr-only">{alt}</span> : null}
|
|
129
141
|
</span>
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
import { isEqual } from '@ver0/deep-equal'
|
|
12
12
|
|
|
13
13
|
import type { GDSComponentProps } from '@graphprotocol/gds-css'
|
|
14
|
+
import { ArrowLeftInteractiveIcon, DotsThreeIcon } from '@graphprotocol/gds-react/icons'
|
|
14
15
|
|
|
15
16
|
import { useCSSPropsPolyfill, useCSSState, useGDS } from '../hooks/index.ts'
|
|
16
|
-
import { ArrowLeftInteractiveIcon, DotsThreeIcon } from '../icons/index.generated.ts'
|
|
17
17
|
import { cn, getCSSPropsAttributes, splitProps } from '../utils/index.ts'
|
|
18
18
|
import { renderAddon, type AddonValue } from './base/Addon.tsx'
|
|
19
19
|
import { MaybeButtonOrLink, type MaybeButtonOrLinkProps } from './base/MaybeButtonOrLink.tsx'
|
|
@@ -258,6 +258,7 @@ export function BreadcrumbsItem({
|
|
|
258
258
|
children,
|
|
259
259
|
...props
|
|
260
260
|
}: BreadcrumbsItemProps) {
|
|
261
|
+
const { rootProps, nestedProps } = splitProps(props)
|
|
261
262
|
const current = passedCurrent ?? props.href === undefined
|
|
262
263
|
|
|
263
264
|
const [stateRef, state] = useCSSState({
|
|
@@ -266,16 +267,14 @@ export function BreadcrumbsItem({
|
|
|
266
267
|
current,
|
|
267
268
|
})
|
|
268
269
|
|
|
269
|
-
const { rootProps, nestedProps } = splitProps(props)
|
|
270
|
-
|
|
271
270
|
return (
|
|
272
271
|
<div
|
|
273
272
|
ref={stateRef}
|
|
274
273
|
role="listitem"
|
|
275
274
|
className={cn(
|
|
276
|
-
`nested/breadcrumbs-item-wrapper gds-breadcrumbs-item root-block
|
|
275
|
+
`nested/breadcrumbs-item-wrapper gds-breadcrumbs-item root-block
|
|
277
276
|
u:has-nested-current/breadcrumbs-item-ref:expose-current
|
|
278
|
-
u:has-nested-hover/breadcrumbs-item-ref:
|
|
277
|
+
u:has-nested-hover/breadcrumbs-item-ref:expose-hover
|
|
279
278
|
u:has-nested-focus-visible/breadcrumbs-item-ref:expose-focus
|
|
280
279
|
u:i:has-nested-not-clickable/breadcrumbs-item-ref:state-idle
|
|
281
280
|
ii:shrink-0`,
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import type { ComponentProps } from 'react'
|
|
4
4
|
|
|
5
5
|
import type { GDSComponentProps } from '@graphprotocol/gds-css'
|
|
6
|
+
import { LoadingIcon } from '@graphprotocol/gds-react/icons'
|
|
6
7
|
|
|
7
8
|
import { useCSSPropsPolyfill, useCSSState, useGDS } from '../hooks/index.ts'
|
|
8
|
-
import { LoadingIcon } from '../icons/index.generated.ts'
|
|
9
9
|
import { cn, getCSSPropsAttributes, isReactNode } from '../utils/index.ts'
|
|
10
10
|
import { renderAddon, type AddonValue } from './base/Addon.tsx'
|
|
11
11
|
import { ButtonOrLink, type ButtonOrLinkProps } from './base/ButtonOrLink.tsx'
|
|
@@ -132,10 +132,10 @@ export function Button({
|
|
|
132
132
|
>
|
|
133
133
|
<span
|
|
134
134
|
className={`
|
|
135
|
-
nested/button-paint pointer-events-none flex h-(--height) grow items-center justify-center
|
|
135
|
+
nested/button-paint pointer-events-none flex h-(--height) max-w-full min-w-full grow items-center justify-center
|
|
136
136
|
rounded-(--gds-button-radius) border-(length:--border-width) border-(--gds-button-border)
|
|
137
137
|
bg-(--gds-button-bg) text-(--gds-button-fg) transition [--border-width:1px]
|
|
138
|
-
@state-[addon-only=auto]/button:
|
|
138
|
+
@state-[addon-only=auto]/button:w-(--height)
|
|
139
139
|
@prop-variant-naked/button:transition-[color]
|
|
140
140
|
@prop-variant-naked/button:[--border-width:0px]
|
|
141
141
|
@prop-size-xsmall/button:px-1.25
|
|
@@ -170,7 +170,7 @@ export function Button({
|
|
|
170
170
|
@prop-variant-naked/button:-inset-0.5
|
|
171
171
|
`}
|
|
172
172
|
/>
|
|
173
|
-
{addonBefore ? <ButtonAddon>{addonBefore}</ButtonAddon> : null}
|
|
173
|
+
{addonBefore ? <ButtonAddon side="before">{addonBefore}</ButtonAddon> : null}
|
|
174
174
|
{children ? (
|
|
175
175
|
<span
|
|
176
176
|
data-loading={replaceChildrenWithLoading || undefined}
|
|
@@ -190,18 +190,28 @@ export function Button({
|
|
|
190
190
|
</span>
|
|
191
191
|
) : null}
|
|
192
192
|
{replaceChildrenWithLoading ? loadingIcon : null}
|
|
193
|
-
{addonAfter ? <ButtonAddon>{addonAfter}</ButtonAddon> : null}
|
|
193
|
+
{addonAfter ? <ButtonAddon side="after">{addonAfter}</ButtonAddon> : null}
|
|
194
194
|
</span>
|
|
195
195
|
</ButtonOrLink>
|
|
196
196
|
</Tooltip>
|
|
197
197
|
)
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
function ButtonAddon({
|
|
200
|
+
function ButtonAddon({
|
|
201
|
+
side,
|
|
202
|
+
className,
|
|
203
|
+
children,
|
|
204
|
+
...props
|
|
205
|
+
}: ComponentProps<'span'> & { side: 'before' | 'after' }) {
|
|
201
206
|
return (
|
|
202
207
|
<span
|
|
208
|
+
data-side={side}
|
|
203
209
|
className={cn(
|
|
204
210
|
`gds-addon root-flex items-center justify-center u:h-(--gds-addon-size) u:min-w-(--gds-addon-size) u:shrink-0
|
|
211
|
+
u:has-avatar-group:data-[side=after]:ps-0.5
|
|
212
|
+
u:has-tag:data-[side=after]:ps-0.5
|
|
213
|
+
u:has-avatar-group:data-[side=before]:pe-0.5
|
|
214
|
+
u:has-tag:data-[side=before]:pe-0.5
|
|
205
215
|
u:has-nested/button-loading:opacity-100`,
|
|
206
216
|
className,
|
|
207
217
|
)}
|
package/src/components/Card.tsx
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { useId, type ReactNode } from 'react'
|
|
4
4
|
|
|
5
5
|
import type { GDSComponentProps } from '@graphprotocol/gds-css'
|
|
6
|
+
import { ArrowUpRightInteractiveIcon } from '@graphprotocol/gds-react/icons'
|
|
6
7
|
|
|
7
8
|
import { useCSSPropsPolyfill, useCSSState, useGDS } from '../hooks/index.ts'
|
|
8
|
-
import { ArrowUpRightInteractiveIcon } from '../icons/index.generated.ts'
|
|
9
9
|
import { cn, getCSSPropsAttributes, splitProps } from '../utils/index.ts'
|
|
10
10
|
import { MaybeButtonOrLink, type MaybeButtonOrLinkProps } from './base/MaybeButtonOrLink.tsx'
|
|
11
11
|
import { CardMeta } from './Card.meta.ts'
|
|
@@ -66,6 +66,7 @@ export function Card({
|
|
|
66
66
|
autoIcon = true,
|
|
67
67
|
...remainingProps
|
|
68
68
|
} = props as CardProps.ButtonProps | CardProps.LinkProps
|
|
69
|
+
const { rootProps, nestedProps } = splitProps(remainingProps)
|
|
69
70
|
|
|
70
71
|
const [statePassedRef, state] = useCSSState(
|
|
71
72
|
{
|
|
@@ -80,7 +81,6 @@ export function Card({
|
|
|
80
81
|
{ variant },
|
|
81
82
|
{ ref: statePassedRef },
|
|
82
83
|
)
|
|
83
|
-
const { rootProps, nestedProps } = splitProps(remainingProps)
|
|
84
84
|
|
|
85
85
|
const Element = as ?? 'div'
|
|
86
86
|
const uniqueId = useId()
|
|
@@ -121,7 +121,7 @@ export function Card({
|
|
|
121
121
|
`}
|
|
122
122
|
{...state.polyfillAttributes}
|
|
123
123
|
{...nestedProps}
|
|
124
|
-
{...(
|
|
124
|
+
{...(as !== undefined && ({ as: 'span' } as Record<string, unknown>))}
|
|
125
125
|
render={(renderProps, { Element, category, target }) => {
|
|
126
126
|
const renderChildrenOutside = interactiveContent === true && category !== 'other'
|
|
127
127
|
const contentId =
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import type { ComponentProps, ReactNode } from 'react'
|
|
4
4
|
|
|
5
5
|
import type { GDSComponentProps } from '@graphprotocol/gds-css'
|
|
6
|
+
import { CheckIcon, MinusIcon } from '@graphprotocol/gds-react/icons'
|
|
6
7
|
|
|
7
8
|
import { useControlled, useGDS } from '../hooks/index.ts'
|
|
8
|
-
import { CheckIcon, MinusIcon } from '../icons/index.generated.ts'
|
|
9
9
|
import { cn, splitProps } from '../utils/index.ts'
|
|
10
10
|
import { Checkable, type CheckableLabelProps } from './base/Checkable.tsx'
|
|
11
11
|
import type { CheckboxMeta } from './Checkbox.meta.ts'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createComponent } from '@graphprotocol/gds-css'
|
|
2
|
+
|
|
3
|
+
export const ChipMeta = createComponent('Chip', {
|
|
4
|
+
cssProps: {
|
|
5
|
+
/** @default 'medium' */
|
|
6
|
+
size: {
|
|
7
|
+
type: 'values',
|
|
8
|
+
values: ['small', 'medium', 'large'],
|
|
9
|
+
defaultValue: 'medium',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const ChipGroupMeta = createComponent('ChipGroup', {
|
|
15
|
+
cssProps: {
|
|
16
|
+
/** @default 'medium' */
|
|
17
|
+
size: {
|
|
18
|
+
type: 'values',
|
|
19
|
+
values: ChipMeta.cssProps.size.values,
|
|
20
|
+
defaultValue: ChipMeta.cssProps.size.defaultValue,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
})
|