softable-pixels-web 1.1.15 → 1.1.16
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/{Select-R22kJLFr.js → Select-DFPwAzYG.js} +1 -2
- package/dist/Select-DFPwAzYG.js.map +1 -0
- package/dist/context-menu.d.ts +1 -1
- package/dist/{index-Rsf19S6N.d.ts → index-B96rw-7n.d.ts} +1 -2
- package/dist/{index-liMvHPFh.d.ts → index-C5I_cIP2.d.ts} +3 -3
- package/dist/{index-CvSwNc4e.d.ts → index-C9q8d9Md.d.ts} +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/tab-switch.d.ts +1 -1
- package/package.json +1 -1
- package/dist/Select-R22kJLFr.js.map +0 -1
|
@@ -102,7 +102,6 @@ function createSelectStyles(props) {
|
|
|
102
102
|
display: "flex",
|
|
103
103
|
flexDirection: "column",
|
|
104
104
|
position: "relative",
|
|
105
|
-
isolation: "isolate",
|
|
106
105
|
rowGap: "0.375rem"
|
|
107
106
|
},
|
|
108
107
|
content: {
|
|
@@ -240,4 +239,4 @@ const Select = (props) => {
|
|
|
240
239
|
|
|
241
240
|
//#endregion
|
|
242
241
|
export { Select as t };
|
|
243
|
-
//# sourceMappingURL=Select-
|
|
242
|
+
//# sourceMappingURL=Select-DFPwAzYG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select-DFPwAzYG.js","names":["OptionItem: React.FC<OptionItemProps>","Select: React.FC<SelectProps>"],"sources":["../src/components/commons/inputs/Select/components/OptionItem/styles.ts","../src/components/commons/inputs/Select/components/OptionItem/index.tsx","../src/components/commons/inputs/Select/hooks/useSelect/index.ts","../src/components/commons/inputs/Select/styles.ts","../src/components/commons/inputs/Select/index.tsx"],"sourcesContent":["import { styled } from '@hooks/useThemedStyles/types'\nimport type { OptionItemProps } from './types'\n\nexport function createOptionsStyles(_props: OptionItemProps) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n alignItems: 'center',\n textAlign: 'left',\n\n borderRadius: '0.25rem',\n padding: '0.5rem 0.75rem',\n\n cursor: 'pointer',\n transition: 'background-color 0.2s ease-out',\n\n __rules: {\n '&:hover': {\n backgroundColor: 'var(--px-background-card-hover)'\n },\n\n '&:focus': {\n outlineOffset: '-1px',\n outline: '2px solid var(--px-color-primary)'\n }\n }\n },\n\n text: {\n flex: 1,\n\n fontSize: '1rem',\n fontWeight: 500,\n lineHeight: '1.5rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-primary)',\n\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis'\n }\n })\n}\n","/** biome-ignore-all lint/a11y/useSemanticElements: It's a custom select component */\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { OptionItemProps } from './types'\n\n// Styles\nimport { createOptionsStyles } from './styles'\n\nexport const OptionItem: React.FC<OptionItemProps> = props => {\n // Hooks\n const { styles, classes } = useThemedStyles(props, createOptionsStyles)\n\n // Functions\n function handleClick() {\n props.onClick(props.option.value)\n }\n\n return (\n <button\n type=\"button\"\n role=\"option\"\n style={styles.container}\n className={classes.container}\n aria-label={props.option.label}\n aria-selected={props.isSelected}\n onClick={handleClick}\n >\n <span style={styles.text}>{props.option.label}</span>\n </button>\n )\n}\n","// External Libraries\nimport { useState } from 'react'\n\n// Types\nimport type { SelectProps } from '../../types'\n\nexport function useSelect({\n value,\n multiple,\n canClear,\n onChange\n}: SelectProps) {\n // States\n const [open, setOpen] = useState(false)\n\n // Functions\n function handleOptionClick(option: string) {\n const isAlreadySelected = value.includes(option)\n\n if (!multiple) {\n if (isAlreadySelected) {\n if (canClear) onChange([])\n } else onChange([option])\n\n setOpen(false)\n return\n }\n\n if (isAlreadySelected) {\n if (value.length === 1) {\n if (canClear) onChange([])\n } else onChange(value.filter(v => v !== option))\n } else onChange([...value, option])\n }\n\n function togglePanel() {\n setOpen(prev => !prev)\n }\n\n function closePanel() {\n setOpen(false)\n }\n\n return { open, togglePanel, closePanel, handleOptionClick }\n}\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { SelectProps } from './types'\n\nexport function createSelectStyles(props: SelectProps) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n\n position: 'relative',\n\n rowGap: '0.375rem'\n },\n\n content: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n\n borderWidth: 1,\n columnGap: '0.25rem',\n borderRadius: '0.5rem',\n padding: '0.625rem 0.875rem',\n\n opacity: props.disabled ? 0.5 : 1,\n cursor: props.disabled ? 'not-allowed' : 'pointer',\n boxShadow: 'var(--px-shadow-default)',\n borderColor: props.errorMessage\n ? 'var(--px-color-error)'\n : 'var(--px-border-primary)',\n\n __rules: {\n '&:focus-within': {\n outlineOffset: '-1px',\n outline: `2px solid var(${props.errorMessage ? '--px-color-error' : '--px-color-primary'})`\n }\n }\n },\n\n text: {\n flex: 1,\n\n textAlign: 'left',\n\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n\n fontSize: '1rem',\n lineHeight: '1.5rem',\n fontFamily: 'inherit',\n fontWeight: props.value.length ? 500 : 400,\n color: props.value.length\n ? 'var(--px-text-primary)'\n : 'var(--px-text-secondary)'\n },\n\n error: {\n display: 'block',\n fontWeight: 400,\n lineHeight: '1rem',\n fontSize: '0.75rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-error)'\n },\n\n panel: {\n width: '100%',\n height: '12rem',\n\n display: 'flex',\n flexDirection: 'column',\n\n position: 'absolute',\n top: 'calc(100% + 0.25rem)',\n left: '0',\n zIndex: 10,\n\n overflowY: 'auto',\n overscrollBehavior: 'contain',\n\n borderWidth: 1,\n rowGap: '0.25rem',\n padding: '0.25rem',\n borderRadius: '0.5rem',\n\n backgroundColor: 'var(--px-bg)',\n boxShadow: 'var(--px-shadow-default)',\n borderColor: 'var(--px-border-primary)'\n }\n })\n}\n","/** biome-ignore-all lint/a11y/useSemanticElements: It's a custom select component */\n// External Libraries\nimport type React from 'react'\nimport { useMemo } from 'react'\n\n// Components\nimport { Label } from '@components/commons/Label'\nimport { OptionItem } from './components/OptionItem'\nimport { Icon } from '@components/commons/toolkit/Icon'\n\n// Hooks\nimport { useSelect } from './hooks/useSelect'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { SelectProps } from './types'\n\n// Styles\nimport { createSelectStyles } from './styles'\n\nexport const Select: React.FC<SelectProps> = props => {\n // Hooks\n const { open, togglePanel, handleOptionClick } = useSelect(props)\n const { styles, classes } = useThemedStyles(props, createSelectStyles, {\n pick: p => [p.disabled, p.errorMessage, p.value],\n override: props.styles,\n applyCommonProps: true,\n commonSlot: 'container'\n })\n\n // Constants\n const maxVisible = props.maxVisibleItems ?? Infinity\n const optionsMap = useMemo(\n () => new Map(props.options.map(option => [option.value, option.label])),\n [props.options]\n )\n\n // Functions\n function renderContent() {\n if (!props.value?.length) return props.placeholder\n\n const resolvedValues = props.value.map(val => optionsMap.get(val) ?? val)\n\n const visibleItems = resolvedValues.slice(0, maxVisible)\n const hiddenCount = resolvedValues.length - visibleItems.length\n\n let result = visibleItems.join(', ')\n if (hiddenCount > 0) result += ` +${hiddenCount}`\n\n return result\n }\n\n return (\n <div style={styles.container}>\n {props.hideLabel ? null : (\n <Label\n label={props.label}\n required={props.required}\n requiredColor={props.requiredColor}\n {...props.labelConfig}\n />\n )}\n\n <button\n dir=\"ltr\"\n type=\"button\"\n role=\"combobox\"\n aria-expanded={open}\n style={styles.content}\n aria-autocomplete=\"none\"\n aria-label={props.label}\n className={classes.content}\n onClick={togglePanel}\n >\n {props.startIcon}\n\n <span id=\"text-content\" style={styles.text}>\n {renderContent()}\n </span>\n\n <Icon size=\"sm\" name=\"chevrons-down\" />\n </button>\n\n {open ? (\n <div style={styles.panel}>\n {props.options.map(option => (\n <OptionItem\n key={option.value}\n option={option}\n isSelected={props.value.includes(option.value)}\n onClick={handleOptionClick}\n />\n ))}\n </div>\n ) : null}\n\n {props.errorMessage ? (\n <span style={styles.error}>{props.errorMessage}</span>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;;;;AAGA,SAAgB,oBAAoB,QAAyB;AAC3D,QAAO,OAAO;EACZ,WAAW;GACT,OAAO;GAEP,SAAS;GACT,YAAY;GACZ,WAAW;GAEX,cAAc;GACd,SAAS;GAET,QAAQ;GACR,YAAY;GAEZ,SAAS;IACP,WAAW,EACT,iBAAiB,mCAClB;IAED,WAAW;KACT,eAAe;KACf,SAAS;KACV;IACF;GACF;EAED,MAAM;GACJ,MAAM;GAEN,UAAU;GACV,YAAY;GACZ,YAAY;GACZ,YAAY;GACZ,OAAO;GAEP,UAAU;GACV,YAAY;GACZ,cAAc;GACf;EACF,CAAC;;;;;;ACjCJ,MAAaA,cAAwC,UAAS;CAE5D,MAAM,EAAE,QAAQ,YAAY,gBAAgB,OAAO,oBAAoB;CAGvE,SAAS,cAAc;AACrB,QAAM,QAAQ,MAAM,OAAO,MAAM;;AAGnC,QACE,oBAAC;EACC,MAAK;EACL,MAAK;EACL,OAAO,OAAO;EACd,WAAW,QAAQ;EACnB,cAAY,MAAM,OAAO;EACzB,iBAAe,MAAM;EACrB,SAAS;YAET,oBAAC;GAAK,OAAO,OAAO;aAAO,MAAM,OAAO;IAAa;GAC9C;;;;;ACxBb,SAAgB,UAAU,EACxB,OACA,UACA,UACA,YACc;CAEd,MAAM,CAAC,MAAM,WAAW,SAAS,MAAM;CAGvC,SAAS,kBAAkB,QAAgB;EACzC,MAAM,oBAAoB,MAAM,SAAS,OAAO;AAEhD,MAAI,CAAC,UAAU;AACb,OAAI,mBACF;QAAI,SAAU,UAAS,EAAE,CAAC;SACrB,UAAS,CAAC,OAAO,CAAC;AAEzB,WAAQ,MAAM;AACd;;AAGF,MAAI,kBACF,KAAI,MAAM,WAAW,GACnB;OAAI,SAAU,UAAS,EAAE,C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KACE,GACJ;GAEH,MAAM,eACL,oBAAC;IAAK,OAAO,OAAO;cAAQ,MAAM;KAAoB,GACpD;;GACA"}
|
package/dist/context-menu.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as types_d_exports, t as ContextMenu } from "./index-
|
|
1
|
+
import { n as types_d_exports, t as ContextMenu } from "./index-C5I_cIP2.js";
|
|
2
2
|
export { ContextMenu, types_d_exports as T };
|
|
@@ -9,7 +9,6 @@ declare function createSelectStyles(props: SelectProps): {
|
|
|
9
9
|
display: "flex";
|
|
10
10
|
flexDirection: "column";
|
|
11
11
|
position: "relative";
|
|
12
|
-
isolation: "isolate";
|
|
13
12
|
rowGap: string;
|
|
14
13
|
};
|
|
15
14
|
content: {
|
|
@@ -101,4 +100,4 @@ interface SelectOption {
|
|
|
101
100
|
declare const Select: React$1.FC<SelectProps>;
|
|
102
101
|
//#endregion
|
|
103
102
|
export { Select as t };
|
|
104
|
-
//# sourceMappingURL=index-
|
|
103
|
+
//# sourceMappingURL=index-B96rw-7n.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as Placement } from "./types-CGI_6rDa.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region rolldown:runtime
|
|
6
6
|
//#endregion
|
|
@@ -69,7 +69,7 @@ interface ContextMenuProps<T> {
|
|
|
69
69
|
}
|
|
70
70
|
//#endregion
|
|
71
71
|
//#region src/components/commons/toolkit/ContextMenu/index.d.ts
|
|
72
|
-
declare const ContextMenu: <T extends string>(props: ContextMenuProps<T>) =>
|
|
72
|
+
declare const ContextMenu: <T extends string>(props: ContextMenuProps<T>) => react_jsx_runtime1.JSX.Element;
|
|
73
73
|
//#endregion
|
|
74
74
|
export { types_d_exports as n, ContextMenu as t };
|
|
75
|
-
//# sourceMappingURL=index-
|
|
75
|
+
//# sourceMappingURL=index-C5I_cIP2.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as CommonStyleProps } from "./styleProps-DEmfU40p.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/commons/toolkit/TabSwitch/styles.d.ts
|
|
6
6
|
declare function createTabSwitchStyles<T>(props: TabSwitchProps<T>): {
|
|
@@ -41,7 +41,7 @@ interface TabSwitchProps<T> extends CommonStyleProps {
|
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/components/commons/toolkit/TabSwitch/index.d.ts
|
|
44
|
-
declare const TabSwitch: <T>(props: TabSwitchProps<T>) =>
|
|
44
|
+
declare const TabSwitch: <T>(props: TabSwitchProps<T>) => react_jsx_runtime0.JSX.Element;
|
|
45
45
|
//#endregion
|
|
46
46
|
export { SwitchOption as n, TabSwitchProps as r, TabSwitch as t };
|
|
47
|
-
//# sourceMappingURL=index-
|
|
47
|
+
//# sourceMappingURL=index-C9q8d9Md.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { n as types_d_exports, t as ContextMenu } from "./index-
|
|
1
|
+
import { n as types_d_exports, t as ContextMenu } from "./index-C5I_cIP2.js";
|
|
2
2
|
import "./types-0c2OAbj2.js";
|
|
3
3
|
import { t as Button } from "./index-Cz1S_fwn.js";
|
|
4
4
|
import { t as IconButton } from "./index-DDvfWEcX.js";
|
|
5
5
|
import { t as Input } from "./index-ZGo_xs-Q.js";
|
|
6
|
-
import { t as Select } from "./index-
|
|
6
|
+
import { t as Select } from "./index-B96rw-7n.js";
|
|
7
7
|
import { t as TextArea } from "./index--Oqbm-1T.js";
|
|
8
8
|
import { t as CheckItem } from "./index-CM9BXEm3.js";
|
|
9
9
|
import { t as Checkbox } from "./index-jLN0CEbk.js";
|
|
10
10
|
import { InfoSummary, InfoSummaryItem, InfoSummaryProps } from "./info-summary.js";
|
|
11
11
|
import { t as Popover } from "./index-CQWwox_y.js";
|
|
12
12
|
import { t as Switch } from "./index-Bw_XZiTz.js";
|
|
13
|
-
import { n as SwitchOption, r as TabSwitchProps, t as TabSwitch } from "./index-
|
|
13
|
+
import { n as SwitchOption, r as TabSwitchProps, t as TabSwitch } from "./index-C9q8d9Md.js";
|
|
14
14
|
import { Typography } from "./typography.js";
|
|
15
15
|
import { a as ThemeName, c as ThemeRegistry, i as ThemeMode, l as ThemeTokens, n as useTheme, o as ThemePersistence, r as ThemeContextData, s as ThemeProviderProps, t as ThemeProvider } from "./index-BLvNLvv2.js";
|
|
16
16
|
import { useDismiss } from "./use-dismiss.js";
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { t as Button } from "./Button-DOEMYhEA.js";
|
|
|
15
15
|
import { t as IconButton } from "./IconButton-DZjuxp2Q.js";
|
|
16
16
|
import "./Label-BVkidQlv.js";
|
|
17
17
|
import { t as Input } from "./Input-B0J7yEux.js";
|
|
18
|
-
import { t as Select } from "./Select-
|
|
18
|
+
import { t as Select } from "./Select-DFPwAzYG.js";
|
|
19
19
|
import { t as TextArea } from "./TextArea-DGCFyZrW.js";
|
|
20
20
|
import { useVirtualAnchor } from "./use-virtual-anchor.js";
|
|
21
21
|
|
package/dist/select.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Select } from "./index-
|
|
1
|
+
import { t as Select } from "./index-B96rw-7n.js";
|
|
2
2
|
export { Select };
|
package/dist/select.js
CHANGED
|
@@ -2,6 +2,6 @@ import "./useThemedStyles-D4si38PM.js";
|
|
|
2
2
|
import "./Icon-kjpHbCbF.js";
|
|
3
3
|
import "./Typography-CHkdzH2K.js";
|
|
4
4
|
import "./Label-BVkidQlv.js";
|
|
5
|
-
import { t as Select } from "./Select-
|
|
5
|
+
import { t as Select } from "./Select-DFPwAzYG.js";
|
|
6
6
|
|
|
7
7
|
export { Select };
|
package/dist/tab-switch.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SwitchOption, r as TabSwitchProps, t as TabSwitch } from "./index-
|
|
1
|
+
import { n as SwitchOption, r as TabSwitchProps, t as TabSwitch } from "./index-C9q8d9Md.js";
|
|
2
2
|
export { SwitchOption, TabSwitch, TabSwitchProps };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select-R22kJLFr.js","names":["OptionItem: React.FC<OptionItemProps>","Select: React.FC<SelectProps>"],"sources":["../src/components/commons/inputs/Select/components/OptionItem/styles.ts","../src/components/commons/inputs/Select/components/OptionItem/index.tsx","../src/components/commons/inputs/Select/hooks/useSelect/index.ts","../src/components/commons/inputs/Select/styles.ts","../src/components/commons/inputs/Select/index.tsx"],"sourcesContent":["import { styled } from '@hooks/useThemedStyles/types'\nimport type { OptionItemProps } from './types'\n\nexport function createOptionsStyles(_props: OptionItemProps) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n alignItems: 'center',\n textAlign: 'left',\n\n borderRadius: '0.25rem',\n padding: '0.5rem 0.75rem',\n\n cursor: 'pointer',\n transition: 'background-color 0.2s ease-out',\n\n __rules: {\n '&:hover': {\n backgroundColor: 'var(--px-background-card-hover)'\n },\n\n '&:focus': {\n outlineOffset: '-1px',\n outline: '2px solid var(--px-color-primary)'\n }\n }\n },\n\n text: {\n flex: 1,\n\n fontSize: '1rem',\n fontWeight: 500,\n lineHeight: '1.5rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-primary)',\n\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis'\n }\n })\n}\n","/** biome-ignore-all lint/a11y/useSemanticElements: It's a custom select component */\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { OptionItemProps } from './types'\n\n// Styles\nimport { createOptionsStyles } from './styles'\n\nexport const OptionItem: React.FC<OptionItemProps> = props => {\n // Hooks\n const { styles, classes } = useThemedStyles(props, createOptionsStyles)\n\n // Functions\n function handleClick() {\n props.onClick(props.option.value)\n }\n\n return (\n <button\n type=\"button\"\n role=\"option\"\n style={styles.container}\n className={classes.container}\n aria-label={props.option.label}\n aria-selected={props.isSelected}\n onClick={handleClick}\n >\n <span style={styles.text}>{props.option.label}</span>\n </button>\n )\n}\n","// External Libraries\nimport { useState } from 'react'\n\n// Types\nimport type { SelectProps } from '../../types'\n\nexport function useSelect({\n value,\n multiple,\n canClear,\n onChange\n}: SelectProps) {\n // States\n const [open, setOpen] = useState(false)\n\n // Functions\n function handleOptionClick(option: string) {\n const isAlreadySelected = value.includes(option)\n\n if (!multiple) {\n if (isAlreadySelected) {\n if (canClear) onChange([])\n } else onChange([option])\n\n setOpen(false)\n return\n }\n\n if (isAlreadySelected) {\n if (value.length === 1) {\n if (canClear) onChange([])\n } else onChange(value.filter(v => v !== option))\n } else onChange([...value, option])\n }\n\n function togglePanel() {\n setOpen(prev => !prev)\n }\n\n function closePanel() {\n setOpen(false)\n }\n\n return { open, togglePanel, closePanel, handleOptionClick }\n}\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { SelectProps } from './types'\n\nexport function createSelectStyles(props: SelectProps) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n\n position: 'relative',\n isolation: 'isolate',\n\n rowGap: '0.375rem'\n },\n\n content: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n\n borderWidth: 1,\n columnGap: '0.25rem',\n borderRadius: '0.5rem',\n padding: '0.625rem 0.875rem',\n\n opacity: props.disabled ? 0.5 : 1,\n cursor: props.disabled ? 'not-allowed' : 'pointer',\n boxShadow: 'var(--px-shadow-default)',\n borderColor: props.errorMessage\n ? 'var(--px-color-error)'\n : 'var(--px-border-primary)',\n\n __rules: {\n '&:focus-within': {\n outlineOffset: '-1px',\n outline: `2px solid var(${props.errorMessage ? '--px-color-error' : '--px-color-primary'})`\n }\n }\n },\n\n text: {\n flex: 1,\n\n textAlign: 'left',\n\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n\n fontSize: '1rem',\n lineHeight: '1.5rem',\n fontFamily: 'inherit',\n fontWeight: props.value.length ? 500 : 400,\n color: props.value.length\n ? 'var(--px-text-primary)'\n : 'var(--px-text-secondary)'\n },\n\n error: {\n display: 'block',\n fontWeight: 400,\n lineHeight: '1rem',\n fontSize: '0.75rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-error)'\n },\n\n panel: {\n width: '100%',\n height: '12rem',\n\n display: 'flex',\n flexDirection: 'column',\n\n position: 'absolute',\n top: 'calc(100% + 0.25rem)',\n left: '0',\n zIndex: 10,\n\n overflowY: 'auto',\n overscrollBehavior: 'contain',\n\n borderWidth: 1,\n rowGap: '0.25rem',\n padding: '0.25rem',\n borderRadius: '0.5rem',\n\n backgroundColor: 'var(--px-bg)',\n boxShadow: 'var(--px-shadow-default)',\n borderColor: 'var(--px-border-primary)'\n }\n })\n}\n","/** biome-ignore-all lint/a11y/useSemanticElements: It's a custom select component */\n// External Libraries\nimport type React from 'react'\nimport { useMemo } from 'react'\n\n// Components\nimport { Label } from '@components/commons/Label'\nimport { OptionItem } from './components/OptionItem'\nimport { Icon } from '@components/commons/toolkit/Icon'\n\n// Hooks\nimport { useSelect } from './hooks/useSelect'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { SelectProps } from './types'\n\n// Styles\nimport { createSelectStyles } from './styles'\n\nexport const Select: React.FC<SelectProps> = props => {\n // Hooks\n const { open, togglePanel, handleOptionClick } = useSelect(props)\n const { styles, classes } = useThemedStyles(props, createSelectStyles, {\n pick: p => [p.disabled, p.errorMessage, p.value],\n override: props.styles,\n applyCommonProps: true,\n commonSlot: 'container'\n })\n\n // Constants\n const maxVisible = props.maxVisibleItems ?? Infinity\n const optionsMap = useMemo(\n () => new Map(props.options.map(option => [option.value, option.label])),\n [props.options]\n )\n\n // Functions\n function renderContent() {\n if (!props.value?.length) return props.placeholder\n\n const resolvedValues = props.value.map(val => optionsMap.get(val) ?? val)\n\n const visibleItems = resolvedValues.slice(0, maxVisible)\n const hiddenCount = resolvedValues.length - visibleItems.length\n\n let result = visibleItems.join(', ')\n if (hiddenCount > 0) result += ` +${hiddenCount}`\n\n return result\n }\n\n return (\n <div style={styles.container}>\n {props.hideLabel ? null : (\n <Label\n label={props.label}\n required={props.required}\n requiredColor={props.requiredColor}\n {...props.labelConfig}\n />\n )}\n\n <button\n dir=\"ltr\"\n type=\"button\"\n role=\"combobox\"\n aria-expanded={open}\n style={styles.content}\n aria-autocomplete=\"none\"\n aria-label={props.label}\n className={classes.content}\n onClick={togglePanel}\n >\n {props.startIcon}\n\n <span id=\"text-content\" style={styles.text}>\n {renderContent()}\n </span>\n\n <Icon size=\"sm\" name=\"chevrons-down\" />\n </button>\n\n {open ? (\n <div style={styles.panel}>\n {props.options.map(option => (\n <OptionItem\n key={option.value}\n option={option}\n isSelected={props.value.includes(option.value)}\n onClick={handleOptionClick}\n />\n ))}\n </div>\n ) : null}\n\n {props.errorMessage ? (\n <span style={styles.error}>{props.errorMessage}</span>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;;;;AAGA,SAAgB,oBAAoB,QAAyB;AAC3D,QAAO,OAAO;EACZ,WAAW;GACT,OAAO;GAEP,SAAS;GACT,YAAY;GACZ,WAAW;GAEX,cAAc;GACd,SAAS;GAET,QAAQ;GACR,YAAY;GAEZ,SAAS;IACP,WAAW,EACT,iBAAiB,mCAClB;IAED,WAAW;KACT,eAAe;KACf,SAAS;KACV;IACF;GACF;EAED,MAAM;GACJ,MAAM;GAEN,UAAU;GACV,YAAY;GACZ,YAAY;GACZ,YAAY;GACZ,OAAO;GAEP,UAAU;GACV,YAAY;GACZ,cAAc;GACf;EACF,CAAC;;;;;;ACjCJ,MAAaA,cAAwC,UAAS;CAE5D,MAAM,EAAE,QAAQ,YAAY,gBAAgB,OAAO,oBAAo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