@mastra/playground-ui 70.0.0 → 70.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Section-Dk_Vcsi7.cjs → Section-BdO9TFjY.cjs} +2 -2
- package/dist/{Section-Dk_Vcsi7.cjs.map → Section-BdO9TFjY.cjs.map} +1 -1
- package/dist/{Section-D6JJ926q.js → Section-DV2aLnkc.js} +2 -2
- package/dist/{Section-D6JJ926q.js.map → Section-DV2aLnkc.js.map} +1 -1
- package/dist/components/Section.cjs.js +1 -1
- package/dist/components/Section.es.js +1 -1
- package/dist/components/SideDialog.cjs.js +1 -1
- package/dist/components/SideDialog.es.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/add-dataset-item-dialog.cjs.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/add-dataset-item-dialog.es.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/collapsible-settings-row.cjs.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/collapsible-settings-row.es.js +1 -1
- package/dist/domains/knowledge/components/KnowledgePageDetail.cjs.js +99 -58
- package/dist/domains/knowledge/components/KnowledgePageDetail.cjs.js.map +1 -1
- package/dist/domains/knowledge/components/KnowledgePageDetail.es.js +99 -58
- package/dist/domains/knowledge/components/KnowledgePageDetail.es.js.map +1 -1
- package/dist/domains/knowledge/components/KnowledgePageExplorer.cjs.js +21 -0
- package/dist/domains/knowledge/components/KnowledgePageExplorer.cjs.js.map +1 -1
- package/dist/domains/knowledge/components/KnowledgePageExplorer.es.js +21 -0
- package/dist/domains/knowledge/components/KnowledgePageExplorer.es.js.map +1 -1
- package/dist/domains/knowledge/components/KnowledgePageTree.cjs.js +1 -1
- package/dist/domains/knowledge/components/KnowledgePageTree.cjs.js.map +1 -1
- package/dist/domains/knowledge/components/KnowledgePageTree.es.js +2 -2
- package/dist/domains/knowledge/components/KnowledgePageTree.es.js.map +1 -1
- package/dist/domains/knowledge/lib/pageAddress.cjs.js +21 -6
- package/dist/domains/knowledge/lib/pageAddress.cjs.js.map +1 -1
- package/dist/domains/knowledge/lib/pageAddress.es.js +21 -6
- package/dist/domains/knowledge/lib/pageAddress.es.js.map +1 -1
- package/dist/domains/mcps/components/mcp-app-viewer.cjs.js +1 -1
- package/dist/domains/mcps/components/mcp-app-viewer.es.js +1 -1
- package/dist/domains/mcps/hooks/use-mcp-app-tool-call.cjs.js +1 -1
- package/dist/domains/mcps/hooks/use-mcp-app-tool-call.es.js +1 -1
- package/dist/new/settings.cjs.js +2 -2
- package/dist/new/settings.es.js +2 -2
- package/dist/{settings-DIrzLcgE.js → settings-B7RMGKgf.js} +31 -15
- package/dist/settings-B7RMGKgf.js.map +1 -0
- package/dist/{settings-5PdsNlhV.cjs → settings-CYKWxfrJ.cjs} +31 -15
- package/dist/settings-CYKWxfrJ.cjs.map +1 -0
- package/dist/{settings-row-C2HTuwjN.js → settings-row-BnlFZSQL.js} +27 -5
- package/dist/settings-row-BnlFZSQL.js.map +1 -0
- package/dist/{settings-row-Dfi4pLnl.cjs → settings-row-Da1HHyBg.cjs} +27 -5
- package/dist/settings-row-Da1HHyBg.cjs.map +1 -0
- package/dist/src/domains/knowledge/components/KnowledgePageDetail.d.ts +11 -1
- package/dist/src/domains/knowledge/lib/pageAddress.d.ts +4 -2
- package/dist/src/ds/new/settings/settings-list.d.ts +16 -2
- package/dist/src/ds/new/settings/settings-row.d.ts +22 -2
- package/dist/style.css +32 -0
- package/dist/{types-DT1pgDom.cjs → types-CVS7iNs8.cjs} +2 -2
- package/dist/{types-DT1pgDom.cjs.map → types-CVS7iNs8.cjs.map} +1 -1
- package/dist/{types-Dl74jixe.js → types-D64dArGX.js} +2 -2
- package/dist/{types-Dl74jixe.js.map → types-D64dArGX.js.map} +1 -1
- package/package.json +7 -7
- package/dist/settings-5PdsNlhV.cjs.map +0 -1
- package/dist/settings-DIrzLcgE.js.map +0 -1
- package/dist/settings-row-C2HTuwjN.js.map +0 -1
- package/dist/settings-row-Dfi4pLnl.cjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settings-DIrzLcgE.js","names":[],"sources":["../src/ds/new/settings/settings-container.tsx","../src/ds/new/settings/settings-header.tsx","../src/ds/new/settings/settings-list.tsx","../src/ds/new/settings/settings-skeleton.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\nimport { fieldsOnSurface } from '@/ds/primitives/raised-surface';\nimport { cn } from '@/lib/utils';\n\n/**\n * A settings card: the card fill with no rim, 14px from its edge to the content, and hairlines between rows that\n * stop at that inset. The card owns its rows' spacing: each direct child gets 13px above and below, and the card\n * adds the last 1px at its edges. Children with nothing in them (an empty `SettingsNoticeRow`) take no space and\n * draw no hairline, so a list can always render its notice row.\n */\nconst settingsCardStyle = cn(\n // `!`: the card owns row spacing, so a row's own reset (`Fieldset`'s `p-0`) can't remove it.\n 'flex min-w-0 flex-col rounded-xl bg-card px-3.5 py-px *:py-3.25! *:empty:hidden',\n '[&>:not(:empty)~:not(:empty)]:border-t [&>:not(:empty)~:not(:empty)]:border-border',\n fieldsOnSurface,\n);\n\nexport type SettingsContainerProps = ComponentProps<'div'>;\n\n/** One settings card. Holds `SettingsRow`s, `SettingsItem`s, a `SettingsListHeader` or a `SettingsEmptyRow`. */\nexport function SettingsContainer({ className, ...props }: SettingsContainerProps) {\n return <div data-slot=\"settings-container\" className={cn(settingsCardStyle, className)} {...props} />;\n}\n","import { createContext, useContext, useId } from 'react';\nimport type { ComponentProps, ReactNode } from 'react';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/ds/components/Tooltip';\nimport { Txt } from '@/ds/components/Txt';\nimport { cn } from '@/lib/utils';\n\nconst SettingsTitleIdContext = createContext<string | undefined>(undefined);\n\n/** One section of a settings page: a `SettingsTitle` (or `SettingsHeader`) above its `SettingsContainer`. */\nexport function SettingsGroup({ className, ...props }: ComponentProps<'section'>) {\n const titleId = useId();\n\n return (\n <SettingsTitleIdContext.Provider value={titleId}>\n <section\n aria-labelledby={titleId}\n className={cn('flex min-w-0 scroll-mt-4 flex-col gap-2', className)}\n {...props}\n />\n </SettingsTitleIdContext.Provider>\n );\n}\n\n/** A section title with something beside it. A list's actions go in its card (`SettingsListHeader`), not here. */\nexport function SettingsHeader({\n action,\n children,\n className,\n ...props\n}: ComponentProps<'header'> & { action?: ReactNode }) {\n return (\n <header\n className={cn('flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4', className)}\n {...props}\n >\n <div className=\"flex min-w-0 flex-col gap-1\">{children}</div>\n {action != null && <div className=\"shrink-0\">{action}</div>}\n </header>\n );\n}\n\nexport function SettingsTitle({\n accessory,\n info,\n className,\n children,\n ...props\n}: Omit<ComponentProps<'h2'>, 'id'> & {\n accessory?: ReactNode;\n /** What the section is for, shown in a tooltip on the title. For sections whose name isn't self-explanatory. */\n info?: ReactNode;\n}) {\n const titleId = useContext(SettingsTitleIdContext);\n\n return (\n // Inset by 10px, so the title sits a little inside the card's edge below it.\n <div className=\"flex min-w-0 flex-wrap items-center gap-2 ps-2.5\">\n <Txt as=\"h2\" id={titleId} variant=\"subheading\" tone=\"muted\" className={className} {...props}>\n {info == null ? children : <SettingsTitleInfo info={info}>{children}</SettingsTitleInfo>}\n </Txt>\n {accessory}\n </div>\n );\n}\n\n/** The title's text as a tooltip trigger, described by `info`. */\nfunction SettingsTitleInfo({ info, children }: { info: ReactNode; children: ReactNode }) {\n const infoId = useId();\n\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <span\n tabIndex={0}\n aria-describedby={infoId}\n className=\"cursor-help underline decoration-transparent decoration-dotted underline-offset-4 hover:decoration-current focus-visible:decoration-current focus-visible:outline-none\"\n />\n }\n >\n {children}\n </TooltipTrigger>\n <TooltipContent id={infoId} keepMounted className=\"max-w-64\">\n {info}\n </TooltipContent>\n </Tooltip>\n );\n}\n\nexport function SettingsDescription({ className, ...props }: ComponentProps<'p'>) {\n return <Txt as=\"p\" variant=\"caption\" tone=\"muted\" className={cn('ps-2.5', className)} {...props} />;\n}\n","import type { ComponentProps, ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\n\n/** A list's count or caption on the left and its one action (\"Add account\", \"Invite member\") on the right. */\nfunction SettingsListBar({\n tone,\n action,\n className,\n children,\n ...props\n}: ComponentProps<'div'> & { tone: 'title' | 'muted'; action?: ReactNode }) {\n return (\n <div className={cn('flex min-h-8 items-center justify-between gap-3', className)} {...props}>\n <div\n className={cn(\n 'min-w-0 truncate',\n tone === 'title' ? 'text-label text-foreground' : 'text-body-sm text-muted-foreground',\n )}\n >\n {children}\n </div>\n {action != null && <div className=\"flex shrink-0 items-center gap-2\">{action}</div>}\n </div>\n );\n}\n\nexport type SettingsListHeaderProps = ComponentProps<'div'> & {\n /** The list's action, on the right. Refresh and other list controls can sit beside it. */\n action?: ReactNode;\n};\n\n/** The first row of a list's `SettingsContainer`: a count (\"2 accounts\") and the list's action. */\nexport function SettingsListHeader(props: SettingsListHeaderProps) {\n return <SettingsListBar data-slot=\"settings-list-header\" tone=\"title\" {...props} />;\n}\n\nexport type SettingsEmptyRowProps = ComponentProps<'div'> & {\n /** The same action the list's header would hold, so an empty list still offers it. */\n action?: ReactNode;\n};\n\n/** An empty list's only row: what's missing on the left (\"No join links\"), the list's action on the right. */\nexport function SettingsEmptyRow(props: SettingsEmptyRowProps) {\n return <SettingsListBar data-slot=\"settings-empty-row\" tone=\"muted\" {...props} />;\n}\n\n/** A list's notices and errors, as a row of its `SettingsContainer`. Takes no space while it has nothing in it. */\nexport function SettingsNoticeRow({ className, ...props }: ComponentProps<'div'>) {\n return <div data-slot=\"settings-notice-row\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** The square on the left of a `SettingsItem` holding an icon or logo. Avatars use `Avatar size=\"md\"`, the\n * same size, so every list's text starts at the same place. */\nexport function SettingsItemIcon({ className, ...props }: ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"settings-item-icon\"\n aria-hidden\n className={cn(\n 'flex size-avatar-md shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground [&>svg]:size-icon-md',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type SettingsItemProps = Omit<ComponentProps<'div'>, 'title'> & {\n /** A `SettingsItemIcon` or an `Avatar size=\"md\"`. */\n media?: ReactNode;\n title: ReactNode;\n /** One line under the title: \"GitHub · Connected 3 weeks ago\". */\n description?: ReactNode;\n /** The item's status or actions, on the right. */\n children?: ReactNode;\n};\n\n/** One thing in a settings list (an account, a member, a session, a source). Goes in a `SettingsContainer`. */\nexport function SettingsItem({ media, title, description, children, className, ...props }: SettingsItemProps) {\n return (\n <div data-slot=\"settings-item\" className={cn('flex min-w-0 items-center gap-3', className)} {...props}>\n {media}\n <div className=\"flex min-w-0 flex-1 flex-col gap-px\">\n {/* A string title truncates, so it also goes in the hover title to stay readable in full. */}\n <div className=\"truncate text-label text-foreground\" title={typeof title === 'string' ? title : undefined}>\n {title}\n </div>\n {description != null && <div className=\"truncate text-caption text-muted-foreground\">{description}</div>}\n </div>\n {children != null && <div className=\"flex shrink-0 items-center gap-2\">{children}</div>}\n </div>\n );\n}\n","import { SettingsItem } from './settings-list';\nimport { SettingsRow } from './settings-row';\nimport { Skeleton } from '@/ds/components/Skeleton/skeleton';\nimport { SkeletonText } from '@/ds/components/Skeleton/skeleton-text';\nimport { cn } from '@/lib/utils';\n\nconst bar = 'motion-reduce:before:animate-none';\n\nexport type SettingsSkeletonProps = {\n /** Announced while loading, e.g. \"Loading members\". */\n label: string;\n /** Placeholder rows, matching how many the loaded list usually has. */\n rows?: number;\n /** `row` stands in for `SettingsRow`s (label left, control right); `item` for `SettingsItem`s (icon, title, description). */\n variant?: 'row' | 'item';\n className?: string;\n};\n\n/**\n * The loading state for anything inside a `SettingsContainer`. Placeholders are built from the real `SettingsRow` and\n * `SettingsItem`, so they sit exactly where the loaded rows will.\n *\n * ```tsx\n * <SettingsContainer>\n * {isLoading ? <SettingsSkeleton label=\"Loading members\" variant=\"item\" rows={3} /> : members.map(...)}\n * </SettingsContainer>\n * ```\n */\nexport function SettingsSkeleton({ label, rows = 2, variant = 'row', className }: SettingsSkeletonProps) {\n const Placeholder = variant === 'item' ? ItemPlaceholder : RowPlaceholder;\n\n return (\n // One child of the card, so it takes the card's row padding; inside, rows repeat that rhythm with hairlines.\n <div\n role=\"status\"\n aria-label={label}\n data-slot=\"settings-skeleton\"\n className={cn('grid divide-y divide-border *:py-3.25 *:first:pt-0 *:last:pb-0', className)}\n >\n {Array.from({ length: rows }, (_, index) => (\n <Placeholder key={index} />\n ))}\n </div>\n );\n}\n\nfunction ItemPlaceholder() {\n return (\n <SettingsItem\n aria-hidden\n media={<Skeleton className={cn('size-avatar-md shrink-0 rounded-lg', bar)} />}\n title={<SkeletonText line=\"text-label\" className={cn('w-32', bar)} />}\n description={<SkeletonText line=\"text-caption\" className={cn('w-48 max-w-full', bar)} />}\n />\n );\n}\n\nfunction RowPlaceholder() {\n return (\n <SettingsRow\n aria-hidden\n label={<SkeletonText line=\"text-label\" className={cn('w-28', bar)} />}\n description={<SkeletonText line=\"text-caption\" className={cn('w-48 max-w-full', bar)} />}\n >\n <Skeleton className={cn('h-control-sm w-28 max-w-full rounded-full', bar)} />\n </SettingsRow>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAUA,IAAM,oBAAoB,GAExB,mFACA,sFACA,eACF;;AAKA,SAAgB,kBAAkB,EAAE,WAAW,GAAG,SAAiC;CACjF,OAAO,oBAAC,OAAD;EAAK,aAAU;EAAqB,WAAW,GAAG,mBAAmB,SAAS;EAAG,GAAI;CAAQ,CAAA;AACtG;;AChBA,IAAM,yBAAyB,cAAkC,KAAA,CAAS;;AAG1E,SAAgB,cAAc,EAAE,WAAW,GAAG,SAAoC;CAChF,MAAM,UAAU,MAAM;CAEtB,OACE,oBAAC,uBAAuB,UAAxB;EAAiC,OAAO;EACtC,UAAA,oBAAC,WAAD;GACE,mBAAiB;GACjB,WAAW,GAAG,2CAA2C,SAAS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;;;AAsBZ,SAAgB,iBAAiB,EAAE,OAAO,OAAO,GAAG,UAAU,OAAO,aAAoC;CACvG,MAAM,cAAc,YAAY,SAAS,kBAAkB;CAE3D,OAEE,oBAAC,OAAD;EACE,MAAK;EACL,cAAY;EACZ,aAAU;EACV,WAAW,GAAG,kEAAkE,SAAS;EAExF,UAAA,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,UAChC,oBAAC,aAAD,CAA0B,GAAR,KAAQ,CAC3B;CACE,CAAA;AAET;AAEA,SAAS,kBAAkB;CACzB,OACE,oBAAC,cAAD;EACE,eAAA;EACA,OAAO,oBAAC,UAAD,EAAU,WAAW,GAAG,sCAAsC,GAAG,EAAI,CAAA;EAC5E,OAAO,oBAAC,cAAD;GAAc,MAAK;GAAa,WAAW,GAAG,QAAQ,GAAG;EAAI,CAAA;EACpE,aAAa,oBAAC,cAAD;GAAc,MAAK;GAAe,WAAW,GAAG,mBAAmB,GAAG;EAAI,CAAA;CACxF,CAAA;AAEL;AAEA,SAAS,iBAAiB;CACxB,OACE,oBAAC,aAAD;EACE,eAAA;EACA,OAAO,oBAAC,cAAD;GAAc,MAAK;GAAa,WAAW,GAAG,QAAQ,GAAG;EAAI,CAAA;EACpE,aAAa,oBAAC,cAAD;GAAc,MAAK;GAAe,WAAW,GAAG,mBAAmB,GAAG;EAAI,CAAA;EAEvF,UAAA,oBAAC,UAAD,EAAU,WAAW,GAAG,6CAA6C,GAAG,EAAI,CAAA;CACjE,CAAA;AAEjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settings-row-C2HTuwjN.js","names":["_Fragment"],"sources":["../src/ds/new/settings/settings-row.tsx"],"sourcesContent":["import { useId } from 'react';\nimport type { ReactNode } from 'react';\nimport { Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend } from '@/ds/components/Field';\nimport type { FieldProps, FieldsetProps } from '@/ds/components/Field';\nimport { IconLock } from '@/ds/icons/central/IconLock';\nimport { cn } from '@/lib/utils';\n\nexport type SettingsRowProps = Omit<FieldProps, 'children' | 'invalid' | 'orientation'> & {\n label: ReactNode;\n description?: ReactNode;\n /** @deprecated The row's `Field` names the control it holds; drop `htmlFor` and the control's `id`. */\n htmlFor?: string;\n children?: ReactNode;\n tone?: 'default' | 'destructive';\n viewOnly?: boolean;\n required?: boolean;\n errorMsg?: ReactNode;\n /**\n * `side` (default): the control sits on the right. Text fields take one shared width (13.75rem), selects hug\n * their value up to that width, and switches and buttons keep their own size; all end at the right edge.\n * `below`: the control goes under the label at full width, for forms with several controls.\n */\n controlPlacement?: 'side' | 'below';\n};\n\n/** Label left, control right; stacked below `sm`. The card around the row gives it its spacing. */\nconst rowClassName = 'min-w-0 gap-3';\n/** Side by side: label left, control pushed right. A control below its label fills the row instead. */\nconst sideRowClassName = 'sm:justify-between sm:gap-6';\nconst headingClassName = 'flex min-w-0 flex-col gap-px';\n/**\n * The control column on the right. Inputs fill it (at least 13.75rem); selects and other field triggers hug\n * their value (`--field-width: auto`, see `fieldTriggerWidthStyle`) up to that same width.\n */\nconst sideControlClassName =\n 'flex min-w-0 items-center justify-end gap-2 [--field-max-width:13.75rem] [--field-width:auto] sm:min-w-55 sm:shrink-0';\n\nexport function SettingsRowControl({ viewOnly = false, children }: { viewOnly?: boolean; children: ReactNode }) {\n if (!viewOnly) return children;\n return (\n <>\n <IconLock className=\"size-icon-md shrink-0\" aria-hidden />\n <span className=\"sr-only\">View only: </span>\n {children}\n </>\n );\n}\n\n/** One setting: a label, an optional one-line description, and its control. Goes in a `SettingsContainer`. */\nexport function SettingsRow({\n label,\n description,\n htmlFor,\n children,\n className,\n tone = 'default',\n viewOnly = false,\n required = false,\n errorMsg,\n disabled,\n controlPlacement = 'side',\n ...props\n}: SettingsRowProps) {\n const controlBelow = controlPlacement === 'below';\n\n return (\n <Field\n orientation={controlBelow ? 'vertical' : 'responsive'}\n invalid={Boolean(errorMsg)}\n disabled={disabled || viewOnly}\n data-slot=\"settings-row\"\n className={cn(rowClassName, !controlBelow && sideRowClassName, className)}\n {...props}\n >\n <div className={headingClassName}>\n <FieldLabel\n {...(htmlFor ? { htmlFor } : {})}\n required={required}\n className={cn(tone === 'destructive' && 'text-destructive-foreground')}\n >\n {label}\n </FieldLabel>\n {description != null && (\n <FieldDescription render={<div />} className=\"mt-0 flex flex-col gap-0.5 text-pretty\">\n {description}\n </FieldDescription>\n )}\n <FieldError className=\"mt-0\">{errorMsg}</FieldError>\n </div>\n {children != null && (\n <div\n data-slot=\"settings-row-control\"\n className={cn(\n 'min-w-0',\n !controlBelow && sideControlClassName,\n viewOnly && 'flex items-center gap-2 text-body-sm text-muted-foreground',\n )}\n >\n <SettingsRowControl viewOnly={viewOnly}>{children}</SettingsRowControl>\n </div>\n )}\n </Field>\n );\n}\n\nexport type SettingsFieldsetRowProps = Omit<FieldsetProps, 'children'> & {\n label: ReactNode;\n description?: ReactNode;\n children?: ReactNode;\n /** Same as `SettingsRow`'s: `below` puts the controls under the label at full width. */\n controlPlacement?: 'side' | 'below';\n};\n\n/** A `SettingsRow` for a group of controls (radios, several switches), labelled by a legend. */\nexport function SettingsFieldsetRow({\n label,\n description,\n children,\n className,\n controlPlacement = 'side',\n ...props\n}: SettingsFieldsetRowProps) {\n const descriptionId = useId();\n const controlBelow = controlPlacement === 'below';\n\n return (\n <Fieldset\n data-slot=\"settings-row\"\n aria-describedby={description == null ? undefined : descriptionId}\n className={cn(\n 'flex flex-col',\n rowClassName,\n !controlBelow && ['sm:flex-row sm:items-center', sideRowClassName],\n className,\n )}\n {...props}\n >\n <div className={headingClassName}>\n <FieldsetLegend>{label}</FieldsetLegend>\n {description != null && (\n <div id={descriptionId} className=\"flex flex-col gap-0.5 text-caption text-pretty text-muted-foreground\">\n {description}\n </div>\n )}\n </div>\n {children != null && (\n <div data-slot=\"settings-row-control\" className={cn('min-w-0', !controlBelow && sideControlClassName)}>\n {children}\n </div>\n )}\n </Fieldset>\n );\n}\n"],"mappings":";;;;;;;AA0BA,IAAM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WACA,mBAAmB,QACnB,GAAG,SACwB;CAC3B,MAAM,gBAAgB,MAAM;CAC5B,MAAM,eAAe,qBAAqB;CAE1C,OACE,qBAAC,UAAD;EACE,aAAU;EACV,oBAAkB,eAAe,OAAO,KAAA,IAAY;EACpD,WAAW,GACT,iBACA,cACA,CAAC,gBAAgB,CAAC,+BAA+B,gBAAgB,GACjE,SACF;EACA,GAAI;EATN,UAAA,CAWE,qBAAC,OAAD;GAAK,WAAW;GAAhB,UAAA,CACE,oBAAC,gBAAD,EAAA,UAAiB,MAAsB,CAAA,GACtC,eAAe,QACd,oBAAC,OAAD;IAAK,IAAI;IAAe,WAAU;IAC/B,UAAA;GACE,CAAA,CAEJ;EACJ,CAAA,GAAA,YAAY,QACX,oBAAC,OAAD;GAAK,aAAU;GAAuB,WAAW,GAAG,WAAW,CAAC,gBAAgB,oBAAoB;GACjG;EACE,CAAA,CAEC;;AAEd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settings-row-Dfi4pLnl.cjs","names":["_Fragment","IconLock","Field","cn","FieldLabel","FieldDescription","FieldError","useId","Fieldset","FieldsetLegend"],"sources":["../src/ds/new/settings/settings-row.tsx"],"sourcesContent":["import { useId } from 'react';\nimport type { ReactNode } from 'react';\nimport { Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend } from '@/ds/components/Field';\nimport type { FieldProps, FieldsetProps } from '@/ds/components/Field';\nimport { IconLock } from '@/ds/icons/central/IconLock';\nimport { cn } from '@/lib/utils';\n\nexport type SettingsRowProps = Omit<FieldProps, 'children' | 'invalid' | 'orientation'> & {\n label: ReactNode;\n description?: ReactNode;\n /** @deprecated The row's `Field` names the control it holds; drop `htmlFor` and the control's `id`. */\n htmlFor?: string;\n children?: ReactNode;\n tone?: 'default' | 'destructive';\n viewOnly?: boolean;\n required?: boolean;\n errorMsg?: ReactNode;\n /**\n * `side` (default): the control sits on the right. Text fields take one shared width (13.75rem), selects hug\n * their value up to that width, and switches and buttons keep their own size; all end at the right edge.\n * `below`: the control goes under the label at full width, for forms with several controls.\n */\n controlPlacement?: 'side' | 'below';\n};\n\n/** Label left, control right; stacked below `sm`. The card around the row gives it its spacing. */\nconst rowClassName = 'min-w-0 gap-3';\n/** Side by side: label left, control pushed right. A control below its label fills the row instead. */\nconst sideRowClassName = 'sm:justify-between sm:gap-6';\nconst headingClassName = 'flex min-w-0 flex-col gap-px';\n/**\n * The control column on the right. Inputs fill it (at least 13.75rem); selects and other field triggers hug\n * their value (`--field-width: auto`, see `fieldTriggerWidthStyle`) up to that same width.\n */\nconst sideControlClassName =\n 'flex min-w-0 items-center justify-end gap-2 [--field-max-width:13.75rem] [--field-width:auto] sm:min-w-55 sm:shrink-0';\n\nexport function SettingsRowControl({ viewOnly = false, children }: { viewOnly?: boolean; children: ReactNode }) {\n if (!viewOnly) return children;\n return (\n <>\n <IconLock className=\"size-icon-md shrink-0\" aria-hidden />\n <span className=\"sr-only\">View only: </span>\n {children}\n </>\n );\n}\n\n/** One setting: a label, an optional one-line description, and its control. Goes in a `SettingsContainer`. */\nexport function SettingsRow({\n label,\n description,\n htmlFor,\n children,\n className,\n tone = 'default',\n viewOnly = false,\n required = false,\n errorMsg,\n disabled,\n controlPlacement = 'side',\n ...props\n}: SettingsRowProps) {\n const controlBelow = controlPlacement === 'below';\n\n return (\n <Field\n orientation={controlBelow ? 'vertical' : 'responsive'}\n invalid={Boolean(errorMsg)}\n disabled={disabled || viewOnly}\n data-slot=\"settings-row\"\n className={cn(rowClassName, !controlBelow && sideRowClassName, className)}\n {...props}\n >\n <div className={headingClassName}>\n <FieldLabel\n {...(htmlFor ? { htmlFor } : {})}\n required={required}\n className={cn(tone === 'destructive' && 'text-destructive-foreground')}\n >\n {label}\n </FieldLabel>\n {description != null && (\n <FieldDescription render={<div />} className=\"mt-0 flex flex-col gap-0.5 text-pretty\">\n {description}\n </FieldDescription>\n )}\n <FieldError className=\"mt-0\">{errorMsg}</FieldError>\n </div>\n {children != null && (\n <div\n data-slot=\"settings-row-control\"\n className={cn(\n 'min-w-0',\n !controlBelow && sideControlClassName,\n viewOnly && 'flex items-center gap-2 text-body-sm text-muted-foreground',\n )}\n >\n <SettingsRowControl viewOnly={viewOnly}>{children}</SettingsRowControl>\n </div>\n )}\n </Field>\n );\n}\n\nexport type SettingsFieldsetRowProps = Omit<FieldsetProps, 'children'> & {\n label: ReactNode;\n description?: ReactNode;\n children?: ReactNode;\n /** Same as `SettingsRow`'s: `below` puts the controls under the label at full width. */\n controlPlacement?: 'side' | 'below';\n};\n\n/** A `SettingsRow` for a group of controls (radios, several switches), labelled by a legend. */\nexport function SettingsFieldsetRow({\n label,\n description,\n children,\n className,\n controlPlacement = 'side',\n ...props\n}: SettingsFieldsetRowProps) {\n const descriptionId = useId();\n const controlBelow = controlPlacement === 'below';\n\n return (\n <Fieldset\n data-slot=\"settings-row\"\n aria-describedby={description == null ? undefined : descriptionId}\n className={cn(\n 'flex flex-col',\n rowClassName,\n !controlBelow && ['sm:flex-row sm:items-center', sideRowClassName],\n className,\n )}\n {...props}\n >\n <div className={headingClassName}>\n <FieldsetLegend>{label}</FieldsetLegend>\n {description != null && (\n <div id={descriptionId} className=\"flex flex-col gap-0.5 text-caption text-pretty text-muted-foreground\">\n {description}\n </div>\n )}\n </div>\n {children != null && (\n <div data-slot=\"settings-row-control\" className={cn('min-w-0', !controlBelow && sideControlClassName)}>\n {children}\n </div>\n )}\n </Fieldset>\n );\n}\n"],"mappings":";;;;;;;AA0BA,IAAM,eAAe;;AAErB,IAAM,mBAAmB;AACzB,IAAM,mBAAmB;;;;;AAKzB,IAAM,uBACJ;AAEF,SAAgB,mBAAmB,EAAE,WAAW,OAAO,YAAyD;CAC9G,IAAI,CAAC,UAAU,OAAO;CACtB,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAAA,kBAAAA,UAAA,EAAA,UAAA;EACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,+BAAAA,UAAD;GAAU,WAAU;GAAwB,eAAA;EAA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