@spark-ui/components 16.2.1 → 16.2.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.
|
@@ -25,6 +25,6 @@ export interface DividerProps extends HTMLAttributes<HTMLDivElement>, Omit<Divid
|
|
|
25
25
|
ref?: Ref<HTMLDivElement>;
|
|
26
26
|
}
|
|
27
27
|
export declare const Divider: {
|
|
28
|
-
({ asChild, className, isDecorative, children, orientation, writingMode, alignment, intent, ref, ...props }: DividerProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
({ asChild, className, isDecorative, children, orientation, writingMode, alignment, intent, ref, role: roleProp, ...props }: DividerProps): import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
displayName: string;
|
|
30
30
|
};
|
package/dist/divider/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),h=require("@base-ui/react/separator"),s=require("class-variance-authority"),E=require("../Slot-DQ8z2zsy.js"),e=require("@spark-ui/internal-utils"),x=[{intent:"current",isEmpty:!0,class:e.tw(["border-current"])},{intent:"current",isEmpty:!1,class:e.tw(["before:border-current after:border-current"])},{intent:"outline",isEmpty:!0,class:e.tw(["border-outline"])},{intent:"outline",isEmpty:!1,class:e.tw(["before:border-outline after:border-outline"])}],j=s.cva(["overflow-hidden group"],{variants:{isEmpty:{true:["border-solid"],false:["inline-flex items-center","after:border-solid before:border-solid"]},orientation:{vertical:["w-fit inline-flex"],horizontal:["w-full"]},writingMode:{"horizontal-tb":[],"vertical-lr":[]},alignment:{start:[],end:[],center:[]},intent:{current:[],outline:[]}},defaultVariants:{orientation:"horizontal",writingMode:"horizontal-tb",alignment:"center",intent:"outline"},compoundVariants:[{isEmpty:!0,orientation:"horizontal",class:e.tw(["my-lg border-t-sm"])},{isEmpty:!0,orientation:"vertical",class:e.tw(["mx-lg min-h-sz-24 border-l-sm"])},{isEmpty:!1,orientation:"horizontal",writingMode:"horizontal-tb",class:e.tw(["flex-row my-sm grow-0","before:border-t-sm","after:border-t-sm","*:px-lg"])},{isEmpty:!1,orientation:"vertical",writingMode:"horizontal-tb",class:e.tw(["flex-col mx-sm","before:border-l-sm","after:border-l-sm","*:py-lg"])},{isEmpty:!1,orientation:"vertical",writingMode:"vertical-lr",class:e.tw(["flex-col mx-sm","before:border-l-sm","after:border-l-sm","*:px-lg"])},{isEmpty:!1,orientation:"horizontal",alignment:"end",class:e.tw(["after:w-sz-40 before:grow after:grow-0"])},{isEmpty:!1,orientation:"horizontal",alignment:"start",class:e.tw(["before:w-sz-40 before:grow-0 after:grow"])},{isEmpty:!1,orientation:"horizontal",alignment:"center",class:e.tw(["justify-center before:grow after:grow"])},{isEmpty:!1,orientation:"vertical",alignment:"end",class:e.tw(["after:h-sz-40 before:grow after:grow-0 before:min-h-sz-40"])},{isEmpty:!1,orientation:"vertical",alignment:"start",class:e.tw(["before:h-sz-40 before:grow-0 after:grow after:min-h-sz-40"])},{isEmpty:!1,orientation:"vertical",alignment:"center",class:e.tw(["justify-center before:grow after:grow before:min-h-sz-40 after:min-h-sz-40"])},...x]}),f=({asChild:t,className:i,isDecorative:o=!1,children:r,orientation:c="horizontal",writingMode:m="horizontal-tb",alignment:w="center",intent:u="outline",ref:g,role:d,...p})=>{const y=t?!r?.props?.children:!r;let n;o?n={role:"none"}:d!==void 0&&(n={role:d});const v=t?(z=>a.jsx(E.Slot,{...z})):void 0;return a.jsx(h.Separator,{"data-spark-component":"divider",className:s.cx(j({isEmpty:y,orientation:c,alignment:w,intent:u,writingMode:m}),i),orientation:c,ref:g,...p,render:v,...n,"data-writing-mode":m,children:r})};f.displayName="Divider";const b=({children:t,ref:i,className:o,...r})=>t?a.jsx("span",{"data-spark-component":"divider-content",ref:i,...r,className:s.cx("group-data-[writing-mode=vertical-lr]:[writing-mode:vertical-lr]",o),children:t}):null;b.displayName="Divider.Content";const l=Object.assign(f,{Content:b});l.displayName="Divider";l.Content.displayName="Divider.Content";exports.Divider=l;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/divider/variants/intents.tsx","../../src/divider/Divider.styles.ts","../../src/divider/Divider.tsx","../../src/divider/DividerContent.tsx","../../src/divider/index.ts"],"sourcesContent":["import { tw } from '@spark-ui/internal-utils'\n\nexport const intentVariants = [\n // current\n {\n intent: 'current',\n isEmpty: true,\n class: tw(['border-current']),\n },\n {\n intent: 'current',\n isEmpty: false,\n class: tw(['before:border-current after:border-current']),\n },\n // outline\n {\n intent: 'outline',\n isEmpty: true,\n class: tw(['border-outline']),\n },\n {\n intent: 'outline',\n isEmpty: false,\n class: tw(['before:border-outline after:border-outline']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { intentVariants } from './variants/intents'\n\nexport const dividerStyles = cva(['overflow-hidden group'], {\n variants: {\n isEmpty: {\n true: ['border-solid'],\n false: ['inline-flex items-center', 'after:border-solid before:border-solid'],\n },\n orientation: {\n vertical: ['w-fit inline-flex'],\n horizontal: ['w-full'],\n },\n writingMode: {\n 'horizontal-tb': [],\n 'vertical-lr': [],\n },\n alignment: {\n start: [],\n end: [],\n center: [],\n },\n intent: {\n current: [],\n outline: [],\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n alignment: 'center',\n intent: 'outline',\n },\n compoundVariants: [\n {\n isEmpty: true,\n orientation: 'horizontal',\n class: tw(['my-lg border-t-sm']),\n },\n {\n isEmpty: true,\n orientation: 'vertical',\n class: tw(['mx-lg min-h-sz-24 border-l-sm']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n class: tw(['flex-row my-sm grow-0', 'before:border-t-sm', 'after:border-t-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'horizontal-tb',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:py-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'vertical-lr',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'end',\n class: tw(['after:w-sz-40 before:grow after:grow-0']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'start',\n class: tw(['before:w-sz-40 before:grow-0 after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'end',\n class: tw(['after:h-sz-40 before:grow after:grow-0 before:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'start',\n class: tw(['before:h-sz-40 before:grow-0 after:grow after:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow before:min-h-sz-40 after:min-h-sz-40']),\n },\n ...intentVariants,\n ],\n})\n\nexport type DividerStylesProps = VariantProps<typeof dividerStyles>\n","import { cx } from 'class-variance-authority'\nimport { Separator } from 'radix-ui'\nimport { HTMLAttributes, ReactElement, ReactNode, Ref } from 'react'\n\nimport { dividerStyles, type DividerStylesProps } from './Divider.styles'\n\nexport interface DividerProps\n extends HTMLAttributes<HTMLDivElement>,\n Omit<DividerStylesProps, 'isEmpty'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactElement\n /**\n * The orientation of the inner content.\n */\n alignment?: 'start' | 'end' | 'center'\n /**\n * The orientation of the separator.\n */\n orientation?: 'vertical' | 'horizontal'\n /**\n * When true, signifies that it is purely visual, carries no semantic meaning, and ensures it is not present in the accessibility tree.\n */\n isDecorative?: boolean\n /**\n * Color scheme of the divider.\n */\n intent?: 'outline' | 'current'\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Divider = ({\n asChild,\n className,\n isDecorative = false,\n children,\n orientation = 'horizontal',\n writingMode = 'horizontal-tb',\n alignment = 'center',\n intent = 'outline',\n ref,\n ...props\n}: DividerProps) => {\n const isEmpty = asChild ? !(children?.props as { children: ReactNode })?.children : !children\n\n return (\n <Separator.Root\n data-spark-component=\"divider\"\n asChild={asChild}\n className={cx(\n dividerStyles({ isEmpty, orientation, alignment, intent, writingMode }),\n className\n )}\n orientation={orientation}\n ref={ref}\n decorative={isDecorative}\n {...props}\n data-writing-mode={writingMode}\n >\n {children}\n </Separator.Root>\n )\n}\n\nDivider.displayName = 'Divider'\n","import { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactNode, Ref } from 'react'\n\nexport interface DividerContentProps extends HTMLAttributes<HTMLSpanElement> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactNode\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const DividerContent = ({ children, ref, className, ...props }: DividerContentProps) => {\n return children ? (\n <span\n data-spark-component=\"divider-content\"\n ref={ref}\n {...props}\n className={cx('group-data-[writing-mode=vertical-lr]:[writing-mode:vertical-lr]', className)}\n >\n {children}\n </span>\n ) : null\n}\n\nDividerContent.displayName = 'Divider.Content'\n","import { Divider as Root } from './Divider'\nimport { DividerContent } from './DividerContent'\n\nexport { type DividerContentProps } from './DividerContent'\n\nexport const Divider: typeof Root & {\n Content: typeof DividerContent\n} = Object.assign(Root, {\n Content: DividerContent,\n})\n\nDivider.displayName = 'Divider'\nDivider.Content.displayName = 'Divider.Content'\n"],"names":["intentVariants","tw","dividerStyles","cva","Divider","asChild","className","isDecorative","children","orientation","writingMode","alignment","intent","ref","props","isEmpty","jsx","Separator","cx","DividerContent","Root"],"mappings":"uNAEaA,EAAiB,CAE5B,CACE,OAAQ,UACR,QAAS,GACT,M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AAAK,EAAK,UAAAP,EAAW,GAAGQ,KACrDN,EACLQ,EAAAA,IAAC,OAAA,CACC,uBAAqB,kBACrB,IAAAH,EACC,GAAGC,EACJ,UAAWI,EAAAA,GAAG,mEAAoEZ,CAAS,EAE1F,SAAAE,CAAA,CAAA,EAED,KAGNW,EAAe,YAAc,kBCpBtB,MAAMf,EAET,OAAO,OAAOgB,EAAM,CACtB,QAASD,CACX,CAAC,EAEDf,EAAQ,YAAc,UACtBA,EAAQ,QAAQ,YAAc"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/divider/variants/intents.tsx","../../src/divider/Divider.styles.ts","../../src/divider/Divider.tsx","../../src/divider/DividerContent.tsx","../../src/divider/index.ts"],"sourcesContent":["import { tw } from '@spark-ui/internal-utils'\n\nexport const intentVariants = [\n // current\n {\n intent: 'current',\n isEmpty: true,\n class: tw(['border-current']),\n },\n {\n intent: 'current',\n isEmpty: false,\n class: tw(['before:border-current after:border-current']),\n },\n // outline\n {\n intent: 'outline',\n isEmpty: true,\n class: tw(['border-outline']),\n },\n {\n intent: 'outline',\n isEmpty: false,\n class: tw(['before:border-outline after:border-outline']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { intentVariants } from './variants/intents'\n\nexport const dividerStyles = cva(['overflow-hidden group'], {\n variants: {\n isEmpty: {\n true: ['border-solid'],\n false: ['inline-flex items-center', 'after:border-solid before:border-solid'],\n },\n orientation: {\n vertical: ['w-fit inline-flex'],\n horizontal: ['w-full'],\n },\n writingMode: {\n 'horizontal-tb': [],\n 'vertical-lr': [],\n },\n alignment: {\n start: [],\n end: [],\n center: [],\n },\n intent: {\n current: [],\n outline: [],\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n alignment: 'center',\n intent: 'outline',\n },\n compoundVariants: [\n {\n isEmpty: true,\n orientation: 'horizontal',\n class: tw(['my-lg border-t-sm']),\n },\n {\n isEmpty: true,\n orientation: 'vertical',\n class: tw(['mx-lg min-h-sz-24 border-l-sm']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n class: tw(['flex-row my-sm grow-0', 'before:border-t-sm', 'after:border-t-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'horizontal-tb',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:py-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'vertical-lr',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'end',\n class: tw(['after:w-sz-40 before:grow after:grow-0']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'start',\n class: tw(['before:w-sz-40 before:grow-0 after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'end',\n class: tw(['after:h-sz-40 before:grow after:grow-0 before:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'start',\n class: tw(['before:h-sz-40 before:grow-0 after:grow after:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow before:min-h-sz-40 after:min-h-sz-40']),\n },\n ...intentVariants,\n ],\n})\n\nexport type DividerStylesProps = VariantProps<typeof dividerStyles>\n","import { Separator as BaseSeparator } from '@base-ui/react/separator'\nimport { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactElement, ReactNode, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { dividerStyles, type DividerStylesProps } from './Divider.styles'\n\nexport interface DividerProps\n extends HTMLAttributes<HTMLDivElement>,\n Omit<DividerStylesProps, 'isEmpty'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactElement\n /**\n * The orientation of the inner content.\n */\n alignment?: 'start' | 'end' | 'center'\n /**\n * The orientation of the separator.\n */\n orientation?: 'vertical' | 'horizontal'\n /**\n * When true, signifies that it is purely visual, carries no semantic meaning, and ensures it is not present in the accessibility tree.\n */\n isDecorative?: boolean\n /**\n * Color scheme of the divider.\n */\n intent?: 'outline' | 'current'\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Divider = ({\n asChild,\n className,\n isDecorative = false,\n children,\n orientation = 'horizontal',\n writingMode = 'horizontal-tb',\n alignment = 'center',\n intent = 'outline',\n ref,\n role: roleProp,\n ...props\n}: DividerProps) => {\n const isEmpty = asChild ? !(children?.props as { children: ReactNode })?.children : !children\n\n let roleProps: { role: string } | undefined\n if (isDecorative) {\n roleProps = { role: 'none' }\n } else if (roleProp !== undefined) {\n roleProps = { role: roleProp }\n }\n\n const renderSlot = asChild\n ? // Base UI uses its `render` prop to swap the underlying element.\n // We rely on Spark's `Slot` to mimic Radix's `asChild` behavior.\n (slotProps: any) => <Slot {...slotProps} />\n : undefined\n\n return (\n <BaseSeparator\n data-spark-component=\"divider\"\n className={cx(\n dividerStyles({ isEmpty, orientation, alignment, intent, writingMode }),\n className\n )}\n orientation={orientation}\n ref={ref}\n {...props}\n render={renderSlot}\n {...roleProps}\n data-writing-mode={writingMode}\n >\n {children}\n </BaseSeparator>\n )\n}\n\nDivider.displayName = 'Divider'\n","import { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactNode, Ref } from 'react'\n\nexport interface DividerContentProps extends HTMLAttributes<HTMLSpanElement> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactNode\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const DividerContent = ({ children, ref, className, ...props }: DividerContentProps) => {\n return children ? (\n <span\n data-spark-component=\"divider-content\"\n ref={ref}\n {...props}\n className={cx('group-data-[writing-mode=vertical-lr]:[writing-mode:vertical-lr]', className)}\n >\n {children}\n </span>\n ) : null\n}\n\nDividerContent.displayName = 'Divider.Content'\n","import { Divider as Root } from './Divider'\nimport { DividerContent } from './DividerContent'\n\nexport { type DividerContentProps } from './DividerContent'\n\nexport const Divider: typeof Root & {\n Content: typeof DividerContent\n} = Object.assign(Root, {\n Content: DividerContent,\n})\n\nDivider.displayName = 'Divider'\nDivider.Content.displayName = 'Divider.Content'\n"],"names":["intentVariants","tw","dividerStyles","cva","Divider","asChild","className","isDecorative","children","orientation","writingMode","alignment","intent","ref","roleProp","props","isEmpty","roleProps","renderSlot","slotProps","jsx","Slot","BaseSeparator","cx","DividerContent","Root"],"mappings":"wQAEaA,EAAiB,CAE5B,CACE,OAAQ,UACR,QAAS,GACT,MAAOC,EAAAA,GAAG,CAAC,gBAAgB,CAAC,CAAA,EAE9B,CACE,OAAQ,UACR,QAAS,GACT,MAAOA,EAAAA,GAAG,CAAC,4CAA4C,CAAC,CAAA,EAG1D,CACE,OAAQ,UACR,QAAS,GACT,MAAOA,EAAAA,GAAG,CAAC,gBAAgB,CAAC,CAAA,EAE9B,CACE,OAAQ,UACR,QAAS,GACT,MAAOA,EAAAA,GAAG,CAAC,4CAA4C,CAAC,CAAA,CAE5D,ECpBaC,EAAgBC,EAAAA,IAAI,CAAC,uBAAuB,EAAG,CAC1D,SAAU,CACR,QAAS,CACP,KAAM,CAAC,cAAc,EACrB,MAAO,CAAC,2BAA4B,wCAAwC,CAAA,EAE9E,YAAa,CACX,SAAU,CAAC,mBAAmB,EAC9B,WAAY,CAAC,QAAQ,CAAA,EAEvB,YAAa,CACX,gBAAiB,CAAA,EACjB,cAAe,CAAA,CAAC,EAElB,UAAW,CACT,MAAO,CAAA,EACP,IAAK,CAAA,EACL,OAAQ,CAAA,CAAC,EAEX,OAAQ,CACN,QAAS,CAAA,EACT,QAAS,CAAA,CAAC,CACZ,EAEF,gBAAiB,CACf,YAAa,aACb,YAAa,gBACb,UAAW,SACX,OAAQ,SAAA,EAEV,iB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AC,EAAS,UACT,IAAAC,EACA,KAAMC,EACN,GAAGC,CACL,IAAoB,CAClB,MAAMC,EAAUX,EAAU,CAAEG,GAAU,OAAmC,SAAW,CAACA,EAErF,IAAIS,EACAV,EACFU,EAAY,CAAE,KAAM,MAAA,EACXH,IAAa,SACtBG,EAAY,CAAE,KAAMH,CAAA,GAGtB,MAAMI,EAAab,GAGdc,GAAmBC,EAAAA,IAACC,OAAA,CAAM,GAAGF,CAAA,CAAW,GACzC,OAEJ,OACEC,EAAAA,IAACE,EAAAA,UAAA,CACC,uBAAqB,UACrB,UAAWC,EAAAA,GACTrB,EAAc,CAAE,QAAAc,EAAS,YAAAP,EAAa,UAAAE,EAAW,OAAAC,EAAQ,YAAAF,EAAa,EACtEJ,CAAA,EAEF,YAAAG,EACA,IAAAI,EACC,GAAGE,EACJ,OAAQG,EACP,GAAGD,EACJ,oBAAmBP,EAElB,SAAAF,CAAA,CAAA,CAGP,EAEAJ,EAAQ,YAAc,UCrEf,MAAMoB,EAAiB,CAAC,CAAE,SAAAhB,EAAU,IAAAK,EAAK,UAAAP,EAAW,GAAGS,KACrDP,EACLY,EAAAA,IAAC,OAAA,CACC,uBAAqB,kBACrB,IAAAP,EACC,GAAGE,EACJ,UAAWQ,EAAAA,GAAG,mEAAoEjB,CAAS,EAE1F,SAAAE,CAAA,CAAA,EAED,KAGNgB,EAAe,YAAc,kBCpBtB,MAAMpB,EAET,OAAO,OAAOqB,EAAM,CACtB,QAASD,CACX,CAAC,EAEDpB,EAAQ,YAAc,UACtBA,EAAQ,QAAQ,YAAc"}
|
package/dist/divider/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Separator as h } from "@base-ui/react/separator";
|
|
3
|
+
import { cva as E, cx as f } from "class-variance-authority";
|
|
4
|
+
import { S as x } from "../Slot-DLY1rJrG.mjs";
|
|
4
5
|
import { tw as e } from "@spark-ui/internal-utils";
|
|
5
|
-
const
|
|
6
|
+
const D = [
|
|
6
7
|
// current
|
|
7
8
|
{
|
|
8
9
|
intent: "current",
|
|
@@ -25,7 +26,7 @@ const v = [
|
|
|
25
26
|
isEmpty: !1,
|
|
26
27
|
class: e(["before:border-outline after:border-outline"])
|
|
27
28
|
}
|
|
28
|
-
],
|
|
29
|
+
], N = E(["overflow-hidden group"], {
|
|
29
30
|
variants: {
|
|
30
31
|
isEmpty: {
|
|
31
32
|
true: ["border-solid"],
|
|
@@ -120,57 +121,65 @@ const v = [
|
|
|
120
121
|
alignment: "center",
|
|
121
122
|
class: e(["justify-center before:grow after:grow before:min-h-sz-40 after:min-h-sz-40"])
|
|
122
123
|
},
|
|
123
|
-
...
|
|
124
|
+
...D
|
|
124
125
|
]
|
|
125
|
-
}),
|
|
126
|
+
}), c = ({
|
|
126
127
|
asChild: t,
|
|
127
128
|
className: o,
|
|
128
129
|
isDecorative: i = !1,
|
|
129
130
|
children: r,
|
|
130
|
-
orientation:
|
|
131
|
-
writingMode:
|
|
132
|
-
alignment:
|
|
133
|
-
intent:
|
|
134
|
-
ref:
|
|
135
|
-
|
|
131
|
+
orientation: s = "horizontal",
|
|
132
|
+
writingMode: l = "horizontal-tb",
|
|
133
|
+
alignment: b = "center",
|
|
134
|
+
intent: g = "outline",
|
|
135
|
+
ref: u,
|
|
136
|
+
role: m,
|
|
137
|
+
...w
|
|
136
138
|
}) => {
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
const y = t ? !r?.props?.children : !r;
|
|
140
|
+
let n;
|
|
141
|
+
i ? n = { role: "none" } : m !== void 0 && (n = { role: m });
|
|
142
|
+
const v = t ? (
|
|
143
|
+
// Base UI uses its `render` prop to swap the underlying element.
|
|
144
|
+
// We rely on Spark's `Slot` to mimic Radix's `asChild` behavior.
|
|
145
|
+
((z) => /* @__PURE__ */ a(x, { ...z }))
|
|
146
|
+
) : void 0;
|
|
147
|
+
return /* @__PURE__ */ a(
|
|
148
|
+
h,
|
|
140
149
|
{
|
|
141
150
|
"data-spark-component": "divider",
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
z({ isEmpty: u, orientation: n, alignment: d, intent: p, writingMode: a }),
|
|
151
|
+
className: f(
|
|
152
|
+
N({ isEmpty: y, orientation: s, alignment: b, intent: g, writingMode: l }),
|
|
145
153
|
o
|
|
146
154
|
),
|
|
147
|
-
orientation:
|
|
148
|
-
ref:
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
orientation: s,
|
|
156
|
+
ref: u,
|
|
157
|
+
...w,
|
|
158
|
+
render: v,
|
|
159
|
+
...n,
|
|
160
|
+
"data-writing-mode": l,
|
|
152
161
|
children: r
|
|
153
162
|
}
|
|
154
163
|
);
|
|
155
164
|
};
|
|
156
|
-
|
|
157
|
-
const
|
|
165
|
+
c.displayName = "Divider";
|
|
166
|
+
const d = ({ children: t, ref: o, className: i, ...r }) => t ? /* @__PURE__ */ a(
|
|
158
167
|
"span",
|
|
159
168
|
{
|
|
160
169
|
"data-spark-component": "divider-content",
|
|
161
170
|
ref: o,
|
|
162
171
|
...r,
|
|
163
|
-
className:
|
|
172
|
+
className: f("group-data-[writing-mode=vertical-lr]:[writing-mode:vertical-lr]", i),
|
|
164
173
|
children: t
|
|
165
174
|
}
|
|
166
175
|
) : null;
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
Content:
|
|
176
|
+
d.displayName = "Divider.Content";
|
|
177
|
+
const p = Object.assign(c, {
|
|
178
|
+
Content: d
|
|
170
179
|
});
|
|
171
|
-
|
|
172
|
-
|
|
180
|
+
p.displayName = "Divider";
|
|
181
|
+
p.Content.displayName = "Divider.Content";
|
|
173
182
|
export {
|
|
174
|
-
|
|
183
|
+
p as Divider
|
|
175
184
|
};
|
|
176
185
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/divider/variants/intents.tsx","../../src/divider/Divider.styles.ts","../../src/divider/Divider.tsx","../../src/divider/DividerContent.tsx","../../src/divider/index.ts"],"sourcesContent":["import { tw } from '@spark-ui/internal-utils'\n\nexport const intentVariants = [\n // current\n {\n intent: 'current',\n isEmpty: true,\n class: tw(['border-current']),\n },\n {\n intent: 'current',\n isEmpty: false,\n class: tw(['before:border-current after:border-current']),\n },\n // outline\n {\n intent: 'outline',\n isEmpty: true,\n class: tw(['border-outline']),\n },\n {\n intent: 'outline',\n isEmpty: false,\n class: tw(['before:border-outline after:border-outline']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { intentVariants } from './variants/intents'\n\nexport const dividerStyles = cva(['overflow-hidden group'], {\n variants: {\n isEmpty: {\n true: ['border-solid'],\n false: ['inline-flex items-center', 'after:border-solid before:border-solid'],\n },\n orientation: {\n vertical: ['w-fit inline-flex'],\n horizontal: ['w-full'],\n },\n writingMode: {\n 'horizontal-tb': [],\n 'vertical-lr': [],\n },\n alignment: {\n start: [],\n end: [],\n center: [],\n },\n intent: {\n current: [],\n outline: [],\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n alignment: 'center',\n intent: 'outline',\n },\n compoundVariants: [\n {\n isEmpty: true,\n orientation: 'horizontal',\n class: tw(['my-lg border-t-sm']),\n },\n {\n isEmpty: true,\n orientation: 'vertical',\n class: tw(['mx-lg min-h-sz-24 border-l-sm']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n class: tw(['flex-row my-sm grow-0', 'before:border-t-sm', 'after:border-t-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'horizontal-tb',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:py-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'vertical-lr',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'end',\n class: tw(['after:w-sz-40 before:grow after:grow-0']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'start',\n class: tw(['before:w-sz-40 before:grow-0 after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'end',\n class: tw(['after:h-sz-40 before:grow after:grow-0 before:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'start',\n class: tw(['before:h-sz-40 before:grow-0 after:grow after:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow before:min-h-sz-40 after:min-h-sz-40']),\n },\n ...intentVariants,\n ],\n})\n\nexport type DividerStylesProps = VariantProps<typeof dividerStyles>\n","import { cx } from 'class-variance-authority'\nimport { Separator } from 'radix-ui'\nimport { HTMLAttributes, ReactElement, ReactNode, Ref } from 'react'\n\nimport { dividerStyles, type DividerStylesProps } from './Divider.styles'\n\nexport interface DividerProps\n extends HTMLAttributes<HTMLDivElement>,\n Omit<DividerStylesProps, 'isEmpty'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactElement\n /**\n * The orientation of the inner content.\n */\n alignment?: 'start' | 'end' | 'center'\n /**\n * The orientation of the separator.\n */\n orientation?: 'vertical' | 'horizontal'\n /**\n * When true, signifies that it is purely visual, carries no semantic meaning, and ensures it is not present in the accessibility tree.\n */\n isDecorative?: boolean\n /**\n * Color scheme of the divider.\n */\n intent?: 'outline' | 'current'\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Divider = ({\n asChild,\n className,\n isDecorative = false,\n children,\n orientation = 'horizontal',\n writingMode = 'horizontal-tb',\n alignment = 'center',\n intent = 'outline',\n ref,\n ...props\n}: DividerProps) => {\n const isEmpty = asChild ? !(children?.props as { children: ReactNode })?.children : !children\n\n return (\n <Separator.Root\n data-spark-component=\"divider\"\n asChild={asChild}\n className={cx(\n dividerStyles({ isEmpty, orientation, alignment, intent, writingMode }),\n className\n )}\n orientation={orientation}\n ref={ref}\n decorative={isDecorative}\n {...props}\n data-writing-mode={writingMode}\n >\n {children}\n </Separator.Root>\n )\n}\n\nDivider.displayName = 'Divider'\n","import { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactNode, Ref } from 'react'\n\nexport interface DividerContentProps extends HTMLAttributes<HTMLSpanElement> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactNode\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const DividerContent = ({ children, ref, className, ...props }: DividerContentProps) => {\n return children ? (\n <span\n data-spark-component=\"divider-content\"\n ref={ref}\n {...props}\n className={cx('group-data-[writing-mode=vertical-lr]:[writing-mode:vertical-lr]', className)}\n >\n {children}\n </span>\n ) : null\n}\n\nDividerContent.displayName = 'Divider.Content'\n","import { Divider as Root } from './Divider'\nimport { DividerContent } from './DividerContent'\n\nexport { type DividerContentProps } from './DividerContent'\n\nexport const Divider: typeof Root & {\n Content: typeof DividerContent\n} = Object.assign(Root, {\n Content: DividerContent,\n})\n\nDivider.displayName = 'Divider'\nDivider.Content.displayName = 'Divider.Content'\n"],"names":["intentVariants","tw","dividerStyles","cva","Divider","asChild","className","isDecorative","children","orientation","writingMode","alignment","intent","ref","props","isEmpty","jsx","Separator","cx","DividerContent","Root"],"mappings":";;;;AAEO,MAAMA,IAAiB;AAAA;AAAA,EAE5B;AAAA,IACE,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAOC,EAAG,CAAC,gBAAgB,CAAC;AAAA,EAAA;AAAA,EAE9B;AAAA,IACE,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAOA,EAAG,CAAC,4CAA4C,CAAC;AAAA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AAC,IAAS;AAAA,EACT,KAAAC;AAAA,EACA,GAAGC;AACL,MAAoB;AAClB,QAAMC,IAAUV,IAAU,CAAEG,GAAU,OAAmC,WAAW,CAACA;AAErF,SACE,gBAAAQ;AAAA,IAACC,EAAU;AAAA,IAAV;AAAA,MACC,wBAAqB;AAAA,MACrB,SAAAZ;AAAA,MACA,WAAWa;AAAA,QACThB,EAAc,EAAE,SAAAa,GAAS,aAAAN,GAAa,WAAAE,GAAW,QAAAC,GAAQ,aAAAF,GAAa;AAAA,QACtEJ;AAAA,MAAA;AAAA,MAEF,aAAAG;AAAA,MACA,KAAAI;AAAA,MACA,YAAYN;AAAA,MACX,GAAGO;AAAA,MACJ,qBAAmBJ;AAAA,MAElB,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGP;AAEAJ,EAAQ,cAAc;ACtDf,MAAMe,IAAiB,CAAC,EAAE,UAAAX,GAAU,KAAAK,GAAK,WAAAP,GAAW,GAAGQ,QACrDN,IACL,gBAAAQ;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,wBAAqB;AAAA,IACrB,KAAAH;AAAA,IACC,GAAGC;AAAA,IACJ,WAAWI,EAAG,oEAAoEZ,CAAS;AAAA,IAE1F,UAAAE;AAAA,EAAA;AAAA,IAED;AAGNW,EAAe,cAAc;ACpBtB,MAAMf,IAET,OAAO,OAAOgB,GAAM;AAAA,EACtB,SAASD;AACX,CAAC;AAEDf,EAAQ,cAAc;AACtBA,EAAQ,QAAQ,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/divider/variants/intents.tsx","../../src/divider/Divider.styles.ts","../../src/divider/Divider.tsx","../../src/divider/DividerContent.tsx","../../src/divider/index.ts"],"sourcesContent":["import { tw } from '@spark-ui/internal-utils'\n\nexport const intentVariants = [\n // current\n {\n intent: 'current',\n isEmpty: true,\n class: tw(['border-current']),\n },\n {\n intent: 'current',\n isEmpty: false,\n class: tw(['before:border-current after:border-current']),\n },\n // outline\n {\n intent: 'outline',\n isEmpty: true,\n class: tw(['border-outline']),\n },\n {\n intent: 'outline',\n isEmpty: false,\n class: tw(['before:border-outline after:border-outline']),\n },\n] as const\n","import { tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nimport { intentVariants } from './variants/intents'\n\nexport const dividerStyles = cva(['overflow-hidden group'], {\n variants: {\n isEmpty: {\n true: ['border-solid'],\n false: ['inline-flex items-center', 'after:border-solid before:border-solid'],\n },\n orientation: {\n vertical: ['w-fit inline-flex'],\n horizontal: ['w-full'],\n },\n writingMode: {\n 'horizontal-tb': [],\n 'vertical-lr': [],\n },\n alignment: {\n start: [],\n end: [],\n center: [],\n },\n intent: {\n current: [],\n outline: [],\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n alignment: 'center',\n intent: 'outline',\n },\n compoundVariants: [\n {\n isEmpty: true,\n orientation: 'horizontal',\n class: tw(['my-lg border-t-sm']),\n },\n {\n isEmpty: true,\n orientation: 'vertical',\n class: tw(['mx-lg min-h-sz-24 border-l-sm']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n writingMode: 'horizontal-tb',\n class: tw(['flex-row my-sm grow-0', 'before:border-t-sm', 'after:border-t-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'horizontal-tb',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:py-lg']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n writingMode: 'vertical-lr',\n class: tw(['flex-col mx-sm', 'before:border-l-sm', 'after:border-l-sm', '*:px-lg']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'end',\n class: tw(['after:w-sz-40 before:grow after:grow-0']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'start',\n class: tw(['before:w-sz-40 before:grow-0 after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'horizontal',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'end',\n class: tw(['after:h-sz-40 before:grow after:grow-0 before:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'start',\n class: tw(['before:h-sz-40 before:grow-0 after:grow after:min-h-sz-40']),\n },\n {\n isEmpty: false,\n orientation: 'vertical',\n alignment: 'center',\n class: tw(['justify-center before:grow after:grow before:min-h-sz-40 after:min-h-sz-40']),\n },\n ...intentVariants,\n ],\n})\n\nexport type DividerStylesProps = VariantProps<typeof dividerStyles>\n","import { Separator as BaseSeparator } from '@base-ui/react/separator'\nimport { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactElement, ReactNode, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { dividerStyles, type DividerStylesProps } from './Divider.styles'\n\nexport interface DividerProps\n extends HTMLAttributes<HTMLDivElement>,\n Omit<DividerStylesProps, 'isEmpty'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactElement\n /**\n * The orientation of the inner content.\n */\n alignment?: 'start' | 'end' | 'center'\n /**\n * The orientation of the separator.\n */\n orientation?: 'vertical' | 'horizontal'\n /**\n * When true, signifies that it is purely visual, carries no semantic meaning, and ensures it is not present in the accessibility tree.\n */\n isDecorative?: boolean\n /**\n * Color scheme of the divider.\n */\n intent?: 'outline' | 'current'\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Divider = ({\n asChild,\n className,\n isDecorative = false,\n children,\n orientation = 'horizontal',\n writingMode = 'horizontal-tb',\n alignment = 'center',\n intent = 'outline',\n ref,\n role: roleProp,\n ...props\n}: DividerProps) => {\n const isEmpty = asChild ? !(children?.props as { children: ReactNode })?.children : !children\n\n let roleProps: { role: string } | undefined\n if (isDecorative) {\n roleProps = { role: 'none' }\n } else if (roleProp !== undefined) {\n roleProps = { role: roleProp }\n }\n\n const renderSlot = asChild\n ? // Base UI uses its `render` prop to swap the underlying element.\n // We rely on Spark's `Slot` to mimic Radix's `asChild` behavior.\n (slotProps: any) => <Slot {...slotProps} />\n : undefined\n\n return (\n <BaseSeparator\n data-spark-component=\"divider\"\n className={cx(\n dividerStyles({ isEmpty, orientation, alignment, intent, writingMode }),\n className\n )}\n orientation={orientation}\n ref={ref}\n {...props}\n render={renderSlot}\n {...roleProps}\n data-writing-mode={writingMode}\n >\n {children}\n </BaseSeparator>\n )\n}\n\nDivider.displayName = 'Divider'\n","import { cx } from 'class-variance-authority'\nimport { HTMLAttributes, ReactNode, Ref } from 'react'\n\nexport interface DividerContentProps extends HTMLAttributes<HTMLSpanElement> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n children?: ReactNode\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const DividerContent = ({ children, ref, className, ...props }: DividerContentProps) => {\n return children ? (\n <span\n data-spark-component=\"divider-content\"\n ref={ref}\n {...props}\n className={cx('group-data-[writing-mode=vertical-lr]:[writing-mode:vertical-lr]', className)}\n >\n {children}\n </span>\n ) : null\n}\n\nDividerContent.displayName = 'Divider.Content'\n","import { Divider as Root } from './Divider'\nimport { DividerContent } from './DividerContent'\n\nexport { type DividerContentProps } from './DividerContent'\n\nexport const Divider: typeof Root & {\n Content: typeof DividerContent\n} = Object.assign(Root, {\n Content: DividerContent,\n})\n\nDivider.displayName = 'Divider'\nDivider.Content.displayName = 'Divider.Content'\n"],"names":["intentVariants","tw","dividerStyles","cva","Divider","asChild","className","isDecorative","children","orientation","writingMode","alignment","intent","ref","roleProp","props","isEmpty","roleProps","renderSlot","slotProps","jsx","Slot","BaseSeparator","cx","DividerContent","Root"],"mappings":";;;;;AAEO,MAAMA,IAAiB;AAAA;AAAA,EAE5B;AAAA,IACE,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAOC,EAAG,CAAC,gBAAgB,CAAC;AAAA,EAAA;AAAA,EAE9B;AAAA,IACE,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAOA,EAAG,CAA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
|
|
2
2
|
"name": "@spark-ui/components",
|
|
3
|
-
"version": "16.2.
|
|
3
|
+
"version": "16.2.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Spark (Leboncoin design system) components.",
|
|
6
6
|
"exports": {
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"@react-aria/toast": "^3.0.0-beta.18",
|
|
55
55
|
"@react-stately/numberfield": "3.9.11",
|
|
56
56
|
"@react-stately/toast": "^3.0.0-beta.7",
|
|
57
|
-
"@spark-ui/hooks": "^16.2.
|
|
58
|
-
"@spark-ui/icons": "^16.2.
|
|
59
|
-
"@spark-ui/internal-utils": "^16.2.
|
|
57
|
+
"@spark-ui/hooks": "^16.2.2",
|
|
58
|
+
"@spark-ui/icons": "^16.2.2",
|
|
59
|
+
"@spark-ui/internal-utils": "^16.2.2",
|
|
60
60
|
"@zag-js/pagination": "1.30.0",
|
|
61
61
|
"@zag-js/react": "1.30.0",
|
|
62
62
|
"class-variance-authority": "0.7.1",
|