@tomny-dev/uzi 0.7.1 → 0.8.0-pr.85.286.1.ccec3e4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/components/ai-chat/AIChat.d.ts +164 -0
- package/dist/components/ai-chat/AIChat.d.ts.map +1 -0
- package/dist/components/ai-chat/AIChat.test.d.ts +2 -0
- package/dist/components/ai-chat/AIChat.test.d.ts.map +1 -0
- package/dist/components/ai-chat/AIChatDock.d.ts +33 -0
- package/dist/components/ai-chat/AIChatDock.d.ts.map +1 -0
- package/dist/components/floating-action-stack/FloatingActionStack.d.ts +19 -0
- package/dist/components/floating-action-stack/FloatingActionStack.d.ts.map +1 -0
- package/dist/components/floating-action-stack/FloatingActionStack.test.d.ts +2 -0
- package/dist/components/floating-action-stack/FloatingActionStack.test.d.ts.map +1 -0
- package/dist/components/multi-select/MultiSelect.d.ts +3 -0
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/index.cjs +9 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index26.js +6 -2
- package/dist/index26.js.map +1 -1
- package/dist/index27.cjs +7 -1
- package/dist/index27.cjs.map +1 -1
- package/dist/index27.js +40 -10
- package/dist/index27.js.map +1 -1
- package/dist/index28.cjs +40 -10
- package/dist/index28.cjs.map +1 -1
- package/dist/index75.js +91 -0
- package/dist/index75.js.map +1 -0
- package/dist/index76.cjs +133 -0
- package/dist/index76.cjs.map +1 -0
- package/dist/index76.js +667 -0
- package/dist/index76.js.map +1 -0
- package/dist/index77.cjs +669 -0
- package/dist/index77.cjs.map +1 -0
- package/dist/index77.js +35 -0
- package/dist/index77.js.map +1 -0
- package/dist/index78.cjs +49 -0
- package/dist/index78.cjs.map +1 -0
- package/dist/index78.js +231 -0
- package/dist/index78.js.map +1 -0
- package/dist/index79.cjs +231 -0
- package/dist/index79.cjs.map +1 -0
- package/dist/index79.js +19 -0
- package/dist/index79.js.map +1 -0
- package/dist/index80.cjs +25 -0
- package/dist/index80.cjs.map +1 -0
- package/dist/index80.js +36 -0
- package/dist/index80.js.map +1 -0
- package/dist/index81.cjs +37 -0
- package/dist/index81.cjs.map +1 -0
- package/dist/style.css +655 -0
- package/package.json +3 -1
package/dist/index27.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index27.js","names":[],"sources":["../src/components/multi-select/MultiSelect.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { cx } from \"../../utils/cx\";\nimport styles from \"./multi-select.module.css\";\n\nexport type MultiSelectOption = {\n label: string;\n value: string;\n disabled?: boolean;\n /** Optional decorative leading visual. The label remains the accessible option name. */\n icon?: React.ReactElement;\n};\n\nexport type MultiSelectProps = {\n options: MultiSelectOption[];\n value: string[];\n onChange: (value: string[]) => void;\n placeholder?: string;\n fullWidth?: boolean;\n maxVisibleValues?: number;\n /** Formats the closed trigger text from the selected options, including an empty selection. */\n formatValue?: (selected: MultiSelectOption[]) => string;\n /** Shows Select all and Clear all actions. Bulk actions modify enabled options only. */\n bulkActions?: boolean;\n selectAllLabel?: string;\n /** Label for clearing all enabled selections. Disabled selected options remain selected. */\n clearAllLabel?: string;\n className?: string;\n disabled?: boolean;\n name?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n};\n\nexport const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>(\n (\n {\n options,\n value,\n onChange,\n placeholder = \"Select options\",\n fullWidth = true,\n maxVisibleValues = 2,\n formatValue,\n bulkActions = false,\n selectAllLabel = \"Select all\",\n clearAllLabel,\n className,\n disabled = false,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref,\n ) => {\n const selectedSet = React.useMemo(() => new Set(value), [value]);\n const selectedOptions = React.useMemo(\n () => options.filter((opt) => selectedSet.has(opt.value)),\n [options, selectedSet],\n );\n\n const enabledValues = React.useMemo(\n () => options.filter((option) => !option.disabled).map((option) => option.value),\n [options],\n );\n const allEnabledSelected =\n enabledValues.length > 0 && enabledValues.every((entry) => selectedSet.has(entry));\n const hasDisabledOptions = options.some((option) => option.disabled);\n const resolvedClearAllLabel =\n clearAllLabel ?? (hasDisabledOptions ? \"Clear enabled\" : \"Clear all\");\n\n const formattedValue = React.useMemo(\n () => formatValue?.(selectedOptions),\n [formatValue, selectedOptions],\n );\n\n const toggleValue = React.useCallback(\n (nextValue: string) => {\n if (selectedSet.has(nextValue)) {\n onChange(value.filter((entry) => entry !== nextValue));\n return;\n }\n\n onChange([...value, nextValue]);\n },\n [onChange, selectedSet, value],\n );\n\n const visibleCount = Math.max(1, maxVisibleValues);\n const visibleOptions = selectedOptions.slice(0, visibleCount);\n const overflowCount = Math.max(\n 0,\n selectedOptions.length - visibleOptions.length,\n );\n\n return (\n <DropdownMenuPrimitive.Root modal={false}>\n <div\n className={cx(\n styles.wrapper,\n fullWidth && styles.wrapperFullWidth,\n className,\n )}\n >\n <DropdownMenuPrimitive.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n className={styles.trigger}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n disabled={disabled}\n >\n <span className={styles.value}>\n {formatValue ? (\n <span className={styles.summary}>{formattedValue}</span>\n ) : selectedOptions.length === 0 ? (\n <span className={styles.placeholder}>{placeholder}</span>\n ) : (\n <>\n {visibleOptions.map((option) => (\n <span key={option.value} className={styles.chip}>\n {option.icon ? <span className={styles.optionIcon} aria-hidden=\"true\">{option.icon}</span> : null}\n {option.label}\n </span>\n ))}\n {overflowCount > 0 ? (\n <span className={cx(styles.chip, styles.chipSummary)}>\n +{overflowCount}\n </span>\n ) : null}\n </>\n )}\n </span>\n <span className={styles.chevron} aria-hidden=\"true\">\n <svg\n viewBox=\"0 0 10 10\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"10\"\n height=\"10\"\n >\n <path\n d=\"M2 3.5L5 6.5L8 3.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </span>\n </button>\n </DropdownMenuPrimitive.Trigger>\n\n {name\n ? value.map((entry) => (\n <input key={entry} type=\"hidden\" name={name} value={entry} />\n ))\n : null}\n\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n className={styles.menu}\n sideOffset={4}\n align=\"start\"\n >\n {bulkActions && enabledValues.length > 0 ? (\n <>\n <DropdownMenuPrimitive.Item\n className={styles.bulkAction}\n disabled={allEnabledSelected}\n onSelect={(event) => {\n event.preventDefault();\n onChange([...value, ...enabledValues.filter((entry) => !selectedSet.has(entry))]);\n }}\n >\n {selectAllLabel}\n </DropdownMenuPrimitive.Item>\n <DropdownMenuPrimitive.Item\n className={styles.bulkAction}\n disabled={!enabledValues.some((entry) => selectedSet.has(entry))}\n onSelect={(event) => {\n event.preventDefault();\n const enabledSet = new Set(enabledValues);\n onChange(value.filter((entry) => !enabledSet.has(entry)));\n }}\n >\n {resolvedClearAllLabel}\n </DropdownMenuPrimitive.Item>\n </>\n ) : null}\n {bulkActions && enabledValues.length > 0 ? (\n <DropdownMenuPrimitive.Separator className={styles.separator} />\n ) : null}\n {options.map((option) => {\n const selected = selectedSet.has(option.value);\n\n return (\n <DropdownMenuPrimitive.CheckboxItem\n key={option.value}\n className={cx(\n styles.option,\n selected && styles.optionSelected,\n option.disabled && styles.optionDisabled,\n )}\n checked={selected}\n disabled={option.disabled}\n onCheckedChange={() => toggleValue(option.value)}\n onSelect={(event) => event.preventDefault()}\n >\n <span\n className={cx(\n styles.indicator,\n selected && styles.indicatorSelected,\n option.disabled && styles.indicatorDisabled,\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator forceMount>\n <svg\n viewBox=\"0 0 16 16\"\n width=\"16\"\n height=\"16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M3.5 8.5 6.5 11.5 12.5 4.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.8\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n <span className={styles.optionLabel}>\n {option.icon ? <span className={styles.optionIcon} aria-hidden=\"true\">{option.icon}</span> : null}\n {option.label}\n </span>\n </DropdownMenuPrimitive.CheckboxItem>\n );\n })}\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n </div>\n </DropdownMenuPrimitive.Root>\n );\n },\n);\n\nMultiSelect.displayName = \"MultiSelect\";\n"],"mappings":";;;;;;;AAoCA,IAAa,cAAc,MAAM,YAE7B,EACE,SACA,OACA,UACA,cAAc,kBACd,YAAY,MACZ,mBAAmB,GACnB,aACA,cAAc,OACd,iBAAiB,cACjB,eACA,WACA,WAAW,OACX,MACA,cAAc,WACd,mBAAmB,kBAErB,QACG;CACH,MAAM,cAAc,MAAM,cAAc,IAAI,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC;CAC/D,MAAM,kBAAkB,MAAM,cACtB,QAAQ,QAAQ,QAAQ,YAAY,IAAI,IAAI,KAAK,CAAC,GACxD,CAAC,SAAS,WAAW,CACvB;CAEA,MAAM,gBAAgB,MAAM,cACpB,QAAQ,QAAQ,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC,KAAK,WAAW,OAAO,KAAK,GAC/E,CAAC,OAAO,CACV;CACA,MAAM,qBACJ,cAAc,SAAS,KAAK,cAAc,OAAO,UAAU,YAAY,IAAI,KAAK,CAAC;CACnF,MAAM,qBAAqB,QAAQ,MAAM,WAAW,OAAO,QAAQ;CACnE,MAAM,wBACJ,kBAAkB,qBAAqB,kBAAkB;CAE3D,MAAM,iBAAiB,MAAM,cACrB,cAAc,eAAe,GACnC,CAAC,aAAa,eAAe,CAC/B;CAEA,MA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ACnB,OAAO,YAAY,4BAAO,cAC5B;QACA,SAAS;QACT,UAAU,OAAO;QACjB,uBAAuB,YAAY,OAAO,KAAK;QAC/C,WAAW,UAAU,MAAM,eAAe;kBAV5C,CAYE,oBAAC,QAAD;SACE,WAAW,GACT,4BAAO,WACP,YAAY,4BAAO,mBACnB,OAAO,YAAY,4BAAO,iBAC5B;SACA,eAAY;mBAEZ,oBAAC,sBAAsB,eAAvB;UAAqC,YAAA;oBACnC,oBAAC,OAAD;WACE,SAAQ;WACR,OAAM;WACN,QAAO;WACP,MAAK;WACL,OAAM;qBAEN,oBAAC,QAAD;YACE,GAAE;YACF,QAAO;YACP,aAAY;YACZ,eAAc;YACd,gBAAe;WAChB,CAAA;UACE,CAAA;SAC8B,CAAA;QACjC,CAAA,GACN,qBAAC,QAAD;SAAM,WAAW,4BAAO;mBAAxB,CACO,OAAO,OAAO,oBAAC,QAAD;UAAM,WAAW,4BAAO;UAAY,eAAY;oBAAQ,OAAO;SAAW,CAAA,IAAI,MAC5F,OAAO,KACJ;UACwB;UAzC7B,OAAO,KAyCsB;MAExC,CAAC;KAC4B;OACH,CAAA;GAC3B;;CACqB,CAAA;AAEhC,CACF;AAEA,YAAY,cAAc"}
|
|
1
|
+
{"version":3,"file":"index27.js","names":[],"sources":["../src/components/multi-select/MultiSelect.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { cx } from \"../../utils/cx\";\nimport styles from \"./multi-select.module.css\";\n\nexport type MultiSelectOption = {\n label: string;\n value: string;\n disabled?: boolean;\n /** Optional decorative leading visual. The label remains the accessible option name. */\n icon?: React.ReactElement;\n};\n\nexport type MultiSelectProps = {\n options: MultiSelectOption[];\n value: string[];\n onChange: (value: string[]) => void;\n placeholder?: string;\n fullWidth?: boolean;\n maxVisibleValues?: number;\n /** Formats the closed trigger text from the selected options, including an empty selection. */\n formatValue?: (selected: MultiSelectOption[]) => string;\n /** Shows Select all and Clear all actions. Bulk actions modify enabled options only. */\n bulkActions?: boolean;\n /** Stage changes until Apply. Cancel/dismiss discards the draft. */\n draftMode?: boolean;\n minSelected?: number;\n selectAllLabel?: string;\n /** Label for clearing all enabled selections. Disabled selected options remain selected. */\n clearAllLabel?: string;\n className?: string;\n disabled?: boolean;\n name?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n};\n\nexport const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>(\n (\n {\n options,\n value,\n onChange,\n placeholder = \"Select options\",\n fullWidth = true,\n maxVisibleValues = 2,\n formatValue,\n bulkActions = false,\n draftMode = false,\n minSelected = 0,\n selectAllLabel = \"Select all\",\n clearAllLabel,\n className,\n disabled = false,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref,\n ) => {\n const [open, setOpen] = React.useState(false);\n const [draft, setDraft] = React.useState<string[]>(value);\n const editValue = draftMode && open ? draft : value;\n const updateSelection = (next: string[]) => {\n if (draftMode) setDraft(next);\n else if (next.length >= minSelected) onChange(next);\n };\n const selectedSet = React.useMemo(() => new Set(editValue), [editValue]);\n const selectedOptions = React.useMemo(\n () => options.filter((opt) => value.includes(opt.value)),\n [options, value],\n );\n\n const enabledValues = React.useMemo(\n () => options.filter((option) => !option.disabled).map((option) => option.value),\n [options],\n );\n const allEnabledSelected =\n enabledValues.length > 0 && enabledValues.every((entry) => selectedSet.has(entry));\n const hasDisabledOptions = options.some((option) => option.disabled);\n const resolvedClearAllLabel =\n clearAllLabel ?? (hasDisabledOptions ? \"Clear enabled\" : \"Clear all\");\n\n const formattedValue = React.useMemo(\n () => formatValue?.(selectedOptions),\n [formatValue, selectedOptions],\n );\n\n const toggleValue = React.useCallback(\n (nextValue: string) => {\n if (selectedSet.has(nextValue)) {\n updateSelection(editValue.filter((entry) => entry !== nextValue));\n return;\n }\n\n updateSelection([...editValue, nextValue]);\n },\n [updateSelection, selectedSet, editValue],\n );\n\n const visibleCount = Math.max(1, maxVisibleValues);\n const visibleOptions = selectedOptions.slice(0, visibleCount);\n const overflowCount = Math.max(\n 0,\n selectedOptions.length - visibleOptions.length,\n );\n\n return (\n <DropdownMenuPrimitive.Root modal={false} open={open} onOpenChange={(next) => {\n if (next) setDraft([...value]);\n setOpen(next);\n }}>\n <div\n className={cx(\n styles.wrapper,\n fullWidth && styles.wrapperFullWidth,\n className,\n )}\n >\n <DropdownMenuPrimitive.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n className={styles.trigger}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n disabled={disabled}\n >\n <span className={styles.value}>\n {formatValue ? (\n <span className={styles.summary}>{formattedValue}</span>\n ) : selectedOptions.length === 0 ? (\n <span className={styles.placeholder}>{placeholder}</span>\n ) : (\n <>\n {visibleOptions.map((option) => (\n <span key={option.value} className={styles.chip}>\n {option.icon ? <span className={styles.optionIcon} aria-hidden=\"true\">{option.icon}</span> : null}\n {option.label}\n </span>\n ))}\n {overflowCount > 0 ? (\n <span className={cx(styles.chip, styles.chipSummary)}>\n +{overflowCount}\n </span>\n ) : null}\n </>\n )}\n </span>\n <span className={styles.chevron} aria-hidden=\"true\">\n <svg\n viewBox=\"0 0 10 10\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"10\"\n height=\"10\"\n >\n <path\n d=\"M2 3.5L5 6.5L8 3.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </span>\n </button>\n </DropdownMenuPrimitive.Trigger>\n\n {name\n ? value.map((entry) => (\n <input key={entry} type=\"hidden\" name={name} value={entry} />\n ))\n : null}\n\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n className={styles.menu}\n sideOffset={4}\n align=\"start\"\n >\n {bulkActions && enabledValues.length > 0 ? (\n <>\n <DropdownMenuPrimitive.Item\n className={styles.bulkAction}\n disabled={allEnabledSelected}\n onSelect={(event) => {\n event.preventDefault();\n updateSelection([...editValue, ...enabledValues.filter((entry) => !selectedSet.has(entry))]);\n }}\n >\n {selectAllLabel}\n </DropdownMenuPrimitive.Item>\n <DropdownMenuPrimitive.Item\n className={styles.bulkAction}\n disabled={!enabledValues.some((entry) => selectedSet.has(entry))}\n onSelect={(event) => {\n event.preventDefault();\n const enabledSet = new Set(enabledValues);\n updateSelection(editValue.filter((entry) => !enabledSet.has(entry)));\n }}\n >\n {resolvedClearAllLabel}\n </DropdownMenuPrimitive.Item>\n </>\n ) : null}\n {bulkActions && enabledValues.length > 0 ? (\n <DropdownMenuPrimitive.Separator className={styles.separator} />\n ) : null}\n {options.map((option) => {\n const selected = selectedSet.has(option.value);\n\n return (\n <DropdownMenuPrimitive.CheckboxItem\n key={option.value}\n className={cx(\n styles.option,\n selected && styles.optionSelected,\n option.disabled && styles.optionDisabled,\n )}\n checked={selected}\n disabled={option.disabled}\n onCheckedChange={() => toggleValue(option.value)}\n onSelect={(event) => event.preventDefault()}\n >\n <span\n className={cx(\n styles.indicator,\n selected && styles.indicatorSelected,\n option.disabled && styles.indicatorDisabled,\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator forceMount>\n <svg\n viewBox=\"0 0 16 16\"\n width=\"16\"\n height=\"16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M3.5 8.5 6.5 11.5 12.5 4.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.8\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n <span className={styles.optionLabel}>\n {option.icon ? <span className={styles.optionIcon} aria-hidden=\"true\">{option.icon}</span> : null}\n {option.label}\n </span>\n </DropdownMenuPrimitive.CheckboxItem>\n );\n })}\n {draftMode ? (\n <div className={styles.draftActions}>\n <button type=\"button\" className={styles.draftButton} onClick={() => setOpen(false)}>Cancel</button>\n <button type=\"button\" className={styles.draftButton} disabled={editValue.length < minSelected} onClick={() => {\n onChange(editValue);\n setOpen(false);\n }}>Apply</button>\n </div>\n ) : null}\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n </div>\n </DropdownMenuPrimitive.Root>\n );\n },\n);\n\nMultiSelect.displayName = \"MultiSelect\";\n"],"mappings":";;;;;;;AAuCA,IAAa,cAAc,MAAM,YAE7B,EACE,SACA,OACA,UACA,cAAc,kBACd,YAAY,MACZ,mBAAmB,GACnB,aACA,cAAc,OACd,YAAY,OACZ,cAAc,GACd,iBAAiB,cACjB,eACA,WACA,WAAW,OACX,MACA,cAAc,WACd,mBAAmB,kBAErB,QACG;CACH,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,YAAY,MAAM,SAAmB,KAAK;CACxD,MAAM,YAAY,aAAa,OAAO,QAAQ;CAC9C,MAAM,mBAAmB,SAAmB;EAC1C,IAAI,WAAW,SAAS,IAAI;OACvB,IAAI,KAAK,UAAU,aAAa,SAAS,IAAI;CACpD;CACA,MAAM,cAAc,MAAM,cAAc,IAAI,IAAI,SAAS,GAAG,CAAC,SAAS,CAAC;CACvE,MAAM,kBAAkB,MAAM,cACtB,QAAQ,QAAQ,QAAQ,MAAM,SAAS,IAAI,KAAK,CAAC,GACvD,CAAC,SAAS,KAAK,CACjB;CAEA,MAAM,gBAAgB,MAAM,cACpB,QAAQ,QAAQ,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC,KAAK,WAAW,OAAO,KAAK,GAC/E,CAAC,OAAO,CACV;CACA,MAAM,qBACJ,cAAc,SAAS,KAAK,cAAc,OAAO,UAAU,YAAY,IAAI,KAAK,CAAC;CACnF,MAAM,qBAAqB,QAAQ,MAAM,WAAW,OAAO,QAAQ;CACnE,MAAM,wBACJ,kBAAkB,qBAAqB,kBAAkB;CAE3D,MAAM,iBAAiB,MAAM,cACrB,cAAc,eAAe,GACnC,CAA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 +8,16 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
8
8
|
let _radix_ui_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
9
9
|
_radix_ui_react_dropdown_menu = require_runtime.__toESM(_radix_ui_react_dropdown_menu, 1);
|
|
10
10
|
//#region src/components/multi-select/MultiSelect.tsx
|
|
11
|
-
var MultiSelect = react.forwardRef(({ options, value, onChange, placeholder = "Select options", fullWidth = true, maxVisibleValues = 2, formatValue, bulkActions = false, selectAllLabel = "Select all", clearAllLabel, className, disabled = false, name, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }, ref) => {
|
|
12
|
-
const
|
|
13
|
-
const
|
|
11
|
+
var MultiSelect = react.forwardRef(({ options, value, onChange, placeholder = "Select options", fullWidth = true, maxVisibleValues = 2, formatValue, bulkActions = false, draftMode = false, minSelected = 0, selectAllLabel = "Select all", clearAllLabel, className, disabled = false, name, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }, ref) => {
|
|
12
|
+
const [open, setOpen] = react.useState(false);
|
|
13
|
+
const [draft, setDraft] = react.useState(value);
|
|
14
|
+
const editValue = draftMode && open ? draft : value;
|
|
15
|
+
const updateSelection = (next) => {
|
|
16
|
+
if (draftMode) setDraft(next);
|
|
17
|
+
else if (next.length >= minSelected) onChange(next);
|
|
18
|
+
};
|
|
19
|
+
const selectedSet = react.useMemo(() => new Set(editValue), [editValue]);
|
|
20
|
+
const selectedOptions = react.useMemo(() => options.filter((opt) => value.includes(opt.value)), [options, value]);
|
|
14
21
|
const enabledValues = react.useMemo(() => options.filter((option) => !option.disabled).map((option) => option.value), [options]);
|
|
15
22
|
const allEnabledSelected = enabledValues.length > 0 && enabledValues.every((entry) => selectedSet.has(entry));
|
|
16
23
|
const hasDisabledOptions = options.some((option) => option.disabled);
|
|
@@ -18,20 +25,25 @@ var MultiSelect = react.forwardRef(({ options, value, onChange, placeholder = "S
|
|
|
18
25
|
const formattedValue = react.useMemo(() => formatValue?.(selectedOptions), [formatValue, selectedOptions]);
|
|
19
26
|
const toggleValue = react.useCallback((nextValue) => {
|
|
20
27
|
if (selectedSet.has(nextValue)) {
|
|
21
|
-
|
|
28
|
+
updateSelection(editValue.filter((entry) => entry !== nextValue));
|
|
22
29
|
return;
|
|
23
30
|
}
|
|
24
|
-
|
|
31
|
+
updateSelection([...editValue, nextValue]);
|
|
25
32
|
}, [
|
|
26
|
-
|
|
33
|
+
updateSelection,
|
|
27
34
|
selectedSet,
|
|
28
|
-
|
|
35
|
+
editValue
|
|
29
36
|
]);
|
|
30
37
|
const visibleCount = Math.max(1, maxVisibleValues);
|
|
31
38
|
const visibleOptions = selectedOptions.slice(0, visibleCount);
|
|
32
39
|
const overflowCount = Math.max(0, selectedOptions.length - visibleOptions.length);
|
|
33
40
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Root, {
|
|
34
41
|
modal: false,
|
|
42
|
+
open,
|
|
43
|
+
onOpenChange: (next) => {
|
|
44
|
+
if (next) setDraft([...value]);
|
|
45
|
+
setOpen(next);
|
|
46
|
+
},
|
|
35
47
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
36
48
|
className: require_cx.cx(require_multi_select_module.default.wrapper, fullWidth && require_multi_select_module.default.wrapperFullWidth, className),
|
|
37
49
|
children: [
|
|
@@ -98,7 +110,7 @@ var MultiSelect = react.forwardRef(({ options, value, onChange, placeholder = "S
|
|
|
98
110
|
disabled: allEnabledSelected,
|
|
99
111
|
onSelect: (event) => {
|
|
100
112
|
event.preventDefault();
|
|
101
|
-
|
|
113
|
+
updateSelection([...editValue, ...enabledValues.filter((entry) => !selectedSet.has(entry))]);
|
|
102
114
|
},
|
|
103
115
|
children: selectAllLabel
|
|
104
116
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Item, {
|
|
@@ -107,7 +119,7 @@ var MultiSelect = react.forwardRef(({ options, value, onChange, placeholder = "S
|
|
|
107
119
|
onSelect: (event) => {
|
|
108
120
|
event.preventDefault();
|
|
109
121
|
const enabledSet = new Set(enabledValues);
|
|
110
|
-
|
|
122
|
+
updateSelection(editValue.filter((entry) => !enabledSet.has(entry)));
|
|
111
123
|
},
|
|
112
124
|
children: resolvedClearAllLabel
|
|
113
125
|
})] }) : null,
|
|
@@ -149,7 +161,25 @@ var MultiSelect = react.forwardRef(({ options, value, onChange, placeholder = "S
|
|
|
149
161
|
}) : null, option.label]
|
|
150
162
|
})]
|
|
151
163
|
}, option.value);
|
|
152
|
-
})
|
|
164
|
+
}),
|
|
165
|
+
draftMode ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
166
|
+
className: require_multi_select_module.default.draftActions,
|
|
167
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
168
|
+
type: "button",
|
|
169
|
+
className: require_multi_select_module.default.draftButton,
|
|
170
|
+
onClick: () => setOpen(false),
|
|
171
|
+
children: "Cancel"
|
|
172
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
173
|
+
type: "button",
|
|
174
|
+
className: require_multi_select_module.default.draftButton,
|
|
175
|
+
disabled: editValue.length < minSelected,
|
|
176
|
+
onClick: () => {
|
|
177
|
+
onChange(editValue);
|
|
178
|
+
setOpen(false);
|
|
179
|
+
},
|
|
180
|
+
children: "Apply"
|
|
181
|
+
})]
|
|
182
|
+
}) : null
|
|
153
183
|
]
|
|
154
184
|
}) })
|
|
155
185
|
]
|
package/dist/index28.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index28.cjs","names":[],"sources":["../src/components/multi-select/MultiSelect.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { cx } from \"../../utils/cx\";\nimport styles from \"./multi-select.module.css\";\n\nexport type MultiSelectOption = {\n label: string;\n value: string;\n disabled?: boolean;\n /** Optional decorative leading visual. The label remains the accessible option name. */\n icon?: React.ReactElement;\n};\n\nexport type MultiSelectProps = {\n options: MultiSelectOption[];\n value: string[];\n onChange: (value: string[]) => void;\n placeholder?: string;\n fullWidth?: boolean;\n maxVisibleValues?: number;\n /** Formats the closed trigger text from the selected options, including an empty selection. */\n formatValue?: (selected: MultiSelectOption[]) => string;\n /** Shows Select all and Clear all actions. Bulk actions modify enabled options only. */\n bulkActions?: boolean;\n selectAllLabel?: string;\n /** Label for clearing all enabled selections. Disabled selected options remain selected. */\n clearAllLabel?: string;\n className?: string;\n disabled?: boolean;\n name?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n};\n\nexport const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>(\n (\n {\n options,\n value,\n onChange,\n placeholder = \"Select options\",\n fullWidth = true,\n maxVisibleValues = 2,\n formatValue,\n bulkActions = false,\n selectAllLabel = \"Select all\",\n clearAllLabel,\n className,\n disabled = false,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref,\n ) => {\n const selectedSet = React.useMemo(() => new Set(value), [value]);\n const selectedOptions = React.useMemo(\n () => options.filter((opt) => selectedSet.has(opt.value)),\n [options, selectedSet],\n );\n\n const enabledValues = React.useMemo(\n () => options.filter((option) => !option.disabled).map((option) => option.value),\n [options],\n );\n const allEnabledSelected =\n enabledValues.length > 0 && enabledValues.every((entry) => selectedSet.has(entry));\n const hasDisabledOptions = options.some((option) => option.disabled);\n const resolvedClearAllLabel =\n clearAllLabel ?? (hasDisabledOptions ? \"Clear enabled\" : \"Clear all\");\n\n const formattedValue = React.useMemo(\n () => formatValue?.(selectedOptions),\n [formatValue, selectedOptions],\n );\n\n const toggleValue = React.useCallback(\n (nextValue: string) => {\n if (selectedSet.has(nextValue)) {\n onChange(value.filter((entry) => entry !== nextValue));\n return;\n }\n\n onChange([...value, nextValue]);\n },\n [onChange, selectedSet, value],\n );\n\n const visibleCount = Math.max(1, maxVisibleValues);\n const visibleOptions = selectedOptions.slice(0, visibleCount);\n const overflowCount = Math.max(\n 0,\n selectedOptions.length - visibleOptions.length,\n );\n\n return (\n <DropdownMenuPrimitive.Root modal={false}>\n <div\n className={cx(\n styles.wrapper,\n fullWidth && styles.wrapperFullWidth,\n className,\n )}\n >\n <DropdownMenuPrimitive.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n className={styles.trigger}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n disabled={disabled}\n >\n <span className={styles.value}>\n {formatValue ? (\n <span className={styles.summary}>{formattedValue}</span>\n ) : selectedOptions.length === 0 ? (\n <span className={styles.placeholder}>{placeholder}</span>\n ) : (\n <>\n {visibleOptions.map((option) => (\n <span key={option.value} className={styles.chip}>\n {option.icon ? <span className={styles.optionIcon} aria-hidden=\"true\">{option.icon}</span> : null}\n {option.label}\n </span>\n ))}\n {overflowCount > 0 ? (\n <span className={cx(styles.chip, styles.chipSummary)}>\n +{overflowCount}\n </span>\n ) : null}\n </>\n )}\n </span>\n <span className={styles.chevron} aria-hidden=\"true\">\n <svg\n viewBox=\"0 0 10 10\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"10\"\n height=\"10\"\n >\n <path\n d=\"M2 3.5L5 6.5L8 3.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </span>\n </button>\n </DropdownMenuPrimitive.Trigger>\n\n {name\n ? value.map((entry) => (\n <input key={entry} type=\"hidden\" name={name} value={entry} />\n ))\n : null}\n\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n className={styles.menu}\n sideOffset={4}\n align=\"start\"\n >\n {bulkActions && enabledValues.length > 0 ? (\n <>\n <DropdownMenuPrimitive.Item\n className={styles.bulkAction}\n disabled={allEnabledSelected}\n onSelect={(event) => {\n event.preventDefault();\n onChange([...value, ...enabledValues.filter((entry) => !selectedSet.has(entry))]);\n }}\n >\n {selectAllLabel}\n </DropdownMenuPrimitive.Item>\n <DropdownMenuPrimitive.Item\n className={styles.bulkAction}\n disabled={!enabledValues.some((entry) => selectedSet.has(entry))}\n onSelect={(event) => {\n event.preventDefault();\n const enabledSet = new Set(enabledValues);\n onChange(value.filter((entry) => !enabledSet.has(entry)));\n }}\n >\n {resolvedClearAllLabel}\n </DropdownMenuPrimitive.Item>\n </>\n ) : null}\n {bulkActions && enabledValues.length > 0 ? (\n <DropdownMenuPrimitive.Separator className={styles.separator} />\n ) : null}\n {options.map((option) => {\n const selected = selectedSet.has(option.value);\n\n return (\n <DropdownMenuPrimitive.CheckboxItem\n key={option.value}\n className={cx(\n styles.option,\n selected && styles.optionSelected,\n option.disabled && styles.optionDisabled,\n )}\n checked={selected}\n disabled={option.disabled}\n onCheckedChange={() => toggleValue(option.value)}\n onSelect={(event) => event.preventDefault()}\n >\n <span\n className={cx(\n styles.indicator,\n selected && styles.indicatorSelected,\n option.disabled && styles.indicatorDisabled,\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator forceMount>\n <svg\n viewBox=\"0 0 16 16\"\n width=\"16\"\n height=\"16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M3.5 8.5 6.5 11.5 12.5 4.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.8\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n <span className={styles.optionLabel}>\n {option.icon ? <span className={styles.optionIcon} aria-hidden=\"true\">{option.icon}</span> : null}\n {option.label}\n </span>\n </DropdownMenuPrimitive.CheckboxItem>\n );\n })}\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n </div>\n </DropdownMenuPrimitive.Root>\n );\n },\n);\n\nMultiSelect.displayName = \"MultiSelect\";\n"],"mappings":";;;;;;;;;;AAoCA,IAA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\"use client\";\n\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { cx } from \"../../utils/cx\";\nimport styles from \"./multi-select.module.css\";\n\nexport type MultiSelectOption = {\n label: string;\n value: string;\n disabled?: boolean;\n /** Optional decorative leading visual. The label remains the accessible option name. */\n icon?: React.ReactElement;\n};\n\nexport type MultiSelectProps = {\n options: MultiSelectOption[];\n value: string[];\n onChange: (value: string[]) => void;\n placeholder?: string;\n fullWidth?: boolean;\n maxVisibleValues?: number;\n /** Formats the closed trigger text from the selected options, including an empty selection. */\n formatValue?: (selected: MultiSelectOption[]) => string;\n /** Shows Select all and Clear all actions. Bulk actions modify enabled options only. */\n bulkActions?: boolean;\n /** Stage changes until Apply. Cancel/dismiss discards the draft. */\n draftMode?: boolean;\n minSelected?: number;\n selectAllLabel?: string;\n /** Label for clearing all enabled selections. Disabled selected options remain selected. */\n clearAllLabel?: string;\n className?: string;\n disabled?: boolean;\n name?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n};\n\nexport const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>(\n (\n {\n options,\n value,\n onChange,\n placeholder = \"Select options\",\n fullWidth = true,\n maxVisibleValues = 2,\n formatValue,\n bulkActions = false,\n draftMode = false,\n minSelected = 0,\n selectAllLabel = \"Select all\",\n clearAllLabel,\n className,\n disabled = false,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref,\n ) => {\n const [open, setOpen] = React.useState(false);\n const [draft, setDraft] = React.useState<string[]>(value);\n const editValue = draftMode && open ? draft : value;\n const updateSelection = (next: string[]) => {\n if (draftMode) setDraft(next);\n else if (next.length >= minSelected) onChange(next);\n };\n const selectedSet = React.useMemo(() => new Set(editValue), [editValue]);\n const selectedOptions = React.useMemo(\n () => options.filter((opt) => value.includes(opt.value)),\n [options, value],\n );\n\n const enabledValues = React.useMemo(\n () => options.filter((option) => !option.disabled).map((option) => option.value),\n [options],\n );\n const allEnabledSelected =\n enabledValues.length > 0 && enabledValues.every((entry) => selectedSet.has(entry));\n const hasDisabledOptions = options.some((option) => option.disabled);\n const resolvedClearAllLabel =\n clearAllLabel ?? (hasDisabledOptions ? \"Clear enabled\" : \"Clear all\");\n\n const formattedValue = React.useMemo(\n () => formatValue?.(selectedOptions),\n [formatValue, selectedOptions],\n );\n\n const toggleValue = React.useCallback(\n (nextValue: string) => {\n if (selectedSet.has(nextValue)) {\n updateSelection(editValue.filter((entry) => entry !== nextValue));\n return;\n }\n\n updateSelection([...editValue, nextValue]);\n },\n [updateSelection, selectedSet, editValue],\n );\n\n const visibleCount = Math.max(1, maxVisibleValues);\n const visibleOptions = selectedOptions.slice(0, visibleCount);\n const overflowCount = Math.max(\n 0,\n selectedOptions.length - visibleOptions.length,\n );\n\n return (\n <DropdownMenuPrimitive.Root modal={false} open={open} onOpenChange={(next) => {\n if (next) setDraft([...value]);\n setOpen(next);\n }}>\n <div\n className={cx(\n styles.wrapper,\n fullWidth && styles.wrapperFullWidth,\n className,\n )}\n >\n <DropdownMenuPrimitive.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n className={styles.trigger}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n disabled={disabled}\n >\n <span className={styles.value}>\n {formatValue ? (\n <span className={styles.summary}>{formattedValue}</span>\n ) : selectedOptions.length === 0 ? (\n <span className={styles.placeholder}>{placeholder}</span>\n ) : (\n <>\n {visibleOptions.map((option) => (\n <span key={option.value} className={styles.chip}>\n {option.icon ? <span className={styles.optionIcon} aria-hidden=\"true\">{option.icon}</span> : null}\n {option.label}\n </span>\n ))}\n {overflowCount > 0 ? (\n <span className={cx(styles.chip, styles.chipSummary)}>\n +{overflowCount}\n </span>\n ) : null}\n </>\n )}\n </span>\n <span className={styles.chevron} aria-hidden=\"true\">\n <svg\n viewBox=\"0 0 10 10\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"10\"\n height=\"10\"\n >\n <path\n d=\"M2 3.5L5 6.5L8 3.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </span>\n </button>\n </DropdownMenuPrimitive.Trigger>\n\n {name\n ? value.map((entry) => (\n <input key={entry} type=\"hidden\" name={name} value={entry} />\n ))\n : null}\n\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n className={styles.menu}\n sideOffset={4}\n align=\"start\"\n >\n {bulkActions && enabledValues.length > 0 ? (\n <>\n <DropdownMenuPrimitive.Item\n className={styles.bulkAction}\n disabled={allEnabledSelected}\n onSelect={(event) => {\n event.preventDefault();\n updateSelection([...editValue, ...enabledValues.filter((entry) => !selectedSet.has(entry))]);\n }}\n >\n {selectAllLabel}\n </DropdownMenuPrimitive.Item>\n <DropdownMenuPrimitive.Item\n className={styles.bulkAction}\n disabled={!enabledValues.some((entry) => selectedSet.has(entry))}\n onSelect={(event) => {\n event.preventDefault();\n const enabledSet = new Set(enabledValues);\n updateSelection(editValue.filter((entry) => !enabledSet.has(entry)));\n }}\n >\n {resolvedClearAllLabel}\n </DropdownMenuPrimitive.Item>\n </>\n ) : null}\n {bulkActions && enabledValues.length > 0 ? (\n <DropdownMenuPrimitive.Separator className={styles.separator} />\n ) : null}\n {options.map((option) => {\n const selected = selectedSet.has(option.value);\n\n return (\n <DropdownMenuPrimitive.CheckboxItem\n key={option.value}\n className={cx(\n styles.option,\n selected && styles.optionSelected,\n option.disabled && styles.optionDisabled,\n )}\n checked={selected}\n disabled={option.disabled}\n onCheckedChange={() => toggleValue(option.value)}\n onSelect={(event) => event.preventDefault()}\n >\n <span\n className={cx(\n styles.indicator,\n selected && styles.indicatorSelected,\n option.disabled && styles.indicatorDisabled,\n )}\n aria-hidden=\"true\"\n >\n <DropdownMenuPrimitive.ItemIndicator forceMount>\n <svg\n viewBox=\"0 0 16 16\"\n width=\"16\"\n height=\"16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M3.5 8.5 6.5 11.5 12.5 4.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.8\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n <span className={styles.optionLabel}>\n {option.icon ? <span className={styles.optionIcon} aria-hidden=\"true\">{option.icon}</span> : null}\n {option.label}\n </span>\n </DropdownMenuPrimitive.CheckboxItem>\n );\n })}\n {draftMode ? (\n <div className={styles.draftActions}>\n <button type=\"button\" className={styles.draftButton} onClick={() => setOpen(false)}>Cancel</button>\n <button type=\"button\" className={styles.draftButton} disabled={editValue.length < minSelected} onClick={() => {\n onChange(editValue);\n setOpen(false);\n }}>Apply</button>\n </div>\n ) : null}\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n </div>\n </DropdownMenuPrimitive.Root>\n );\n },\n);\n\nMultiSelect.displayName = \"MultiSelect\";\n"],"mappings":";;;;;;;;;;AAuCA,IAAa,cAAc,MAAM,YAE7B,EACE,SACA,OACA,UACA,cAAc,kBACd,YAAY,MACZ,mBAAmB,GACnB,aACA,cAAc,OACd,YAAY,OACZ,cAAc,GACd,iBAAiB,cACjB,eACA,WACA,WAAW,OACX,MACA,cAAc,WACd,mBAAmB,kBAErB,QACG;CACH,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,YAAY,MAAM,SAAmB,KAAK;CACxD,MAAM,YAAY,aAAa,OAAO,QAAQ;CAC9C,MAAM,mBAAmB,SAAmB;EAC1C,IAAI,WAAW,SAAS,IAAI;OACvB,IAAI,KAAK,UAAU,aAAa,SAAS,IAAI;CACpD;CACA,MAAM,cAAc,MAAM,cAAc,IAAI,IAAI,SAAS,GAAG,CAAC,SAAS,CAAC;CACvE,MAAM,kBAAkB,MAAM,cACtB,QAAQ,QAAQ,QAAQ,MAAM,SAAS,IAAI,K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AAQ,KAAK;QACf;kBAAG;OAAa,CAAA,CACb;WACH;KACyB;OACH,CAAA;GAC3B;;CACqB,CAAA;AAEhC,CACF;AAEA,YAAY,cAAc"}
|
package/dist/index75.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
//#region src/components/ai-chat/ai-chat.module.css
|
|
2
|
+
var container = "uzi-ai-chat-module__container__UoyFb";
|
|
3
|
+
var scope = "uzi-ai-chat-module__scope__6xOgo";
|
|
4
|
+
var scopeLabel = "uzi-ai-chat-module__scopeLabel__LHbKZ";
|
|
5
|
+
var scopeHelp = "uzi-ai-chat-module__scopeHelp__NddsL";
|
|
6
|
+
var closeBtn = "uzi-ai-chat-module__closeBtn__IeRH2";
|
|
7
|
+
var sendButton = "uzi-ai-chat-module__sendButton__S9MmM";
|
|
8
|
+
var errorActions = "uzi-ai-chat-module__errorActions__MWoVQ";
|
|
9
|
+
var historyLimit = "uzi-ai-chat-module__historyLimit__LgZzD";
|
|
10
|
+
var thread = "uzi-ai-chat-module__thread__Rqyeu";
|
|
11
|
+
var viewport = "uzi-ai-chat-module__viewport__-CgLF";
|
|
12
|
+
var chatToolbar = "uzi-ai-chat-module__chatToolbar__-QMr9";
|
|
13
|
+
var messageList = "uzi-ai-chat-module__messageList__G3H50";
|
|
14
|
+
var userMessage = "uzi-ai-chat-module__userMessage__iGksi";
|
|
15
|
+
var assistantMessage = "uzi-ai-chat-module__assistantMessage__hRdxP";
|
|
16
|
+
var textPart = "uzi-ai-chat-module__textPart__U0myJ";
|
|
17
|
+
var reasoning = "uzi-ai-chat-module__reasoning__7Xf83";
|
|
18
|
+
var toolPart = "uzi-ai-chat-module__toolPart__P160m";
|
|
19
|
+
var reasoningSummary = "uzi-ai-chat-module__reasoningSummary__3gaQ3";
|
|
20
|
+
var reasoningText = "uzi-ai-chat-module__reasoningText__qxl36";
|
|
21
|
+
var sources = "uzi-ai-chat-module__sources__EwoEv";
|
|
22
|
+
var sourcesLabel = "uzi-ai-chat-module__sourcesLabel__YV6j1";
|
|
23
|
+
var data = "uzi-ai-chat-module__data__6pYCT";
|
|
24
|
+
var structuredData = "uzi-ai-chat-module__structuredData__CVeqF";
|
|
25
|
+
var footer = "uzi-ai-chat-module__footer__VzCvT";
|
|
26
|
+
var composerForm = "uzi-ai-chat-module__composerForm__E2Wqd";
|
|
27
|
+
var input = "uzi-ai-chat-module__input__-Rzh8";
|
|
28
|
+
var status = "uzi-ai-chat-module__status__Wm3t3";
|
|
29
|
+
var error = "uzi-ai-chat-module__error__csAOF";
|
|
30
|
+
var emptyState = "uzi-ai-chat-module__emptyState__JzB1x";
|
|
31
|
+
var composerExtras = "uzi-ai-chat-module__composerExtras__B1qBc";
|
|
32
|
+
var composerActions = "uzi-ai-chat-module__composerActions__wrPZO";
|
|
33
|
+
var approvalActions = "uzi-ai-chat-module__approvalActions__ptwyO";
|
|
34
|
+
var attachmentList = "uzi-ai-chat-module__attachmentList__isbAi";
|
|
35
|
+
var attachmentError = "uzi-ai-chat-module__attachmentError__E-kU-";
|
|
36
|
+
var messageBubble = "uzi-ai-chat-module__messageBubble__ZG7M-";
|
|
37
|
+
var messageLabel = "uzi-ai-chat-module__messageLabel__esd4p";
|
|
38
|
+
var composerSurface = "uzi-ai-chat-module__composerSurface__t7lZs";
|
|
39
|
+
var composerRow = "uzi-ai-chat-module__composerRow__Mjqy2";
|
|
40
|
+
var composerIconButton = "uzi-ai-chat-module__composerIconButton__6FYlZ";
|
|
41
|
+
var visuallyHidden = "uzi-ai-chat-module__visuallyHidden__qVCl7";
|
|
42
|
+
var attachmentThumbnail = "uzi-ai-chat-module__attachmentThumbnail__OzmIc";
|
|
43
|
+
var attachmentFilename = "uzi-ai-chat-module__attachmentFilename__yHCLk";
|
|
44
|
+
var ai_chat_module_default = {
|
|
45
|
+
container,
|
|
46
|
+
scope,
|
|
47
|
+
scopeLabel,
|
|
48
|
+
scopeHelp,
|
|
49
|
+
closeBtn,
|
|
50
|
+
sendButton,
|
|
51
|
+
errorActions,
|
|
52
|
+
historyLimit,
|
|
53
|
+
thread,
|
|
54
|
+
viewport,
|
|
55
|
+
chatToolbar,
|
|
56
|
+
messageList,
|
|
57
|
+
userMessage,
|
|
58
|
+
assistantMessage,
|
|
59
|
+
textPart,
|
|
60
|
+
reasoning,
|
|
61
|
+
toolPart,
|
|
62
|
+
reasoningSummary,
|
|
63
|
+
reasoningText,
|
|
64
|
+
sources,
|
|
65
|
+
sourcesLabel,
|
|
66
|
+
data,
|
|
67
|
+
structuredData,
|
|
68
|
+
footer,
|
|
69
|
+
composerForm,
|
|
70
|
+
input,
|
|
71
|
+
status,
|
|
72
|
+
error,
|
|
73
|
+
emptyState,
|
|
74
|
+
composerExtras,
|
|
75
|
+
composerActions,
|
|
76
|
+
approvalActions,
|
|
77
|
+
attachmentList,
|
|
78
|
+
attachmentError,
|
|
79
|
+
messageBubble,
|
|
80
|
+
messageLabel,
|
|
81
|
+
composerSurface,
|
|
82
|
+
composerRow,
|
|
83
|
+
composerIconButton,
|
|
84
|
+
visuallyHidden,
|
|
85
|
+
attachmentThumbnail,
|
|
86
|
+
attachmentFilename
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
export { approvalActions, assistantMessage, attachmentError, attachmentFilename, attachmentList, attachmentThumbnail, chatToolbar, closeBtn, composerActions, composerExtras, composerForm, composerIconButton, composerRow, composerSurface, container, data, ai_chat_module_default as default, emptyState, error, errorActions, footer, historyLimit, input, messageBubble, messageLabel, messageList, reasoning, reasoningSummary, reasoningText, scope, scopeHelp, scopeLabel, sendButton, sources, sourcesLabel, status, structuredData, textPart, thread, toolPart, userMessage, viewport, visuallyHidden };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=index75.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index75.js","names":[],"sources":["../src/components/ai-chat/ai-chat.module.css"],"sourcesContent":[".container {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n max-height: none;\n overflow: hidden;\n position: relative;\n}\n\n.scope {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n padding: 0.75rem 3rem 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border-bottom: 1px solid var(--border);\n}\n\n.scopeLabel {\n font-size: 0.6875rem;\n font-weight: 650;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n color: var(--muted-foreground);\n}\n\n.scope strong {\n font-size: 0.875rem;\n}\n\n.scopeHelp {\n margin: 0;\n font-size: 0.75rem;\n color: var(--muted-foreground);\n line-height: 1.5;\n}\n\n.closeBtn {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n z-index: 1;\n display: grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n border: 0;\n border-radius: 50%;\n background: transparent;\n color: var(--muted-foreground);\n cursor: pointer;\n font-size: 0.875rem;\n}\n\n.closeBtn:hover {\n background: var(--uzi-surface-2, var(--muted));\n color: var(--foreground);\n}\n\n.closeBtn:focus-visible,\n.sendButton:focus-visible,\n.errorActions button:focus-visible,\n.historyLimit button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.thread {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n overflow: hidden;\n}\n\n.viewport {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-height: 0;\n overflow-y: auto;\n overflow-x: hidden;\n gap: 0.75rem;\n}\n\n.chatToolbar {\n position: sticky;\n top: 0;\n z-index: 1;\n display: flex;\n justify-content: flex-end;\n padding: 0.5rem 1rem;\n background: var(--uzi-surface-1, var(--background));\n border-bottom: 1px solid var(--border);\n}\n\n.chatToolbar button {\n border: 0;\n border-radius: 0.375rem;\n padding: 0.35rem 0.5rem;\n background: transparent;\n color: var(--muted-foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.chatToolbar button:hover {\n color: var(--foreground);\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.chatToolbar button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.messageList {\n display: flex;\n flex: 1 0 auto;\n flex-direction: column;\n gap: 0.75rem;\n padding: 1rem;\n}\n\n.userMessage,\n.assistantMessage {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border-radius: 0.75rem;\n color: var(--foreground);\n overflow-wrap: anywhere;\n}\n\n.userMessage {\n background: color-mix(in srgb, var(--primary) 10%, transparent);\n border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);\n}\n\n.assistantMessage {\n background: var(--muted);\n border: 1px solid var(--border);\n}\n\n.textPart {\n white-space: pre-wrap;\n line-height: 1.6;\n}\n\n.reasoning,\n.toolPart {\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n padding: 0.5rem 0.75rem;\n background: var(--uzi-surface-1, transparent);\n}\n\n.reasoningSummary,\n.toolPart summary {\n cursor: pointer;\n font-size: 0.75rem;\n font-weight: 600;\n color: var(--muted-foreground);\n}\n\n.reasoningText {\n margin: 0.5rem 0 0;\n font-size: 0.8125rem;\n line-height: 1.6;\n color: var(--muted-foreground);\n white-space: pre-wrap;\n}\n\n.sources {\n padding-top: 0.5rem;\n border-top: 1px solid var(--border);\n}\n\n.sourcesLabel {\n display: block;\n font-size: 0.6875rem;\n font-weight: 650;\n color: var(--muted-foreground);\n margin-bottom: 0.25rem;\n}\n\n.sources ul {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin: 0;\n padding-left: 1.25rem;\n}\n\n.sources li {\n font-size: 0.75rem;\n overflow-wrap: anywhere;\n}\n\n.data {\n padding: 0.5rem;\n background: var(--uzi-surface-2, var(--muted));\n border-radius: 0.5rem;\n overflow-x: auto;\n}\n\n.structuredData {\n margin: 0;\n padding: 0.5rem 0;\n max-width: 100%;\n overflow-x: auto;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n font-size: 0.75rem;\n line-height: 1.5;\n}\n\n.footer {\n position: sticky;\n bottom: 0;\n z-index: 1;\n flex-shrink: 0;\n background: var(--background);\n border-top: 1px solid var(--border);\n}\n\n.composerForm {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: end;\n gap: 0.75rem;\n padding: 0.75rem 1rem;\n}\n\n.input {\n width: 100%;\n min-height: 2.5rem;\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--background);\n color: var(--foreground);\n font: inherit;\n font-size: 0.875rem;\n line-height: 1.5;\n resize: vertical;\n}\n\n.input:focus {\n outline: none;\n border-color: var(--primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);\n}\n\n.input::placeholder {\n color: var(--muted-foreground);\n}\n\n.input:disabled,\n.sendButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.sendButton {\n min-height: 2.5rem;\n padding: 0.5rem 0.875rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--primary);\n color: var(--primary-foreground);\n font: inherit;\n font-size: 0.875rem;\n font-weight: 600;\n cursor: pointer;\n}\n\n.sendButton:not(:disabled):hover {\n filter: brightness(0.95);\n}\n\n.status {\n margin: 0;\n padding: 0.5rem 1rem;\n text-align: center;\n font-size: 0.8125rem;\n color: var(--muted-foreground);\n font-style: italic;\n}\n\n.error {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border: 1px solid var(--destructive);\n border-radius: 0.5rem;\n margin: 0.75rem 1rem;\n background: color-mix(in srgb, var(--destructive) 10%, transparent);\n}\n\n.error p {\n margin: 0;\n color: var(--destructive);\n font-size: 0.8125rem;\n}\n\n.errorActions {\n display: flex;\n gap: 0.5rem;\n}\n\n.errorActions button,\n.historyLimit button {\n padding: 0.375rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.375rem;\n background: transparent;\n color: var(--foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.errorActions button:hover,\n.historyLimit button:hover {\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.historyLimit {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n align-items: center;\n padding: 0.75rem 1rem;\n margin: 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n}\n\n.historyLimit span {\n font-size: 0.75rem;\n color: var(--muted-foreground);\n}\n\n.emptyState {\n display: grid;\n place-items: center;\n flex: 1;\n min-height: 12rem;\n color: var(--muted-foreground);\n text-align: center;\n}\n\n.emptyState p {\n margin: 0;\n font-size: 0.875rem;\n}\n\n@media (max-width: 640px) {\n .composerForm {\n grid-template-columns: minmax(0, 1fr) auto;\n }\n\n .errorActions {\n flex-wrap: wrap;\n }\n}\n\n/* Optional integration controls use the same Uzi surface and layout tokens. */\n.composerExtras {\n grid-column: 1 / -1;\n min-width: 0;\n}\n\n.composerActions {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.approvalActions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.5rem; }\n.approvalActions button, .attachmentList button {\n background: var(--background); color: var(--foreground); border: 1px solid var(--border);\n border-radius: 0.375rem; padding: 0.3rem 0.55rem; cursor: pointer;\n}\n.approvalActions button:disabled { opacity: 0.5; cursor: not-allowed; }\n.attachmentError { color: var(--destructive); padding: 0.5rem 1rem; margin: 0; }\n.attachmentList { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.4rem 0; margin: 0; list-style: none; }\n.attachmentList li { display: inline-flex; gap: 0.5rem; align-items: center; font-size: 0.75rem; }\n\n/* Role-aware message layout shared by the default renderer and consumer apps. */\n.messageBubble { width: fit-content; min-width: 0; max-width: 100%; }\n.messageBubble.userMessage { align-self: flex-end; max-width: min(90%, 42rem); }\n.messageBubble.assistantMessage { align-self: flex-start; max-width: 100%; }\n.messageLabel { font-size: 0.6875rem; font-weight: 650; color: var(--muted-foreground); }\n\n/* Shared compact composer: same visual grammar as Betty, without app-owned behavior. */\n.composerSurface {\n grid-column: 1 / -1;\n min-width: 0;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--background);\n}\n.composerSurface:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }\n.composerRow { display: flex; align-items: end; min-width: 0; gap: 0.375rem; padding: 0.375rem; }\n.composerRow .input {\n display: block; flex: 1; width: 0; min-width: 0; min-height: 2.75rem;\n max-height: 11rem; padding: 0.625rem 0.25rem; border: 0;\n background: transparent; resize: none; font-size: 1rem;\n}\n.composerRow .input:focus { outline: none; box-shadow: none; }\n.composerIconButton, .composerRow .sendButton {\n display: grid; place-items: center; flex-shrink: 0;\n width: 2.75rem; height: 2.75rem; min-height: 2.75rem;\n padding: 0; border-radius: 0.625rem; cursor: pointer;\n}\n.composerIconButton {\n color: var(--foreground); border: 0; background: transparent;\n}\n.composerIconButton:hover:not(:disabled) { background: var(--muted); }\n.composerRow .sendButton { border: 0; background: var(--primary); color: var(--primary-foreground); }\n.composerIconButton:focus-visible, .composerRow .sendButton:focus-visible {\n outline: 2px solid var(--ring); outline-offset: 2px;\n}\n.composerIconButton:disabled { opacity: 0.5; cursor: not-allowed; }\n.visuallyHidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }\n\n/* Thumbnail treatment matches the Betty attachment shelf. */\n.attachmentList {\n gap: 0.5rem;\n padding: 0;\n align-items: center;\n}\n.attachmentList li {\n max-width: 100%;\n position: relative;\n min-height: 3rem;\n border-radius: 0.625rem;\n border: 1px solid var(--border);\n background: var(--uzi-surface-1, var(--muted));\n padding: 0.125rem;\n}\n.attachmentThumbnail {\n width: 3rem;\n height: 3rem;\n border-radius: 0.5rem;\n object-fit: cover;\n}\n.attachmentFilename {\n max-width: 11rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0.5rem;\n}\n.attachmentList li button {\n flex-shrink: 0;\n border: 0;\n background: transparent;\n color: var(--muted-foreground);\n border-radius: 0.4rem;\n}\n.attachmentList li button:hover { color: var(--foreground); background: var(--muted); }\n"],"mappings":""}
|
package/dist/index76.cjs
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
//#region src/components/ai-chat/ai-chat.module.css
|
|
2
|
+
var container = "uzi-ai-chat-module__container__UoyFb";
|
|
3
|
+
var scope = "uzi-ai-chat-module__scope__6xOgo";
|
|
4
|
+
var scopeLabel = "uzi-ai-chat-module__scopeLabel__LHbKZ";
|
|
5
|
+
var scopeHelp = "uzi-ai-chat-module__scopeHelp__NddsL";
|
|
6
|
+
var closeBtn = "uzi-ai-chat-module__closeBtn__IeRH2";
|
|
7
|
+
var sendButton = "uzi-ai-chat-module__sendButton__S9MmM";
|
|
8
|
+
var errorActions = "uzi-ai-chat-module__errorActions__MWoVQ";
|
|
9
|
+
var historyLimit = "uzi-ai-chat-module__historyLimit__LgZzD";
|
|
10
|
+
var thread = "uzi-ai-chat-module__thread__Rqyeu";
|
|
11
|
+
var viewport = "uzi-ai-chat-module__viewport__-CgLF";
|
|
12
|
+
var chatToolbar = "uzi-ai-chat-module__chatToolbar__-QMr9";
|
|
13
|
+
var messageList = "uzi-ai-chat-module__messageList__G3H50";
|
|
14
|
+
var userMessage = "uzi-ai-chat-module__userMessage__iGksi";
|
|
15
|
+
var assistantMessage = "uzi-ai-chat-module__assistantMessage__hRdxP";
|
|
16
|
+
var textPart = "uzi-ai-chat-module__textPart__U0myJ";
|
|
17
|
+
var reasoning = "uzi-ai-chat-module__reasoning__7Xf83";
|
|
18
|
+
var toolPart = "uzi-ai-chat-module__toolPart__P160m";
|
|
19
|
+
var reasoningSummary = "uzi-ai-chat-module__reasoningSummary__3gaQ3";
|
|
20
|
+
var reasoningText = "uzi-ai-chat-module__reasoningText__qxl36";
|
|
21
|
+
var sources = "uzi-ai-chat-module__sources__EwoEv";
|
|
22
|
+
var sourcesLabel = "uzi-ai-chat-module__sourcesLabel__YV6j1";
|
|
23
|
+
var data = "uzi-ai-chat-module__data__6pYCT";
|
|
24
|
+
var structuredData = "uzi-ai-chat-module__structuredData__CVeqF";
|
|
25
|
+
var footer = "uzi-ai-chat-module__footer__VzCvT";
|
|
26
|
+
var composerForm = "uzi-ai-chat-module__composerForm__E2Wqd";
|
|
27
|
+
var input = "uzi-ai-chat-module__input__-Rzh8";
|
|
28
|
+
var status = "uzi-ai-chat-module__status__Wm3t3";
|
|
29
|
+
var error = "uzi-ai-chat-module__error__csAOF";
|
|
30
|
+
var emptyState = "uzi-ai-chat-module__emptyState__JzB1x";
|
|
31
|
+
var composerExtras = "uzi-ai-chat-module__composerExtras__B1qBc";
|
|
32
|
+
var composerActions = "uzi-ai-chat-module__composerActions__wrPZO";
|
|
33
|
+
var approvalActions = "uzi-ai-chat-module__approvalActions__ptwyO";
|
|
34
|
+
var attachmentList = "uzi-ai-chat-module__attachmentList__isbAi";
|
|
35
|
+
var attachmentError = "uzi-ai-chat-module__attachmentError__E-kU-";
|
|
36
|
+
var messageBubble = "uzi-ai-chat-module__messageBubble__ZG7M-";
|
|
37
|
+
var messageLabel = "uzi-ai-chat-module__messageLabel__esd4p";
|
|
38
|
+
var composerSurface = "uzi-ai-chat-module__composerSurface__t7lZs";
|
|
39
|
+
var composerRow = "uzi-ai-chat-module__composerRow__Mjqy2";
|
|
40
|
+
var composerIconButton = "uzi-ai-chat-module__composerIconButton__6FYlZ";
|
|
41
|
+
var visuallyHidden = "uzi-ai-chat-module__visuallyHidden__qVCl7";
|
|
42
|
+
var attachmentThumbnail = "uzi-ai-chat-module__attachmentThumbnail__OzmIc";
|
|
43
|
+
var attachmentFilename = "uzi-ai-chat-module__attachmentFilename__yHCLk";
|
|
44
|
+
var ai_chat_module_default = {
|
|
45
|
+
container,
|
|
46
|
+
scope,
|
|
47
|
+
scopeLabel,
|
|
48
|
+
scopeHelp,
|
|
49
|
+
closeBtn,
|
|
50
|
+
sendButton,
|
|
51
|
+
errorActions,
|
|
52
|
+
historyLimit,
|
|
53
|
+
thread,
|
|
54
|
+
viewport,
|
|
55
|
+
chatToolbar,
|
|
56
|
+
messageList,
|
|
57
|
+
userMessage,
|
|
58
|
+
assistantMessage,
|
|
59
|
+
textPart,
|
|
60
|
+
reasoning,
|
|
61
|
+
toolPart,
|
|
62
|
+
reasoningSummary,
|
|
63
|
+
reasoningText,
|
|
64
|
+
sources,
|
|
65
|
+
sourcesLabel,
|
|
66
|
+
data,
|
|
67
|
+
structuredData,
|
|
68
|
+
footer,
|
|
69
|
+
composerForm,
|
|
70
|
+
input,
|
|
71
|
+
status,
|
|
72
|
+
error,
|
|
73
|
+
emptyState,
|
|
74
|
+
composerExtras,
|
|
75
|
+
composerActions,
|
|
76
|
+
approvalActions,
|
|
77
|
+
attachmentList,
|
|
78
|
+
attachmentError,
|
|
79
|
+
messageBubble,
|
|
80
|
+
messageLabel,
|
|
81
|
+
composerSurface,
|
|
82
|
+
composerRow,
|
|
83
|
+
composerIconButton,
|
|
84
|
+
visuallyHidden,
|
|
85
|
+
attachmentThumbnail,
|
|
86
|
+
attachmentFilename
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
exports.approvalActions = approvalActions;
|
|
90
|
+
exports.assistantMessage = assistantMessage;
|
|
91
|
+
exports.attachmentError = attachmentError;
|
|
92
|
+
exports.attachmentFilename = attachmentFilename;
|
|
93
|
+
exports.attachmentList = attachmentList;
|
|
94
|
+
exports.attachmentThumbnail = attachmentThumbnail;
|
|
95
|
+
exports.chatToolbar = chatToolbar;
|
|
96
|
+
exports.closeBtn = closeBtn;
|
|
97
|
+
exports.composerActions = composerActions;
|
|
98
|
+
exports.composerExtras = composerExtras;
|
|
99
|
+
exports.composerForm = composerForm;
|
|
100
|
+
exports.composerIconButton = composerIconButton;
|
|
101
|
+
exports.composerRow = composerRow;
|
|
102
|
+
exports.composerSurface = composerSurface;
|
|
103
|
+
exports.container = container;
|
|
104
|
+
exports.data = data;
|
|
105
|
+
exports.default = ai_chat_module_default;
|
|
106
|
+
exports.emptyState = emptyState;
|
|
107
|
+
exports.error = error;
|
|
108
|
+
exports.errorActions = errorActions;
|
|
109
|
+
exports.footer = footer;
|
|
110
|
+
exports.historyLimit = historyLimit;
|
|
111
|
+
exports.input = input;
|
|
112
|
+
exports.messageBubble = messageBubble;
|
|
113
|
+
exports.messageLabel = messageLabel;
|
|
114
|
+
exports.messageList = messageList;
|
|
115
|
+
exports.reasoning = reasoning;
|
|
116
|
+
exports.reasoningSummary = reasoningSummary;
|
|
117
|
+
exports.reasoningText = reasoningText;
|
|
118
|
+
exports.scope = scope;
|
|
119
|
+
exports.scopeHelp = scopeHelp;
|
|
120
|
+
exports.scopeLabel = scopeLabel;
|
|
121
|
+
exports.sendButton = sendButton;
|
|
122
|
+
exports.sources = sources;
|
|
123
|
+
exports.sourcesLabel = sourcesLabel;
|
|
124
|
+
exports.status = status;
|
|
125
|
+
exports.structuredData = structuredData;
|
|
126
|
+
exports.textPart = textPart;
|
|
127
|
+
exports.thread = thread;
|
|
128
|
+
exports.toolPart = toolPart;
|
|
129
|
+
exports.userMessage = userMessage;
|
|
130
|
+
exports.viewport = viewport;
|
|
131
|
+
exports.visuallyHidden = visuallyHidden;
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=index76.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index76.cjs","names":[],"sources":["../src/components/ai-chat/ai-chat.module.css"],"sourcesContent":[".container {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n max-height: none;\n overflow: hidden;\n position: relative;\n}\n\n.scope {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n padding: 0.75rem 3rem 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border-bottom: 1px solid var(--border);\n}\n\n.scopeLabel {\n font-size: 0.6875rem;\n font-weight: 650;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n color: var(--muted-foreground);\n}\n\n.scope strong {\n font-size: 0.875rem;\n}\n\n.scopeHelp {\n margin: 0;\n font-size: 0.75rem;\n color: var(--muted-foreground);\n line-height: 1.5;\n}\n\n.closeBtn {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n z-index: 1;\n display: grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n border: 0;\n border-radius: 50%;\n background: transparent;\n color: var(--muted-foreground);\n cursor: pointer;\n font-size: 0.875rem;\n}\n\n.closeBtn:hover {\n background: var(--uzi-surface-2, var(--muted));\n color: var(--foreground);\n}\n\n.closeBtn:focus-visible,\n.sendButton:focus-visible,\n.errorActions button:focus-visible,\n.historyLimit button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.thread {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n overflow: hidden;\n}\n\n.viewport {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-height: 0;\n overflow-y: auto;\n overflow-x: hidden;\n gap: 0.75rem;\n}\n\n.chatToolbar {\n position: sticky;\n top: 0;\n z-index: 1;\n display: flex;\n justify-content: flex-end;\n padding: 0.5rem 1rem;\n background: var(--uzi-surface-1, var(--background));\n border-bottom: 1px solid var(--border);\n}\n\n.chatToolbar button {\n border: 0;\n border-radius: 0.375rem;\n padding: 0.35rem 0.5rem;\n background: transparent;\n color: var(--muted-foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.chatToolbar button:hover {\n color: var(--foreground);\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.chatToolbar button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.messageList {\n display: flex;\n flex: 1 0 auto;\n flex-direction: column;\n gap: 0.75rem;\n padding: 1rem;\n}\n\n.userMessage,\n.assistantMessage {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border-radius: 0.75rem;\n color: var(--foreground);\n overflow-wrap: anywhere;\n}\n\n.userMessage {\n background: color-mix(in srgb, var(--primary) 10%, transparent);\n border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);\n}\n\n.assistantMessage {\n background: var(--muted);\n border: 1px solid var(--border);\n}\n\n.textPart {\n white-space: pre-wrap;\n line-height: 1.6;\n}\n\n.reasoning,\n.toolPart {\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n padding: 0.5rem 0.75rem;\n background: var(--uzi-surface-1, transparent);\n}\n\n.reasoningSummary,\n.toolPart summary {\n cursor: pointer;\n font-size: 0.75rem;\n font-weight: 600;\n color: var(--muted-foreground);\n}\n\n.reasoningText {\n margin: 0.5rem 0 0;\n font-size: 0.8125rem;\n line-height: 1.6;\n color: var(--muted-foreground);\n white-space: pre-wrap;\n}\n\n.sources {\n padding-top: 0.5rem;\n border-top: 1px solid var(--border);\n}\n\n.sourcesLabel {\n display: block;\n font-size: 0.6875rem;\n font-weight: 650;\n color: var(--muted-foreground);\n margin-bottom: 0.25rem;\n}\n\n.sources ul {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin: 0;\n padding-left: 1.25rem;\n}\n\n.sources li {\n font-size: 0.75rem;\n overflow-wrap: anywhere;\n}\n\n.data {\n padding: 0.5rem;\n background: var(--uzi-surface-2, var(--muted));\n border-radius: 0.5rem;\n overflow-x: auto;\n}\n\n.structuredData {\n margin: 0;\n padding: 0.5rem 0;\n max-width: 100%;\n overflow-x: auto;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n font-size: 0.75rem;\n line-height: 1.5;\n}\n\n.footer {\n position: sticky;\n bottom: 0;\n z-index: 1;\n flex-shrink: 0;\n background: var(--background);\n border-top: 1px solid var(--border);\n}\n\n.composerForm {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: end;\n gap: 0.75rem;\n padding: 0.75rem 1rem;\n}\n\n.input {\n width: 100%;\n min-height: 2.5rem;\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--background);\n color: var(--foreground);\n font: inherit;\n font-size: 0.875rem;\n line-height: 1.5;\n resize: vertical;\n}\n\n.input:focus {\n outline: none;\n border-color: var(--primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);\n}\n\n.input::placeholder {\n color: var(--muted-foreground);\n}\n\n.input:disabled,\n.sendButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.sendButton {\n min-height: 2.5rem;\n padding: 0.5rem 0.875rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--primary);\n color: var(--primary-foreground);\n font: inherit;\n font-size: 0.875rem;\n font-weight: 600;\n cursor: pointer;\n}\n\n.sendButton:not(:disabled):hover {\n filter: brightness(0.95);\n}\n\n.status {\n margin: 0;\n padding: 0.5rem 1rem;\n text-align: center;\n font-size: 0.8125rem;\n color: var(--muted-foreground);\n font-style: italic;\n}\n\n.error {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border: 1px solid var(--destructive);\n border-radius: 0.5rem;\n margin: 0.75rem 1rem;\n background: color-mix(in srgb, var(--destructive) 10%, transparent);\n}\n\n.error p {\n margin: 0;\n color: var(--destructive);\n font-size: 0.8125rem;\n}\n\n.errorActions {\n display: flex;\n gap: 0.5rem;\n}\n\n.errorActions button,\n.historyLimit button {\n padding: 0.375rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.375rem;\n background: transparent;\n color: var(--foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.errorActions button:hover,\n.historyLimit button:hover {\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.historyLimit {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n align-items: center;\n padding: 0.75rem 1rem;\n margin: 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n}\n\n.historyLimit span {\n font-size: 0.75rem;\n color: var(--muted-foreground);\n}\n\n.emptyState {\n display: grid;\n place-items: center;\n flex: 1;\n min-height: 12rem;\n color: var(--muted-foreground);\n text-align: center;\n}\n\n.emptyState p {\n margin: 0;\n font-size: 0.875rem;\n}\n\n@media (max-width: 640px) {\n .composerForm {\n grid-template-columns: minmax(0, 1fr) auto;\n }\n\n .errorActions {\n flex-wrap: wrap;\n }\n}\n\n/* Optional integration controls use the same Uzi surface and layout tokens. */\n.composerExtras {\n grid-column: 1 / -1;\n min-width: 0;\n}\n\n.composerActions {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.approvalActions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.5rem; }\n.approvalActions button, .attachmentList button {\n background: var(--background); color: var(--foreground); border: 1px solid var(--border);\n border-radius: 0.375rem; padding: 0.3rem 0.55rem; cursor: pointer;\n}\n.approvalActions button:disabled { opacity: 0.5; cursor: not-allowed; }\n.attachmentError { color: var(--destructive); padding: 0.5rem 1rem; margin: 0; }\n.attachmentList { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.4rem 0; margin: 0; list-style: none; }\n.attachmentList li { display: inline-flex; gap: 0.5rem; align-items: center; font-size: 0.75rem; }\n\n/* Role-aware message layout shared by the default renderer and consumer apps. */\n.messageBubble { width: fit-content; min-width: 0; max-width: 100%; }\n.messageBubble.userMessage { align-self: flex-end; max-width: min(90%, 42rem); }\n.messageBubble.assistantMessage { align-self: flex-start; max-width: 100%; }\n.messageLabel { font-size: 0.6875rem; font-weight: 650; color: var(--muted-foreground); }\n\n/* Shared compact composer: same visual grammar as Betty, without app-owned behavior. */\n.composerSurface {\n grid-column: 1 / -1;\n min-width: 0;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--background);\n}\n.composerSurface:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }\n.composerRow { display: flex; align-items: end; min-width: 0; gap: 0.375rem; padding: 0.375rem; }\n.composerRow .input {\n display: block; flex: 1; width: 0; min-width: 0; min-height: 2.75rem;\n max-height: 11rem; padding: 0.625rem 0.25rem; border: 0;\n background: transparent; resize: none; font-size: 1rem;\n}\n.composerRow .input:focus { outline: none; box-shadow: none; }\n.composerIconButton, .composerRow .sendButton {\n display: grid; place-items: center; flex-shrink: 0;\n width: 2.75rem; height: 2.75rem; min-height: 2.75rem;\n padding: 0; border-radius: 0.625rem; cursor: pointer;\n}\n.composerIconButton {\n color: var(--foreground); border: 0; background: transparent;\n}\n.composerIconButton:hover:not(:disabled) { background: var(--muted); }\n.composerRow .sendButton { border: 0; background: var(--primary); color: var(--primary-foreground); }\n.composerIconButton:focus-visible, .composerRow .sendButton:focus-visible {\n outline: 2px solid var(--ring); outline-offset: 2px;\n}\n.composerIconButton:disabled { opacity: 0.5; cursor: not-allowed; }\n.visuallyHidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }\n\n/* Thumbnail treatment matches the Betty attachment shelf. */\n.attachmentList {\n gap: 0.5rem;\n padding: 0;\n align-items: center;\n}\n.attachmentList li {\n max-width: 100%;\n position: relative;\n min-height: 3rem;\n border-radius: 0.625rem;\n border: 1px solid var(--border);\n background: var(--uzi-surface-1, var(--muted));\n padding: 0.125rem;\n}\n.attachmentThumbnail {\n width: 3rem;\n height: 3rem;\n border-radius: 0.5rem;\n object-fit: cover;\n}\n.attachmentFilename {\n max-width: 11rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0.5rem;\n}\n.attachmentList li button {\n flex-shrink: 0;\n border: 0;\n background: transparent;\n color: var(--muted-foreground);\n border-radius: 0.4rem;\n}\n.attachmentList li button:hover { color: var(--foreground); background: var(--muted); }\n"],"mappings":""}
|