@dust-tt/sparkle 0.2.527 → 0.2.529-rc-1
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/cjs/index.js +1 -1
- package/dist/esm/components/AssistantCard.d.ts +2 -2
- package/dist/esm/components/AssistantCard.d.ts.map +1 -1
- package/dist/esm/components/Button.d.ts +24 -8
- package/dist/esm/components/Button.d.ts.map +1 -1
- package/dist/esm/components/Button.js +29 -33
- package/dist/esm/components/Button.js.map +1 -1
- package/dist/esm/components/Card.d.ts +12 -1
- package/dist/esm/components/Card.d.ts.map +1 -1
- package/dist/esm/components/Card.js.map +1 -1
- package/dist/esm/components/EmptyCTA.d.ts +2 -2
- package/dist/esm/components/EmptyCTA.d.ts.map +1 -1
- package/dist/esm/components/EmptyCTA.js.map +1 -1
- package/dist/esm/components/IconButton.d.ts.map +1 -1
- package/dist/esm/components/IconButton.js +1 -1
- package/dist/esm/components/IconButton.js.map +1 -1
- package/dist/esm/components/LinkWrapper.d.ts +1 -0
- package/dist/esm/components/LinkWrapper.d.ts.map +1 -1
- package/dist/esm/components/LinkWrapper.js +2 -2
- package/dist/esm/components/LinkWrapper.js.map +1 -1
- package/dist/esm/components/SplitButton.d.ts +3 -3
- package/dist/esm/components/SplitButton.d.ts.map +1 -1
- package/dist/esm/components/SplitButton.js.map +1 -1
- package/dist/esm/components/Tabs.d.ts +1 -1
- package/dist/esm/components/Tabs.js +1 -1
- package/dist/esm/components/Tabs.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -1
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/context.d.ts +1 -0
- package/dist/esm/context.d.ts.map +1 -1
- package/dist/esm/context.js +7 -4
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/stories/Button.stories.d.ts +2 -2
- package/dist/esm/stories/Button.stories.d.ts.map +1 -1
- package/dist/esm/stories/Button.stories.js +12 -5
- package/dist/esm/stories/Button.stories.js.map +1 -1
- package/dist/esm/stories/Chip.stories.d.ts +1 -0
- package/dist/esm/stories/Chip.stories.d.ts.map +1 -1
- package/dist/esm/stories/IconButton.stories.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/AssistantCard.tsx +2 -2
- package/src/components/Button.tsx +148 -91
- package/src/components/Card.tsx +2 -2
- package/src/components/EmptyCTA.tsx +2 -2
- package/src/components/IconButton.tsx +0 -1
- package/src/components/LinkWrapper.tsx +26 -19
- package/src/components/SplitButton.tsx +4 -4
- package/src/components/Tabs.tsx +1 -1
- package/src/components/index.ts +2 -2
- package/src/context.tsx +18 -4
- package/src/stories/Button.stories.tsx +24 -4
|
@@ -99,7 +99,8 @@ var ButtonBySize = function (_a) {
|
|
|
99
99
|
React.createElement(Button, { size: size, variant: "highlight", label: "Button" }),
|
|
100
100
|
React.createElement(Button, { size: size, variant: "warning", label: "Button" }),
|
|
101
101
|
React.createElement(Button, { size: size, variant: "ghost", label: "Button" }),
|
|
102
|
-
React.createElement(Button, { size: size, variant: "primary", label: "Button with href", href: "hello" })
|
|
102
|
+
React.createElement(Button, { size: size, variant: "primary", label: "Button with href", href: "hello" }),
|
|
103
|
+
React.createElement(Button, { size: size, variant: "primary", label: "Button with href and disabled", href: "hello", disabled: true })),
|
|
103
104
|
React.createElement("div", { className: "s-flex s-items-center s-gap-4" },
|
|
104
105
|
React.createElement(Button, { size: size, label: "Button", isLoading: true }),
|
|
105
106
|
React.createElement(Button, { size: size, variant: "outline", label: "Button", isLoading: true }),
|
|
@@ -114,9 +115,15 @@ var ButtonBySize = function (_a) {
|
|
|
114
115
|
React.createElement(Button, { size: size, variant: "ghost", icon: PlusIcon, label: "Button" }))));
|
|
115
116
|
};
|
|
116
117
|
export var Gallery = {
|
|
117
|
-
render: function () { return (React.createElement("div", { className: "s-flex s-flex-col s-gap-
|
|
118
|
-
React.createElement(
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
render: function () { return (React.createElement("div", { className: "s-flex s-flex-col s-gap-6" },
|
|
119
|
+
React.createElement("div", { className: "s-flex s-flex-col s-gap-4" },
|
|
120
|
+
React.createElement(ButtonBySize, { size: "xs" }),
|
|
121
|
+
React.createElement(ButtonBySize, { size: "sm" }),
|
|
122
|
+
React.createElement(ButtonBySize, { size: "md" })),
|
|
123
|
+
React.createElement(Separator, null),
|
|
124
|
+
React.createElement("h3", { className: "s-text-primary dark:s-text-primary-50" }, "With tooltip"),
|
|
125
|
+
React.createElement("div", { className: "s-flex s-gap-4" },
|
|
126
|
+
React.createElement(Button, { label: "Button with tooltip", tooltip: "Hello" }),
|
|
127
|
+
React.createElement(Button, { label: "Button as link with tooltip", href: "https://dust.tt", target: "_blank", tooltip: "Hello" })))); },
|
|
121
128
|
};
|
|
122
129
|
//# sourceMappingURL=Button.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.js","sourceRoot":"","sources":["../../../src/stories/Button.stories.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE3E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE/E,IAAM,KAAK,GAAG;IACZ,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,SAAS;CACZ,CAAC;AAEX,IAAM,IAAI,GAAG;IACX,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,WAAW,EAAE,wCAAwC;YACrD,OAAO,EAAE,eAAe;YACxB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC5B;QACD,IAAI,EAAE;YACJ,WAAW,EACT,qFAAqF;YACvF,OAAO,EAAE,YAAY;YACrB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC5B;QACD,IAAI,EAAE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Y,IAAC,IAAI,EAAC,IAAI,GAAG;YAC1B,oBAAC,YAAY,IAAC,IAAI,EAAC,IAAI,GAAG;YAC1B,oBAAC,YAAY,IAAC,IAAI,EAAC,IAAI,GAAG,CACtB;QACN,oBAAC,SAAS,OAAG;QACb,4BAAI,SAAS,EAAC,uCAAuC,mBAAkB;QACvE,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,oBAAC,MAAM,IAAC,KAAK,EAAC,qBAAqB,EAAC,OAAO,EAAC,OAAO,GAAG;YACtD,oBAAC,MAAM,IACL,KAAK,EAAC,6BAA6B,EACnC,IAAI,EAAC,iBAAiB,EACtB,MAAM,EAAC,QAAQ,EACf,OAAO,EAAC,OAAO,GACf,CACE,CACF,CACP,EAnBa,CAmBb;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/Chip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"Chip.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/Chip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCmB,CAAC;AAE9B,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAGnC,eAAO,MAAM,KAAK,EAAE,KAQnB,CAAC;AAEF,eAAO,MAAM,YAAY,yBAOxB,CAAC;AAEF,eAAO,MAAM,aAAa,yBAezB,CAAC;AAEF,eAAO,MAAM,SAAS,yBA+ErB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import type { StoryObj } from "@storybook/react";
|
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
5
|
component: import("react").ForwardRefExoticComponent<{
|
|
6
|
-
variant?: "primary" | "highlight" | "warning" | "outline" | "ghost" | "ghost-secondary" |
|
|
6
|
+
variant?: "primary" | "highlight" | "warning" | "outline" | "ghost" | "ghost-secondary" | undefined;
|
|
7
7
|
onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
|
|
8
8
|
size?: "xs" | "sm" | "md" | "xmini" | "mini" | undefined;
|
|
9
9
|
tooltip?: string | undefined;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
Avatar,
|
|
5
5
|
Card,
|
|
6
6
|
CardActionButton,
|
|
7
|
-
|
|
7
|
+
MiniButtonAsButtonProps,
|
|
8
8
|
} from "@sparkle/components/";
|
|
9
9
|
import { CardVariantType } from "@sparkle/components/Card";
|
|
10
10
|
import { MoreIcon } from "@sparkle/icons/app/";
|
|
@@ -20,7 +20,7 @@ interface BaseAssistantCardProps {
|
|
|
20
20
|
variant?: CardVariantType;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
type AssistantCardMore = Omit<
|
|
23
|
+
type AssistantCardMore = Omit<MiniButtonAsButtonProps, "icon" | "size">;
|
|
24
24
|
|
|
25
25
|
export const AssistantCardMore = React.forwardRef<
|
|
26
26
|
HTMLButtonElement,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Slot } from "@radix-ui/react-slot";
|
|
2
2
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { useMemo } from "react";
|
|
5
4
|
|
|
6
5
|
import {
|
|
7
6
|
Counter,
|
|
@@ -188,31 +187,78 @@ const COUNTER_SIZE_MAP: Record<ButtonSizeType, CounterSizeType> = {
|
|
|
188
187
|
md: "md",
|
|
189
188
|
};
|
|
190
189
|
|
|
191
|
-
type
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
190
|
+
type ButtonBaseProps = {
|
|
191
|
+
label?: string;
|
|
192
|
+
icon?: React.ComponentType;
|
|
193
|
+
isSelect?: boolean;
|
|
194
|
+
isLoading?: boolean;
|
|
195
|
+
isPulsing?: boolean;
|
|
196
|
+
tooltip?: string;
|
|
197
|
+
isCounter?: boolean;
|
|
198
|
+
counterValue?: string;
|
|
199
|
+
variant?: ButtonVariantType;
|
|
200
|
+
size?: ButtonSizeType;
|
|
201
|
+
className?: string;
|
|
202
|
+
"aria-label"?: string;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export type ButtonAsButtonProps = ButtonBaseProps &
|
|
206
|
+
React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
207
|
+
href?: never;
|
|
208
|
+
target?: never;
|
|
209
|
+
replace?: never;
|
|
210
|
+
shallow?: never;
|
|
199
211
|
};
|
|
200
212
|
|
|
201
|
-
export type
|
|
213
|
+
export type MiniButtonAsButtonProps = ButtonAsButtonProps & {
|
|
202
214
|
size: "mini";
|
|
203
215
|
icon: React.ComponentType;
|
|
204
216
|
label?: never;
|
|
205
217
|
};
|
|
206
218
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
219
|
+
type ButtonAsAnchorLinkProps = ButtonBaseProps &
|
|
220
|
+
Omit<LinkWrapperProps, "children"> & {
|
|
221
|
+
href: string;
|
|
222
|
+
disabled?: boolean;
|
|
223
|
+
type?: never;
|
|
224
|
+
onClick?: never;
|
|
225
|
+
form?: never;
|
|
226
|
+
autoFocus?: never;
|
|
227
|
+
tabIndex?: never;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export type ButtonProps =
|
|
231
|
+
| ButtonAsButtonProps
|
|
232
|
+
| ButtonAsAnchorLinkProps
|
|
233
|
+
| MiniButtonAsButtonProps;
|
|
212
234
|
|
|
213
|
-
|
|
235
|
+
function isAnchorProps(props: ButtonProps): props is ButtonAsAnchorLinkProps {
|
|
236
|
+
return typeof props.href === "string" && props.href.length > 0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const ContentWithTooltip = ({
|
|
240
|
+
children,
|
|
241
|
+
tooltip,
|
|
242
|
+
}: {
|
|
243
|
+
children: React.ReactNode;
|
|
244
|
+
tooltip: string;
|
|
245
|
+
}) => {
|
|
246
|
+
return (
|
|
247
|
+
<TooltipProvider>
|
|
248
|
+
<TooltipRoot>
|
|
249
|
+
<TooltipTrigger asChild>{children}</TooltipTrigger>
|
|
250
|
+
<TooltipPortal>
|
|
251
|
+
<TooltipContent>{tooltip}</TooltipContent>
|
|
252
|
+
</TooltipPortal>
|
|
253
|
+
</TooltipRoot>
|
|
254
|
+
</TooltipProvider>
|
|
255
|
+
);
|
|
256
|
+
};
|
|
214
257
|
|
|
215
|
-
const Button = React.forwardRef<
|
|
258
|
+
const Button = React.forwardRef<
|
|
259
|
+
HTMLButtonElement | HTMLAnchorElement,
|
|
260
|
+
ButtonProps
|
|
261
|
+
>(
|
|
216
262
|
(
|
|
217
263
|
{
|
|
218
264
|
label,
|
|
@@ -226,11 +272,6 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
226
272
|
isCounter = false,
|
|
227
273
|
counterValue,
|
|
228
274
|
size = "sm",
|
|
229
|
-
href,
|
|
230
|
-
target,
|
|
231
|
-
rel,
|
|
232
|
-
replace,
|
|
233
|
-
shallow,
|
|
234
275
|
"aria-label": ariaLabel,
|
|
235
276
|
...props
|
|
236
277
|
},
|
|
@@ -239,17 +280,6 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
239
280
|
const iconSize = ICON_SIZE_MAP[size];
|
|
240
281
|
const counterSize = COUNTER_SIZE_MAP[size];
|
|
241
282
|
|
|
242
|
-
const renderIcon = (visual: React.ComponentType, extraClass = "") => (
|
|
243
|
-
<Icon visual={visual} size={iconSize} className={cn(extraClass)} />
|
|
244
|
-
);
|
|
245
|
-
const renderChevron = (visual: React.ComponentType, extraClass = "") => (
|
|
246
|
-
<Icon
|
|
247
|
-
visual={visual}
|
|
248
|
-
size={iconSize}
|
|
249
|
-
className={cn(variant ? chevronVariantMap[variant] : "", extraClass)}
|
|
250
|
-
/>
|
|
251
|
-
);
|
|
252
|
-
|
|
253
283
|
const showCounter = isCounter && counterValue != null;
|
|
254
284
|
const showContainer = label || showCounter;
|
|
255
285
|
|
|
@@ -269,7 +299,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
269
299
|
/>
|
|
270
300
|
</div>
|
|
271
301
|
) : (
|
|
272
|
-
icon &&
|
|
302
|
+
icon && <Icon visual={icon} size={iconSize} className="-s-mx-0.5" />
|
|
273
303
|
)}
|
|
274
304
|
|
|
275
305
|
{showContainer && (
|
|
@@ -290,69 +320,96 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
290
320
|
)}
|
|
291
321
|
</div>
|
|
292
322
|
)}
|
|
293
|
-
{isSelect &&
|
|
323
|
+
{isSelect && (
|
|
324
|
+
<Icon
|
|
325
|
+
visual={ChevronDownIcon}
|
|
326
|
+
size={iconSize}
|
|
327
|
+
className={cn(
|
|
328
|
+
variant ? chevronVariantMap[variant] : "",
|
|
329
|
+
isLoading ? "" : "-s-mr-1"
|
|
330
|
+
)}
|
|
331
|
+
/>
|
|
332
|
+
)}
|
|
294
333
|
</>
|
|
295
334
|
);
|
|
296
335
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
336
|
+
if (isAnchorProps(props)) {
|
|
337
|
+
const {
|
|
338
|
+
href,
|
|
339
|
+
target,
|
|
340
|
+
rel,
|
|
341
|
+
replace,
|
|
342
|
+
shallow,
|
|
343
|
+
prefetch,
|
|
344
|
+
tabIndex,
|
|
345
|
+
disabled,
|
|
346
|
+
} = props;
|
|
308
347
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
{content}
|
|
327
|
-
</MetaButton>
|
|
328
|
-
);
|
|
348
|
+
const innerContent = (
|
|
349
|
+
<span
|
|
350
|
+
className={cn(
|
|
351
|
+
buttonVariants({ variant, size, className }),
|
|
352
|
+
isPulsing && "s-animate-pulse"
|
|
353
|
+
)}
|
|
354
|
+
tabIndex={tabIndex}
|
|
355
|
+
style={
|
|
356
|
+
{
|
|
357
|
+
"--pulse-color": "#93C5FD",
|
|
358
|
+
"--duration": "1.5s",
|
|
359
|
+
} as React.CSSProperties
|
|
360
|
+
}
|
|
361
|
+
>
|
|
362
|
+
{content}
|
|
363
|
+
</span>
|
|
364
|
+
);
|
|
329
365
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
366
|
+
return (
|
|
367
|
+
<LinkWrapper
|
|
368
|
+
ref={ref as React.Ref<HTMLAnchorElement>}
|
|
369
|
+
href={href}
|
|
370
|
+
target={target}
|
|
371
|
+
rel={rel}
|
|
372
|
+
replace={replace}
|
|
373
|
+
shallow={shallow}
|
|
374
|
+
prefetch={prefetch}
|
|
375
|
+
disabled={disabled}
|
|
376
|
+
>
|
|
377
|
+
{tooltip ? (
|
|
378
|
+
<ContentWithTooltip tooltip={tooltip}>
|
|
379
|
+
{innerContent}
|
|
380
|
+
</ContentWithTooltip>
|
|
381
|
+
) : (
|
|
382
|
+
innerContent
|
|
383
|
+
)}
|
|
384
|
+
</LinkWrapper>
|
|
385
|
+
);
|
|
386
|
+
} else {
|
|
387
|
+
const innerButton = (
|
|
388
|
+
<MetaButton
|
|
389
|
+
ref={ref as React.Ref<HTMLButtonElement>}
|
|
390
|
+
size={size}
|
|
391
|
+
variant={variant}
|
|
392
|
+
disabled={isLoading || props.disabled}
|
|
393
|
+
className={cn(isPulsing && "s-animate-pulse", className)}
|
|
394
|
+
aria-label={ariaLabel || tooltip || label}
|
|
395
|
+
style={
|
|
396
|
+
{
|
|
397
|
+
"--pulse-color": "#93C5FD",
|
|
398
|
+
"--duration": "1.5s",
|
|
399
|
+
} as React.CSSProperties
|
|
400
|
+
}
|
|
401
|
+
{...props}
|
|
402
|
+
>
|
|
403
|
+
{content}
|
|
404
|
+
</MetaButton>
|
|
405
|
+
);
|
|
342
406
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
shallow={shallow}
|
|
350
|
-
>
|
|
351
|
-
{wrappedContent}
|
|
352
|
-
</LinkWrapper>
|
|
353
|
-
) : (
|
|
354
|
-
wrappedContent
|
|
355
|
-
);
|
|
407
|
+
return tooltip ? (
|
|
408
|
+
<ContentWithTooltip tooltip={tooltip}>{innerButton}</ContentWithTooltip>
|
|
409
|
+
) : (
|
|
410
|
+
innerButton
|
|
411
|
+
);
|
|
412
|
+
}
|
|
356
413
|
}
|
|
357
414
|
);
|
|
358
415
|
|
package/src/components/Card.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
-
import { Button,
|
|
4
|
+
import { Button, MiniButtonAsButtonProps } from "@sparkle/components/Button";
|
|
5
5
|
import { LinkWrapperProps } from "@sparkle/components/LinkWrapper";
|
|
6
6
|
import {
|
|
7
7
|
noHrefLink,
|
|
@@ -216,7 +216,7 @@ CardActions.displayName = "CardActions";
|
|
|
216
216
|
|
|
217
217
|
export const CardActionButton = React.forwardRef<
|
|
218
218
|
HTMLButtonElement,
|
|
219
|
-
|
|
219
|
+
MiniButtonAsButtonProps
|
|
220
220
|
>(({ className, variant = "outline", icon = XMarkIcon, ...props }, ref) => {
|
|
221
221
|
return (
|
|
222
222
|
<Button
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
import { Button,
|
|
3
|
+
import { Button, ButtonAsButtonProps } from "@sparkle/components/";
|
|
4
4
|
import { cn } from "@sparkle/lib/utils";
|
|
5
5
|
|
|
6
6
|
interface EmptyCTAProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -35,7 +35,7 @@ const EmptyCTA = React.forwardRef<HTMLDivElement, EmptyCTAProps>(
|
|
|
35
35
|
|
|
36
36
|
EmptyCTA.displayName = "EmptyCTA";
|
|
37
37
|
|
|
38
|
-
interface EmptyCTAButtonProps extends
|
|
38
|
+
interface EmptyCTAButtonProps extends ButtonAsButtonProps {
|
|
39
39
|
icon: React.ComponentType;
|
|
40
40
|
label: string;
|
|
41
41
|
}
|
|
@@ -10,29 +10,36 @@ export interface LinkWrapperProps {
|
|
|
10
10
|
shallow?: boolean;
|
|
11
11
|
target?: string;
|
|
12
12
|
prefetch?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export const LinkWrapper = React.forwardRef<
|
|
16
17
|
HTMLAnchorElement,
|
|
17
18
|
LinkWrapperProps
|
|
18
|
-
>(
|
|
19
|
-
|
|
19
|
+
>(
|
|
20
|
+
(
|
|
21
|
+
{ children, href, rel, replace, shallow, target, prefetch, disabled },
|
|
22
|
+
ref
|
|
23
|
+
) => {
|
|
24
|
+
const { components } = React.useContext(SparkleContext);
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
if (href) {
|
|
27
|
+
return (
|
|
28
|
+
<components.link
|
|
29
|
+
ref={ref}
|
|
30
|
+
href={href}
|
|
31
|
+
target={target}
|
|
32
|
+
rel={rel}
|
|
33
|
+
replace={replace}
|
|
34
|
+
shallow={shallow}
|
|
35
|
+
prefetch={prefetch}
|
|
36
|
+
disabled={disabled}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</components.link>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
}
|
|
43
|
+
return children;
|
|
44
|
+
}
|
|
45
|
+
);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
ButtonAsButtonProps,
|
|
5
5
|
DropdownMenu,
|
|
6
6
|
DropdownMenuContent,
|
|
7
7
|
DropdownMenuItem,
|
|
8
8
|
DropdownMenuTrigger,
|
|
9
|
-
RegularButtonProps,
|
|
10
9
|
} from "@sparkle/components/";
|
|
11
10
|
import { Button, ButtonVariantType } from "@sparkle/components/Button";
|
|
12
11
|
import { Separator } from "@sparkle/components/Separator";
|
|
@@ -23,7 +22,7 @@ interface SplitButtonActionProps {
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
export interface SplitButtonProps
|
|
26
|
-
extends Omit<
|
|
25
|
+
extends Omit<ButtonAsButtonProps, "children" | "onClick"> {
|
|
27
26
|
/**
|
|
28
27
|
* List of possible actions, will be displayed in dropdown
|
|
29
28
|
*/
|
|
@@ -130,7 +129,8 @@ const flexSeparatorVariants: Record<ButtonVariantType, string> = {
|
|
|
130
129
|
"ghost-secondary": "s-bg-separator dark:s-bg-separator-night",
|
|
131
130
|
};
|
|
132
131
|
|
|
133
|
-
export interface FlexSplitButtonProps
|
|
132
|
+
export interface FlexSplitButtonProps
|
|
133
|
+
extends Omit<ButtonAsButtonProps, "size"> {
|
|
134
134
|
containerClassName?: string;
|
|
135
135
|
splitAction: React.ReactElement<React.ComponentProps<typeof Button>>;
|
|
136
136
|
}
|
package/src/components/Tabs.tsx
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -11,9 +11,9 @@ export { BarHeader } from "./BarHeader";
|
|
|
11
11
|
export type { BreadcrumbItem } from "./Breadcrumbs";
|
|
12
12
|
export { Breadcrumbs } from "./Breadcrumbs";
|
|
13
13
|
export type {
|
|
14
|
+
ButtonAsButtonProps,
|
|
14
15
|
ButtonProps,
|
|
15
|
-
|
|
16
|
-
RegularButtonProps,
|
|
16
|
+
MiniButtonAsButtonProps,
|
|
17
17
|
} from "./Button";
|
|
18
18
|
export { Button } from "./Button";
|
|
19
19
|
export type { CardProps } from "./Card";
|
package/src/context.tsx
CHANGED
|
@@ -2,6 +2,8 @@ import React, { ComponentType, MouseEvent, ReactNode } from "react";
|
|
|
2
2
|
import type { UrlObject } from "url";
|
|
3
3
|
import url from "url";
|
|
4
4
|
|
|
5
|
+
import { cn } from "./lib/utils";
|
|
6
|
+
|
|
5
7
|
type SparkleLinkProps = {
|
|
6
8
|
href: string | UrlObject;
|
|
7
9
|
className?: string;
|
|
@@ -22,6 +24,7 @@ type SparkleLinkProps = {
|
|
|
22
24
|
target?: string;
|
|
23
25
|
rel?: string;
|
|
24
26
|
prefetch?: boolean;
|
|
27
|
+
disabled?: boolean;
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
export type SparkleContextLinkType = ComponentType<
|
|
@@ -34,12 +37,24 @@ export type SparkleContextType = {
|
|
|
34
37
|
};
|
|
35
38
|
};
|
|
36
39
|
|
|
40
|
+
// To mimic disabled button behavior, we disable pointer events
|
|
41
|
+
// if disabled is true.
|
|
37
42
|
export const aLink: SparkleContextLinkType = React.forwardRef<
|
|
38
43
|
HTMLAnchorElement,
|
|
39
44
|
SparkleLinkProps
|
|
40
45
|
>(
|
|
41
46
|
(
|
|
42
|
-
{
|
|
47
|
+
{
|
|
48
|
+
href,
|
|
49
|
+
className,
|
|
50
|
+
ariaCurrent,
|
|
51
|
+
ariaLabel,
|
|
52
|
+
onClick,
|
|
53
|
+
children,
|
|
54
|
+
target,
|
|
55
|
+
rel,
|
|
56
|
+
disabled,
|
|
57
|
+
},
|
|
43
58
|
ref
|
|
44
59
|
) => {
|
|
45
60
|
const hrefAsString = typeof href !== "string" ? url.format(href) : href;
|
|
@@ -48,7 +63,7 @@ export const aLink: SparkleContextLinkType = React.forwardRef<
|
|
|
48
63
|
<a
|
|
49
64
|
ref={ref}
|
|
50
65
|
href={hrefAsString}
|
|
51
|
-
className={className}
|
|
66
|
+
className={cn(className, disabled && "s-pointer-events-none")}
|
|
52
67
|
aria-current={ariaCurrent}
|
|
53
68
|
aria-label={ariaLabel}
|
|
54
69
|
onClick={onClick}
|
|
@@ -64,10 +79,9 @@ export const aLink: SparkleContextLinkType = React.forwardRef<
|
|
|
64
79
|
export const noHrefLink: SparkleContextLinkType = React.forwardRef<
|
|
65
80
|
HTMLAnchorElement,
|
|
66
81
|
SparkleLinkProps
|
|
67
|
-
>(({
|
|
82
|
+
>(({ ariaCurrent, ariaLabel, onClick, children }, ref) => (
|
|
68
83
|
<a
|
|
69
84
|
ref={ref}
|
|
70
|
-
className={className}
|
|
71
85
|
aria-current={ariaCurrent}
|
|
72
86
|
aria-label={ariaLabel}
|
|
73
87
|
onClick={onClick}
|
|
@@ -120,6 +120,13 @@ const ButtonBySize = ({
|
|
|
120
120
|
label="Button with href"
|
|
121
121
|
href="hello"
|
|
122
122
|
/>
|
|
123
|
+
<Button
|
|
124
|
+
size={size}
|
|
125
|
+
variant="primary"
|
|
126
|
+
label="Button with href and disabled"
|
|
127
|
+
href="hello"
|
|
128
|
+
disabled={true}
|
|
129
|
+
/>
|
|
123
130
|
</div>
|
|
124
131
|
<div className="s-flex s-items-center s-gap-4">
|
|
125
132
|
<Button size={size} label="Button" isLoading />
|
|
@@ -140,10 +147,23 @@ const ButtonBySize = ({
|
|
|
140
147
|
|
|
141
148
|
export const Gallery: Story = {
|
|
142
149
|
render: () => (
|
|
143
|
-
<div className="s-flex s-flex-col s-gap-
|
|
144
|
-
<
|
|
145
|
-
|
|
146
|
-
|
|
150
|
+
<div className="s-flex s-flex-col s-gap-6">
|
|
151
|
+
<div className="s-flex s-flex-col s-gap-4">
|
|
152
|
+
<ButtonBySize size="xs" />
|
|
153
|
+
<ButtonBySize size="sm" />
|
|
154
|
+
<ButtonBySize size="md" />
|
|
155
|
+
</div>
|
|
156
|
+
<Separator />
|
|
157
|
+
<h3 className="s-text-primary dark:s-text-primary-50">With tooltip</h3>
|
|
158
|
+
<div className="s-flex s-gap-4">
|
|
159
|
+
<Button label="Button with tooltip" tooltip="Hello" />
|
|
160
|
+
<Button
|
|
161
|
+
label="Button as link with tooltip"
|
|
162
|
+
href="https://dust.tt"
|
|
163
|
+
target="_blank"
|
|
164
|
+
tooltip="Hello"
|
|
165
|
+
/>
|
|
166
|
+
</div>
|
|
147
167
|
</div>
|
|
148
168
|
),
|
|
149
169
|
};
|