@viasat/beam-react 2.21.1 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/Search.css +1 -1
- package/assets/panel.css +1 -1
- package/chunks/Search.Results.BM9NkYBp.js +1 -0
- package/chunks/Search.Results.wKBufUSo.js +64 -0
- package/chunks/{panel.module.a_gaicKX.js → panel.module.DCpj0tSX.js} +1 -1
- package/lib/Alert/Alert.figma.d.ts +1 -0
- package/lib/Switch/Switch.figma.d.ts +1 -0
- package/lib/Tooltip/Tooltip.figma.d.ts +1 -0
- package/lib/wip/Panel/Panel.Body.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Body.d.ts +6 -1
- package/lib/wip/Panel/Panel.Body.es.js +11 -9
- package/lib/wip/Panel/Panel.Divider.cjs.js +1 -0
- package/lib/wip/Panel/Panel.Divider.d.ts +6 -0
- package/lib/wip/Panel/Panel.Divider.es.js +18 -0
- package/lib/wip/Panel/Panel.Footer.Actions.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Footer.Actions.es.js +1 -1
- package/lib/wip/Panel/Panel.Footer.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Footer.d.ts +12 -1
- package/lib/wip/Panel/Panel.Footer.es.js +28 -15
- package/lib/wip/Panel/Panel.Header.ContentAfter.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Header.ContentAfter.es.js +1 -1
- package/lib/wip/Panel/Panel.Header.ContentBefore.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Header.ContentBefore.es.js +1 -1
- package/lib/wip/Panel/Panel.Header.Description.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Header.Description.es.js +1 -1
- package/lib/wip/Panel/Panel.Header.Heading.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Header.Heading.es.js +1 -1
- package/lib/wip/Panel/Panel.Header.Row.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Header.Row.es.js +1 -1
- package/lib/wip/Panel/Panel.Header.Subheader.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Header.Subheader.es.js +1 -1
- package/lib/wip/Panel/Panel.Header.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Header.d.ts +12 -1
- package/lib/wip/Panel/Panel.Header.es.js +37 -24
- package/lib/wip/Panel/Panel.Inline.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Inline.d.ts +3 -6
- package/lib/wip/Panel/Panel.Inline.es.js +62 -70
- package/lib/wip/Panel/Panel.Overlay.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Overlay.d.ts +3 -2
- package/lib/wip/Panel/Panel.Overlay.es.js +23 -22
- package/lib/wip/Panel/Panel.cjs.js +1 -1
- package/lib/wip/Panel/Panel.d.ts +4 -4
- package/lib/wip/Panel/Panel.es.js +69 -60
- package/lib/wip/Panel/Panel.helpers.cjs.js +1 -1
- package/lib/wip/Panel/Panel.helpers.d.ts +2 -1
- package/lib/wip/Panel/Panel.helpers.es.js +8 -7
- package/lib/wip/Panel/Panel.types.cjs.js +1 -1
- package/lib/wip/Panel/Panel.types.d.ts +11 -1
- package/lib/wip/Panel/Panel.types.es.js +5 -1
- package/lib/wip/Search/Search.Results.Item.cjs.js +1 -1
- package/lib/wip/Search/Search.Results.Item.d.ts +6 -6
- package/lib/wip/Search/Search.Results.Item.es.js +5 -6
- package/lib/wip/Search/Search.Results.ViewAll.cjs.js +1 -1
- package/lib/wip/Search/Search.Results.ViewAll.d.ts +7 -7
- package/lib/wip/Search/Search.Results.ViewAll.es.js +2 -2
- package/lib/wip/Search/Search.Results.cjs.js +1 -1
- package/lib/wip/Search/Search.Results.es.js +3 -5
- package/lib/wip/Search/Search.cjs.js +1 -1
- package/lib/wip/Search/Search.d.ts +17 -8
- package/lib/wip/Search/Search.es.js +175 -157
- package/lib/wip/Search/SearchDropdown.cjs.js +1 -1
- package/lib/wip/Search/SearchDropdown.es.js +25 -24
- package/lib/wip/Search/index.d.ts +4 -1
- package/package.json +6 -6
- package/chunks/Search.Results.CFA_KEdP.js +0 -1
- package/chunks/Search.Results.DVf6WKnI.js +0 -68
- package/lib/wip/Search/Search.Results.d.ts +0 -15
- package/chunks/{panel.module.DGxSyRdA.js → panel.module.DJLJpnm_.js} +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../chunks/constants.hwjHOsvT.js");const e=["00","00-alt","01","02","03"],o=e;exports.PanelDividerColors=o;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { PanelDividerColor, PanelDividerColors } from '@viasat/beam-shared/components/panel';
|
|
3
|
+
export type { PanelDividerColor };
|
|
4
|
+
export { PanelDividerColors };
|
|
2
5
|
export type PanelKind = 'inline' | 'overlay';
|
|
3
6
|
export type PanelPosition = 'start' | 'end' | 'bottom' | 'full';
|
|
4
7
|
export type PanelModalType = 'nonModal' | 'isModal' | 'alert';
|
|
@@ -40,7 +43,9 @@ interface BasePanelProps extends ComponentPropsWithoutRef<'aside'> {
|
|
|
40
43
|
*/
|
|
41
44
|
onOpenChange?: (open: boolean) => void;
|
|
42
45
|
/**
|
|
43
|
-
* Specify the size of the Panel
|
|
46
|
+
* Specify the size of the Panel.
|
|
47
|
+
* When `position="bottom"`, only `size="full"` has an effect (enables full-viewport height).
|
|
48
|
+
* All other values are ignored for bottom panels — width is always 100%.
|
|
44
49
|
* @default 'md'
|
|
45
50
|
*/
|
|
46
51
|
size?: PanelSize;
|
|
@@ -71,6 +76,11 @@ interface BasePanelProps extends ComponentPropsWithoutRef<'aside'> {
|
|
|
71
76
|
* @default true
|
|
72
77
|
*/
|
|
73
78
|
divider?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Specify the border color of the external divider between panel and page content
|
|
81
|
+
* @default '01'
|
|
82
|
+
*/
|
|
83
|
+
dividerColor?: PanelDividerColor;
|
|
74
84
|
/**
|
|
75
85
|
* Specify the position of the Panel
|
|
76
86
|
* 'start' | 'end' | 'bottom' | 'full'
|
|
@@ -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"),o=require("react"),n=require("../../ActionList/ActionList.cjs.js"),s=o.forwardRef(({children:t,...e},i)=>r.jsx(n.ActionList.Item,{ref:i,...e,children:t}));exports.Item=s;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentPropsWithRef, ElementType, ReactElement } from 'react';
|
|
2
2
|
import { ActionListItemProps } from '../../ActionList/ActionList.Item';
|
|
3
|
-
export type SearchResultsItemProps<C extends
|
|
4
|
-
export declare const SearchResultsItem: SearchResultsItemComponent;
|
|
3
|
+
export type SearchResultsItemProps<C extends ElementType = 'div'> = Omit<ActionListItemProps<C>, 'defaultSelected' | 'kind' | 'onSelectionChange' | 'role'>;
|
|
5
4
|
interface SearchResultsItemComponent {
|
|
6
|
-
<C extends
|
|
7
|
-
ref?:
|
|
8
|
-
}):
|
|
5
|
+
<C extends ElementType = 'div'>(props: ActionListItemProps<C> & {
|
|
6
|
+
ref?: ComponentPropsWithRef<C>['ref'];
|
|
7
|
+
}): ReactElement | null;
|
|
9
8
|
displayName?: string;
|
|
10
9
|
}
|
|
10
|
+
export declare const Item: SearchResultsItemComponent;
|
|
11
11
|
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { ActionList as
|
|
4
|
-
const
|
|
5
|
-
({ children:
|
|
2
|
+
import { forwardRef as e } from "react";
|
|
3
|
+
import { ActionList as f } from "../../ActionList/ActionList.es.js";
|
|
4
|
+
const s = e(
|
|
5
|
+
({ children: r, ...o }, t) => /* @__PURE__ */ m(f.Item, { ref: t, ...o, children: r })
|
|
6
6
|
);
|
|
7
|
-
a.displayName = "Search.Results.Item";
|
|
8
7
|
export {
|
|
9
|
-
|
|
8
|
+
s as Item
|
|
10
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");require("clsx");const e=require("../../../chunks/Search.Results.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");require("clsx");const e=require("../../../chunks/Search.Results.BM9NkYBp.js");require("../../ActionList/ActionList.cjs.js");require("../../Icon/Icon.cjs.js");exports.ViewAll=e.ViewAll;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type SearchResultsViewAllProps<C extends
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType, ReactElement } from 'react';
|
|
2
|
+
export type SearchResultsViewAllProps<C extends ElementType = 'div'> = {
|
|
3
3
|
/**
|
|
4
4
|
* Specify a different component to render the item, such as an anchor tag for links
|
|
5
5
|
*
|
|
@@ -11,12 +11,12 @@ export type SearchResultsViewAllProps<C extends React.ElementType = 'div'> = {
|
|
|
11
11
|
* 'group' when inside a Search.Results, 'global' when directly inside Search.
|
|
12
12
|
*/
|
|
13
13
|
variant?: 'group' | 'global';
|
|
14
|
-
} &
|
|
15
|
-
export declare const SearchResultsViewAll: SearchResultsViewAllComponent;
|
|
14
|
+
} & ComponentPropsWithoutRef<C>;
|
|
16
15
|
interface SearchResultsViewAllComponent {
|
|
17
|
-
<C extends
|
|
18
|
-
ref?:
|
|
19
|
-
}):
|
|
16
|
+
<C extends ElementType = 'div'>(props: SearchResultsViewAllProps<C> & {
|
|
17
|
+
ref?: ComponentPropsWithRef<C>['ref'];
|
|
18
|
+
}): ReactElement | null;
|
|
20
19
|
displayName?: string;
|
|
21
20
|
}
|
|
21
|
+
export declare const ViewAll: SearchResultsViewAllComponent;
|
|
22
22
|
export {};
|
|
@@ -3,9 +3,9 @@ import "react";
|
|
|
3
3
|
import "../../../chunks/classNames.BTJmrO_L.js";
|
|
4
4
|
import "../../../chunks/constants.CKKGf1-i.js";
|
|
5
5
|
import "clsx";
|
|
6
|
-
import {
|
|
6
|
+
import { V as a } from "../../../chunks/Search.Results.wKBufUSo.js";
|
|
7
7
|
import "../../ActionList/ActionList.es.js";
|
|
8
8
|
import "../../Icon/Icon.es.js";
|
|
9
9
|
export {
|
|
10
|
-
a as
|
|
10
|
+
a as ViewAll
|
|
11
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");require("clsx");const e=require("../../../chunks/Search.Results.BM9NkYBp.js");require("./Search.Results.Item.cjs.js");require("../../ActionList/ActionList.cjs.js");exports.Results=e.Results;exports.SearchResultsContext=e.SearchResultsContext;
|
|
@@ -3,12 +3,10 @@ import "react";
|
|
|
3
3
|
import "../../../chunks/classNames.BTJmrO_L.js";
|
|
4
4
|
import "../../../chunks/constants.CKKGf1-i.js";
|
|
5
5
|
import "clsx";
|
|
6
|
-
import {
|
|
6
|
+
import { R, a as l } from "../../../chunks/Search.Results.wKBufUSo.js";
|
|
7
7
|
import "./Search.Results.Item.es.js";
|
|
8
8
|
import "../../ActionList/ActionList.es.js";
|
|
9
9
|
export {
|
|
10
|
-
|
|
11
|
-
l as
|
|
12
|
-
u as SearchResultsContext,
|
|
13
|
-
h as default
|
|
10
|
+
R as Results,
|
|
11
|
+
l as SearchResultsContext
|
|
14
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),be=require("../../../chunks/classNames.DAeKwerT.js"),_e=require("../../../chunks/constants.hwjHOsvT.js"),S=require("react"),t=require("../../../chunks/Search.Results.BM9NkYBp.js"),V=require("clsx"),pe=require("../../../chunks/form.context.hesWPMlU.js"),fe=require("../../Form/contexts/label.context.cjs.js"),xe=require("../../Form/contexts/helperText.context.cjs.js"),me=require("../../Form/hooks/useUniversalRef.hook.cjs.js"),_=require("../../Form/hooks/useAccessibleId.hook.cjs.js"),he=require("../../Icon/Icon.cjs.js"),ye=require("./useSearchDropdown.cjs.js"),Se=require("./SearchDropdown.cjs.js"),Ie=require("../../ActionList/ActionList.cjs.js"),qe=require("../../../utils/hooks/useDebounced.cjs.js"),Re=require("../../../utils/hooks/useEffectAfterMount.cjs.js"),je=require("../../Spinner/Spinner.cjs.js"),Ne=require("../../CloseButton/CloseButton.cjs.js"),{baseClassNamePrefix:De,subElementClassPrefix:c,classModifierPrefix:p}=be.getBEMClassNames("search"),n=S.forwardRef(({id:C,defaultValue:z="",value:I,onChange:i,onSearch:U,loading:q=!1,debounce:W=200,onKeyDown:f,label:R,contentAfter:j,contentBefore:N,helperText:D,fluid:G,width:J,theme:P,disabled:r,hideIcon:Q,icon:X=t.SvgSearch,error:l,readOnly:u,clearable:v=!0,noResults:w,clearButtonAriaLabel:Y="Clear search",className:Z,children:A,"aria-describedby":O,"aria-labelledby":K,"aria-label":k,...x},ee)=>{const{refFn:se,ref:te}=me.useUniversalRef(ee),[ie,$]=S.useState(String(z)),d=I!==void 0,o=d?String(I):ie,re=e=>{d||$(e.target.value),i==null||i(e)},{immediate:m,debounced:g}=qe.useDebounced(U,W),le=e=>{if(f==null||f(e),e.key==="Enter"){if(e.isDefaultPrevented()||e.isPropagationStopped())return;const{activeIndex:a,elementsRef:de}=h,y=a!==null?de.current[a]:null;y&&y.getAttribute("aria-disabled")!=="true"?(e.preventDefault(),y.click()):a===null&&m(o)}e.key==="Escape"&&(!v||h.open)&&e.preventDefault()},{id:b}=_.useAccessibleId(),{id:E}=_.useAccessibleId(),{id:F}=_.useAccessibleId(),{id:M}=_.useAccessibleId(),T=!!(l!=null&&l.length),H=!!A||!!w,B=V(D&&M,T&&F,O),L=K??(R?E:void 0),{dropdownProps:h,getFieldProps:ae,getInputProps:ce}=ye.useSearchDropdown({enabled:H,disabled:!!r,readOnly:!!u});Re.useEffectAfterMount(()=>{g(o)},[o,g]);const ne=V(t.styles[De],P&&_e.themeClassName(P),G&&t.styles[`${p}fluid`],r&&t.styles[`${p}disabled`],u&&t.styles[`${p}read-only`],l&&t.styles[`${p}error`],Z),oe=e=>{var a;r||e.target instanceof HTMLInputElement||e.target.closest('button,[role="button"],a,[role="link"]')||(e.preventDefault(),e.stopPropagation(),(a=te.current)==null||a.focus())},ue=S.useCallback(()=>{d?i==null||i({target:{value:"",name:x.name,id:b,type:"search"}}):$(""),m("")},[b,d,i,m,x.name]);return s.jsxs("div",{id:C,className:ne,role:"search",style:{maxWidth:J},"aria-labelledby":L,"aria-label":k,"aria-describedby":B,"aria-busy":q,children:[s.jsx(fe.LabelProvider,{ctxDisabled:!!r,ctxRequired:!1,ctxHtmlFor:b,ctxId:E,children:R}),s.jsxs("div",{className:t.styles[`${c}field`],...ae({onPointerDown:oe}),children:[!Q&&s.jsx(he.Icon,{icon:X,"aria-hidden":!0}),N&&s.jsx("div",{className:t.styles[`${c}content`],children:N}),s.jsx("input",{id:b,type:"search",className:t.styles[`${c}field__input`],value:o,disabled:r,readOnly:u,"aria-invalid":!!l,"aria-labelledby":L,"aria-label":k,"aria-describedby":B,...ce({...x,onChange:re,onKeyDown:le}),ref:se}),q&&s.jsx("div",{className:t.styles[`${c}field__spinner`],children:s.jsx(je.Spinner,{size:"xxs"})}),v&&o&&!r&&!u&&s.jsx(Ne.CloseButton,{onClick:ue,className:`${c}field__clear-button`,size:"sm","aria-label":Y}),j&&s.jsx("div",{className:t.styles[`${c}content`],children:j})]}),s.jsxs(xe.HelperTextProvider,{ctxId:M,ctxDisabled:!!r,children:[D,T&&s.jsx(pe.HelperText,{id:F,appearance:"negative",children:l})]}),H&&s.jsx(Se.SearchDropdown,{...h,children:s.jsx(Ie.ActionList,{role:"listbox",noResults:w,children:A})})]})});n.displayName="Search";n.Results=t.Results;n.Results.displayName="Search.Results";n.Results.Item.displayName="Search.Results.Item";n.Results.ViewAll.displayName="Search.Results.ViewAll";exports.Search=n;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ThemeTypes } from '@viasat/beam-shared/utils';
|
|
2
2
|
import { Nullable } from '@viasat/beam-shared/utils/types';
|
|
3
|
-
import { default as React } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import { default as React, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
|
|
4
|
+
import { Results } from './Search.Results';
|
|
5
5
|
import { IconComponentType } from '../../../utils/types';
|
|
6
6
|
export interface SearchProps extends React.ComponentPropsWithRef<'input'> {
|
|
7
7
|
/**
|
|
8
|
-
* Specify a callback called whenever a search is conducted
|
|
8
|
+
* Specify a callback that gets called whenever a search is conducted
|
|
9
9
|
*/
|
|
10
10
|
onSearch: (query: string) => void;
|
|
11
11
|
/**
|
|
@@ -72,17 +72,26 @@ export interface SearchProps extends React.ComponentPropsWithRef<'input'> {
|
|
|
72
72
|
noResults?: string;
|
|
73
73
|
/**
|
|
74
74
|
* Aria label for the clear button
|
|
75
|
-
* @default
|
|
75
|
+
* @default Clear search
|
|
76
76
|
*/
|
|
77
77
|
clearButtonAriaLabel?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Specify if Search displays in a disabled state
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
disabled?: boolean;
|
|
78
83
|
/**
|
|
79
84
|
* Specify the theme of the Search. By default it inherits the theme from the parent
|
|
80
85
|
*/
|
|
81
86
|
theme?: ThemeTypes;
|
|
87
|
+
/**
|
|
88
|
+
* Speficy the Search results to display in the Search dropdown
|
|
89
|
+
* (see Search.Results)
|
|
90
|
+
*/
|
|
82
91
|
children?: React.ReactNode;
|
|
83
92
|
}
|
|
84
|
-
|
|
85
|
-
export declare const Search: typeof SearchComponent & {
|
|
93
|
+
interface SearchComponent extends ForwardRefExoticComponent<PropsWithoutRef<SearchProps> & RefAttributes<HTMLInputElement>> {
|
|
86
94
|
Results: typeof Results;
|
|
87
|
-
}
|
|
88
|
-
export
|
|
95
|
+
}
|
|
96
|
+
export declare const Search: SearchComponent;
|
|
97
|
+
export {};
|
|
@@ -1,161 +1,179 @@
|
|
|
1
1
|
import { jsxs as S, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { g as
|
|
3
|
-
import { t as
|
|
4
|
-
import
|
|
5
|
-
import { s as r, S as
|
|
6
|
-
import
|
|
7
|
-
import { H as
|
|
8
|
-
import { LabelProvider as
|
|
9
|
-
import { HelperTextProvider as
|
|
10
|
-
import { useUniversalRef as
|
|
11
|
-
import { useAccessibleId as
|
|
12
|
-
import { Icon as
|
|
13
|
-
import { useSearchDropdown as
|
|
14
|
-
import { SearchDropdown as
|
|
15
|
-
import { ActionList as
|
|
16
|
-
import { useDebounced as
|
|
17
|
-
import { useEffectAfterMount as
|
|
18
|
-
import { Spinner as
|
|
19
|
-
import { CloseButton as
|
|
20
|
-
const { baseClassNamePrefix:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
$ && H,
|
|
61
|
-
M && w,
|
|
62
|
-
X
|
|
63
|
-
), {
|
|
64
|
-
dropdownProps: b,
|
|
65
|
-
getFieldProps: se,
|
|
66
|
-
getInputProps: ie
|
|
67
|
-
} = Ie({
|
|
68
|
-
enabled: A,
|
|
69
|
-
disabled: !!i,
|
|
70
|
-
readOnly: !!n
|
|
71
|
-
});
|
|
72
|
-
ve(() => {
|
|
73
|
-
k(c);
|
|
74
|
-
}, [c, k]);
|
|
75
|
-
const ae = F(
|
|
76
|
-
r[ge],
|
|
77
|
-
y && me(y),
|
|
78
|
-
V && r[`${f}fluid`],
|
|
79
|
-
i && r[`${f}disabled`],
|
|
80
|
-
n && r[`${f}read-only`],
|
|
81
|
-
a && r[`${f}error`],
|
|
82
|
-
Q
|
|
83
|
-
), oe = (e) => {
|
|
84
|
-
var o;
|
|
85
|
-
i || e.target instanceof HTMLInputElement || e.target.closest('button,[role="button"],a,[role="link"]') || (e.preventDefault(), e.stopPropagation(), (o = K.current) == null || o.focus());
|
|
86
|
-
}, le = de(() => {
|
|
87
|
-
m ? s == null || s({
|
|
88
|
-
target: {
|
|
89
|
-
value: "",
|
|
90
|
-
name: p.name,
|
|
91
|
-
id: d,
|
|
92
|
-
type: "search"
|
|
2
|
+
import { g as ue } from "../../../chunks/classNames.BTJmrO_L.js";
|
|
3
|
+
import { t as fe } from "../../../chunks/constants.CKKGf1-i.js";
|
|
4
|
+
import pe, { forwardRef as be, useCallback as he } from "react";
|
|
5
|
+
import { s as r, S as xe, R as Ie } from "../../../chunks/Search.Results.wKBufUSo.js";
|
|
6
|
+
import q from "clsx";
|
|
7
|
+
import { H as ye } from "../../../chunks/form.context.D7b4066_.js";
|
|
8
|
+
import { LabelProvider as Se } from "../../Form/contexts/label.context.es.js";
|
|
9
|
+
import { HelperTextProvider as Ne } from "../../Form/contexts/helperText.context.es.js";
|
|
10
|
+
import { useUniversalRef as Re } from "../../Form/hooks/useUniversalRef.hook.es.js";
|
|
11
|
+
import { useAccessibleId as f } from "../../Form/hooks/useAccessibleId.hook.es.js";
|
|
12
|
+
import { Icon as Pe } from "../../Icon/Icon.es.js";
|
|
13
|
+
import { useSearchDropdown as ve } from "./useSearchDropdown.es.js";
|
|
14
|
+
import { SearchDropdown as De } from "./SearchDropdown.es.js";
|
|
15
|
+
import { ActionList as $e } from "../../ActionList/ActionList.es.js";
|
|
16
|
+
import { useDebounced as ge } from "../../../utils/hooks/useDebounced.es.js";
|
|
17
|
+
import { useEffectAfterMount as _e } from "../../../utils/hooks/useEffectAfterMount.es.js";
|
|
18
|
+
import { Spinner as we } from "../../Spinner/Spinner.es.js";
|
|
19
|
+
import { CloseButton as Ee } from "../../CloseButton/CloseButton.es.js";
|
|
20
|
+
const { baseClassNamePrefix: ke, subElementClassPrefix: o, classModifierPrefix: p } = ue("search"), n = be(
|
|
21
|
+
({
|
|
22
|
+
id: z,
|
|
23
|
+
defaultValue: C = "",
|
|
24
|
+
value: N,
|
|
25
|
+
onChange: a,
|
|
26
|
+
onSearch: U,
|
|
27
|
+
loading: R = !1,
|
|
28
|
+
debounce: W = 200,
|
|
29
|
+
onKeyDown: b,
|
|
30
|
+
label: P,
|
|
31
|
+
contentAfter: v,
|
|
32
|
+
contentBefore: D,
|
|
33
|
+
helperText: $,
|
|
34
|
+
fluid: G,
|
|
35
|
+
width: J,
|
|
36
|
+
theme: g,
|
|
37
|
+
disabled: s,
|
|
38
|
+
hideIcon: Q,
|
|
39
|
+
icon: X = xe,
|
|
40
|
+
error: i,
|
|
41
|
+
readOnly: d,
|
|
42
|
+
clearable: _ = !0,
|
|
43
|
+
noResults: w,
|
|
44
|
+
clearButtonAriaLabel: Y = "Clear search",
|
|
45
|
+
className: Z,
|
|
46
|
+
children: E,
|
|
47
|
+
"aria-describedby": K,
|
|
48
|
+
"aria-labelledby": O,
|
|
49
|
+
"aria-label": k,
|
|
50
|
+
...h
|
|
51
|
+
}, ee) => {
|
|
52
|
+
const { refFn: te, ref: re } = Re(ee), [ae, A] = pe.useState(String(C)), m = N !== void 0, c = m ? String(N) : ae, se = (e) => {
|
|
53
|
+
m || A(e.target.value), a == null || a(e);
|
|
54
|
+
}, { immediate: x, debounced: H } = ge(U, W), ie = (e) => {
|
|
55
|
+
if (b == null || b(e), e.key === "Enter") {
|
|
56
|
+
if (e.isDefaultPrevented() || e.isPropagationStopped())
|
|
57
|
+
return;
|
|
58
|
+
const { activeIndex: l, elementsRef: me } = I, y = l !== null ? me.current[l] : null;
|
|
59
|
+
y && y.getAttribute("aria-disabled") !== "true" ? (e.preventDefault(), y.click()) : l === null && x(c);
|
|
93
60
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
61
|
+
e.key === "Escape" && (!_ || I.open) && e.preventDefault();
|
|
62
|
+
}, { id: u } = f(), { id: M } = f(), { id: V } = f(), { id: B } = f(), F = !!(i != null && i.length), L = !!E || !!w, T = q(
|
|
63
|
+
$ && B,
|
|
64
|
+
F && V,
|
|
65
|
+
K
|
|
66
|
+
), j = O ?? (P ? M : void 0), { dropdownProps: I, getFieldProps: le, getInputProps: oe } = ve({
|
|
67
|
+
enabled: L,
|
|
68
|
+
disabled: !!s,
|
|
69
|
+
readOnly: !!d
|
|
70
|
+
});
|
|
71
|
+
_e(() => {
|
|
72
|
+
H(c);
|
|
73
|
+
}, [c, H]);
|
|
74
|
+
const ce = q(
|
|
75
|
+
r[ke],
|
|
76
|
+
g && fe(g),
|
|
77
|
+
G && r[`${p}fluid`],
|
|
78
|
+
s && r[`${p}disabled`],
|
|
79
|
+
d && r[`${p}read-only`],
|
|
80
|
+
i && r[`${p}error`],
|
|
81
|
+
Z
|
|
82
|
+
), ne = (e) => {
|
|
83
|
+
var l;
|
|
84
|
+
s || e.target instanceof HTMLInputElement || e.target.closest(
|
|
85
|
+
'button,[role="button"],a,[role="link"]'
|
|
86
|
+
) || (e.preventDefault(), e.stopPropagation(), (l = re.current) == null || l.focus());
|
|
87
|
+
}, de = he(() => {
|
|
88
|
+
m ? a == null || a({
|
|
89
|
+
target: {
|
|
90
|
+
value: "",
|
|
91
|
+
name: h.name,
|
|
92
|
+
id: u,
|
|
93
|
+
type: "search"
|
|
94
|
+
}
|
|
95
|
+
}) : A(""), x("");
|
|
96
|
+
}, [u, m, a, x, h.name]);
|
|
97
|
+
return /* @__PURE__ */ S(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
id: z,
|
|
101
|
+
className: ce,
|
|
102
|
+
role: "search",
|
|
103
|
+
style: { maxWidth: J },
|
|
104
|
+
"aria-labelledby": j,
|
|
105
|
+
"aria-label": k,
|
|
106
|
+
"aria-describedby": T,
|
|
107
|
+
"aria-busy": R,
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ t(
|
|
110
|
+
Se,
|
|
111
|
+
{
|
|
112
|
+
ctxDisabled: !!s,
|
|
113
|
+
ctxRequired: !1,
|
|
114
|
+
ctxHtmlFor: u,
|
|
115
|
+
ctxId: M,
|
|
116
|
+
children: P
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ S(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
className: r[`${o}field`],
|
|
123
|
+
...le({ onPointerDown: ne }),
|
|
124
|
+
children: [
|
|
125
|
+
!Q && /* @__PURE__ */ t(Pe, { icon: X, "aria-hidden": !0 }),
|
|
126
|
+
D && /* @__PURE__ */ t("div", { className: r[`${o}content`], children: D }),
|
|
127
|
+
/* @__PURE__ */ t(
|
|
128
|
+
"input",
|
|
129
|
+
{
|
|
130
|
+
id: u,
|
|
131
|
+
type: "search",
|
|
132
|
+
className: r[`${o}field__input`],
|
|
133
|
+
value: c,
|
|
134
|
+
disabled: s,
|
|
135
|
+
readOnly: d,
|
|
136
|
+
"aria-invalid": !!i,
|
|
137
|
+
"aria-labelledby": j,
|
|
138
|
+
"aria-label": k,
|
|
139
|
+
"aria-describedby": T,
|
|
140
|
+
...oe({
|
|
141
|
+
...h,
|
|
142
|
+
onChange: se,
|
|
143
|
+
onKeyDown: ie
|
|
144
|
+
}),
|
|
145
|
+
ref: te
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
R && /* @__PURE__ */ t("div", { className: r[`${o}field__spinner`], children: /* @__PURE__ */ t(we, { size: "xxs" }) }),
|
|
149
|
+
_ && c && !s && !d && /* @__PURE__ */ t(
|
|
150
|
+
Ee,
|
|
151
|
+
{
|
|
152
|
+
onClick: de,
|
|
153
|
+
className: `${o}field__clear-button`,
|
|
154
|
+
size: "sm",
|
|
155
|
+
"aria-label": Y
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
v && /* @__PURE__ */ t("div", { className: r[`${o}content`], children: v })
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
/* @__PURE__ */ S(Ne, { ctxId: B, ctxDisabled: !!s, children: [
|
|
163
|
+
$,
|
|
164
|
+
F && /* @__PURE__ */ t(ye, { id: V, appearance: "negative", children: i })
|
|
165
|
+
] }),
|
|
166
|
+
L && /* @__PURE__ */ t(De, { ...I, children: /* @__PURE__ */ t($e, { role: "listbox", noResults: w, children: E }) })
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
n.displayName = "Search";
|
|
173
|
+
n.Results = Ie;
|
|
174
|
+
n.Results.displayName = "Search.Results";
|
|
175
|
+
n.Results.Item.displayName = "Search.Results.Item";
|
|
176
|
+
n.Results.ViewAll.displayName = "Search.Results.ViewAll";
|
|
158
177
|
export {
|
|
159
|
-
|
|
160
|
-
L as default
|
|
178
|
+
n as Search
|
|
161
179
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),p=require("@floating-ui/react"),_=require("../../Box/Box.cjs.js"),q=require("clsx"),t=require("../../../chunks/classNames.DAeKwerT.js"),N=require("../../../chunks/constants.hwjHOsvT.js"),b=require("../../ActionList/ActionList.context.cjs.js"),g=require("react"),e=require("../../../chunks/Search.Results.BM9NkYBp.js"),h=require("../../../chunks/floatingui.module.D3Aw_aYe.js"),B=require("../../../chunks/popover.module.DGUJIXrP.js"),{baseClassNamePrefix:P}=t.getBEMClassNames("floatingui"),{baseClassNamePrefix:S}=t.getBEMClassNames("popover"),{subElementClassPrefix:w}=t.getBEMClassNames("search"),y=[e.Results,e.Results.Item,e.Results.ViewAll],v=({setOpen:o,isMounted:r,getFloatingProps:a,floatingStyles:i,labelsRef:n,elementsRef:c,getItemProps:u,setFloating:m,theme:l,className:x,children:f,activeIndex:C})=>{const d=g.useCallback(()=>o(!1),[o]);return r?s.jsx(p.FloatingPortal,{children:s.jsx(_.Box,{className:q(l&&N.themeClassName(l),h.floatinguiStyles[P],B.popoverStyles[S],e.styles[`${w}dropdown`],x),...a(),style:i,ref:m,children:s.jsx(b.ActionListContextProvider,{allowChildrenTypes:y,getItemProps:u,itemsFocusable:!1,onItemClick:d,labelsRef:n,elementsRef:c,activeIndex:C,children:f})})}):null};exports.SearchDropdown=v;
|