@tedi-design-system/react 18.0.0-rc.23 → 18.0.0-rc.25
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/_virtual/index.cjs10.js +1 -1
- package/_virtual/index.cjs11.js +1 -1
- package/_virtual/index.cjs12.js +1 -1
- package/_virtual/index.cjs13.js +1 -1
- package/_virtual/index.cjs5.js +1 -1
- package/_virtual/index.cjs6.js +1 -1
- package/_virtual/index.cjs7.js +1 -1
- package/_virtual/index.cjs8.js +1 -1
- package/_virtual/index.cjs9.js +1 -1
- package/_virtual/index.es10.js +1 -1
- package/_virtual/index.es11.js +1 -1
- package/_virtual/index.es12.js +1 -1
- package/_virtual/index.es13.js +4 -2
- package/_virtual/index.es14.js +2 -2
- package/_virtual/index.es5.js +2 -4
- package/_virtual/index.es6.js +1 -1
- package/_virtual/index.es7.js +1 -1
- package/_virtual/index.es8.js +1 -1
- package/_virtual/index.es9.js +1 -1
- package/bundle-stats.html +1 -1
- package/external/@mui/system/colorManipulator.cjs.js +1 -1
- package/external/@mui/system/colorManipulator.es.js +2 -2
- package/external/@mui/system/createStyled.cjs.js +1 -1
- package/external/@mui/system/createStyled.es.js +6 -6
- package/external/@mui/system/useThemeWithoutDefault.cjs.js +1 -1
- package/external/@mui/system/useThemeWithoutDefault.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/external/react-is/index.cjs.js +1 -1
- package/external/react-is/index.es.js +1 -1
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/form/select/components/select-multi-value.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-multi-value.d.ts +3 -1
- package/src/tedi/components/form/select/components/select-multi-value.es.js +41 -29
- package/src/tedi/components/form/select/select.cjs.js +1 -1
- package/src/tedi/components/form/select/select.d.ts +9 -0
- package/src/tedi/components/form/select/select.es.js +89 -88
- package/src/tedi/components/form/select/select.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/select/select.module.scss.es.js +1 -0
- package/src/tedi/components/misc/ellipsis/ellipsis.cjs.js +1 -1
- package/src/tedi/components/misc/ellipsis/ellipsis.d.ts +11 -1
- package/src/tedi/components/misc/ellipsis/ellipsis.es.js +28 -21
- package/src/tedi/components/misc/ellipsis/ellipsis.module.scss.cjs.js +1 -1
- package/src/tedi/components/misc/ellipsis/ellipsis.module.scss.es.js +6 -3
- package/src/tedi/components/tags/tag/tag.cjs.js +1 -1
- package/src/tedi/components/tags/tag/tag.d.ts +10 -0
- package/src/tedi/components/tags/tag/tag.es.js +24 -21
- package/src/tedi/components/tags/tag/tag.module.scss.cjs.js +1 -1
- package/src/tedi/components/tags/tag/tag.module.scss.es.js +1 -0
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),g=require("../../../../../../external/classnames/index.cjs.js"),x=require("../../../tags/tag/tag.cjs.js"),S=require("../select.module.scss.cjs.js"),c=require("./select-bulk-helpers.cjs.js"),M=require("./select-tags-context.cjs.js"),d=t=>l=>{if(l.type==="click"&&t.onClick){t.onClick(l);return}if(l.type==="keydown"){const n=l;(n.key==="Enter"||n.key===" ")&&t.onClick&&(n.preventDefault(),n.stopPropagation(),t.onClick(n))}},q=({isTagRemovable:t,tagsEllipsis:l=!1,children:n,removeProps:y,...o})=>{const{isSingleRow:C,visibleCount:a}=M.useSelectTagsContext();if(o.data.value===c.SELECT_ALL_VALUE||c.isGroupSentinel(o.data))return null;const s=o.selectProps.value??[],i=Array.isArray(s)?s.findIndex(e=>e.value===o.data.value):-1,f=C&&a!==null&&i!==-1&&i>=a,u=d(y),k=e=>{e.stopPropagation(),u(e)},p=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),u(e))};return f?null:r.jsx("div",{onMouseDown:e=>e.stopPropagation(),"data-tedi-tag-index":i,className:g.default({[S.default["tedi-select__multi-value--ellipsis"]]:l!==!1}),children:r.jsx(x.Tag,{color:"primary",ellipsis:l,onClose:t?k:void 0,closeButtonProps:t?{tabIndex:0,onMouseDown:e=>e.stopPropagation(),onKeyDown:p}:void 0,children:n})})};exports.SelectMultiValue=q;exports.createMultiValueCloseHandler=d;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { MultiValueProps } from 'react-select';
|
|
2
|
+
import { TagEllipsis } from '../../../tags/tag/tag';
|
|
2
3
|
import { ISelectOption } from '../select';
|
|
3
4
|
type MultiValueType = MultiValueProps<ISelectOption> & {
|
|
4
5
|
isTagRemovable?: boolean;
|
|
6
|
+
tagsEllipsis?: TagEllipsis;
|
|
5
7
|
};
|
|
6
8
|
type RemoveProps = MultiValueProps<ISelectOption>['removeProps'];
|
|
7
9
|
/**
|
|
@@ -14,5 +16,5 @@ type RemoveProps = MultiValueProps<ISelectOption>['removeProps'];
|
|
|
14
16
|
* keyboard branch only fires when the handler is reused outside Tag.
|
|
15
17
|
*/
|
|
16
18
|
export declare const createMultiValueCloseHandler: (removeProps: RemoveProps) => React.MouseEventHandler<HTMLButtonElement> & React.KeyboardEventHandler<HTMLButtonElement>;
|
|
17
|
-
export declare const SelectMultiValue: ({ isTagRemovable, children, removeProps, ...props }: MultiValueType) => JSX.Element | null;
|
|
19
|
+
export declare const SelectMultiValue: ({ isTagRemovable, tagsEllipsis, children, removeProps, ...props }: MultiValueType) => JSX.Element | null;
|
|
18
20
|
export {};
|
|
@@ -1,45 +1,57 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
2
|
+
import C from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { Tag as k } from "../../../tags/tag/tag.es.js";
|
|
4
|
+
import m from "../select.module.scss.es.js";
|
|
5
|
+
import { SELECT_ALL_VALUE as g, isGroupSentinel as x } from "./select-bulk-helpers.es.js";
|
|
6
|
+
import { useSelectTagsContext as w } from "./select-tags-context.es.js";
|
|
7
|
+
const D = (t) => (e) => {
|
|
6
8
|
if (e.type === "click" && t.onClick) {
|
|
7
9
|
t.onClick(e);
|
|
8
10
|
return;
|
|
9
11
|
}
|
|
10
12
|
if (e.type === "keydown") {
|
|
11
|
-
const
|
|
12
|
-
(
|
|
13
|
+
const l = e;
|
|
14
|
+
(l.key === "Enter" || l.key === " ") && t.onClick && (l.preventDefault(), l.stopPropagation(), t.onClick(l));
|
|
13
15
|
}
|
|
14
|
-
},
|
|
16
|
+
}, P = ({
|
|
15
17
|
isTagRemovable: t,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
tagsEllipsis: e = !1,
|
|
19
|
+
children: l,
|
|
20
|
+
removeProps: u,
|
|
21
|
+
...n
|
|
19
22
|
}) => {
|
|
20
|
-
const { isSingleRow: d, visibleCount: a } =
|
|
21
|
-
if (
|
|
23
|
+
const { isSingleRow: d, visibleCount: a } = w();
|
|
24
|
+
if (n.data.value === g || x(n.data))
|
|
22
25
|
return null;
|
|
23
|
-
const
|
|
24
|
-
o.stopPropagation(),
|
|
25
|
-
},
|
|
26
|
-
(o.key === "Enter" || o.key === " ") && (o.preventDefault(), o.stopPropagation(),
|
|
26
|
+
const s = n.selectProps.value ?? [], i = Array.isArray(s) ? s.findIndex((o) => o.value === n.data.value) : -1, f = d && a !== null && i !== -1 && i >= a, r = D(u), p = (o) => {
|
|
27
|
+
o.stopPropagation(), r(o);
|
|
28
|
+
}, y = (o) => {
|
|
29
|
+
(o.key === "Enter" || o.key === " ") && (o.preventDefault(), o.stopPropagation(), r(o));
|
|
27
30
|
};
|
|
28
|
-
return
|
|
29
|
-
|
|
31
|
+
return f ? null : /* @__PURE__ */ c(
|
|
32
|
+
"div",
|
|
30
33
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
onMouseDown: (o) => o.stopPropagation(),
|
|
35
|
+
"data-tedi-tag-index": i,
|
|
36
|
+
className: C({ [m["tedi-select__multi-value--ellipsis"]]: e !== !1 }),
|
|
37
|
+
children: /* @__PURE__ */ c(
|
|
38
|
+
k,
|
|
39
|
+
{
|
|
40
|
+
color: "primary",
|
|
41
|
+
ellipsis: e,
|
|
42
|
+
onClose: t ? p : void 0,
|
|
43
|
+
closeButtonProps: t ? {
|
|
44
|
+
tabIndex: 0,
|
|
45
|
+
onMouseDown: (o) => o.stopPropagation(),
|
|
46
|
+
onKeyDown: y
|
|
47
|
+
} : void 0,
|
|
48
|
+
children: l
|
|
49
|
+
}
|
|
50
|
+
)
|
|
39
51
|
}
|
|
40
|
-
)
|
|
52
|
+
);
|
|
41
53
|
};
|
|
42
54
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
55
|
+
P as SelectMultiValue,
|
|
56
|
+
D as createMultiValueCloseHandler
|
|
45
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),W=require("../../../../../external/classnames/index.cjs.js"),a=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),W=require("../../../../../external/classnames/index.cjs.js"),a=require("react"),Xe=require("../../../../../external/react-select/dist/react-select.esm.cjs.js"),Je=require("../../../../../external/react-select/async/dist/react-select-async.esm.cjs.js"),Qe=require("../feedback-text/feedback-text.cjs.js"),Ye=require("../form-label/form-label.cjs.js"),_=require("../input-group/input-group.cjs.js"),Ze=require("../input-group/input-group.module.scss.cjs.js"),r=require("./components/select-bulk-helpers.cjs.js"),et=require("./components/select-clear-indicator.cjs.js"),tt=require("./components/select-control.cjs.js"),lt=require("./components/select-dropdown-indicator.cjs.js"),nt=require("./components/select-group.cjs.js"),st=require("./components/select-group-heading.cjs.js"),ot=require("./components/select-indicators-container.cjs.js"),at=require("./components/select-input.cjs.js"),rt=require("./components/select-loading-indicator.cjs.js"),it=require("./components/select-menu.cjs.js"),ut=require("./components/select-menu-list.cjs.js"),ct=require("./components/select-menu-portal.cjs.js"),dt=require("./components/select-multi-value.cjs.js"),pt=require("./components/select-multi-value-remove.cjs.js"),ft=require("./components/select-option.cjs.js"),gt=require("./components/select-single-value.cjs.js"),mt=require("./components/select-value-container.cjs.js"),f=require("./select.module.scss.cjs.js"),St=require("../../../providers/label-provider/use-labels.cjs.js"),X=a.forwardRef((E,J)=>{var z;const{options:c,defaultOptions:Q,id:w,name:Y,iconName:Z="arrow_drop_down",label:ee,required:k,value:x,defaultValue:R,tagsDirection:C="stack",onChange:O,onInputChange:te,inputValue:le,loadOptions:ne,isLoading:se,openMenuOnFocus:oe=!1,openMenuOnClick:ae=!0,tabSelectsValue:re=!1,disabled:T=!1,className:ie,hideLabel:ue=!1,helper:i,placeholder:ce,invalid:de,valid:pe,size:V,async:fe=!1,renderOption:ge,renderMessageListFooter:D,noOptionsMessage:me,loadingMessage:Se,multiple:v=!1,showSelectAll:G=!1,selectableGroups:P=!1,dropdownType:be="menu",renderValue:Le,closeMenuOnSelect:Me=!v,blurInputOnSelect:F=!1,autoFocus:ve=!1,isClearable:ye=!0,isClearIndicatorVisible:Ie=!1,isSearchable:N=!0,menuIsOpen:he,onMenuClose:Ae,onMenuOpen:Ce,onBlur:Oe,inputIsHidden:Ve,isTagRemovable:qe=!1,tagsEllipsis:_e=!1,backspaceRemovesValue:Ee=!1,optionGroupHeadingText:we={modifiers:"small",color:"tertiary"},cacheOptions:ke=!0,showRadioButtons:xe=!1,renderWithoutLabel:Re,tooltip:Te,classNames:j}=E,g=(z=_.useOptionalInputGroup)==null?void 0:z.call(_),De=a.useId(),Ge=g==null?void 0:g.hasExternalLabel,q=E.id??(g==null?void 0:g.inputId)??De,H=i?(i==null?void 0:i.id)??`${q}-helper`:void 0,I=a.useRef(null),{getLabel:h}=St.useLabels();a.useImperativeHandle(J,()=>I.current);const S=!!G&&v,[Pe,Fe]=a.useState(R??null),U=x!==void 0,m=U?x:Pe,d=a.useMemo(()=>Array.isArray(m)?m:m?[m]:[],[m]),A=a.useMemo(()=>({value:r.SELECT_ALL_VALUE,label:h("select.select-all")}),[h]),b=!!P&&!!v,{groupFlattenedOptions:B,groupSentinelMap:y}=a.useMemo(()=>{const t=new Map;if(!b||!c||c.length===0)return{groupFlattenedOptions:null,groupSentinelMap:t};if(!c.some(e=>e&&Array.isArray(e.options)))return{groupFlattenedOptions:null,groupSentinelMap:t};const n=[],u=new Map;for(const e of c)if(e&&Array.isArray(e.options)){const l=e,s=`${r.GROUP_OPTION_PREFIX}${l.label??""}`,p=l.options.filter(L=>!L.isDisabled);u.set(s,{enabled:p}),n.push({value:s,label:l.label??""});for(const L of l.options)n.push({...L,customData:{...L.customData??{},__tediInGroup:!0}})}else n.push(e);return{groupFlattenedOptions:n,groupSentinelMap:u}},[c,b]),Ne=a.useMemo(()=>{let t=B??c;return S&&t&&t.length>0&&(t=[A,...t]),t},[c,B,S,A]),je=a.useMemo(()=>{const t=[];if(b&&y.size>0)for(const[o,n]of y)n.enabled.length>0&&r.areAllSelected(d,n.enabled)&&t.push({value:o,label:""});if(S){const o=r.getEnabledOptions(c??[]);o.length>0&&r.areAllSelected(d,o)&&t.push(A)}return t.length===0?m:[...d,...t]},[m,d,c,b,y,S,A]),He=(t,o)=>{let n=t;const u=o.option;if(b&&u&&y.has(u.value)){const e=y.get(u.value).enabled;if(o.action==="select-option"){const l=[...d];for(const s of e)l.some(p=>p.value===s.value)||l.push(s);n=l}else o.action==="deselect-option"&&(n=d.filter(l=>!e.some(s=>s.value===l.value)))}else if(S){const e=r.getEnabledOptions(c??[]),l=(u==null?void 0:u.value)===r.SELECT_ALL_VALUE;l&&o.action==="select-option"?n=[...d.filter(p=>p.value!==r.SELECT_ALL_VALUE&&!e.some(L=>L.value===p.value)),...e]:l&&o.action==="deselect-option"&&(n=d.filter(s=>s.value!==r.SELECT_ALL_VALUE&&!e.some(p=>p.value===s.value)))}Array.isArray(n)&&(n=n.filter(e=>e.value!==r.SELECT_ALL_VALUE&&!r.isGroupSentinel(e))),U||Fe(n),O==null||O(n),!F&&I.current&&setTimeout(()=>{var e,l;return(l=(e=I.current)==null?void 0:e.inputRef)==null?void 0:l.focus()},0)},Ue=a.useCallback((t,o)=>t.data.value===r.SELECT_ALL_VALUE||r.isGroupSentinel(t.data)||!o?!0:String(t.label).toLowerCase().includes(o.toLowerCase()),[]),[K,$]=a.useState(!1),Be=t=>{(t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="Home"||t.key==="End"||t.key==="PageUp"||t.key==="PageDown"||t.key==="Tab")&&(K||$(!0))},Ke=a.useCallback(()=>{$(t=>t&&!1)},[]),$e=a.useCallback(t=>M.jsx(ut.SelectMenuList,{...t,renderMessageListFooter:D}),[D]),ze=()=>{const t={ClearIndicator:e=>et.SelectClearIndicator({isClearIndicatorVisible:Ie,...e}),DropdownIndicator:()=>lt.SelectDropDownIndicator({iconName:Z}),IndicatorSeparator:()=>null,MenuPortal:ct.SelectMenuPortal,Menu:it.SelectMenu,MenuList:$e,Option:e=>ft.SelectOption({renderOption:ge,multiple:v,showRadioButtons:xe,...e}),Control:tt.SelectControl,Input:at.SelectInput,MultiValue:e=>dt.SelectMultiValue({isTagRemovable:qe,tagsEllipsis:_e,...e}),MultiValueRemove:pt.SelectMultiValueRemove,SingleValue:gt.SelectSingleValue,Group:nt.SelectGroup,GroupHeading:e=>st.SelectGroupHeading({optionGroupHeadingText:we,...e}),IndicatorsContainer:ot.SelectIndicatorsContainer,ValueContainer:mt.SelectValueContainer,LoadingIndicator:rt.SelectLoadingIndicator},o=fe?Je.default:Xe.default,n=()=>h("select.no-options"),u=()=>h("select.loading");return M.jsx(o,{tagsDirection:C,showSelectAll:G,selectableGroups:P,dropdownType:be,renderValue:Le,keyboardMode:K,exitKeyboardMode:Ke,onKeyDown:Be,id:q,"aria-describedby":H,autoFocus:ve,ref:I,instanceId:w,className:"tedi-select__wrapper",name:Y,options:Ne,defaultOptions:Q,value:je,defaultValue:R,cacheOptions:ke,onChange:He,filterOption:S||b?Ue:void 0,onInputChange:te,onBlur:Oe,inputValue:le,inputId:`${w}-input`,loadOptions:ne,isLoading:se,noOptionsMessage:me||n,loadingMessage:Se||u,classNamePrefix:"select",components:t,isDisabled:T,isSearchable:N,menuIsOpen:he,openMenuOnFocus:oe,openMenuOnClick:ae,tabSelectsValue:re,onMenuClose:Ae,onMenuOpen:Ce,placeholder:ce||"",isClearable:ye,backspaceRemovesValue:Ee,menuShouldScrollIntoView:!0,isMulti:v,hideSelectedOptions:!1,closeMenuOnSelect:Me,blurInputOnSelect:F,menuPlacement:"auto",inputIsHidden:Ve,required:k,menuPortalTarget:document.body,menuPosition:"absolute",classNames:(()=>{const e={};if(j)for(const[l,s]of Object.entries(j))e[l]=typeof s=="string"?()=>s:s;if(g){const l=e.control;e.control=s=>W.default(l==null?void 0:l(s),Ze.default["tedi-input-group__input"])}return Object.keys(e).length>0?e:void 0})(),theme:e=>({...e,colors:{...e.colors,primary:"var(--tedi-blue-600)",danger:"var(--tedi-red-600)",dangerLight:"var(--tedi-red-200)"}}),styles:{input:e=>({...e,gridTemplateColumns:"0fr"})}})},We=W.default(f.default["tedi-select"],ie,{[f.default["tedi-select--invalid"]]:de||(i==null?void 0:i.type)==="error"},{[f.default["tedi-select--valid"]]:pe||(i==null?void 0:i.type)==="valid"},{[f.default[`tedi-select--${V}`]]:V},{[f.default[`tedi-select--tags-${C}`]]:C},{[f.default["tedi-select--searchable"]]:N},{[f.default["tedi-select--disabled"]]:T});return M.jsxs("div",{"data-name":"select",className:We,children:[M.jsxs("div",{className:f.default["tedi-select__inner"],children:[!Ge&&M.jsx(Ye.FormLabel,{id:`${q}-input`,label:ee,required:k,hideLabel:ue,size:V,renderWithoutLabel:Re,tooltip:Te}),ze()]}),i&&M.jsx(Qe.FeedbackText,{...i,id:H})]})});X.displayName="Select";exports.Select=X;
|
|
@@ -3,6 +3,7 @@ import { GroupBase, InputActionMeta, MenuListProps, OptionProps, OptionsOrGroups
|
|
|
3
3
|
import { FeedbackTextProps } from '../../../../tedi/components/form/feedback-text/feedback-text';
|
|
4
4
|
import { FormLabelProps } from '../../../../tedi/components/form/form-label/form-label';
|
|
5
5
|
import { TextProps } from '../../base/typography/text/text';
|
|
6
|
+
import { TagEllipsis } from '../../tags/tag/tag';
|
|
6
7
|
declare module '../../../../../node_modules/react-select/dist/declarations/src/Select' {
|
|
7
8
|
interface Props<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
|
|
8
9
|
inputIsHidden?: boolean;
|
|
@@ -143,6 +144,14 @@ export interface SelectProps extends Omit<FormLabelProps, 'id' | 'label'> {
|
|
|
143
144
|
* @default 'stack'
|
|
144
145
|
*/
|
|
145
146
|
tagsDirection?: 'stack' | 'row';
|
|
147
|
+
/**
|
|
148
|
+
* Truncate each selected tag's label when it is width-constrained, revealing
|
|
149
|
+
* the full text in a popover on hover/focus. `end` shows a trailing ellipsis
|
|
150
|
+
* (`Long label…`); `start` a leading one (`…label`). `false` never truncates —
|
|
151
|
+
* long labels wrap. Forwarded to each tag's `ellipsis` prop.
|
|
152
|
+
* @default false
|
|
153
|
+
*/
|
|
154
|
+
tagsEllipsis?: TagEllipsis;
|
|
146
155
|
/**
|
|
147
156
|
* Layout for the dropdown menu.
|
|
148
157
|
* - `"menu"` (default): vertical list of options.
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsx as C, jsxs as q } from "react/jsx-runtime";
|
|
2
2
|
import W from "../../../../../external/classnames/index.es.js";
|
|
3
|
-
import r, { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { FeedbackText as
|
|
7
|
-
import { FormLabel as
|
|
8
|
-
import { useOptionalInputGroup as
|
|
9
|
-
import
|
|
10
|
-
import { SELECT_ALL_VALUE as v, GROUP_OPTION_PREFIX as
|
|
11
|
-
import { SelectClearIndicator as
|
|
12
|
-
import { SelectControl as
|
|
13
|
-
import { SelectDropDownIndicator as
|
|
14
|
-
import { SelectGroup as
|
|
15
|
-
import { SelectGroupHeading as
|
|
16
|
-
import { SelectIndicatorsContainer as
|
|
17
|
-
import { SelectInput as
|
|
18
|
-
import { SelectLoadingIndicator as
|
|
19
|
-
import { SelectMenu as
|
|
20
|
-
import { SelectMenuList as
|
|
21
|
-
import { SelectMenuPortal as
|
|
22
|
-
import { SelectMultiValue as
|
|
23
|
-
import { SelectMultiValueRemove as
|
|
24
|
-
import { SelectOption as
|
|
25
|
-
import { SelectSingleValue as
|
|
26
|
-
import { SelectValueContainer as
|
|
3
|
+
import r, { forwardRef as Qe } from "react";
|
|
4
|
+
import Ye from "../../../../../external/react-select/dist/react-select.esm.es.js";
|
|
5
|
+
import Ze from "../../../../../external/react-select/async/dist/react-select-async.esm.es.js";
|
|
6
|
+
import { FeedbackText as et } from "../feedback-text/feedback-text.es.js";
|
|
7
|
+
import { FormLabel as tt } from "../form-label/form-label.es.js";
|
|
8
|
+
import { useOptionalInputGroup as ot } from "../input-group/input-group.es.js";
|
|
9
|
+
import lt from "../input-group/input-group.module.scss.es.js";
|
|
10
|
+
import { SELECT_ALL_VALUE as v, GROUP_OPTION_PREFIX as nt, areAllSelected as X, getEnabledOptions as J, isGroupSentinel as Q } from "./components/select-bulk-helpers.es.js";
|
|
11
|
+
import { SelectClearIndicator as st } from "./components/select-clear-indicator.es.js";
|
|
12
|
+
import { SelectControl as rt } from "./components/select-control.es.js";
|
|
13
|
+
import { SelectDropDownIndicator as at } from "./components/select-dropdown-indicator.es.js";
|
|
14
|
+
import { SelectGroup as it } from "./components/select-group.es.js";
|
|
15
|
+
import { SelectGroupHeading as ct } from "./components/select-group-heading.es.js";
|
|
16
|
+
import { SelectIndicatorsContainer as ut } from "./components/select-indicators-container.es.js";
|
|
17
|
+
import { SelectInput as dt } from "./components/select-input.es.js";
|
|
18
|
+
import { SelectLoadingIndicator as pt } from "./components/select-loading-indicator.es.js";
|
|
19
|
+
import { SelectMenu as mt } from "./components/select-menu.es.js";
|
|
20
|
+
import { SelectMenuList as ft } from "./components/select-menu-list.es.js";
|
|
21
|
+
import { SelectMenuPortal as gt } from "./components/select-menu-portal.es.js";
|
|
22
|
+
import { SelectMultiValue as bt } from "./components/select-multi-value.es.js";
|
|
23
|
+
import { SelectMultiValueRemove as St } from "./components/select-multi-value-remove.es.js";
|
|
24
|
+
import { SelectOption as vt } from "./components/select-option.es.js";
|
|
25
|
+
import { SelectSingleValue as yt } from "./components/select-single-value.es.js";
|
|
26
|
+
import { SelectValueContainer as Mt } from "./components/select-value-container.es.js";
|
|
27
27
|
import p from "./select.module.scss.es.js";
|
|
28
|
-
import { useLabels as
|
|
29
|
-
const
|
|
28
|
+
import { useLabels as ht } from "../../../providers/label-provider/use-labels.es.js";
|
|
29
|
+
const It = Qe(
|
|
30
30
|
(k, Y) => {
|
|
31
31
|
var z;
|
|
32
32
|
const {
|
|
@@ -67,30 +67,31 @@ const ht = Je(
|
|
|
67
67
|
dropdownType: ye = "menu",
|
|
68
68
|
renderValue: Me,
|
|
69
69
|
closeMenuOnSelect: he = !y,
|
|
70
|
-
blurInputOnSelect:
|
|
70
|
+
blurInputOnSelect: E = !1,
|
|
71
71
|
autoFocus: Ie = !1,
|
|
72
72
|
isClearable: Oe = !0,
|
|
73
73
|
isClearIndicatorVisible: Ce = !1,
|
|
74
|
-
isSearchable:
|
|
74
|
+
isSearchable: T = !0,
|
|
75
75
|
menuIsOpen: Le,
|
|
76
76
|
onMenuClose: Ve,
|
|
77
77
|
onMenuOpen: we,
|
|
78
78
|
onBlur: Ae,
|
|
79
79
|
inputIsHidden: ke,
|
|
80
80
|
isTagRemovable: _e = !1,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
tagsEllipsis: Re = !1,
|
|
82
|
+
backspaceRemovesValue: De = !1,
|
|
83
|
+
optionGroupHeadingText: Ne = { modifiers: "small", color: "tertiary" },
|
|
84
|
+
cacheOptions: Fe = !0,
|
|
85
|
+
showRadioButtons: xe = !1,
|
|
86
|
+
renderWithoutLabel: Ge,
|
|
87
|
+
tooltip: Pe,
|
|
88
|
+
classNames: $
|
|
89
|
+
} = k, m = (z = ot) == null ? void 0 : z(), Ee = r.useId(), Te = m == null ? void 0 : m.hasExternalLabel, A = k.id ?? (m == null ? void 0 : m.inputId) ?? Ee, H = a ? (a == null ? void 0 : a.id) ?? `${A}-helper` : void 0, h = r.useRef(null), { getLabel: I } = ht();
|
|
89
90
|
r.useImperativeHandle(
|
|
90
91
|
Y,
|
|
91
92
|
() => h.current
|
|
92
93
|
);
|
|
93
|
-
const g = !!G && y, [$e,
|
|
94
|
+
const g = !!G && y, [$e, He] = r.useState(N ?? null), j = D !== void 0, f = j ? D : $e, u = r.useMemo(() => Array.isArray(f) ? f : f ? [f] : [], [f]), O = r.useMemo(
|
|
94
95
|
() => ({ value: v, label: I("select.select-all") }),
|
|
95
96
|
[I]
|
|
96
97
|
), b = !!P && !!y, { groupFlattenedOptions: K, groupSentinelMap: M } = r.useMemo(() => {
|
|
@@ -101,7 +102,7 @@ const ht = Je(
|
|
|
101
102
|
const l = [], i = /* @__PURE__ */ new Map();
|
|
102
103
|
for (const e of c)
|
|
103
104
|
if (e && Array.isArray(e.options)) {
|
|
104
|
-
const o = e, n = `${
|
|
105
|
+
const o = e, n = `${nt}${o.label ?? ""}`, d = o.options.filter((S) => !S.isDisabled);
|
|
105
106
|
i.set(n, { enabled: d }), l.push({ value: n, label: o.label ?? "" });
|
|
106
107
|
for (const S of o.options)
|
|
107
108
|
l.push({
|
|
@@ -111,10 +112,10 @@ const ht = Je(
|
|
|
111
112
|
} else
|
|
112
113
|
l.push(e);
|
|
113
114
|
return { groupFlattenedOptions: l, groupSentinelMap: i };
|
|
114
|
-
}, [c, b]),
|
|
115
|
+
}, [c, b]), je = r.useMemo(() => {
|
|
115
116
|
let t = K ?? c;
|
|
116
117
|
return g && t && t.length > 0 && (t = [O, ...t]), t;
|
|
117
|
-
}, [c, K, g, O]),
|
|
118
|
+
}, [c, K, g, O]), Ke = r.useMemo(() => {
|
|
118
119
|
const t = [];
|
|
119
120
|
if (b && M.size > 0)
|
|
120
121
|
for (const [s, l] of M)
|
|
@@ -132,7 +133,7 @@ const ht = Je(
|
|
|
132
133
|
M,
|
|
133
134
|
g,
|
|
134
135
|
O
|
|
135
|
-
]),
|
|
136
|
+
]), Ue = (t, s) => {
|
|
136
137
|
let l = t;
|
|
137
138
|
const i = s.option;
|
|
138
139
|
if (b && i && M.has(i.value)) {
|
|
@@ -151,40 +152,40 @@ const ht = Je(
|
|
|
151
152
|
(n) => n.value !== v && !e.some((d) => d.value === n.value)
|
|
152
153
|
));
|
|
153
154
|
}
|
|
154
|
-
Array.isArray(l) && (l = l.filter((e) => e.value !== v && !Q(e))), j ||
|
|
155
|
+
Array.isArray(l) && (l = l.filter((e) => e.value !== v && !Q(e))), j || He(l), V == null || V(l), !E && h.current && setTimeout(() => {
|
|
155
156
|
var e, o;
|
|
156
157
|
return (o = (e = h.current) == null ? void 0 : e.inputRef) == null ? void 0 : o.focus();
|
|
157
158
|
}, 0);
|
|
158
|
-
},
|
|
159
|
+
}, Be = r.useCallback(
|
|
159
160
|
(t, s) => t.data.value === v || Q(t.data) || !s ? !0 : String(t.label).toLowerCase().includes(s.toLowerCase()),
|
|
160
161
|
[]
|
|
161
|
-
), [U, B] = r.useState(!1),
|
|
162
|
+
), [U, B] = r.useState(!1), ze = (t) => {
|
|
162
163
|
(t.key === "ArrowUp" || t.key === "ArrowDown" || t.key === "Home" || t.key === "End" || t.key === "PageUp" || t.key === "PageDown" || t.key === "Tab") && (U || B(!0));
|
|
163
|
-
},
|
|
164
|
+
}, qe = r.useCallback(() => {
|
|
164
165
|
B((t) => t && !1);
|
|
165
|
-
}, []),
|
|
166
|
-
(t) => /* @__PURE__ */ C(
|
|
166
|
+
}, []), We = r.useCallback(
|
|
167
|
+
(t) => /* @__PURE__ */ C(ft, { ...t, renderMessageListFooter: x }),
|
|
167
168
|
[x]
|
|
168
|
-
),
|
|
169
|
+
), Xe = () => {
|
|
169
170
|
const t = {
|
|
170
|
-
ClearIndicator: (e) =>
|
|
171
|
-
DropdownIndicator: () =>
|
|
171
|
+
ClearIndicator: (e) => st({ isClearIndicatorVisible: Ce, ...e }),
|
|
172
|
+
DropdownIndicator: () => at({ iconName: te }),
|
|
172
173
|
IndicatorSeparator: () => null,
|
|
173
|
-
MenuPortal:
|
|
174
|
-
Menu:
|
|
175
|
-
MenuList:
|
|
176
|
-
Option: (e) =>
|
|
177
|
-
Control:
|
|
178
|
-
Input:
|
|
179
|
-
MultiValue: (e) =>
|
|
180
|
-
MultiValueRemove:
|
|
181
|
-
SingleValue:
|
|
182
|
-
Group:
|
|
183
|
-
GroupHeading: (e) =>
|
|
184
|
-
IndicatorsContainer:
|
|
185
|
-
ValueContainer:
|
|
186
|
-
LoadingIndicator:
|
|
187
|
-
}, s = ge ?
|
|
174
|
+
MenuPortal: gt,
|
|
175
|
+
Menu: mt,
|
|
176
|
+
MenuList: We,
|
|
177
|
+
Option: (e) => vt({ renderOption: be, multiple: y, showRadioButtons: xe, ...e }),
|
|
178
|
+
Control: rt,
|
|
179
|
+
Input: dt,
|
|
180
|
+
MultiValue: (e) => bt({ isTagRemovable: _e, tagsEllipsis: Re, ...e }),
|
|
181
|
+
MultiValueRemove: St,
|
|
182
|
+
SingleValue: yt,
|
|
183
|
+
Group: it,
|
|
184
|
+
GroupHeading: (e) => ct({ optionGroupHeadingText: Ne, ...e }),
|
|
185
|
+
IndicatorsContainer: ut,
|
|
186
|
+
ValueContainer: Mt,
|
|
187
|
+
LoadingIndicator: pt
|
|
188
|
+
}, s = ge ? Ze : Ye, l = () => I("select.no-options"), i = () => I("select.loading");
|
|
188
189
|
return /* @__PURE__ */ C(
|
|
189
190
|
s,
|
|
190
191
|
{
|
|
@@ -194,8 +195,8 @@ const ht = Je(
|
|
|
194
195
|
dropdownType: ye,
|
|
195
196
|
renderValue: Me,
|
|
196
197
|
keyboardMode: U,
|
|
197
|
-
exitKeyboardMode:
|
|
198
|
-
onKeyDown:
|
|
198
|
+
exitKeyboardMode: qe,
|
|
199
|
+
onKeyDown: ze,
|
|
199
200
|
id: A,
|
|
200
201
|
"aria-describedby": H,
|
|
201
202
|
autoFocus: Ie,
|
|
@@ -203,13 +204,13 @@ const ht = Je(
|
|
|
203
204
|
instanceId: _,
|
|
204
205
|
className: "tedi-select__wrapper",
|
|
205
206
|
name: ee,
|
|
206
|
-
options:
|
|
207
|
+
options: je,
|
|
207
208
|
defaultOptions: Z,
|
|
208
|
-
value:
|
|
209
|
+
value: Ke,
|
|
209
210
|
defaultValue: N,
|
|
210
|
-
cacheOptions:
|
|
211
|
-
onChange:
|
|
212
|
-
filterOption: g || b ?
|
|
211
|
+
cacheOptions: Fe,
|
|
212
|
+
onChange: Ue,
|
|
213
|
+
filterOption: g || b ? Be : void 0,
|
|
213
214
|
onInputChange: le,
|
|
214
215
|
onBlur: Ae,
|
|
215
216
|
inputValue: ne,
|
|
@@ -221,7 +222,7 @@ const ht = Je(
|
|
|
221
222
|
classNamePrefix: "select",
|
|
222
223
|
components: t,
|
|
223
224
|
isDisabled: F,
|
|
224
|
-
isSearchable:
|
|
225
|
+
isSearchable: T,
|
|
225
226
|
menuIsOpen: Le,
|
|
226
227
|
openMenuOnFocus: ae,
|
|
227
228
|
openMenuOnClick: ie,
|
|
@@ -230,12 +231,12 @@ const ht = Je(
|
|
|
230
231
|
onMenuOpen: we,
|
|
231
232
|
placeholder: pe || "",
|
|
232
233
|
isClearable: Oe,
|
|
233
|
-
backspaceRemovesValue:
|
|
234
|
+
backspaceRemovesValue: De,
|
|
234
235
|
menuShouldScrollIntoView: !0,
|
|
235
236
|
isMulti: y,
|
|
236
237
|
hideSelectedOptions: !1,
|
|
237
238
|
closeMenuOnSelect: he,
|
|
238
|
-
blurInputOnSelect:
|
|
239
|
+
blurInputOnSelect: E,
|
|
239
240
|
menuPlacement: "auto",
|
|
240
241
|
inputIsHidden: ke,
|
|
241
242
|
required: R,
|
|
@@ -243,12 +244,12 @@ const ht = Je(
|
|
|
243
244
|
menuPosition: "absolute",
|
|
244
245
|
classNames: (() => {
|
|
245
246
|
const e = {};
|
|
246
|
-
if (
|
|
247
|
-
for (const [o, n] of Object.entries(
|
|
247
|
+
if ($)
|
|
248
|
+
for (const [o, n] of Object.entries($))
|
|
248
249
|
e[o] = typeof n == "string" ? () => n : n;
|
|
249
250
|
if (m) {
|
|
250
251
|
const o = e.control;
|
|
251
|
-
e.control = (n) => W(o == null ? void 0 : o(n),
|
|
252
|
+
e.control = (n) => W(o == null ? void 0 : o(n), lt["tedi-input-group__input"]);
|
|
252
253
|
}
|
|
253
254
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
254
255
|
})(),
|
|
@@ -269,37 +270,37 @@ const ht = Je(
|
|
|
269
270
|
}
|
|
270
271
|
}
|
|
271
272
|
);
|
|
272
|
-
},
|
|
273
|
+
}, Je = W(
|
|
273
274
|
p["tedi-select"],
|
|
274
275
|
ue,
|
|
275
276
|
{ [p["tedi-select--invalid"]]: me || (a == null ? void 0 : a.type) === "error" },
|
|
276
277
|
{ [p["tedi-select--valid"]]: fe || (a == null ? void 0 : a.type) === "valid" },
|
|
277
278
|
{ [p[`tedi-select--${w}`]]: w },
|
|
278
279
|
{ [p[`tedi-select--tags-${L}`]]: L },
|
|
279
|
-
{ [p["tedi-select--searchable"]]:
|
|
280
|
+
{ [p["tedi-select--searchable"]]: T },
|
|
280
281
|
{ [p["tedi-select--disabled"]]: F }
|
|
281
282
|
);
|
|
282
|
-
return /* @__PURE__ */ q("div", { "data-name": "select", className:
|
|
283
|
+
return /* @__PURE__ */ q("div", { "data-name": "select", className: Je, children: [
|
|
283
284
|
/* @__PURE__ */ q("div", { className: p["tedi-select__inner"], children: [
|
|
284
285
|
!Te && /* @__PURE__ */ C(
|
|
285
|
-
|
|
286
|
+
tt,
|
|
286
287
|
{
|
|
287
288
|
id: `${A}-input`,
|
|
288
289
|
label: oe,
|
|
289
290
|
required: R,
|
|
290
291
|
hideLabel: de,
|
|
291
292
|
size: w,
|
|
292
|
-
renderWithoutLabel:
|
|
293
|
-
tooltip:
|
|
293
|
+
renderWithoutLabel: Ge,
|
|
294
|
+
tooltip: Pe
|
|
294
295
|
}
|
|
295
296
|
),
|
|
296
|
-
|
|
297
|
+
Xe()
|
|
297
298
|
] }),
|
|
298
|
-
a && /* @__PURE__ */ C(
|
|
299
|
+
a && /* @__PURE__ */ C(et, { ...a, id: H })
|
|
299
300
|
] });
|
|
300
301
|
}
|
|
301
302
|
);
|
|
302
|
-
|
|
303
|
+
It.displayName = "Select";
|
|
303
304
|
export {
|
|
304
|
-
|
|
305
|
+
It as Select
|
|
305
306
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-select__control":"tedi-select__control-dbce8bb7","tedi-select__value-container":"tedi-select__value-container-253d079a","tedi-select__indicators-container":"tedi-select__indicators-container-0fc8fa2a","tedi-select__input":"tedi-select__input-5525b622","tedi-select":"tedi-select-8b014852","tedi-select--disabled":"tedi-select--disabled-2d4b8ddd","tedi-select--invalid":"tedi-select--invalid-3901c89c","tedi-select--valid":"tedi-select--valid-969c0297","tedi-select__control--focused":"tedi-select__control--focused-0e632efe","tedi-select__arrow":"tedi-select__arrow-94b5ef4a","tedi-select__loading-indicator":"tedi-select__loading-indicator-a35a63ca","tedi-select__dropdown-indicator":"tedi-select__dropdown-indicator-5a948baa","tedi-select__clear-indicator":"tedi-select__clear-indicator-68b60b12","tedi-select__menu-portal":"tedi-select__menu-portal-d5349f37","tedi-select__menu":"tedi-select__menu-bf54b75b","tedi-select__menu-list--grid":"tedi-select__menu-list--grid-393f3232","tedi-select__menu-list":"tedi-select__menu-list-0aa06e24","tedi-select__menu-list-inner":"tedi-select__menu-list-inner-471e5cf8","tedi-select__menu-list-footer":"tedi-select__menu-list-footer-eb1d3bbc","tedi-select__option":"tedi-select__option-6f811381","tedi-select__option--disabled":"tedi-select__option--disabled-d3aff112","tedi-select__option--focused":"tedi-select__option--focused-1d972ff1","tedi-select__option--selected":"tedi-select__option--selected-a93e5fb0","tedi-select--small":"tedi-select--small-2659608b","tedi-select__multi-value-item":"tedi-select__multi-value-item-b8ec59ae","tedi-select__group":"tedi-select__group-b275e954","tedi-select__group-heading":"tedi-select__group-heading-02b3d9bc","tedi-select__group-heading--selectable":"tedi-select__group-heading--selectable-c84cd617","tedi-select__option--indented":"tedi-select__option--indented-bf4a1661","tedi-select__multi-value-clear":"tedi-select__multi-value-clear-d231f7de","tedi-select--tags-row":"tedi-select--tags-row-c9f33e4b","tedi-select__overflow-tag":"tedi-select__overflow-tag-c0391df2","tedi-select__menu-list--keyboard":"tedi-select__menu-list--keyboard-3d066942","tedi-select__select-all":"tedi-select__select-all-12c3e7f1","tedi-select__group-heading-toggle":"tedi-select__group-heading-toggle-34296a63","tedi-select--tags-stack":"tedi-select--tags-stack-ddb929a9","tedi-select__separator":"tedi-select__separator-b1045f3f","tedi-select--searchable":"tedi-select--searchable-d56eb325"};exports.default=e;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-select__control":"tedi-select__control-dbce8bb7","tedi-select__value-container":"tedi-select__value-container-253d079a","tedi-select__indicators-container":"tedi-select__indicators-container-0fc8fa2a","tedi-select__input":"tedi-select__input-5525b622","tedi-select":"tedi-select-8b014852","tedi-select--disabled":"tedi-select--disabled-2d4b8ddd","tedi-select--invalid":"tedi-select--invalid-3901c89c","tedi-select--valid":"tedi-select--valid-969c0297","tedi-select__control--focused":"tedi-select__control--focused-0e632efe","tedi-select__arrow":"tedi-select__arrow-94b5ef4a","tedi-select__loading-indicator":"tedi-select__loading-indicator-a35a63ca","tedi-select__dropdown-indicator":"tedi-select__dropdown-indicator-5a948baa","tedi-select__clear-indicator":"tedi-select__clear-indicator-68b60b12","tedi-select__menu-portal":"tedi-select__menu-portal-d5349f37","tedi-select__menu":"tedi-select__menu-bf54b75b","tedi-select__menu-list--grid":"tedi-select__menu-list--grid-393f3232","tedi-select__menu-list":"tedi-select__menu-list-0aa06e24","tedi-select__menu-list-inner":"tedi-select__menu-list-inner-471e5cf8","tedi-select__menu-list-footer":"tedi-select__menu-list-footer-eb1d3bbc","tedi-select__option":"tedi-select__option-6f811381","tedi-select__option--disabled":"tedi-select__option--disabled-d3aff112","tedi-select__option--focused":"tedi-select__option--focused-1d972ff1","tedi-select__option--selected":"tedi-select__option--selected-a93e5fb0","tedi-select--small":"tedi-select--small-2659608b","tedi-select__multi-value-item":"tedi-select__multi-value-item-b8ec59ae","tedi-select__multi-value--ellipsis":"tedi-select__multi-value--ellipsis-1d821ed7","tedi-select__group":"tedi-select__group-b275e954","tedi-select__group-heading":"tedi-select__group-heading-02b3d9bc","tedi-select__group-heading--selectable":"tedi-select__group-heading--selectable-c84cd617","tedi-select__option--indented":"tedi-select__option--indented-bf4a1661","tedi-select__multi-value-clear":"tedi-select__multi-value-clear-d231f7de","tedi-select--tags-row":"tedi-select--tags-row-c9f33e4b","tedi-select__overflow-tag":"tedi-select__overflow-tag-c0391df2","tedi-select__menu-list--keyboard":"tedi-select__menu-list--keyboard-3d066942","tedi-select__select-all":"tedi-select__select-all-12c3e7f1","tedi-select__group-heading-toggle":"tedi-select__group-heading-toggle-34296a63","tedi-select--tags-stack":"tedi-select--tags-stack-ddb929a9","tedi-select__separator":"tedi-select__separator-b1045f3f","tedi-select--searchable":"tedi-select--searchable-d56eb325"};exports.default=e;
|
|
@@ -24,6 +24,7 @@ const e = {
|
|
|
24
24
|
"tedi-select__option--selected": "tedi-select__option--selected-a93e5fb0",
|
|
25
25
|
"tedi-select--small": "tedi-select--small-2659608b",
|
|
26
26
|
"tedi-select__multi-value-item": "tedi-select__multi-value-item-b8ec59ae",
|
|
27
|
+
"tedi-select__multi-value--ellipsis": "tedi-select__multi-value--ellipsis-1d821ed7",
|
|
27
28
|
"tedi-select__group": "tedi-select__group-b275e954",
|
|
28
29
|
"tedi-select__group-heading": "tedi-select__group-heading-02b3d9bc",
|
|
29
30
|
"tedi-select__group-heading--selectable": "tedi-select__group-heading--selectable-c84cd617",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("../../../../../external/classnames/index.cjs.js"),o=require("react"),a=require("../../overlays/popover/popover.cjs.js"),i=require("./ellipsis.module.scss.cjs.js"),x=require("../../../helpers/hooks/use-element-size.cjs.js"),g=d=>{const{children:l,lineClamp:r=2,position:s="end",popover:p=!0,className:u,...m}=d,n=o.useRef(null),[f,h]=o.useState(!1),v=x.useElementSize(n);o.useEffect(()=>{const t=n.current;t&&h(s==="start"?t.scrollWidth>t.clientWidth:t.scrollHeight>t.clientHeight)},[v,s,r]);const c=e.jsx("div",{"data-name":"ellipsis",...m,ref:n,className:j.default(i.default["tedi-ellipsis"],{[i.default["tedi-ellipsis--start"]]:s==="start"},u),style:s==="end"?{lineClamp:r,WebkitLineClamp:r}:void 0,children:s==="start"?e.jsx("span",{className:i.default["tedi-ellipsis__inner"],children:l}):l});return f&&p?e.jsxs(a.Popover,{openWith:"hover",focusManager:{modal:!1},children:[e.jsx(a.Popover.Trigger,{children:c}),e.jsx(a.Popover.Content,{children:e.jsx("span",{className:i.default["tedi-ellipsis__overlay"],children:l})})]}):c};exports.Ellipsis=g;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
export type EllipsisPosition = 'start' | 'end';
|
|
2
3
|
export interface EllipsisProps {
|
|
3
4
|
/**
|
|
4
5
|
* The content to be displayed inside the ellipsis container.
|
|
@@ -6,10 +7,19 @@ export interface EllipsisProps {
|
|
|
6
7
|
children: React.ReactNode;
|
|
7
8
|
/**
|
|
8
9
|
* The maximum number of lines before truncating the text with an ellipsis.
|
|
9
|
-
* If the content exceeds this limit, it will be truncated.
|
|
10
|
+
* If the content exceeds this limit, it will be truncated. Applies to the
|
|
11
|
+
* `end` (multi-line) position only.
|
|
10
12
|
* @default 2
|
|
11
13
|
*/
|
|
12
14
|
lineClamp?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Where the ellipsis is placed.
|
|
17
|
+
* - `end` — trailing ellipsis, multi-line (clamped by `lineClamp`).
|
|
18
|
+
* - `start` — leading ellipsis, single-line (keeps the end of the text visible,
|
|
19
|
+
* e.g. for file paths or IDs).
|
|
20
|
+
* @default end
|
|
21
|
+
*/
|
|
22
|
+
position?: EllipsisPosition;
|
|
13
23
|
/**
|
|
14
24
|
* Determines whether a popover should be displayed when the text is truncated.
|
|
15
25
|
* If `true`, hovering over the truncated text will show the full content in a popover.
|