@bothub-chat/ui 2.32.4 → 2.32.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import"react";import"unified";import"remark-parse";import"remark-gfm";import"mdast-util-to-markdown";import{hasSubstring as
|
|
1
|
+
import"react";import"unified";import"remark-parse";import"remark-gfm";import"mdast-util-to-markdown";import{hasSubstring as t}from"../../utils/hasSubstring/index.js";const l=(l,r)=>l.map((l=>{if("string"==typeof l)return t(l,r)?l:null;if("collapse"===l.type&&l.data){const e=l.data.map((l=>"string"==typeof l?t(l,r)?l:null:l.label?t(l.label,r)?l:null:l)).filter((t=>null!==t));return e.length>0?Object.assign(Object.assign({},l),{data:e}):null}return l.label?t(l.label,r)?l:null:l})).filter((t=>null!==t));export{l as filterData};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SelectFieldDataItem, SelectFieldSize } from '@/ui/components/select-field';
|
|
3
3
|
import { SelectFieldOptionClickEventHandler } from '../list';
|
|
4
|
-
export interface SelectFieldCollapseOptionProps extends React.PropsWithChildren, Pick<React.ComponentProps<'div'>, 'onMouseEnter' | 'onMouseLeave' | 'onPointerDown' | 'onPointerUp'> {
|
|
4
|
+
export interface SelectFieldCollapseOptionProps extends React.PropsWithChildren, Pick<React.ComponentProps<'div'>, 'onMouseEnter' | 'onMouseLeave' | 'onPointerDown' | 'onPointerUp' | 'onPointerLeave'> {
|
|
5
5
|
size: SelectFieldSize;
|
|
6
6
|
item: SelectFieldDataItem;
|
|
7
7
|
onClick?: SelectFieldOptionClickEventHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"tslib";import{jsx as l,jsxs as o,Fragment as i}from"react/jsx-runtime";import{useCallback as t}from"react";import{SelectFieldOptionsStyled as n,SelectFieldOption as r,SelectFieldOptionSide as d,SelectFieldOptionText as a,SelectFieldDivider as c,SelectFieldOptionLabel as s,SelectFieldEmpty as p,SelectFieldEmptyText as b,SelectFieldRadio as u,SelectFieldRadioTitleAndRadio as
|
|
1
|
+
import{__rest as e}from"tslib";import{jsx as l,jsxs as o,Fragment as i}from"react/jsx-runtime";import{useCallback as t}from"react";import{SelectFieldOptionsStyled as n,SelectFieldOption as r,SelectFieldOptionSide as d,SelectFieldOptionText as a,SelectFieldDivider as c,SelectFieldOptionLabel as s,SelectFieldEmpty as p,SelectFieldEmptyText as b,SelectFieldRadio as u,SelectFieldRadioTitleAndRadio as v,SelectFieldRadioLabel as h,SelectFieldRadioDescription as m,SelectFieldOptionColor as f,SelectFieldColorOptionText as y}from"./styled.js";import{Tooltip as $}from"../../../tooltip/index.js";import{IconProvider as j}from"../../../icon/context.js";import"../../../icon/styled.js";import"../../../../theme/index.js";import{SelectFieldCollapseOption as g}from"../collapse/index.js";import{SearchDataIcon as z}from"../../../../icons/search-data/index.js";import{Radio as k}from"../../../radio/index.js";import{useTheme as M}from"../../../../theme/hook.js";import{TooltipConsumer as C}from"../../../tooltip/context.js";const L=x=>{var{value:O,data:E,size:P,disableSelect:T=!1,onOptionClick:w}=x,A=e(x,["value","data","size","disableSelect","onOptionClick"]);const D=M(),S=t((e=>{null==w||w(e)}),[w]);return l(n,Object.assign({$size:P},A,{children:E.map(((e,t)=>{var n,M,x,E,A,H,N,q,B,F,G,I,J;if("string"==typeof e){let o;return o=!(!O||Array.isArray(O))&&("string"==typeof O?e===O:e===O.value),l(r,{$selected:o,$disabled:!1,$size:P,onClick:S.bind(null,e),children:l(d,{children:l(a,{$selected:o,$size:P,children:e})})},t)}if("divider"===e.type)return l(c,{},null!==(M=null!==(n=e.id)&&void 0!==n?n:e.value)&&void 0!==M?M:`divider-${t}`);if("label"===e.type)return l(s,{children:e.label},null!==(E=null!==(x=e.id)&&void 0!==x?x:e.value)&&void 0!==E?E:`label-${t}`);if("empty"===e.type&&e.label)return o(p,{$size:P,children:[l(j,{size:34,fill:D.colors.grayScale.gray1,children:null!==(A=e.icon)&&void 0!==A?A:l(z,{})}),l(b,{children:e.label})]},null!==(N=null!==(H=e.id)&&void 0!==H?H:e.value)&&void 0!==N?N:`empty-${t}`);if("radio"===e.type){const i=l=>{l.preventDefault(),S(e)};return l($,Object.assign({},"object"==typeof e.tooltip&&e.tooltip,"object"!=typeof e.tooltip&&{disabled:!0},e.label&&e.label.length>64&&{placement:"top-left",label:e.label,disabled:!1},{children:l(C,{children:({handleTooltipMouseEnter:t,handleTooltipMouseLeave:n})=>o(u,{$selected:e.selected,$disabled:e.disabled,onPointerDown:t,onPointerLeave:n,onMouseEnter:t,onMouseLeave:n,onClick:i,children:[o(v,{children:[e.label&&l(h,{children:e.label}),l(k,{type:"radio",checked:e.selected,name:e.radioName,disabled:e.disabled,icon:e.disabled?e.end:void 0})]}),e.description&&l(m,{children:e.description})]})})}),null!==(B=null!==(q=e.id)&&void 0!==q?q:e.value)&&void 0!==B?B:`radio-${t}`)}if("collapse"===e.type&&e.data)return l($,Object.assign({},"object"==typeof e.tooltip&&e.tooltip,"object"!=typeof e.tooltip&&{disabled:!0},e.label&&e.label.length>64&&{placement:"top-left",label:e.label,disabled:!1},{children:l(C,{children:({handleTooltipMouseEnter:o,handleTooltipMouseLeave:i})=>{var t;return l(g,{size:P,item:e,onPointerDown:o,onPointerLeave:i,onMouseEnter:o,onMouseLeave:i,onClick:e.onClick,icon:e.disabled?e.end:void 0,children:l(L,{value:O,data:null!==(t=e.data)&&void 0!==t?t:[],size:P,disableSelect:T,onOptionClick:w})})}})}),null!==(G=null!==(F=e.id)&&void 0!==F?F:e.value)&&void 0!==G?G:`collapse-${t}`);const K=!!e.disabled;let Q;return Q=!(!O||Array.isArray(O))&&(("string"==typeof O?e.value===O:e.value===O.value)&&!T),l($,Object.assign({},"object"==typeof e.tooltip&&e.tooltip,"object"!=typeof e.tooltip&&{disabled:!0},e.label&&e.label.length>64&&{placement:"top-left",label:e.label,disabled:!1},{children:l(C,{children:({handleTooltipMouseEnter:t,handleTooltipMouseLeave:n})=>o(r,{$selected:Q,$disabled:K,$size:P,$backgroundHoverColor:e.backgroundHoverColor,onPointerDown:t,onPointerLeave:n,onMouseEnter:t,onMouseLeave:n,onClick:S.bind(null,e),children:[o(d,{children:[e.icon&&l(j,{fill:D.colors.base.white,size:"large"===P?24:18,children:e.icon}),!e.color&&o(a,{$selected:Q,$size:P,$bold:e.bold,children:[e.label&&o(i,{children:[e.label.slice(0,64),e.label.length>64&&"..."]}),!e.label&&e.value]}),e.color&&l(f,{$color:e.color===D.colors.accent.primary&&Q?D.colors.accent.primaryLight:e.color}),e.color&&o(y,{$selected:Q,children:[e.label&&o(i,{children:[e.label.slice(0,64),e.label.length>64&&"..."]}),!e.label&&e.value]})]}),e.end&&l(d,{children:l(j,{size:16,children:e.end})})]})})}),null!==(J=null!==(I=e.id)&&void 0!==I?I:e.value)&&void 0!==J?J:t)}))}))};export{L as SelectFieldOptions};
|