@getgreenline/blaze-ui 1.0.55-beta.1 → 1.0.55
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/account-switcher/types.d.ts +2 -0
- package/dist/components/account-switcher/types.d.ts.map +1 -1
- package/dist/components/account-switcher.d.ts +1 -1
- package/dist/components/account-switcher.d.ts.map +1 -1
- package/dist/components/account-switcher.js +4 -5
- package/package.json +1 -1
|
@@ -24,6 +24,8 @@ export type AccountSwitcherProps = {
|
|
|
24
24
|
searchable?: boolean;
|
|
25
25
|
/** Placeholder for the search field. */
|
|
26
26
|
searchPlaceholder?: string;
|
|
27
|
+
/** Text shown in the default trigger when no account is selected. */
|
|
28
|
+
triggerPlaceholder?: string;
|
|
27
29
|
/** Message shown when no accounts match the search query. */
|
|
28
30
|
emptyText?: string;
|
|
29
31
|
/** Popover alignment relative to the trigger. Defaults to "start". */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/account-switcher/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAEnC,MAAM,MAAM,OAAO,GAAG;IACpB,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAA;IACV,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,+BAA+B;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uEAAuE;IACvE,aAAa,CAAC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CAAA;IAC3C,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,kEAAkE;IAClE,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC1C,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,wDAAwD;IACxD,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Account, AccountSwitcherProps } from "./account-switcher/types";
|
|
2
|
-
declare function AccountSwitcher({ accounts, value, defaultValue, onValueChange, searchable, searchPlaceholder, emptyText, align, side, className, triggerClassName, trigger, }: AccountSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function AccountSwitcher({ accounts, value, defaultValue, onValueChange, searchable, searchPlaceholder, triggerPlaceholder, emptyText, align, side, className, triggerClassName, trigger, }: AccountSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export { AccountSwitcher };
|
|
4
4
|
export type { Account, AccountSwitcherProps };
|
|
5
5
|
//# sourceMappingURL=account-switcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-switcher.d.ts","sourceRoot":"","sources":["../../src/components/account-switcher.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAE7E,iBAAS,eAAe,CAAC,EACvB,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,aAAa,EACb,UAAiB,EACjB,iBAAwC,EACxC,SAAgC,EAChC,KAAe,EACf,IAAe,EACf,SAAS,EACT,gBAAgB,EAChB,OAAO,GACR,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"account-switcher.d.ts","sourceRoot":"","sources":["../../src/components/account-switcher.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAE7E,iBAAS,eAAe,CAAC,EACvB,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,aAAa,EACb,UAAiB,EACjB,iBAAwC,EACxC,kBAAwC,EACxC,SAAgC,EAChC,KAAe,EACf,IAAe,EACf,SAAS,EACT,gBAAgB,EAChB,OAAO,GACR,EAAE,oBAAoB,2CAqEtB;AAED,OAAO,EAAE,eAAe,EAAE,CAAA;AAC1B,YAAY,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -6,7 +6,7 @@ import { AccountSwitcherList } from './account-switcher/list.js';
|
|
|
6
6
|
import { AccountSwitcherSearch } from './account-switcher/search.js';
|
|
7
7
|
import { AccountSwitcherTrigger } from './account-switcher/trigger.js';
|
|
8
8
|
|
|
9
|
-
function AccountSwitcher({ accounts, value, defaultValue, onValueChange, searchable = true, searchPlaceholder = "Search accounts...", emptyText = "No accounts found.", align = "start", side = "bottom", className, triggerClassName, trigger, }) {
|
|
9
|
+
function AccountSwitcher({ accounts, value, defaultValue, onValueChange, searchable = true, searchPlaceholder = "Search accounts...", triggerPlaceholder = "Select account...", emptyText = "No accounts found.", align = "start", side = "bottom", className, triggerClassName, trigger, }) {
|
|
10
10
|
const [open, setOpen] = React.useState(false);
|
|
11
11
|
const [query, setQuery] = React.useState("");
|
|
12
12
|
const [internalValue, setInternalValue] = React.useState(() => defaultValue ?? accounts[0]?.id ?? "");
|
|
@@ -24,8 +24,7 @@ function AccountSwitcher({ accounts, value, defaultValue, onValueChange, searcha
|
|
|
24
24
|
setInternalValue(accountId);
|
|
25
25
|
}
|
|
26
26
|
onValueChange?.(accountId);
|
|
27
|
-
|
|
28
|
-
setQuery("");
|
|
27
|
+
handleOpenChange(false);
|
|
29
28
|
};
|
|
30
29
|
const handleOpenChange = (nextOpen) => {
|
|
31
30
|
setOpen(nextOpen);
|
|
@@ -33,8 +32,8 @@ function AccountSwitcher({ accounts, value, defaultValue, onValueChange, searcha
|
|
|
33
32
|
setQuery("");
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
|
-
const triggerNode = trigger ?? (jsx(AccountSwitcherTrigger, { account: selected, placeholder:
|
|
37
|
-
return (jsxs(Popover, { open: open, onOpenChange: handleOpenChange, children: [jsx(PopoverTrigger, { asChild: true, children: triggerNode }), jsxs(PopoverContent, { side: side, align: align, className: cn("tw:w-[320px] tw:p-0", className), children: [searchable && (jsx(AccountSwitcherSearch, { value: query, onChange: setQuery, placeholder: searchPlaceholder })), jsx("div", { className: "tw:max-h-[360px] tw:overflow-y-auto tw:p-2", children: jsx(AccountSwitcherList, { accounts: filtered, selectedId:
|
|
35
|
+
const triggerNode = trigger ?? (jsx(AccountSwitcherTrigger, { account: selected, placeholder: triggerPlaceholder, className: triggerClassName }));
|
|
36
|
+
return (jsxs(Popover, { open: open, onOpenChange: handleOpenChange, children: [jsx(PopoverTrigger, { asChild: true, children: triggerNode }), jsxs(PopoverContent, { side: side, align: align, className: cn("tw:w-[320px] tw:p-0", className), children: [searchable && (jsx(AccountSwitcherSearch, { value: query, onChange: setQuery, placeholder: searchPlaceholder })), jsx("div", { className: "tw:max-h-[360px] tw:overflow-y-auto tw:p-2", children: jsx(AccountSwitcherList, { accounts: filtered, selectedId: selected?.id, onSelect: handleSelect, emptyText: emptyText }) })] })] }));
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
export { AccountSwitcher };
|