@spark-ui/components 11.1.6 → 11.2.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/alert-dialog/index.js +1 -1
- package/dist/alert-dialog/index.js.map +1 -1
- package/dist/alert-dialog/index.mjs +1 -1
- package/dist/{chunk-WA56YHV3.mjs → chunk-2BSBKLHG.mjs} +2 -2
- package/dist/chunk-2BSBKLHG.mjs.map +1 -0
- package/dist/dialog/index.js +1 -1
- package/dist/dialog/index.js.map +1 -1
- package/dist/dialog/index.mjs +1 -1
- package/dist/docgen.json +19 -0
- package/dist/drawer/index.js +1 -1
- package/dist/drawer/index.js.map +1 -1
- package/dist/drawer/index.mjs +1 -1
- package/dist/drawer/index.mjs.map +1 -1
- package/dist/scrolling-list/index.js +5 -3
- package/dist/scrolling-list/index.js.map +1 -1
- package/dist/scrolling-list/index.mjs +5 -3
- package/dist/scrolling-list/index.mjs.map +1 -1
- package/dist/toast/index.d.mts +3 -2
- package/dist/toast/index.d.ts +3 -2
- package/dist/toast/index.js +61 -53
- package/dist/toast/index.js.map +1 -1
- package/dist/toast/index.mjs +61 -53
- package/dist/toast/index.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-WA56YHV3.mjs.map +0 -1
package/dist/toast/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ import { cx } from "class-variance-authority";
|
|
|
26
26
|
import { cva } from "class-variance-authority";
|
|
27
27
|
var toastStyles = cva(
|
|
28
28
|
[
|
|
29
|
-
"gap-lg p-
|
|
29
|
+
"gap-lg p-md flex w-max !w-[min(400px,calc(100vw-2rem))] flex-col rounded-lg",
|
|
30
30
|
"absolute right-0 bottom-0 left-auto mr-0",
|
|
31
31
|
"bg-clip-padding shadow-md select-none",
|
|
32
32
|
"focus-visible:ring-focus focus-visible:ring-2 focus-visible:outline-none",
|
|
@@ -239,13 +239,23 @@ var getActionProps = (action, { toastDesign, toastIntent }) => {
|
|
|
239
239
|
if (!action) return {};
|
|
240
240
|
const { design, intent, className, onClick, ...rest } = action;
|
|
241
241
|
return {
|
|
242
|
-
design: design ??
|
|
242
|
+
design: design ?? toastDesign,
|
|
243
243
|
intent: intent ?? getButtonIntent(toastIntent),
|
|
244
|
-
className: cx("
|
|
244
|
+
className: cx("ml-auto", className),
|
|
245
245
|
onClick,
|
|
246
246
|
...rest
|
|
247
247
|
};
|
|
248
248
|
};
|
|
249
|
+
var getToastRootProps = (toast, design, intent) => ({
|
|
250
|
+
key: toast.id,
|
|
251
|
+
swipeDirection: ["down", "right"],
|
|
252
|
+
toast,
|
|
253
|
+
className: cx(toastStyles({ design, intent })),
|
|
254
|
+
style: {
|
|
255
|
+
["--gap"]: "var(--spacing-md)",
|
|
256
|
+
["--offset-y"]: "calc(var(--toast-offset-y) * -1 + (var(--toast-index) * var(--gap) * -1) + var(--toast-swipe-movement-y))"
|
|
257
|
+
}
|
|
258
|
+
});
|
|
249
259
|
function Toast({ toast }) {
|
|
250
260
|
const {
|
|
251
261
|
icon: ToastIcon,
|
|
@@ -253,59 +263,55 @@ function Toast({ toast }) {
|
|
|
253
263
|
design = "filled",
|
|
254
264
|
action,
|
|
255
265
|
isClosable,
|
|
256
|
-
closeLabel = "Close"
|
|
266
|
+
closeLabel = "Close",
|
|
267
|
+
compact = false
|
|
257
268
|
} = toast.data ?? {};
|
|
258
269
|
const ActionButton = action?.close ? BaseToast.Close : BaseToast.Action;
|
|
259
|
-
const actionProps = getActionProps(action, {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
toastStyles({
|
|
270
|
-
design,
|
|
271
|
-
intent
|
|
272
|
-
})
|
|
273
|
-
),
|
|
274
|
-
style: {
|
|
275
|
-
["--gap"]: "var(--spacing-md)",
|
|
276
|
-
["--offset-y"]: "calc(var(--toast-offset-y) * -1 + (var(--toast-index) * var(--gap) * -1) + var(--toast-swipe-movement-y))"
|
|
277
|
-
},
|
|
278
|
-
children: [
|
|
279
|
-
/* @__PURE__ */ jsxs("div", { className: "gap-sm flex flex-col", children: [
|
|
280
|
-
/* @__PURE__ */ jsxs("div", { className: "gap-lg flex items-center", children: [
|
|
281
|
-
ToastIcon && /* @__PURE__ */ jsx(Icon, { size: "md", children: ToastIcon }),
|
|
282
|
-
/* @__PURE__ */ jsxs("div", { className: "gap-sm flex flex-col", children: [
|
|
283
|
-
/* @__PURE__ */ jsx(BaseToast.Title, { className: toast.description ? "text-headline-2" : "text-body-1" }),
|
|
284
|
-
/* @__PURE__ */ jsx(BaseToast.Description, { className: "text-body-1" })
|
|
285
|
-
] })
|
|
286
|
-
] }),
|
|
287
|
-
action && /* @__PURE__ */ jsx(ActionButton, { render: /* @__PURE__ */ jsx(Button, { ...actionProps }), children: action.label })
|
|
288
|
-
] }),
|
|
289
|
-
isClosable && /* @__PURE__ */ jsx(
|
|
290
|
-
BaseToast.Close,
|
|
270
|
+
const actionProps = getActionProps(action, { toastDesign: design, toastIntent: intent });
|
|
271
|
+
const rootProps = getToastRootProps(toast, design, intent);
|
|
272
|
+
const getCloseButton = (className) => {
|
|
273
|
+
if (!isClosable) return null;
|
|
274
|
+
return /* @__PURE__ */ jsx(
|
|
275
|
+
BaseToast.Close,
|
|
276
|
+
{
|
|
277
|
+
className,
|
|
278
|
+
render: /* @__PURE__ */ jsx(
|
|
279
|
+
IconButton,
|
|
291
280
|
{
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
"aria-label": closeLabel,
|
|
297
|
-
design,
|
|
298
|
-
intent: getCloseButtonIntent(intent),
|
|
299
|
-
size: "sm"
|
|
300
|
-
}
|
|
301
|
-
),
|
|
302
|
-
children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Close, {}) })
|
|
281
|
+
"aria-label": closeLabel,
|
|
282
|
+
design,
|
|
283
|
+
intent: getCloseButtonIntent(intent),
|
|
284
|
+
size: "md"
|
|
303
285
|
}
|
|
304
|
-
)
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
286
|
+
),
|
|
287
|
+
children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Close, {}) })
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
};
|
|
291
|
+
return /* @__PURE__ */ jsx(BaseToast.Root, { ...rootProps, children: /* @__PURE__ */ jsxs("div", { className: cx("flex", compact ? "gap-lg items-center" : "gap-md flex-col"), children: [
|
|
292
|
+
/* @__PURE__ */ jsxs("div", { className: "gap-lg p-md flex grow items-center", children: [
|
|
293
|
+
ToastIcon && /* @__PURE__ */ jsx(Icon, { size: "md", children: ToastIcon }),
|
|
294
|
+
/* @__PURE__ */ jsxs(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
className: cx(
|
|
298
|
+
"gap-sm flex flex-col",
|
|
299
|
+
compact && "flex-1",
|
|
300
|
+
!compact && isClosable && "pr-3xl"
|
|
301
|
+
),
|
|
302
|
+
children: [
|
|
303
|
+
/* @__PURE__ */ jsx(BaseToast.Title, { className: toast.description ? "text-headline-2" : "text-body-1" }),
|
|
304
|
+
/* @__PURE__ */ jsx(BaseToast.Description, { className: "text-body-1" })
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
] }),
|
|
309
|
+
/* @__PURE__ */ jsxs("div", { className: cx("flex"), children: [
|
|
310
|
+
action && /* @__PURE__ */ jsx(ActionButton, { render: /* @__PURE__ */ jsx(Button, { ...actionProps }), children: action.label }),
|
|
311
|
+
compact && getCloseButton()
|
|
312
|
+
] }),
|
|
313
|
+
!compact && getCloseButton("top-md right-md absolute")
|
|
314
|
+
] }) });
|
|
309
315
|
}
|
|
310
316
|
|
|
311
317
|
// src/toast/useToastManager.ts
|
|
@@ -354,6 +360,7 @@ function ToastTrigger({
|
|
|
354
360
|
isClosable = true,
|
|
355
361
|
icon,
|
|
356
362
|
action,
|
|
363
|
+
compact,
|
|
357
364
|
priority = "low"
|
|
358
365
|
}) {
|
|
359
366
|
const toastManager = BaseToast3.useToastManager();
|
|
@@ -370,7 +377,8 @@ function ToastTrigger({
|
|
|
370
377
|
intent,
|
|
371
378
|
isClosable,
|
|
372
379
|
...icon && { icon },
|
|
373
|
-
action
|
|
380
|
+
action,
|
|
381
|
+
...compact !== void 0 && { compact }
|
|
374
382
|
}
|
|
375
383
|
});
|
|
376
384
|
}
|
package/dist/toast/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/toast/index.tsx","../../src/toast/Toast.tsx","../../src/toast/Toast.styles.ts","../../src/toast/useToastManager.ts"],"sourcesContent":["import { Toast as BaseToast } from '@base-ui-components/react/toast'\nimport { Slot } from '@spark-ui/components/slot'\nimport { cx } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { Toast } from './Toast'\nimport type { ToastData, ToastObject } from './types'\nimport { useToastManager } from './useToastManager'\n\nexport * from './types'\n\nfunction ToastList() {\n const { toasts } = useToastManager()\n\n return toasts.map(toast => <Toast key={toast.id} toast={toast} />)\n}\n\ninterface ToastProviderProps extends React.ComponentProps<typeof BaseToast.Provider> {\n children: React.ReactNode\n}\n\nexport function ToastProvider({ children, limit = 3 }: ToastProviderProps) {\n return (\n <BaseToast.Provider limit={limit}>\n <BaseToast.Portal>\n <BaseToast.Viewport\n className={cx(\n 'z-toast right-lg bottom-lg text-on-surfa- fixed top-auto mx-auto flex w-fit flex-col items-end'\n )}\n >\n <ToastList />\n </BaseToast.Viewport>\n </BaseToast.Portal>\n {children}\n </BaseToast.Provider>\n )\n}\n\ninterface ToastTriggerProps\n extends React.ComponentPropsWithRef<'button'>,\n Pick<ToastObject, 'priority'>,\n Pick<ToastData, 'design' | 'intent' | 'icon' | 'isClosable' | 'action'> {\n children: React.ReactNode\n asChild?: boolean\n title: string\n description?: string\n timeout?: number\n}\n\nexport function ToastTrigger({\n children,\n onClick,\n asChild = false,\n title,\n description,\n timeout = 5000,\n design = 'filled',\n intent = 'neutral',\n isClosable = true,\n icon,\n action,\n priority = 'low',\n}: ToastTriggerProps) {\n const toastManager = BaseToast.useToastManager()\n\n const Component = asChild ? Slot : 'button'\n\n function createToast(e: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(e)\n toastManager.add({\n title,\n description,\n timeout,\n priority,\n data: {\n design,\n intent,\n isClosable,\n ...(icon && { icon }),\n action,\n },\n })\n }\n\n return (\n <Component {...(!asChild && { type: 'button' })} onClick={createToast}>\n {children}\n </Component>\n )\n}\n\nexport { useToastManager }\n","import { Toast as BaseToast } from '@base-ui-components/react/toast'\nimport { Button, ButtonProps } from '@spark-ui/components/button'\nimport { Icon } from '@spark-ui/components/icon'\nimport { IconButton } from '@spark-ui/components/icon-button'\nimport { Close } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { toastStyles } from './Toast.styles'\nimport type { ToastData, ToastDesign, ToastIntent, ToastObject } from './types'\n\nfunction getButtonIntent(intent?: ToastIntent): ButtonProps['intent'] {\n if (intent === 'surfaceInverse') return 'surface'\n if (intent === 'surface') return 'surfaceInverse'\n if (intent === 'error') return 'danger'\n\n return intent as ButtonProps['intent']\n}\n\nfunction getCloseButtonIntent(intent?: ToastIntent): ButtonProps['intent'] {\n if (intent === 'surfaceInverse') return 'surfaceInverse'\n if (intent === 'surface') return 'surface'\n if (intent === 'error') return 'danger'\n\n return intent as ButtonProps['intent']\n}\n\nconst getActionProps = (\n action: ToastData['action'],\n { toastDesign, toastIntent }: { toastDesign?: ToastDesign; toastIntent?: ToastIntent }\n): ButtonProps => {\n if (!action) return {}\n\n const { design, intent, className, onClick, ...rest } = action\n\n return {\n design: design ?? (toastDesign === 'filled' ? 'tinted' : 'filled'),\n intent: intent ?? getButtonIntent(toastIntent),\n className: cx('mt-md self-end', className),\n onClick,\n ...rest,\n }\n}\n\nexport function Toast({ toast }: { toast: ToastObject }) {\n const {\n icon: ToastIcon,\n intent = 'neutral',\n design = 'filled',\n action,\n isClosable,\n closeLabel = 'Close',\n } = toast.data ?? {}\n\n const ActionButton = action?.close ? BaseToast.Close : BaseToast.Action\n\n const actionProps = getActionProps(action, {\n toastDesign: design,\n toastIntent: intent,\n })\n\n return (\n <BaseToast.Root\n key={toast.id}\n swipeDirection={['down', 'right']}\n toast={toast}\n className={cx(\n toastStyles({\n design,\n intent,\n })\n )}\n style={{\n ['--gap' as string]: 'var(--spacing-md)',\n ['--offset-y' as string]:\n 'calc(var(--toast-offset-y) * -1 + (var(--toast-index) * var(--gap) * -1) + var(--toast-swipe-movement-y))',\n }}\n >\n <div className=\"gap-sm flex flex-col\">\n <div className=\"gap-lg flex items-center\">\n {ToastIcon && <Icon size=\"md\">{ToastIcon}</Icon>}\n <div className=\"gap-sm flex flex-col\">\n <BaseToast.Title className={toast.description ? 'text-headline-2' : 'text-body-1'} />\n <BaseToast.Description className=\"text-body-1\" />\n </div>\n </div>\n {action && <ActionButton render={<Button {...actionProps} />}>{action.label}</ActionButton>}\n </div>\n\n {isClosable && (\n <BaseToast.Close\n className=\"top-sm right-sm absolute\"\n render={\n <IconButton\n aria-label={closeLabel}\n design={design}\n intent={getCloseButtonIntent(intent)}\n size=\"sm\"\n />\n }\n >\n <Icon>\n <Close />\n </Icon>\n </BaseToast.Close>\n )}\n </BaseToast.Root>\n )\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const toastStyles = cva(\n [\n 'gap-lg p-lg flex w-max !w-[min(400px,calc(100vw-2rem))] flex-col rounded-lg',\n 'absolute right-0 bottom-0 left-auto mr-0',\n 'bg-clip-padding shadow-md select-none',\n 'focus-visible:ring-focus focus-visible:ring-2 focus-visible:outline-none',\n 'z-[calc(1000-var(--toast-index))]',\n \"after:absolute after:bottom-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']\",\n // Stack effect while not focused\n '[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+calc(min(var(--toast-index),10)*-16px)))_scale(calc(max(0,1-(var(--toast-index)*0.1))))]',\n // Scale and translate\n 'ease-standard [transition-property:opacity,transform]',\n 'duration-400',\n // Present when the toast is animating in.\n 'data-[starting-style]:[transform:translateY(150%)]',\n // Expanded: Present when the toast is expanded in the viewport.\n 'data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y)))]',\n // Present when the toast is animating out.\n 'data-[ending-style]:duration-250',\n 'data-[ending-style]:opacity-0',\n 'data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]',\n 'data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]',\n 'data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]',\n // Limited: Present when the toast was removed due to exceeding the limit.\n 'data-[limited]:opacity-0',\n ],\n {\n variants: {\n design: {\n filled: '',\n tinted: '',\n },\n intent: {\n success: '',\n alert: '',\n error: '',\n info: '',\n neutral: '',\n main: '',\n basic: '',\n support: '',\n accent: '',\n surface: '',\n surfaceInverse: '',\n },\n },\n compoundVariants: [\n // Filled variants\n {\n design: 'filled',\n intent: 'success',\n class: ['bg-success text-on-success'],\n },\n {\n design: 'filled',\n intent: 'alert',\n class: ['bg-alert text-on-alert'],\n },\n {\n design: 'filled',\n intent: 'error',\n class: ['bg-error text-on-error'],\n },\n {\n design: 'filled',\n intent: 'info',\n class: ['bg-info text-on-info'],\n },\n {\n design: 'filled',\n intent: 'neutral',\n class: ['bg-neutral text-on-neutral'],\n },\n {\n design: 'filled',\n intent: 'main',\n class: ['bg-main text-on-main'],\n },\n {\n design: 'filled',\n intent: 'basic',\n class: ['bg-basic text-on-basic'],\n },\n {\n design: 'filled',\n intent: 'support',\n class: ['bg-support text-on-support'],\n },\n {\n design: 'filled',\n intent: 'accent',\n class: ['bg-accent text-on-accent'],\n },\n {\n design: 'filled',\n intent: 'surface',\n class: ['bg-surface text-on-surface'],\n },\n {\n design: 'filled',\n intent: 'surfaceInverse',\n class: ['bg-surface-inverse text-on-surface-inverse'],\n },\n\n // Tinted variants\n {\n design: 'tinted',\n intent: 'success',\n class: ['bg-success-container text-on-success-container'],\n },\n {\n design: 'tinted',\n intent: 'alert',\n class: ['bg-alert-container text-on-alert-container'],\n },\n {\n design: 'tinted',\n intent: 'error',\n class: ['bg-error-container text-on-error-container'],\n },\n {\n design: 'tinted',\n intent: 'info',\n class: ['bg-info-container text-on-info-container'],\n },\n {\n design: 'tinted',\n intent: 'neutral',\n class: ['bg-neutral-container text-on-neutral-container'],\n },\n {\n design: 'tinted',\n intent: 'main',\n class: ['bg-main-container text-on-main-container'],\n },\n {\n design: 'tinted',\n intent: 'basic',\n class: ['bg-basic-container text-on-basic-container'],\n },\n {\n design: 'tinted',\n intent: 'support',\n class: ['bg-support-container text-on-support-container'],\n },\n {\n design: 'tinted',\n intent: 'accent',\n class: ['bg-accent-container text-on-accent-container'],\n },\n {\n design: 'tinted',\n intent: 'surface',\n class: ['bg-surface text-on-surface'],\n },\n {\n design: 'tinted',\n intent: 'surfaceInverse',\n class: ['bg-surface-inverse text-on-surface-inverse'],\n },\n ],\n defaultVariants: {\n design: 'filled',\n intent: 'neutral',\n },\n }\n)\n\nexport const snackbarItemVariantContent = cva(\n [\n 'inline-grid items-center',\n 'col-start-1 row-start-1',\n 'pl-md pr-lg', // applying padding on the parent prevents VoiceOver on Safari from reading snackbar content 🤷\n ],\n {\n variants: {\n /**\n * Force action button displaying on a new line\n * @default false\n */\n actionOnNewline: {\n true: [\n 'grid-rows-[52px_1fr_52px]',\n 'grid-cols-[min-content_1fr_min-content]',\n \"[grid-template-areas:'icon_message_close'_'._message_.'_'action_action_action']\",\n ],\n false: [\n 'grid-cols-[min-content_1fr_min-content_min-content]',\n \"[grid-template-areas:'icon_message_action_close']\",\n ],\n },\n },\n defaultVariants: {\n actionOnNewline: false,\n },\n }\n)\n\nexport type ToastVariantProps = VariantProps<typeof toastStyles>\nexport type SnackbarItemVariantContentProps = VariantProps<typeof snackbarItemVariantContent>\n","import { Toast as BaseToast } from '@base-ui-components/react/toast'\nimport * as React from 'react'\n\nimport type { UseToastManagerReturnValue } from './types'\n\nexport function useToastManager(): UseToastManagerReturnValue {\n const baseToastManager = BaseToast.useToastManager()\n\n const closeAll = React.useCallback((): void => {\n baseToastManager.toasts.forEach(({ id }) => baseToastManager.close(id))\n }, [baseToastManager])\n\n return {\n ...baseToastManager,\n closeAll,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,SAASA,kBAAiB;AAEnC,SAAS,MAAAC,WAAU;;;ACFnB,SAAS,SAAS,iBAAiB;AAInC,SAAS,aAAa;AACtB,SAAS,UAAU;;;ACLnB,SAAS,WAAyB;AAE3B,IAAM,cAAc;AAAA,EACzB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,QAAQ;AAAA,QACN,QAAQ;AAAA,QACR,QAAQ;AAAA,MACV;AAAA,MACA,QAAQ;AAAA,QACN,SAAS;AAAA,QACT,OAAO;AAAA,QACP,OAAO;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,QACP,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA;AAAA,MAEhB;AAAA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OAClB;AAAA,oBAAAF,KAACE,WAAU,QAAV,EACC,0BAAAF;AAAA,MAACE,WAAU;AAAA,MAAV;AAAA,QACC,WAAWC;AAAA,UACT;AAAA,QACF;AAAA,QAEA,0BAAAH,KAAC,aAAU;AAAA;AAAA,IACb,GACF;AAAA,IACC;AAAA,KACH;AAEJ;AAaO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,SAAS;AAAA,EACT,SAAS;AAAA,EACT,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAsB;AACpB,QAAM,eAAeE,WAAU,gBAAgB;AAE/C,QAAM,YAAY,UAAU,OAAO;AAEnC,WAAS,YAAY,GAAwC;AAC3D,cAAU,CAAC;AACX,iBAAa,IAAI;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAI,QAAQ,EAAE,KAAK;AAAA,QACnB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SACE,gBAAAF,KAAC,aAAW,GAAI,CAAC,WAAW,EAAE,MAAM,SAAS,GAAI,SAAS,aACvD,UACH;AAEJ;","names":["BaseToast","cx","BaseToast","jsx","jsxs","BaseToast","cx"]}
|
|
1
|
+
{"version":3,"sources":["../../src/toast/index.tsx","../../src/toast/Toast.tsx","../../src/toast/Toast.styles.ts","../../src/toast/useToastManager.ts"],"sourcesContent":["import { Toast as BaseToast } from '@base-ui-components/react/toast'\nimport { Slot } from '@spark-ui/components/slot'\nimport { cx } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { Toast } from './Toast'\nimport type { ToastData, ToastObject } from './types'\nimport { useToastManager } from './useToastManager'\n\nexport * from './types'\n\nfunction ToastList() {\n const { toasts } = useToastManager()\n\n return toasts.map(toast => <Toast key={toast.id} toast={toast} />)\n}\n\ninterface ToastProviderProps extends React.ComponentProps<typeof BaseToast.Provider> {\n children: React.ReactNode\n}\n\nexport function ToastProvider({ children, limit = 3 }: ToastProviderProps) {\n return (\n <BaseToast.Provider limit={limit}>\n <BaseToast.Portal>\n <BaseToast.Viewport\n className={cx(\n 'z-toast right-lg bottom-lg text-on-surfa- fixed top-auto mx-auto flex w-fit flex-col items-end'\n )}\n >\n <ToastList />\n </BaseToast.Viewport>\n </BaseToast.Portal>\n {children}\n </BaseToast.Provider>\n )\n}\n\ninterface ToastTriggerProps\n extends React.ComponentPropsWithRef<'button'>,\n Pick<ToastObject, 'priority'>,\n Pick<ToastData, 'design' | 'intent' | 'icon' | 'isClosable' | 'action' | 'compact'> {\n children: React.ReactNode\n asChild?: boolean\n title: string\n description?: string\n timeout?: number\n}\n\nexport function ToastTrigger({\n children,\n onClick,\n asChild = false,\n title,\n description,\n timeout = 5000,\n design = 'filled',\n intent = 'neutral',\n isClosable = true,\n icon,\n action,\n compact,\n priority = 'low',\n}: ToastTriggerProps) {\n const toastManager = BaseToast.useToastManager()\n\n const Component = asChild ? Slot : 'button'\n\n function createToast(e: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(e)\n toastManager.add({\n title,\n description,\n timeout,\n priority,\n data: {\n design,\n intent,\n isClosable,\n ...(icon && { icon }),\n action,\n ...(compact !== undefined && { compact }),\n },\n })\n }\n\n return (\n <Component {...(!asChild && { type: 'button' })} onClick={createToast}>\n {children}\n </Component>\n )\n}\n\nexport { useToastManager }\n","import { Toast as BaseToast } from '@base-ui-components/react/toast'\nimport { Button, ButtonProps } from '@spark-ui/components/button'\nimport { Icon } from '@spark-ui/components/icon'\nimport { IconButton } from '@spark-ui/components/icon-button'\nimport { Close } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { toastStyles } from './Toast.styles'\nimport type { ToastData, ToastDesign, ToastIntent, ToastObject } from './types'\n\nfunction getButtonIntent(intent?: ToastIntent): ButtonProps['intent'] {\n if (intent === 'surfaceInverse') return 'surface'\n if (intent === 'surface') return 'surfaceInverse'\n if (intent === 'error') return 'danger'\n\n return intent as ButtonProps['intent']\n}\n\nfunction getCloseButtonIntent(intent?: ToastIntent): ButtonProps['intent'] {\n if (intent === 'surfaceInverse') return 'surfaceInverse'\n if (intent === 'surface') return 'surface'\n if (intent === 'error') return 'danger'\n\n return intent as ButtonProps['intent']\n}\n\nconst getActionProps = (\n action: ToastData['action'],\n { toastDesign, toastIntent }: { toastDesign?: ToastDesign; toastIntent?: ToastIntent }\n): ButtonProps => {\n if (!action) return {}\n\n const { design, intent, className, onClick, ...rest } = action\n\n return {\n design: design ?? toastDesign,\n intent: intent ?? getButtonIntent(toastIntent),\n className: cx('ml-auto', className),\n onClick,\n ...rest,\n }\n}\n\nconst getToastRootProps = (toast: ToastObject, design: ToastDesign, intent: ToastIntent) => ({\n key: toast.id,\n swipeDirection: ['down', 'right'] as ['down', 'right'],\n toast,\n className: cx(toastStyles({ design, intent })),\n style: {\n ['--gap' as string]: 'var(--spacing-md)',\n ['--offset-y' as string]:\n 'calc(var(--toast-offset-y) * -1 + (var(--toast-index) * var(--gap) * -1) + var(--toast-swipe-movement-y))',\n },\n})\n\nexport function Toast({ toast }: { toast: ToastObject }) {\n const {\n icon: ToastIcon,\n intent = 'neutral',\n design = 'filled',\n action,\n isClosable,\n closeLabel = 'Close',\n compact = false,\n } = toast.data ?? {}\n\n const ActionButton = action?.close ? BaseToast.Close : BaseToast.Action\n const actionProps = getActionProps(action, { toastDesign: design, toastIntent: intent })\n const rootProps = getToastRootProps(toast, design, intent)\n\n const getCloseButton = (className?: string) => {\n if (!isClosable) return null\n\n return (\n <BaseToast.Close\n className={className}\n render={\n <IconButton\n aria-label={closeLabel}\n design={design}\n intent={getCloseButtonIntent(intent)}\n size=\"md\"\n />\n }\n >\n <Icon>\n <Close />\n </Icon>\n </BaseToast.Close>\n )\n }\n\n return (\n <BaseToast.Root {...rootProps}>\n <div className={cx('flex', compact ? 'gap-lg items-center' : 'gap-md flex-col')}>\n <div className=\"gap-lg p-md flex grow items-center\">\n {/* Icon */}\n {ToastIcon && <Icon size=\"md\">{ToastIcon}</Icon>}\n {/* Title and description */}\n <div\n className={cx(\n 'gap-sm flex flex-col',\n compact && 'flex-1',\n !compact && isClosable && 'pr-3xl'\n )}\n >\n <BaseToast.Title className={toast.description ? 'text-headline-2' : 'text-body-1'} />\n <BaseToast.Description className=\"text-body-1\" />\n </div>\n </div>\n\n <div className={cx('flex')}>\n {/* Action button */}\n {action && (\n <ActionButton render={<Button {...actionProps} />}>{action.label}</ActionButton>\n )}\n {/* Close button - compact layout only */}\n {compact && getCloseButton()}\n </div>\n\n {/* Close button - default layout only */}\n {!compact && getCloseButton('top-md right-md absolute')}\n </div>\n </BaseToast.Root>\n )\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const toastStyles = cva(\n [\n 'gap-lg p-md flex w-max !w-[min(400px,calc(100vw-2rem))] flex-col rounded-lg',\n 'absolute right-0 bottom-0 left-auto mr-0',\n 'bg-clip-padding shadow-md select-none',\n 'focus-visible:ring-focus focus-visible:ring-2 focus-visible:outline-none',\n 'z-[calc(1000-var(--toast-index))]',\n \"after:absolute after:bottom-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']\",\n // Stack effect while not focused\n '[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+calc(min(var(--toast-index),10)*-16px)))_scale(calc(max(0,1-(var(--toast-index)*0.1))))]',\n // Scale and translate\n 'ease-standard [transition-property:opacity,transform]',\n 'duration-400',\n // Present when the toast is animating in.\n 'data-[starting-style]:[transform:translateY(150%)]',\n // Expanded: Present when the toast is expanded in the viewport.\n 'data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y)))]',\n // Present when the toast is animating out.\n 'data-[ending-style]:duration-250',\n 'data-[ending-style]:opacity-0',\n 'data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]',\n 'data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]',\n 'data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]',\n // Limited: Present when the toast was removed due to exceeding the limit.\n 'data-[limited]:opacity-0',\n ],\n {\n variants: {\n design: {\n filled: '',\n tinted: '',\n },\n intent: {\n success: '',\n alert: '',\n error: '',\n info: '',\n neutral: '',\n main: '',\n basic: '',\n support: '',\n accent: '',\n surface: '',\n surfaceInverse: '',\n },\n },\n compoundVariants: [\n // Filled variants\n {\n design: 'filled',\n intent: 'success',\n class: ['bg-success text-on-success'],\n },\n {\n design: 'filled',\n intent: 'alert',\n class: ['bg-alert text-on-alert'],\n },\n {\n design: 'filled',\n intent: 'error',\n class: ['bg-error text-on-error'],\n },\n {\n design: 'filled',\n intent: 'info',\n class: ['bg-info text-on-info'],\n },\n {\n design: 'filled',\n intent: 'neutral',\n class: ['bg-neutral text-on-neutral'],\n },\n {\n design: 'filled',\n intent: 'main',\n class: ['bg-main text-on-main'],\n },\n {\n design: 'filled',\n intent: 'basic',\n class: ['bg-basic text-on-basic'],\n },\n {\n design: 'filled',\n intent: 'support',\n class: ['bg-support text-on-support'],\n },\n {\n design: 'filled',\n intent: 'accent',\n class: ['bg-accent text-on-accent'],\n },\n {\n design: 'filled',\n intent: 'surface',\n class: ['bg-surface text-on-surface'],\n },\n {\n design: 'filled',\n intent: 'surfaceInverse',\n class: ['bg-surface-inverse text-on-surface-inverse'],\n },\n\n // Tinted variants\n {\n design: 'tinted',\n intent: 'success',\n class: ['bg-success-container text-on-success-container'],\n },\n {\n design: 'tinted',\n intent: 'alert',\n class: ['bg-alert-container text-on-alert-container'],\n },\n {\n design: 'tinted',\n intent: 'error',\n class: ['bg-error-container text-on-error-container'],\n },\n {\n design: 'tinted',\n intent: 'info',\n class: ['bg-info-container text-on-info-container'],\n },\n {\n design: 'tinted',\n intent: 'neutral',\n class: ['bg-neutral-container text-on-neutral-container'],\n },\n {\n design: 'tinted',\n intent: 'main',\n class: ['bg-main-container text-on-main-container'],\n },\n {\n design: 'tinted',\n intent: 'basic',\n class: ['bg-basic-container text-on-basic-container'],\n },\n {\n design: 'tinted',\n intent: 'support',\n class: ['bg-support-container text-on-support-container'],\n },\n {\n design: 'tinted',\n intent: 'accent',\n class: ['bg-accent-container text-on-accent-container'],\n },\n {\n design: 'tinted',\n intent: 'surface',\n class: ['bg-surface text-on-surface'],\n },\n {\n design: 'tinted',\n intent: 'surfaceInverse',\n class: ['bg-surface-inverse text-on-surface-inverse'],\n },\n ],\n defaultVariants: {\n design: 'filled',\n intent: 'neutral',\n },\n }\n)\n\nexport const snackbarItemVariantContent = cva(\n [\n 'inline-grid items-center',\n 'col-start-1 row-start-1',\n 'pl-md pr-lg', // applying padding on the parent prevents VoiceOver on Safari from reading snackbar content 🤷\n ],\n {\n variants: {\n /**\n * Force action button displaying on a new line\n * @default false\n */\n actionOnNewline: {\n true: [\n 'grid-rows-[52px_1fr_52px]',\n 'grid-cols-[min-content_1fr_min-content]',\n \"[grid-template-areas:'icon_message_close'_'._message_.'_'action_action_action']\",\n ],\n false: [\n 'grid-cols-[min-content_1fr_min-content_min-content]',\n \"[grid-template-areas:'icon_message_action_close']\",\n ],\n },\n },\n defaultVariants: {\n actionOnNewline: false,\n },\n }\n)\n\nexport type ToastVariantProps = VariantProps<typeof toastStyles>\nexport type SnackbarItemVariantContentProps = VariantProps<typeof snackbarItemVariantContent>\n","import { Toast as BaseToast } from '@base-ui-components/react/toast'\nimport * as React from 'react'\n\nimport type { UseToastManagerReturnValue } from './types'\n\nexport function useToastManager(): UseToastManagerReturnValue {\n const baseToastManager = BaseToast.useToastManager()\n\n const closeAll = React.useCallback((): void => {\n baseToastManager.toasts.forEach(({ id }) => baseToastManager.close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AAAA,oBAAAF,KAACE,WAAU,QAAV,EACC,0BAAAF;AAAA,MAACE,WAAU;AAAA,MAAV;AAAA,QACC,WAAWC;AAAA,UACT;AAAA,QACF;AAAA,QAEA,0BAAAH,KAAC,aAAU;AAAA;AAAA,IACb,GACF;AAAA,IACC;AAAA,KACH;AAEJ;AAaO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,SAAS;AAAA,EACT,SAAS;AAAA,EACT,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAsB;AACpB,QAAM,eAAeE,WAAU,gBAAgB;AAE/C,QAAM,YAAY,UAAU,OAAO;AAEnC,WAAS,YAAY,GAAwC;AAC3D,cAAU,CAAC;AACX,iBAAa,IAAI;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAI,QAAQ,EAAE,KAAK;AAAA,QACnB;AAAA,QACA,GAAI,YAAY,UAAa,EAAE,QAAQ;AAAA,MACzC;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SACE,gBAAAF,KAAC,aAAW,GAAI,CAAC,WAAW,EAAE,MAAM,SAAS,GAAI,SAAS,aACvD,UACH;AAEJ;","names":["BaseToast","cx","BaseToast","jsx","jsxs","BaseToast","cx"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/components",
|
|
3
|
-
"version": "11.1
|
|
3
|
+
"version": "11.2.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Spark (Leboncoin design system) components.",
|
|
6
6
|
"exports": {
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@react-aria/toast": "^3.0.0-beta.18",
|
|
54
54
|
"@react-stately/numberfield": "3.9.11",
|
|
55
55
|
"@react-stately/toast": "^3.0.0-beta.7",
|
|
56
|
-
"@spark-ui/hooks": "^11.1
|
|
57
|
-
"@spark-ui/icons": "^11.1
|
|
58
|
-
"@spark-ui/internal-utils": "^11.1
|
|
56
|
+
"@spark-ui/hooks": "^11.2.1",
|
|
57
|
+
"@spark-ui/icons": "^11.2.1",
|
|
58
|
+
"@spark-ui/internal-utils": "^11.2.1",
|
|
59
59
|
"@zag-js/pagination": "1.25.0",
|
|
60
60
|
"@zag-js/react": "1.25.0",
|
|
61
61
|
"class-variance-authority": "0.7.1",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"url": "https://github.com/leboncoin/spark-web/issues?q=is%3Aopen+label%3A%22Component%3A+button%22"
|
|
83
83
|
},
|
|
84
84
|
"homepage": "https://sparkui.vercel.app",
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "a92cb7950a5637402c5f13ab9cd16f6d2d6726bc"
|
|
86
86
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dialog/Dialog.tsx","../src/dialog/DialogContext.tsx","../src/dialog/DialogBody.tsx","../src/dialog/DialogClose.tsx","../src/dialog/DialogCloseButton.tsx","../src/dialog/DialogContent.tsx","../src/dialog/DialogContent.styles.tsx","../src/dialog/DialogDescription.tsx","../src/dialog/DialogFooter.tsx","../src/dialog/DialogHeader.tsx","../src/dialog/DialogOverlay.tsx","../src/dialog/DialogPortal.tsx","../src/dialog/DialogTitle.tsx","../src/dialog/DialogTrigger.tsx","../src/dialog/index.ts"],"sourcesContent":["import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, useEffect, useRef } from 'react'\n\nimport { DialogProvider } from './DialogContext'\n\nexport interface DialogProps {\n /**\n * Children of the component.\n */\n children?: RadixDialog.DialogProps['children']\n /**\n * Specifies if the dialog is open or not.\n */\n open?: RadixDialog.DialogProps['open']\n /**\n * Default open state.\n */\n defaultOpen?: RadixDialog.DialogProps['defaultOpen']\n /**\n * Handler executen on every dialog open state change.\n */\n onOpenChange?: RadixDialog.DialogProps['onOpenChange']\n /**\n * Specifies if the dialog is a modal.\n */\n modal?: RadixDialog.DialogProps['modal']\n /**\n * Specifies if the dialog should have a fade animation on its body (in case it is scrollable).\n */\n withFade?: boolean\n}\n\nexport const Dialog = ({ children, withFade = false, ...rest }: DialogProps): ReactElement => {\n const open = rest.open\n const activeElementRef = useRef<Element>(null)\n\n /**\n * This function captures the active element when the Dialog is opened\n * and sets focus back to it when the Dialog is closed.\n */\n function handleActiveElementFocus() {\n if (open && document.activeElement) {\n activeElementRef.current = document.activeElement\n }\n\n if (!open) {\n setTimeout(() => {\n if (!(activeElementRef.current instanceof HTMLElement)) return\n activeElementRef.current.focus()\n }, 0)\n }\n }\n\n useEffect(handleActiveElementFocus, [open])\n\n return (\n <DialogProvider withFade={withFade}>\n <RadixDialog.Root {...rest}>{children}</RadixDialog.Root>\n </DialogProvider>\n )\n}\n\nDialog.displayName = 'Dialog.Root'\n","import { createContext, type ReactNode, useContext, useState } from 'react'\n\nexport interface DialogContextState {\n isFullScreen: boolean\n setIsFullScreen: (value: boolean) => void\n withFade: boolean\n}\n\nconst DialogContext = createContext<DialogContextState | null>(null)\n\nexport const DialogProvider = ({\n children: childrenProp,\n withFade = false,\n}: {\n children: ReactNode\n withFade?: boolean\n}) => {\n const [isFullScreen, setIsFullScreen] = useState(false)\n\n return (\n <DialogContext.Provider\n value={{\n isFullScreen,\n setIsFullScreen,\n withFade,\n }}\n >\n {childrenProp}\n </DialogContext.Provider>\n )\n}\n\nexport const useDialog = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw Error('useDialog must be used within a Dialog provider')\n }\n\n return context\n}\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { useScrollOverflow } from '@spark-ui/hooks/use-scroll-overflow'\nimport { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref, useRef } from 'react'\n\nimport { useDialog } from './DialogContext'\n\nexport interface BodyProps {\n children: ReactNode\n className?: string\n tabIndex?: number\n ref?: Ref<HTMLDivElement>\n inset?: boolean\n}\n\nexport const Body = ({\n children,\n className,\n inset = false,\n ref: forwardedRef,\n ...rest\n}: BodyProps): ReactElement => {\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const ref = useMergeRefs(forwardedRef, scrollAreaRef)\n\n const { withFade } = useDialog()\n\n const overflow = useScrollOverflow(scrollAreaRef)\n\n return (\n <div\n data-spark-component=\"dialog-body\"\n ref={ref}\n className={cx(\n 'focus-visible:u-outline relative grow overflow-y-auto outline-hidden',\n 'transition-all duration-300',\n {\n ['px-xl py-lg']: !inset,\n },\n className\n )}\n style={{\n ...(withFade && {\n maskImage:\n 'linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 44px, rgba(0, 0, 0, 1) calc(100% - 44px), rgba(0, 0, 0, 0))',\n maskSize: `100% calc(100% + ${overflow.top ? '0px' : '44px'} + ${overflow.bottom ? '0px' : '44px'})`,\n maskPosition: `0 ${overflow.top ? '0px' : '-44px'}`,\n }),\n }}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\nBody.displayName = 'Dialog.Body'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type CloseProps = RadixDialog.DialogCloseProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Close = (props: CloseProps) => <RadixDialog.Close {...props} />\n\nClose.displayName = 'Dialog.Close'\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport { Close, CloseProps } from './DialogClose'\n\nexport type CloseButtonProps = CloseProps &\n Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>\n\nconst Root = ({\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n intent = 'neutral',\n design = 'ghost',\n children = <CloseSVG />,\n ref,\n ...rest\n}: CloseButtonProps) => {\n return (\n <Close\n data-spark-component=\"dialog-close-button\"\n data-part=\"close\"\n ref={ref}\n className={cx(['absolute', 'top-md', 'right-xl'], className)}\n asChild\n {...rest}\n >\n <IconButton intent={intent} size={size} design={design} aria-label={ariaLabel}>\n <Icon>{children}</Icon>\n </IconButton>\n </Close>\n )\n}\n\nexport const CloseButton = Object.assign(Root, {\n id: 'CloseButton',\n})\n\nRoot.displayName = 'Dialog.CloseButton'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, Ref, useEffect } from 'react'\n\nimport { dialogContentStyles, type DialogContentStylesProps } from './DialogContent.styles'\nimport { useDialog } from './DialogContext'\n\nexport interface ContentProps extends RadixDialog.DialogContentProps, DialogContentStylesProps {\n /**\n * When set to true, the content will adjust its width to fit the content rather than taking up the full available width.\n */\n isNarrow?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Content = ({\n children,\n className,\n isNarrow = false,\n size = 'md',\n onInteractOutside,\n ref,\n ...rest\n}: ContentProps): ReactElement => {\n const { setIsFullScreen } = useDialog()\n\n useEffect(() => {\n if (size === 'fullscreen') setIsFullScreen(true)\n\n return () => setIsFullScreen(false)\n }, [setIsFullScreen, size])\n\n return (\n <RadixDialog.Content\n data-spark-component=\"dialog-content\"\n ref={ref}\n className={dialogContentStyles({\n className,\n isNarrow,\n size,\n })}\n onInteractOutside={e => {\n const isForegroundElement = (e.target as HTMLElement).closest('.z-toast, .z-popover')\n\n /**\n * The focus trap of the dialog applies `pointer-events-none` on the body of the page in the background, but\n * some components with an higher z-index have `pointer-events-auto` applied on them to remain interactive and ignore the focust trap (ex: a Snackbar with actions).\n *\n * Clicking on the snackbar will be considered as an \"outside click\" and close the dialog. We want to prevent this.\n */\n if (isForegroundElement) {\n e.preventDefault()\n }\n\n onInteractOutside?.(e)\n }}\n {...rest}\n >\n {children}\n </RadixDialog.Content>\n )\n}\n\nContent.displayName = 'Dialog.Content'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const dialogContentStyles = cva(\n [\n 'z-modal flex flex-col bg-surface group',\n 'focus-visible:outline-hidden focus-visible:u-outline',\n '[&:not(:has(footer))]:pb-lg',\n '[&:not(:has(header))]:pt-lg',\n ],\n {\n variants: {\n size: {\n fullscreen: 'fixed size-full top-0 left-0',\n sm: 'max-w-sz-480',\n md: 'max-w-sz-672',\n lg: 'max-w-sz-864',\n },\n isNarrow: {\n true: [],\n false: [],\n },\n },\n compoundVariants: [\n {\n size: ['sm', 'md', 'lg'],\n class: [\n 'fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2',\n 'max-h-[80%]',\n 'shadow-md rounded-lg',\n 'data-[state=open]:animate-fade-in',\n 'data-[state=closed]:animate-fade-out',\n ],\n },\n {\n size: ['sm', 'md', 'lg'],\n isNarrow: false,\n class: ['w-full'],\n },\n ],\n defaultVariants: {\n size: 'md',\n isNarrow: false,\n },\n }\n)\n\nexport type DialogContentStylesProps = VariantProps<typeof dialogContentStyles>\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type DescriptionProps = RadixDialog.DialogDescriptionProps & {\n ref?: Ref<HTMLParagraphElement>\n}\n\nexport const Description = (props: DescriptionProps) => (\n <RadixDialog.Description data-spark-component=\"dialog-description\" {...props} />\n)\n\nDescription.displayName = 'Dialog.Description'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface FooterProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Footer = ({ children, className, ref, ...rest }: FooterProps): ReactElement => (\n <footer\n data-spark-component=\"dialog-footer\"\n ref={ref}\n className={cx(className, ['px-xl', 'py-lg'])}\n {...rest}\n >\n {children}\n </footer>\n)\n\nFooter.displayName = 'Dialog.Footer'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface HeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Header = ({ children, className, ref, ...rest }: HeaderProps): ReactElement => (\n <header\n data-spark-component=\"dialog-header\"\n ref={ref}\n className={cx(className, ['px-xl', 'py-lg'])}\n {...rest}\n >\n {children}\n </header>\n)\n\nHeader.displayName = 'Dialog.Header'\n","import { cx } from 'class-variance-authority'\nimport { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, Ref } from 'react'\n\nimport { useDialog } from './DialogContext'\n\nexport type OverlayProps = RadixDialog.DialogOverlayProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Overlay = ({ className, ref, ...rest }: OverlayProps): ReactElement | null => {\n const { isFullScreen } = useDialog()\n\n return (\n <RadixDialog.Overlay\n data-spark-component=\"dialog-overlay\"\n ref={ref}\n className={cx(\n isFullScreen ? 'hidden' : 'fixed',\n ['top-0', 'left-0', 'w-screen', 'h-screen', 'z-overlay'],\n ['bg-overlay/dim-1'],\n ['data-[state=open]:animate-fade-in'],\n ['data-[state=closed]:animate-fade-out'],\n className\n )}\n {...rest}\n />\n )\n}\n\nOverlay.displayName = 'Dialog.Overlay'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement } from 'react'\n\nexport type PortalProps = RadixDialog.DialogPortalProps\n\nexport const Portal = ({ children, ...rest }: PortalProps): ReactElement => (\n <RadixDialog.Portal {...rest}>{children}</RadixDialog.Portal>\n)\n\nPortal.displayName = 'Dialog.Portal'\n","import { cx } from 'class-variance-authority'\nimport { Dialog as RadixDialog } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type TitleProps = RadixDialog.DialogTitleProps & {\n ref?: Ref<HTMLHeadingElement>\n}\n\nexport const Title = ({ className, ref, ...others }: TitleProps) => {\n return (\n <RadixDialog.Title\n data-spark-component=\"dialog-title\"\n ref={ref}\n className={cx(\n 'text-headline-1 text-on-surface',\n 'group-has-data-[part=close]:pr-3xl',\n className\n )}\n {...others}\n />\n )\n}\n\nTitle.displayName = 'Dialog.Title'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, ReactNode, Ref } from 'react'\n\nexport interface TriggerProps {\n /**\n * Children of the component.\n */\n children?: ReactNode\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: RadixDialog.DialogTriggerProps['asChild']\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Trigger = (props: TriggerProps): ReactElement => (\n <RadixDialog.Trigger data-spark-component=\"dialog-trigger\" {...props} />\n)\n\nTrigger.displayName = 'Dialog.Trigger'\n","import { Dialog as Root } from './Dialog'\nimport { Body } from './DialogBody'\nimport { Close } from './DialogClose'\nimport { CloseButton } from './DialogCloseButton'\nimport { Content } from './DialogContent'\nimport { Description } from './DialogDescription' // aria-describedby\nimport { Footer } from './DialogFooter'\nimport { Header } from './DialogHeader'\nimport { Overlay } from './DialogOverlay'\nimport { Portal } from './DialogPortal'\nimport { Title } from './DialogTitle' // aria-labelledby\nimport { Trigger } from './DialogTrigger'\n\nexport const Dialog: typeof Root & {\n Trigger: typeof Trigger\n Portal: typeof Portal\n Overlay: typeof Overlay\n Content: typeof Content\n Header: typeof Header\n Body: typeof Body\n Footer: typeof Footer\n Close: typeof Close\n CloseButton: typeof CloseButton\n Title: typeof Title\n Description: typeof Description\n} = Object.assign(Root, {\n Trigger,\n Portal,\n Overlay,\n Content,\n Header,\n Body,\n Footer,\n Close,\n CloseButton,\n Title,\n Description,\n})\n\nDialog.displayName = 'Dialog'\nDialog.Trigger.displayName = 'Dialog.Trigger'\nTrigger.displayName = 'Dialog.Trigger'\nPortal.displayName = 'Dialog.Portal'\nOverlay.displayName = 'Dialog.Overlay'\nContent.displayName = 'Dialog.Content'\nHeader.displayName = 'Dialog.Header'\nBody.displayName = 'Dialog.Body'\nFooter.displayName = 'Dialog.Footer'\nCloseButton.displayName = 'Dialog.CloseButton'\nTitle.displayName = 'Dialog.Title'\nDescription.displayName = 'Dialog.Description'\n\nexport { type DialogProps } from './Dialog'\nexport { type ContentProps as DialogContentProps } from './DialogContent'\nexport { type HeaderProps as DialogHeaderProps } from './DialogHeader'\nexport { type BodyProps as DialogBodyProps } from './DialogBody'\nexport { type FooterProps as DialogFooterProps } from './DialogFooter'\nexport { type TriggerProps as DialogTriggerProps } from './DialogTrigger'\nexport { type OverlayProps as DialogOverlayProps } from './DialogOverlay'\nexport { type PortalProps as DialogPortalProps } from './DialogPortal'\nexport { type TitleProps as DialogTitleProps } from './DialogTitle'\nexport { type DescriptionProps as DialogDescriptionProps } from './DialogDescription'\nexport { type CloseProps as DialogCloseProps } from './DialogClose'\nexport { type CloseButtonProps as DialogCloseButtonProps } from './DialogCloseButton'\n"],"mappings":";;;;;;;;AAAA,SAAS,UAAU,mBAAmB;AACtC,SAA4B,WAAW,cAAc;;;ACDrD,SAAS,eAA+B,YAAY,gBAAgB;AAoBhE;AAZJ,IAAM,gBAAgB,cAAyC,IAAI;AAE5D,IAAM,iBAAiB,CAAC;AAAA,EAC7B,UAAU;AAAA,EACV,WAAW;AACb,MAGM;AACJ,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AAEtD,SACE;AAAA,IAAC,cAAc;AAAA,IAAd;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;AAEO,IAAM,YAAY,MAAM;AAC7B,QAAM,UAAU,WAAW,aAAa;AAExC,MAAI,CAAC,SAAS;AACZ,UAAM,MAAM,iDAAiD;AAAA,EAC/D;AAEA,SAAO;AACT;;;ADiBM,gBAAAA,YAAA;AAzBC,IAAM,SAAS,CAAC,EAAE,UAAU,WAAW,OAAO,GAAG,KAAK,MAAiC;AAC5F,QAAM,OAAO,KAAK;AAClB,QAAM,mBAAmB,OAAgB,IAAI;AAM7C,WAAS,2BAA2B;AAClC,QAAI,QAAQ,SAAS,eAAe;AAClC,uBAAiB,UAAU,SAAS;AAAA,IACtC;AAEA,QAAI,CAAC,MAAM;AACT,iBAAW,MAAM;AACf,YAAI,EAAE,iBAAiB,mBAAmB,aAA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SACE,gBAAAA;AAAA,IAACD,aAAY;AAAA,IAAZ;AAAA,MACC,wBAAqB;AAAA,MACrB;AAAA,MACA,WAAWD;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,MAAM,cAAc;;;ACvBpB,SAAS,UAAUG,oBAAmB;AAgBpC,gBAAAC,aAAA;AADK,IAAM,UAAU,CAAC,UACtB,gBAAAA,MAACD,aAAY,SAAZ,EAAoB,wBAAqB,kBAAkB,GAAG,OAAO;AAGxE,QAAQ,cAAc;;;ACNf,IAAME,UAYT,OAAO,OAAO,QAAM;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEDA,QAAO,cAAc;AACrBA,QAAO,QAAQ,cAAc;AAC7B,QAAQ,cAAc;AACtB,OAAO,cAAc;AACrB,QAAQ,cAAc;AACtB,QAAQ,cAAc;AACtB,OAAO,cAAc;AACrB,KAAK,cAAc;AACnB,OAAO,cAAc;AACrB,YAAY,cAAc;AAC1B,MAAM,cAAc;AACpB,YAAY,cAAc;","names":["jsx","useRef","jsx","useRef","RadixDialog","jsx","cx","jsx","cx","RadixDialog","useEffect","jsx","useEffect","RadixDialog","RadixDialog","jsx","cx","jsx","cx","jsx","cx","RadixDialog","jsx","RadixDialog","cx","RadixDialog","jsx","cx","RadixDialog","jsx","RadixDialog","jsx","Dialog"]}
|