@bioturing/components 0.28.1 → 0.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/breadcrumb/style.css +1 -1
- package/dist/components/checkbox/style.css +1 -1
- package/dist/components/choice-list/component.js +137 -50
- package/dist/components/choice-list/component.js.map +1 -1
- package/dist/components/choice-list/style.css +1 -1
- package/dist/components/code-block/component.js +8 -8
- package/dist/components/color-select/style.css +1 -1
- package/dist/components/combobox/component.js +171 -141
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/combobox/style.css +1 -1
- package/dist/components/drag-drop/style.css +1 -1
- package/dist/components/dropdown-menu/component.js +110 -100
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/item.css +1 -1
- package/dist/components/dropdown-menu/item.js +52 -49
- package/dist/components/dropdown-menu/item.js.map +1 -1
- package/dist/components/dropdown-menu/style.css +1 -1
- package/dist/components/ds-root/component.js +22 -17
- package/dist/components/ds-root/component.js.map +1 -1
- package/dist/components/ds-root/style.css +1 -1
- package/dist/components/form/style.css +1 -1
- package/dist/components/modal/style.css +1 -1
- package/dist/components/nav/style.css +1 -1
- package/dist/components/resizable/component.js +27 -26
- package/dist/components/resizable/component.js.map +1 -1
- package/dist/components/scroll-area/component.js +70 -24
- package/dist/components/scroll-area/component.js.map +1 -1
- package/dist/components/scroll-area/style.css +1 -1
- package/dist/components/select-trigger/component.js +150 -0
- package/dist/components/select-trigger/component.js.map +1 -0
- package/dist/components/select-trigger/style.css +1 -0
- package/dist/components/switch/style.css +1 -1
- package/dist/components/table/style.css +1 -1
- package/dist/components/theme-provider/component.js.map +1 -1
- package/dist/components/theme-provider/style.css +1 -1
- package/dist/components/toast/component.js +13 -13
- package/dist/components/toast/component.js.map +1 -1
- package/dist/components/tour/style.css +1 -1
- package/dist/components/utils/WithRenderProp.js.map +1 -1
- package/dist/index.d.ts +101 -42
- package/dist/index.js +125 -125
- package/dist/tokens/and-theme/tokens.js +12 -12
- package/dist/tokens/and-theme/tokens.js.map +1 -1
- package/package.json +6 -6
- package/dist/components/combobox/trigger.js +0 -89
- package/dist/components/combobox/trigger.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.js","sources":["../../../src/components/combobox/trigger.tsx"],"sourcesContent":["\"use client\";\nimport React, { forwardRef } from \"react\";\nimport { CaretDownIcon, XCircleIcon, XIcon } from \"@bioturing/assets\";\nimport { clsx, useCls } from \"../utils\";\nimport type { ComboboxOption } from \"./component\";\n\nexport interface ComboboxTriggerProps\n extends React.ComponentPropsWithoutRef<\"button\"> {\n /** Selected options */\n selectedOptions: ComboboxOption[];\n /** Placeholder text */\n placeholder?: string;\n /** Whether multiple selection is enabled */\n multiple?: boolean;\n /** Whether the component is disabled */\n disabled?: boolean;\n /** Whether the dropdown is open */\n open?: boolean;\n /** Size variant */\n size?: \"small\" | \"middle\" | \"large\";\n /** Whether to show clear button */\n allowClear?: boolean;\n /** Custom suffix icon */\n suffixIcon?: React.ReactNode;\n /** Custom clear icon */\n clearIcon?: React.ReactNode;\n /** Custom class names */\n classNames?: {\n trigger?: string;\n };\n /** Clear handler */\n onClear?: () => void;\n /** Show selection summary instead of individual tags when multiple */\n showSelectionSummary?: boolean;\n /** Render function for the selection summary in multiple case */\n selectionSummaryRender?: (selectedValues: Array<string | number>) => React.ReactNode;\n}\n\nexport const ComboboxTrigger = forwardRef<\n HTMLButtonElement,\n ComboboxTriggerProps\n>(\n (\n {\n selectedOptions,\n placeholder = \"Select...\",\n multiple = false,\n disabled = false,\n open = false,\n size = \"middle\",\n allowClear = false,\n suffixIcon,\n clearIcon,\n classNames,\n className,\n onClear,\n showSelectionSummary = false,\n selectionSummaryRender,\n ...rest\n },\n ref\n ) => {\n const cls = useCls();\n\n const renderTriggerContent = () => {\n if (selectedOptions.length === 0) {\n return (\n <span className={cls(\"combobox-selection-placeholder\")}>\n {placeholder}\n </span>\n );\n }\n\n if (multiple) {\n // Show selection summary if enabled\n if (showSelectionSummary) {\n const selectedValues = selectedOptions.map(opt => opt.value);\n return (\n <span className={cls(\"combobox-selection-summary\")}>\n {selectionSummaryRender\n ? selectionSummaryRender(selectedValues)\n : `${selectedOptions.length} items selected`}\n </span>\n );\n }\n \n // Default: Simple text display for multiple selections - no tags\n return (\n <span className={cls(\"combobox-selection-text\")}>\n {selectedOptions.length === 1\n ? selectedOptions[0].label\n : `${selectedOptions.length} items selected`}\n </span>\n );\n } else {\n return (\n <span className={cls(\"combobox-selection-text\")}>\n {selectedOptions[0].label}\n </span>\n );\n }\n };\n\n const handleClearClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n onClear?.();\n };\n\n return (\n <button\n ref={ref}\n className={clsx(\n cls(\"combobox\"),\n cls(`combobox-${size}`),\n multiple && cls(\"combobox-multiple\"),\n disabled && cls(\"combobox-disabled\"),\n open && cls(\"combobox-open\"),\n cls(\"combobox-trigger\"),\n classNames?.trigger,\n className\n )}\n disabled={disabled}\n role=\"combobox\"\n aria-expanded={open}\n {...rest}\n >\n <span className={cls(\"combobox-selector\")}>\n <span className={cls(\"combobox-selection-wrap\")}>\n {renderTriggerContent()}\n </span>\n <span className={cls(\"combobox-selection-suffix\")}>\n {allowClear && selectedOptions.length > 0 && (\n <span\n className={cls(\"combobox-clear\")}\n unselectable=\"on\"\n aria-hidden=\"true\"\n onClick={handleClearClick}\n >\n {clearIcon || (\n <span className={cls(\"combobox-clear-icon\")}>\n <XCircleIcon weight=\"fill\" />\n </span>\n )}\n </span>\n )}\n {(!allowClear || selectedOptions.length === 0) && (\n <span\n className={cls(\"combobox-arrow\")}\n unselectable=\"on\"\n aria-hidden=\"true\"\n >\n {suffixIcon || (\n <span className={cls(\"combobox-arrow-icon\")}>\n <CaretDownIcon weight=\"bold\" />\n </span>\n )}\n </span>\n )}\n </span>\n </span>\n </button>\n );\n }\n);\n\nComboboxTrigger.displayName = \"ComboboxTrigger\";\n"],"names":["ComboboxTrigger","forwardRef","selectedOptions","placeholder","multiple","disabled","open","size","allowClear","suffixIcon","clearIcon","classNames","className","onClear","showSelectionSummary","selectionSummaryRender","rest","ref","cls","useCls","renderTriggerContent","selectedValues","opt","jsx","handleClearClick","e","clsx","jsxs","XCircleIcon","CaretDownIcon"],"mappings":";;;;;;AAsCO,MAAMA,IAAkBC;AAAA,EAI7B,CACE;AAAA,IACE,iBAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,UAAAC,IAAW;AAAA,IACX,UAAAC,IAAW;AAAA,IACX,MAAAC,IAAO;AAAA,IACP,MAAAC,IAAO;AAAA,IACP,YAAAC,IAAa;AAAA,IACb,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,sBAAAC,IAAuB;AAAA,IACvB,wBAAAC;AAAA,IACA,GAAGC;AAAA,KAELC,MACG;AACH,UAAMC,IAAMC,EAAO,GAEbC,IAAuB,MAAM;AAC7B,UAAAlB,EAAgB,WAAW;AAC7B,iCACG,QAAK,EAAA,WAAWgB,EAAI,gCAAgC,GAClD,UACHf,GAAA;AAIJ,UAAIC,GAAU;AAEZ,YAAIU,GAAsB;AACxB,gBAAMO,IAAiBnB,EAAgB,IAAI,CAAAoB,MAAOA,EAAI,KAAK;AAC3D,iBACG,gBAAAC,EAAA,QAAA,EAAK,WAAWL,EAAI,4BAA4B,GAC9C,UACGH,IAAAA,EAAuBM,CAAc,IACrC,GAAGnB,EAAgB,MAAM,mBAC/B;AAAA,QAAA;AAKJ,iCACG,QAAK,EAAA,WAAWgB,EAAI,yBAAyB,GAC3C,UAAgBhB,EAAA,WAAW,IACxBA,EAAgB,CAAC,EAAE,QACnB,GAAGA,EAAgB,MAAM,mBAC/B;AAAA,MAAA;AAIA,eAAA,gBAAAqB,EAAC,UAAK,WAAWL,EAAI,yBAAyB,GAC3C,UAAAhB,EAAgB,CAAC,EAAE,MACtB,CAAA;AAAA,IAGN,GAEMsB,IAAmB,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