softable-pixels-web 1.1.17 → 1.1.18
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/{BasePopover-DOi9H3B4.js → BasePopover-DaG1Bad1.js} +7 -5
- package/dist/BasePopover-DaG1Bad1.js.map +1 -0
- package/dist/{Button-A1POxp3L.js → Button-DiBsoNFU.js} +1 -1
- package/dist/{Button-A1POxp3L.js.map → Button-DiBsoNFU.js.map} +1 -1
- package/dist/{ContextMenu-l9GdmRqh.js → ContextMenu-DBEnLqgp.js} +6 -5
- package/dist/ContextMenu-DBEnLqgp.js.map +1 -0
- package/dist/{IconButton-CH8DZizu.js → IconButton-DAZvE8i5.js} +1 -1
- package/dist/{IconButton-CH8DZizu.js.map → IconButton-DAZvE8i5.js.map} +1 -1
- package/dist/{Input-FFQ1J5SC.js → Input-B6a6mXsZ.js} +2 -2
- package/dist/{Input-FFQ1J5SC.js.map → Input-B6a6mXsZ.js.map} +1 -1
- package/dist/{Label-C5AIUqYV.js → Label-BHq2knad.js} +1 -1
- package/dist/{Label-C5AIUqYV.js.map → Label-BHq2knad.js.map} +1 -1
- package/dist/{Popover-B6DCtCvD.js → Popover-CeU8aanh.js} +32 -4
- package/dist/Popover-CeU8aanh.js.map +1 -0
- package/dist/{Select-DtU_3TOA.js → Select-CkeZfibD.js} +8 -6
- package/dist/Select-CkeZfibD.js.map +1 -0
- package/dist/TextArea-Oqw0zh_x.js +135 -0
- package/dist/TextArea-Oqw0zh_x.js.map +1 -0
- package/dist/base-popover.d.ts +3 -2
- package/dist/base-popover.js +2 -2
- package/dist/button.js +1 -1
- package/dist/check-item.d.ts +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/context-menu.d.ts +1 -1
- package/dist/context-menu.js +3 -2
- package/dist/icon-button.js +1 -1
- package/dist/{index-fjoAYF43.d.ts → index-BD5ThARj.d.ts} +1 -1
- package/dist/{index-B_Soaf4t.d.ts → index-BD5Vr9sw.d.ts} +25 -9
- package/dist/{index-B1ejLAYY.d.ts → index-BDr6Gid4.d.ts} +4 -4
- package/dist/{index-QQdIoKht.d.ts → index-BymgvkBq.d.ts} +1 -1
- package/dist/{index-Dud1UL9T.d.ts → index-C5UBhjvX.d.ts} +5 -1
- package/dist/{index-BWV7SXNm.d.ts → index-CzB15994.d.ts} +1 -1
- package/dist/{index-DpH49YA0.d.ts → index-D-9XHxWM.d.ts} +3 -3
- package/dist/{index-CdNWNIsY.d.ts → index-DiIBw1ed.d.ts} +8 -3
- package/dist/index-DlKVR1LO.d.ts +9 -0
- package/dist/{index-DZE-RE4B.d.ts → index-aQIW73fh.d.ts} +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.js +9 -9
- package/dist/input.js +2 -2
- package/dist/popover.d.ts +2 -1
- package/dist/popover.js +1 -1
- package/dist/select.d.ts +2 -1
- package/dist/select.js +4 -4
- package/dist/switch.d.ts +1 -1
- package/dist/tab-switch.d.ts +1 -1
- package/dist/text-area.d.ts +1 -2
- package/dist/text-area.js +2 -2
- package/dist/theme-context.d.ts +1 -1
- package/dist/{index-CNn6Rkw1.d.ts → types-C2C3tKY8.d.ts} +5 -7
- package/dist/{types-V8tEaVpX.d.ts → types-CCfbRgMy.d.ts} +1 -1
- package/dist/use-floating.d.ts +1 -1
- package/package.json +1 -1
- package/dist/BasePopover-DOi9H3B4.js.map +0 -1
- package/dist/ContextMenu-l9GdmRqh.js.map +0 -1
- package/dist/Popover-B6DCtCvD.js.map +0 -1
- package/dist/Select-DtU_3TOA.js.map +0 -1
- package/dist/TextArea-DY7hxFbx.js +0 -113
- package/dist/TextArea-DY7hxFbx.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea-Oqw0zh_x.js","names":[],"sources":["../src/components/commons/inputs/TextArea/styles.ts","../src/components/commons/inputs/TextArea/index.tsx"],"sourcesContent":["// Types\nimport { styled } from '@hooks/useThemedStyles/types'\nimport type { TextAreaProps } from './types'\n\nexport function createTextAreaStyles(props: TextAreaProps) {\n const { height = '8rem', readOnly, startIcon } = props\n\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n\n rowGap: '0.375rem'\n },\n iconContainer: {\n position: 'absolute',\n left: '0.75rem',\n top: '1.375rem',\n transform: 'translateY(-50%)'\n },\n textArea: {\n height,\n width: '100%',\n paddingBlock: '0.75rem',\n paddingInline: '0.875rem',\n borderWidth: 1,\n borderRadius: '0.5rem',\n resize: 'none',\n\n fontWeight: '400',\n fontSize: '1rem',\n color: 'var(--px-text-primary)',\n\n borderColor: props.errorMessage\n ? 'var(--px-color-error)'\n : 'var(--px-border-primary)',\n outlineOffset: '-1px',\n\n cursor: readOnly ? 'default' : undefined,\n paddingLeft: startIcon ? '2.5rem' : undefined,\n\n __rules: {\n '&::placeholder': {\n fontWeight: 400,\n color: 'var(--px-text-secondary)'\n },\n '&:focus-within': {\n outlineOffset: '-1px',\n outline: `2px solid var(${props.errorMessage ? '--px-color-error' : '--px-color-primary'})`\n }\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}\n","// External Libraries\nimport { useId } from 'react'\n\n// Types\nimport type { TextAreaProps } from './types'\n\n// Components\nimport { Label } from '@components/commons/toolkit/Label'\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Styles\nimport { createTextAreaStyles } from './styles'\n\nexport const TextArea = (props: TextAreaProps) => {\n const {\n value,\n disabled,\n readOnly,\n maxLength,\n hideMaxLength,\n textMaxLength,\n placeholder,\n errorMessage,\n\n label,\n required,\n requiredColor,\n labelConfig,\n\n startIcon,\n iconColor\n } = props\n\n // Hooks\n const inputId = useId()\n\n const { styles, classes } = useThemedStyles(props, createTextAreaStyles, {\n pick: p => [\n p.height,\n p.readOnly,\n p.startIcon,\n p.placeholderColor,\n p.focusedRingColor\n ],\n override: props.styles,\n applyCommonProps: true\n })\n\n // Functions\n function handleChange(e: React.ChangeEvent<HTMLTextAreaElement>) {\n if (disabled || readOnly) return\n props.onChange?.(e.target.value)\n }\n\n function renderLabel() {\n if (!label) return null\n\n return (\n <div>\n <Label\n label={label}\n htmlFor={inputId}\n required={required}\n requiredColor={requiredColor}\n {...labelConfig}\n />\n </div>\n )\n }\n\n return (\n <div style={styles.container}>\n {renderLabel()}\n\n <div style={{ position: 'relative' }}>\n {startIcon && (\n <div style={styles.iconContainer}>\n <Icon\n name={startIcon}\n color={iconColor ? iconColor : 'var(--px-text-primary)'}\n />\n </div>\n )}\n\n <textarea\n value={value}\n disabled={disabled}\n readOnly={readOnly}\n maxLength={maxLength}\n placeholder={placeholder}\n style={styles.textArea}\n className={classes.textArea}\n onChange={handleChange}\n />\n </div>\n\n {maxLength && !hideMaxLength ? (\n <Typography variant=\"b2\" styles={{ text: { marginLeft: 'auto' } }}>\n {value?.length}/{maxLength} {textMaxLength}\n </Typography>\n ) : null}\n\n {errorMessage ? <span style={styles.error}>{errorMessage}</span> : null}\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAIA,SAAgB,qBAAqB,OAAsB;CACzD,MAAM,EAAE,SAAS,QAAQ,UAAU,cAAc;AAEjD,QAAO,OAAO;EACZ,WAAW;GACT,OAAO;GAEP,SAAS;GACT,eAAe;GAEf,QAAQ;GACT;EACD,eAAe;GACb,UAAU;GACV,MAAM;GACN,KAAK;GACL,WAAW;GACZ;EACD,UAAU;GACR;GACA,OAAO;GACP,cAAc;GACd,eAAe;GACf,aAAa;GACb,cAAc;GACd,QAAQ;GAER,YAAY;GACZ,UAAU;GACV,OAAO;GAEP,aAAa,MAAM,eACf,0BACA;GACJ,eAAe;GAEf,QAAQ,WAAW,YAAY;GAC/B,aAAa,YAAY,WAAW;GAEpC,SAAS;IACP,kBAAkB;KAChB,YAAY;KACZ,OAAO;KACR;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base-popover.d.ts
CHANGED
package/dist/base-popover.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./useThemedStyles-CrarDyWc.js";
|
|
2
2
|
import "./useDismiss-CAEk_GV-.js";
|
|
3
3
|
import "./useFloating-cvZUo5wI.js";
|
|
4
|
-
import "./Popover-
|
|
5
|
-
import { t as BasePopover } from "./BasePopover-
|
|
4
|
+
import "./Popover-CeU8aanh.js";
|
|
5
|
+
import { t as BasePopover } from "./BasePopover-DaG1Bad1.js";
|
|
6
6
|
|
|
7
7
|
export { BasePopover };
|
package/dist/button.js
CHANGED
package/dist/check-item.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as CheckItem } from "./index-
|
|
1
|
+
import { t as CheckItem } from "./index-CzB15994.js";
|
|
2
2
|
export { CheckItem };
|
package/dist/checkbox.d.ts
CHANGED
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-BDr6Gid4.js";
|
|
2
2
|
export { ContextMenu, types_d_exports as ContextMenuTypes };
|
package/dist/context-menu.js
CHANGED
|
@@ -2,8 +2,9 @@ import "./useThemedStyles-CrarDyWc.js";
|
|
|
2
2
|
import "./Switch-DJNZbvzy.js";
|
|
3
3
|
import "./useDismiss-CAEk_GV-.js";
|
|
4
4
|
import "./useFloating-cvZUo5wI.js";
|
|
5
|
-
import "./Popover-
|
|
5
|
+
import "./Popover-CeU8aanh.js";
|
|
6
6
|
import "./Typography-BkFV7BhK.js";
|
|
7
|
-
import { n as types_exports, t as ContextMenu } from "./ContextMenu-
|
|
7
|
+
import { n as types_exports, t as ContextMenu } from "./ContextMenu-DBEnLqgp.js";
|
|
8
|
+
import "./BasePopover-DaG1Bad1.js";
|
|
8
9
|
|
|
9
10
|
export { ContextMenu, types_exports as ContextMenuTypes };
|
package/dist/icon-button.js
CHANGED
|
@@ -292,4 +292,4 @@ declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
|
292
292
|
declare function useTheme(): ThemeContextData;
|
|
293
293
|
//#endregion
|
|
294
294
|
export { ThemeName as a, ThemeRegistry as c, ThemeMode as i, ThemeTokens as l, useTheme as n, ThemePersistence as o, ThemeContextData as r, ThemeProviderProps as s, ThemeProvider as t };
|
|
295
|
-
//# sourceMappingURL=index-
|
|
295
|
+
//# sourceMappingURL=index-BD5ThARj.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as TextProps } from "./styleProps-B2pBEf9N.js";
|
|
2
2
|
import { SVGProps } from "react";
|
|
3
3
|
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -82,6 +82,12 @@ type IconName = keyof typeof icons;
|
|
|
82
82
|
//#endregion
|
|
83
83
|
//#region src/components/commons/inputs/TextArea/styles.d.ts
|
|
84
84
|
declare function createTextAreaStyles(props: TextAreaProps): {
|
|
85
|
+
container: {
|
|
86
|
+
width: string;
|
|
87
|
+
display: "flex";
|
|
88
|
+
flexDirection: "column";
|
|
89
|
+
rowGap: string;
|
|
90
|
+
};
|
|
85
91
|
iconContainer: {
|
|
86
92
|
position: "absolute";
|
|
87
93
|
left: string;
|
|
@@ -93,29 +99,40 @@ declare function createTextAreaStyles(props: TextAreaProps): {
|
|
|
93
99
|
width: string;
|
|
94
100
|
paddingBlock: string;
|
|
95
101
|
paddingInline: string;
|
|
102
|
+
borderWidth: number;
|
|
96
103
|
borderRadius: string;
|
|
97
104
|
resize: "none";
|
|
98
105
|
fontWeight: "400";
|
|
99
106
|
fontSize: string;
|
|
100
107
|
color: "var(--px-text-primary)";
|
|
101
|
-
|
|
108
|
+
borderColor: "var(--px-color-error)" | "var(--px-border-primary)";
|
|
102
109
|
outlineOffset: string;
|
|
103
110
|
cursor: "default" | undefined;
|
|
104
111
|
paddingLeft: string | undefined;
|
|
105
112
|
__rules: {
|
|
106
113
|
'&::placeholder': {
|
|
107
|
-
|
|
114
|
+
fontWeight: number;
|
|
115
|
+
color: "var(--px-text-secondary)";
|
|
108
116
|
};
|
|
109
|
-
'&:focus': {
|
|
117
|
+
'&:focus-within': {
|
|
118
|
+
outlineOffset: string;
|
|
110
119
|
outline: string;
|
|
111
120
|
};
|
|
112
121
|
};
|
|
113
122
|
};
|
|
123
|
+
error: {
|
|
124
|
+
display: "block";
|
|
125
|
+
fontWeight: number;
|
|
126
|
+
lineHeight: string;
|
|
127
|
+
fontSize: string;
|
|
128
|
+
fontFamily: "inherit";
|
|
129
|
+
color: "var(--px-text-error)";
|
|
130
|
+
};
|
|
114
131
|
};
|
|
115
132
|
//#endregion
|
|
116
133
|
//#region src/components/commons/inputs/TextArea/types.d.ts
|
|
117
134
|
interface TextAreaProps {
|
|
118
|
-
value
|
|
135
|
+
value?: string;
|
|
119
136
|
label?: string;
|
|
120
137
|
placeholder?: string;
|
|
121
138
|
styles?: Partial<ReturnType<typeof createTextAreaStyles>>;
|
|
@@ -127,13 +144,12 @@ interface TextAreaProps {
|
|
|
127
144
|
maxLength?: number;
|
|
128
145
|
hideMaxLength?: boolean;
|
|
129
146
|
textMaxLength?: string;
|
|
147
|
+
errorMessage?: string;
|
|
130
148
|
iconColor?: string;
|
|
131
149
|
placeholderColor?: string;
|
|
132
150
|
focusedRingColor?: string;
|
|
133
151
|
requiredColor?: string;
|
|
134
|
-
|
|
135
|
-
labelWeight?: string;
|
|
136
|
-
labelVariant?: TypographyVariant;
|
|
152
|
+
labelConfig?: TextProps;
|
|
137
153
|
onChange?: (value: string) => void;
|
|
138
154
|
}
|
|
139
155
|
//#endregion
|
|
@@ -141,4 +157,4 @@ interface TextAreaProps {
|
|
|
141
157
|
declare const TextArea: (props: TextAreaProps) => react_jsx_runtime3.JSX.Element;
|
|
142
158
|
//#endregion
|
|
143
159
|
export { TextArea as t };
|
|
144
|
-
//# sourceMappingURL=index-
|
|
160
|
+
//# sourceMappingURL=index-BD5Vr9sw.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as Placement } from "./types-
|
|
1
|
+
import { n as Placement } from "./types-CCfbRgMy.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/commons/toolkit/ContextMenu/styles.d.ts
|
|
6
6
|
declare function createContextMenuStyles<T>(_props: ContextMenuProps<T>): {
|
|
@@ -67,7 +67,7 @@ interface ContextMenuProps<T> {
|
|
|
67
67
|
}
|
|
68
68
|
//#endregion
|
|
69
69
|
//#region src/components/commons/toolkit/ContextMenu/index.d.ts
|
|
70
|
-
declare const ContextMenu: <T extends string>(props: ContextMenuProps<T>) =>
|
|
70
|
+
declare const ContextMenu: <T extends string>(props: ContextMenuProps<T>) => react_jsx_runtime2.JSX.Element;
|
|
71
71
|
//#endregion
|
|
72
72
|
export { types_d_exports as n, ContextMenu as t };
|
|
73
|
-
//# sourceMappingURL=index-
|
|
73
|
+
//# sourceMappingURL=index-BDr6Gid4.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { a as TextProps, n as LayoutProps, r as MarginProps } from "./styleProps-B2pBEf9N.js";
|
|
2
2
|
import { n as StylesOf } from "./useThemedStyles-C23Tevdv.js";
|
|
3
|
+
import { t as FloatingOptions } from "./types-CCfbRgMy.js";
|
|
4
|
+
import { t as PopoverProps } from "./types-C2C3tKY8.js";
|
|
3
5
|
import React$1 from "react";
|
|
4
6
|
|
|
5
7
|
//#region src/components/commons/inputs/Select/styles.d.ts
|
|
@@ -63,6 +65,8 @@ interface SelectProps extends LayoutProps, MarginProps {
|
|
|
63
65
|
value: string[];
|
|
64
66
|
placeholder?: string;
|
|
65
67
|
options: SelectOption[];
|
|
68
|
+
portalId?: PopoverProps['portalId'];
|
|
69
|
+
strategy: FloatingOptions['strategy'];
|
|
66
70
|
canClear?: boolean;
|
|
67
71
|
multiple?: boolean;
|
|
68
72
|
required?: boolean;
|
|
@@ -85,4 +89,4 @@ interface SelectOption {
|
|
|
85
89
|
declare const Select: React$1.FC<SelectProps>;
|
|
86
90
|
//#endregion
|
|
87
91
|
export { types_d_exports as n, Select as t };
|
|
88
|
-
//# sourceMappingURL=index-
|
|
92
|
+
//# sourceMappingURL=index-C5UBhjvX.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as CommonStyleProps } from "./styleProps-B2pBEf9N.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-D-9XHxWM.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as PopoverProps } from "./types-C2C3tKY8.js";
|
|
2
2
|
import React, { PropsWithChildren } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/commons/structure/BasePopover/types.d.ts
|
|
@@ -8,10 +8,15 @@ interface LayoutProps {
|
|
|
8
8
|
minHeight?: string;
|
|
9
9
|
maxHeight?: string;
|
|
10
10
|
}
|
|
11
|
-
interface
|
|
11
|
+
interface PanelProps {
|
|
12
|
+
padding?: string;
|
|
13
|
+
}
|
|
14
|
+
interface BasePopoverProps extends Omit<PopoverProps, 'content' | 'hideShadow'>, LayoutProps, PropsWithChildren {
|
|
15
|
+
panel?: PanelProps;
|
|
16
|
+
}
|
|
12
17
|
//#endregion
|
|
13
18
|
//#region src/components/commons/structure/BasePopover/index.d.ts
|
|
14
19
|
declare const BasePopover: React.FC<BasePopoverProps>;
|
|
15
20
|
//#endregion
|
|
16
21
|
export { BasePopover as t };
|
|
17
|
-
//# sourceMappingURL=index-
|
|
22
|
+
//# sourceMappingURL=index-DiIBw1ed.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as PopoverProps } from "./types-C2C3tKY8.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/commons/toolkit/Popover/index.d.ts
|
|
5
|
+
|
|
6
|
+
declare const Popover: React.FC<PopoverProps>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Popover as t };
|
|
9
|
+
//# sourceMappingURL=index-DlKVR1LO.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -2,18 +2,19 @@ import "./types-Ck6jQYTO.js";
|
|
|
2
2
|
import { t as Button } from "./index-E0ifwXgE.js";
|
|
3
3
|
import { t as IconButton } from "./index-BszVk1Tx.js";
|
|
4
4
|
import { t as Input } from "./index-B1QUSkjv.js";
|
|
5
|
-
import { n as types_d_exports$2, t as Select } from "./index-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import { t as
|
|
10
|
-
import { t as
|
|
11
|
-
import {
|
|
5
|
+
import { n as types_d_exports$2, t as Select } from "./index-C5UBhjvX.js";
|
|
6
|
+
import { n as types_d_exports$1 } from "./types-C2C3tKY8.js";
|
|
7
|
+
import { t as TextArea } from "./index-BD5Vr9sw.js";
|
|
8
|
+
import { t as Popover } from "./index-DlKVR1LO.js";
|
|
9
|
+
import { t as BasePopover } from "./index-DiIBw1ed.js";
|
|
10
|
+
import { t as CheckItem } from "./index-CzB15994.js";
|
|
11
|
+
import { t as Checkbox } from "./index-BymgvkBq.js";
|
|
12
|
+
import { n as types_d_exports, t as ContextMenu } from "./index-BDr6Gid4.js";
|
|
12
13
|
import { InfoSummary, InfoSummaryItem, InfoSummaryProps } from "./info-summary.js";
|
|
13
|
-
import { t as Switch } from "./index-
|
|
14
|
-
import { n as SwitchOption, r as TabSwitchProps, t as TabSwitch } from "./index-
|
|
14
|
+
import { t as Switch } from "./index-aQIW73fh.js";
|
|
15
|
+
import { n as SwitchOption, r as TabSwitchProps, t as TabSwitch } from "./index-D-9XHxWM.js";
|
|
15
16
|
import { Typography } from "./typography.js";
|
|
16
|
-
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-
|
|
17
|
+
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-BD5ThARj.js";
|
|
17
18
|
import { useDismiss } from "./use-dismiss.js";
|
|
18
19
|
import { AnchorLike, useFloating } from "./use-floating.js";
|
|
19
20
|
import { useVirtualAnchor } from "./use-virtual-anchor.js";
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import "./useThemedStyles-CrarDyWc.js";
|
|
|
2
2
|
import { t as Switch } from "./Switch-DJNZbvzy.js";
|
|
3
3
|
import { t as useDismiss } from "./useDismiss-CAEk_GV-.js";
|
|
4
4
|
import { t as useFloating } from "./useFloating-cvZUo5wI.js";
|
|
5
|
-
import { n as types_exports$1, t as Popover } from "./Popover-
|
|
5
|
+
import { n as types_exports$1, t as Popover } from "./Popover-CeU8aanh.js";
|
|
6
6
|
import "./Icon-KzwFJI_k.js";
|
|
7
7
|
import { t as Typography } from "./Typography-BkFV7BhK.js";
|
|
8
8
|
import { t as Checkbox } from "./Checkbox-j9ZnSxT7.js";
|
|
@@ -10,14 +10,14 @@ import { n as useTheme, t as ThemeProvider } from "./ThemeContext-DhXvmWKO.js";
|
|
|
10
10
|
import { t as TabSwitch } from "./TabSwitch-DlXdgLPc.js";
|
|
11
11
|
import { t as CheckItem } from "./CheckItem-CJqWCE1W.js";
|
|
12
12
|
import { t as InfoSummary } from "./InfoSummary-Cf2ein9V.js";
|
|
13
|
-
import { n as types_exports, t as ContextMenu } from "./ContextMenu-
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
import "./
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import { t as
|
|
20
|
-
import { t as TextArea } from "./TextArea-
|
|
13
|
+
import { n as types_exports, t as ContextMenu } from "./ContextMenu-DBEnLqgp.js";
|
|
14
|
+
import { t as BasePopover } from "./BasePopover-DaG1Bad1.js";
|
|
15
|
+
import { t as Button } from "./Button-DiBsoNFU.js";
|
|
16
|
+
import { t as IconButton } from "./IconButton-DAZvE8i5.js";
|
|
17
|
+
import "./Label-BHq2knad.js";
|
|
18
|
+
import { t as Input } from "./Input-B6a6mXsZ.js";
|
|
19
|
+
import { n as types_exports$2, t as Select } from "./Select-CkeZfibD.js";
|
|
20
|
+
import { t as TextArea } from "./TextArea-Oqw0zh_x.js";
|
|
21
21
|
import { useVirtualAnchor } from "./use-virtual-anchor.js";
|
|
22
22
|
|
|
23
23
|
export { BasePopover, Button, CheckItem, Checkbox, ContextMenu, types_exports as ContextMenuTypes, IconButton, InfoSummary, Input, Popover, types_exports$1 as PopoverTypes, Select, types_exports$2 as SelectTypes, Switch, TabSwitch, TextArea, ThemeProvider, Typography, useDismiss, useFloating, useTheme, useVirtualAnchor };
|
package/dist/input.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./useThemedStyles-CrarDyWc.js";
|
|
2
2
|
import "./Icon-KzwFJI_k.js";
|
|
3
3
|
import "./Typography-BkFV7BhK.js";
|
|
4
|
-
import "./Label-
|
|
5
|
-
import { t as Input } from "./Input-
|
|
4
|
+
import "./Label-BHq2knad.js";
|
|
5
|
+
import { t as Input } from "./Input-B6a6mXsZ.js";
|
|
6
6
|
|
|
7
7
|
export { Input };
|
package/dist/popover.d.ts
CHANGED
package/dist/popover.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./useThemedStyles-CrarDyWc.js";
|
|
2
2
|
import "./useDismiss-CAEk_GV-.js";
|
|
3
3
|
import "./useFloating-cvZUo5wI.js";
|
|
4
|
-
import { n as types_exports, t as Popover } from "./Popover-
|
|
4
|
+
import { n as types_exports, t as Popover } from "./Popover-CeU8aanh.js";
|
|
5
5
|
|
|
6
6
|
export { Popover, types_exports as PopoverTypes };
|
package/dist/select.d.ts
CHANGED
package/dist/select.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./useThemedStyles-CrarDyWc.js";
|
|
2
2
|
import "./useDismiss-CAEk_GV-.js";
|
|
3
3
|
import "./useFloating-cvZUo5wI.js";
|
|
4
|
-
import "./Popover-
|
|
4
|
+
import "./Popover-CeU8aanh.js";
|
|
5
5
|
import "./Icon-KzwFJI_k.js";
|
|
6
6
|
import "./Typography-BkFV7BhK.js";
|
|
7
|
-
import "./
|
|
8
|
-
import
|
|
9
|
-
import "./
|
|
7
|
+
import "./BasePopover-DaG1Bad1.js";
|
|
8
|
+
import "./Label-BHq2knad.js";
|
|
9
|
+
import { n as types_exports, t as Select } from "./Select-CkeZfibD.js";
|
|
10
10
|
|
|
11
11
|
export { Select, types_exports as SelectTypes };
|
package/dist/switch.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Switch } from "./index-
|
|
1
|
+
import { t as Switch } from "./index-aQIW73fh.js";
|
|
2
2
|
export { Switch };
|
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-D-9XHxWM.js";
|
|
2
2
|
export { SwitchOption, TabSwitch, TabSwitchProps };
|
package/dist/text-area.d.ts
CHANGED
package/dist/text-area.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./useThemedStyles-CrarDyWc.js";
|
|
2
2
|
import "./Icon-KzwFJI_k.js";
|
|
3
3
|
import "./Typography-BkFV7BhK.js";
|
|
4
|
-
import "./Label-
|
|
5
|
-
import { t as TextArea } from "./TextArea-
|
|
4
|
+
import "./Label-BHq2knad.js";
|
|
5
|
+
import { t as TextArea } from "./TextArea-Oqw0zh_x.js";
|
|
6
6
|
|
|
7
7
|
export { TextArea };
|
package/dist/theme-context.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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-BD5ThARj.js";
|
|
2
2
|
export { ThemeContextData, ThemeMode, ThemeName, ThemePersistence, ThemeProvider, ThemeProviderProps, ThemeRegistry, ThemeTokens, useTheme };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as PaddingProps } from "./styleProps-B2pBEf9N.js";
|
|
2
|
-
import { t as FloatingOptions } from "./types-
|
|
3
|
-
import
|
|
2
|
+
import { t as FloatingOptions } from "./types-CCfbRgMy.js";
|
|
3
|
+
import { MouseEventHandler, ReactNode, RefObject } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/commons/toolkit/Popover/styles.d.ts
|
|
6
6
|
declare function createPopoverStyles({
|
|
@@ -31,6 +31,7 @@ type PopoverTriggerRenderProps = {
|
|
|
31
31
|
};
|
|
32
32
|
interface PopoverProps extends PaddingProps {
|
|
33
33
|
open?: boolean;
|
|
34
|
+
portalId?: string;
|
|
34
35
|
hideShadow?: boolean;
|
|
35
36
|
closeOnEscape?: boolean;
|
|
36
37
|
closeOnOutsideClick?: boolean;
|
|
@@ -47,8 +48,5 @@ interface PopoverProps extends PaddingProps {
|
|
|
47
48
|
styles?: Partial<ReturnType<typeof createPopoverStyles>>;
|
|
48
49
|
}
|
|
49
50
|
//#endregion
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
//#endregion
|
|
53
|
-
export { PopoverProps as n, types_d_exports as r, Popover as t };
|
|
54
|
-
//# sourceMappingURL=index-CNn6Rkw1.d.ts.map
|
|
51
|
+
export { types_d_exports as n, PopoverProps as t };
|
|
52
|
+
//# sourceMappingURL=types-C2C3tKY8.d.ts.map
|
package/dist/use-floating.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BasePopover-DOi9H3B4.js","names":["BasePopover: React.FC<BasePopoverProps>"],"sources":["../src/components/commons/structure/BasePopover/styles.ts","../src/components/commons/structure/BasePopover/index.tsx"],"sourcesContent":["// Types\nimport type { BasePopoverProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createBasePopoverStyles({\n maxWidth = 'unset',\n minWidth = 'fit-content',\n minHeight = 'fit-content',\n maxHeight = '15rem'\n}: BasePopoverProps) {\n return styled({\n content: {\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n\n display: 'flex',\n flexDirection: 'column',\n\n zIndex: 10,\n\n overflowY: 'auto',\n overscrollBehavior: 'contain',\n\n borderWidth: 1,\n rowGap: '0.25rem',\n padding: '0.5rem',\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","// External Libraries\nimport type React from 'react'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Components\nimport { Popover } from '@components/commons/toolkit/Popover'\n\n// Types\nimport type { BasePopoverProps } from './types'\n\n// Styles\nimport { createBasePopoverStyles } from './styles'\n\nexport const BasePopover: React.FC<BasePopoverProps> = props => {\n const { children, ...rest } = props\n\n const { styles } = useThemedStyles(props, createBasePopoverStyles, {\n applyCommonProps: false,\n pick: p => [p.open, p.trigger]\n })\n\n return (\n <Popover\n {...rest}\n content={({ widthTrigger }) => (\n <div style={{ ...styles.content, width: widthTrigger }}>{children}</div>\n )}\n />\n )\n}\n"],"mappings":";;;;;AAIA,SAAgB,wBAAwB,EACtC,WAAW,SACX,WAAW,eACX,YAAY,eACZ,YAAY,WACO;AACnB,QAAO,OAAO,EACZ,SAAS;EACP;EACA;EACA;EACA;EAEA,SAAS;EACT,eAAe;EAEf,QAAQ;EAER,WAAW;EACX,oBAAoB;EAEpB,aAAa;EACb,QAAQ;EACR,SAAS;EACT,cAAc;EAEd,iBAAiB;EACjB,WAAW;EACX,aAAa;EACd,EACF,CAAC;;;;;ACnBJ,MAAaA,eAA0C,UAAS;CAC9D,MAAM,EAAE,UAAU,GAAG,SAAS;CAE9B,MAAM,EAAE,WAAW,gBAAgB,OAAO,yBAAyB;EACjE,kBAAkB;EAClB,OAAM,MAAK,CAAC,EAAE,MAAM,EAAE,QAAQ;EAC/B,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,EAAE,mBACV,oBAAC;GAAI,OAAO;IAAE,GAAG,OAAO;IAAS,OAAO;IAAc;GAAG;IAAe;GAE1E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu-l9GdmRqh.js","names":["floatingOptions: FloatingOptions","DividerRow: React.FC","close"],"sources":["../src/components/commons/toolkit/ContextMenu/components/Menu/components/ItemRow/styles.ts","../src/components/commons/toolkit/ContextMenu/components/Menu/components/ItemRow/index.tsx","../src/components/commons/toolkit/ContextMenu/components/Menu/components/CustomRow/styles.ts","../src/components/commons/toolkit/ContextMenu/components/Menu/components/CustomRow/index.tsx","../src/components/commons/toolkit/ContextMenu/components/Menu/components/DividerRow/styles.ts","../src/components/commons/toolkit/ContextMenu/components/Menu/components/DividerRow/index.tsx","../src/components/commons/toolkit/ContextMenu/components/Menu/styles.ts","../src/components/commons/toolkit/ContextMenu/components/Menu/index.tsx","../src/components/commons/toolkit/ContextMenu/utils/normalizeMenuOptions.ts","../src/components/commons/toolkit/ContextMenu/types.ts","../src/components/commons/toolkit/ContextMenu/styles.ts","../src/components/commons/toolkit/ContextMenu/index.tsx"],"sourcesContent":["// Types\nimport type { ItemRowProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createItemRowStyles<T>({ item, active }: ItemRowProps<T>) {\n return styled({\n button: {\n width: '100%',\n textAlign: 'left',\n\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: '0.5rem',\n\n borderRadius: '0.5rem',\n\n paddingInline: '0.5rem',\n paddingBlock: '0.25rem',\n\n userSelect: 'none',\n\n backgroundColor:\n item.disabled || active\n ? 'var(--px-background-card-hover)'\n : 'transparent',\n\n __rules: {\n '&:hover': {\n transition: 'all 200ms',\n backgroundColor: 'var(--px-background-card-hover) !important'\n }\n }\n },\n containerIcon: {\n width: '1rem',\n flexShrink: 0,\n display: 'flex',\n alignItems: 'center'\n }\n })\n}\n","// External Libraries\nimport { useEffect, useRef, useState } from 'react'\n\n// Components\nimport { Menu } from '../..'\nimport { Switch } from '@components/commons/toolkit/Switch'\nimport { Popover } from '@components/commons/toolkit/Popover'\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { ItemRowProps } from './types'\nimport type { FloatingOptions } from '@hooks/useFloating/types'\n\n// Styles\nimport { createItemRowStyles } from './styles'\n\nexport const ItemRow = <T extends string>(props: ItemRowProps<T>) => {\n const { item, depth, width, onHover, onSelect } = props\n const isGroup = item.type === 'group'\n\n const [subOpen, setSubOpen] = useState(false)\n const closeTimer = useRef<number | null>(null)\n const anchorRef = useRef<HTMLButtonElement | null>(null)\n const floatingOptions: FloatingOptions = {\n offsetX: 10,\n offsetY: -4,\n strategy: 'fixed',\n keepInViewport: true,\n placement: 'right-start'\n }\n\n // Hooks\n const { styles, classes } = useThemedStyles(props, createItemRowStyles, {\n applyCommonProps: true,\n override: props.styles,\n pick: p => [p.active]\n })\n\n // Functions\n function handleMouseEnter() {\n onHover(item.id, isGroup)\n\n if (!isGroup) return\n clearTimer()\n setSubOpen(true)\n }\n\n function handleMouseLeave() {\n if (!isGroup) return\n scheduleClose()\n }\n\n function handleClick() {\n if (isGroup) return\n onSelect(item)\n }\n\n function clearTimer() {\n if (closeTimer.current) window.clearTimeout(closeTimer.current)\n closeTimer.current = null\n }\n\n function scheduleClose() {\n clearTimer()\n closeTimer.current = window.setTimeout(() => setSubOpen(false), 150)\n }\n\n function renderMenuType() {\n if (item.type === 'switch') return <Switch checked={item.checked} />\n else {\n return (\n <>\n {item.shortcut ? <span>{item.shortcut}</span> : null}\n\n {isGroup ? <span>›</span> : null}\n </>\n )\n }\n }\n\n // UseEffects\n // biome-ignore lint/correctness/useExhaustiveDependencies: <Not needed>\n useEffect(() => {\n return () => clearTimer()\n }, [])\n\n return (\n <>\n <button\n ref={anchorRef}\n type=\"button\"\n role=\"menuitem\"\n style={styles.button}\n className={classes.button}\n disabled={!!item.disabled}\n aria-disabled={item.disabled || undefined}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {item.icon ? (\n <span style={styles.containerIcon}>{item.icon ?? null}</span>\n ) : null}\n\n <Typography variant=\"b2\">{item.label}</Typography>\n\n {renderMenuType()}\n </button>\n\n {isGroup ? (\n <Popover\n // biome-ignore lint/suspicious/noExplicitAny: <Not needed>\n anchorRef={anchorRef as any}\n open={subOpen}\n closeOnOutsideClick={false}\n closeOnEscape={false}\n floatingOptions={floatingOptions}\n onMouseEnter={() => {\n clearTimer()\n setSubOpen(true)\n }}\n onMouseLeave={() => {\n scheduleClose()\n }}\n content={() => (\n <Menu\n width={width}\n depth={depth + 1}\n activeId={undefined}\n items={item.children}\n onHover={onHover}\n onSelect={onSelect}\n />\n )}\n onOpenChange={setSubOpen}\n />\n ) : null}\n </>\n )\n}\n","// Types\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createCustomRowStyles() {\n return styled({\n container: {\n padding: '0.25rem'\n }\n })\n}\n","// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { CustomRowProps } from './types'\n\n// Styles\nimport { createCustomRowStyles } from './styles'\n\nexport const CustomRow = <T extends string>(props: CustomRowProps<T>) => {\n const { item, close } = props\n\n // Hooks\n const { styles } = useThemedStyles(props, createCustomRowStyles)\n\n return <div style={styles.container}>{item.render({ close })}</div>\n}\n","// Types\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createDividerRowStyles() {\n return styled({\n container: {\n border: 0,\n display: 'flex',\n marginBlock: '0.1rem',\n borderTop: '1px solid var(--px-border-primary)'\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Styles\nimport { createDividerRowStyles } from './styles'\n\nexport const DividerRow: React.FC = props => {\n // Hooks\n const { styles } = useThemedStyles(props, createDividerRowStyles)\n\n return <hr style={styles.container} />\n}\n","// Types\nimport type { MenuProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createMenuStyles<T>({ width }: MenuProps<T>) {\n return styled({\n container: {\n width,\n flexShrink: 0\n }\n })\n}\n","// Components\nimport { ItemRow } from './components/ItemRow'\nimport { CustomRow } from './components/CustomRow'\nimport { DividerRow } from './components/DividerRow'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { MenuProps } from './types'\n\n// Styles\nimport { createMenuStyles } from './styles'\n\nexport const Menu = <T extends string>(props: MenuProps<T>) => {\n const { items, depth, activeId, width = 240, onHover, onSelect } = props\n\n const { styles } = useThemedStyles(props, createMenuStyles, {\n applyCommonProps: true,\n override: props.styles,\n pick: p => [p.items, p.width, p.activeId, p.onSelect, p.onHover]\n })\n\n // Functions\n function renderItems() {\n return items.map(item => {\n if (item.type === 'divider') return <DividerRow key={item.id} />\n if (item.type === 'custom')\n return <CustomRow key={item.id} item={item} close={close} />\n\n return (\n <ItemRow\n key={item.id}\n item={item}\n depth={depth}\n width={width}\n active={activeId === item.id}\n onHover={onHover}\n onSelect={onSelect}\n />\n )\n })\n }\n\n return (\n <div style={styles.container} role={depth === 0 ? 'menu' : undefined}>\n {renderItems()}\n </div>\n )\n}\n","// Types\nimport type { MenuOption, MenuOptionInput } from '../types'\n\nexport function normalizeMenuOptions<T>(\n options: MenuOptionInput<T>[]\n): MenuOption<T>[] {\n return options.map(opt => {\n if ('children' in opt) {\n return {\n id: opt.id,\n label: opt.label,\n icon: opt.icon,\n shortcut: opt.shortcut,\n disabled: opt.disabled,\n className: opt.className,\n type: 'group' as const,\n children: normalizeMenuOptions(opt.children)\n }\n }\n return opt as MenuOption<T>\n })\n}\n","// External Libraries\nimport type { ReactNode } from 'react'\n\n// Hooks\nimport type { Placement } from '@hooks/useFloating/types'\n\n// Styles\nimport type { createContextMenuStyles } from './styles'\n\ninterface BaseOption<T> {\n id: T\n icon?: ReactNode\n label?: ReactNode\n disabled?: boolean\n className?: string\n shortcut?: ReactNode\n closeOnSelect?: boolean\n}\n\nexport type MenuActionOption<T> = BaseOption<T> & {\n type: 'action'\n closeOnSelect?: boolean\n}\n\nexport type MenuSwitchOption<T> = BaseOption<T> & {\n type: 'switch'\n checked: boolean\n closeOnSelect?: boolean\n onCheckedChange: (next: boolean) => void\n}\n\nexport interface MenuDividerOption<T> {\n id: T\n type: 'divider'\n}\n\nexport interface MenuCustomOption<T> extends BaseOption<T> {\n type: 'custom'\n render: (ctx: { close: () => void }) => ReactNode\n}\n\nexport interface MenuGroupInput<T> extends BaseOption<T> {\n type?: 'group'\n children: MenuOptionInput<T>[]\n}\n\nexport type MenuOptionInput<T> =\n | MenuGroupInput<T>\n | MenuActionOption<T>\n | MenuSwitchOption<T>\n | MenuCustomOption<T>\n | MenuDividerOption<T>\n\nexport interface MenuGroup<T> extends BaseOption<T> {\n type: 'group'\n children: MenuOption<T>[]\n}\n\nexport type MenuOption<T> =\n | MenuGroup<T>\n | MenuActionOption<T>\n | MenuSwitchOption<T>\n | MenuCustomOption<T>\n | MenuDividerOption<T>\n\nexport interface ContextMenuProps<T> {\n trigger: ReactNode\n options: MenuOptionInput<T>[]\n\n offsetX?: number\n offsetY?: number\n columnWidth?: number\n placement?: Placement\n\n onSelect: (actionId: T) => void\n\n styles?: Partial<ReturnType<typeof createContextMenuStyles>>\n}\n","// Types\nimport type { ContextMenuProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createContextMenuStyles<T>(_props: ContextMenuProps<T>) {\n return styled({\n trigger: {\n width: 'fit-content',\n height: 'fit-content',\n\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n cursor: 'pointer'\n }\n })\n}\n","// External Libraries\nimport { useMemo } from 'react'\n\n// Components\nimport { Popover } from '../Popover'\nimport { Menu } from './components/Menu'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Utils\nimport { normalizeMenuOptions } from './utils'\n\n// Types\nimport type { ContextMenuProps, MenuOption } from './types'\nimport type { PopoverTriggerRenderProps } from '../Popover/types'\n\nexport * as ContextMenuTypes from './types'\n\n// Styles\nimport { createContextMenuStyles } from './styles'\n\nexport const ContextMenu = <T extends string>(props: ContextMenuProps<T>) => {\n const {\n trigger,\n options,\n offsetX = 0,\n offsetY = 8,\n columnWidth = 240,\n placement = 'bottom-start',\n onSelect\n } = props\n\n const items = useMemo(() => normalizeMenuOptions(options), [options])\n const floatingOptions = useMemo(\n () => ({\n offsetX,\n offsetY,\n placement\n }),\n [offsetX, offsetY, placement]\n )\n\n // Hooks\n const { styles } = useThemedStyles(props, createContextMenuStyles, {\n applyCommonProps: true,\n override: props.styles,\n pick: p => [p.options, p.columnWidth, p.placement]\n })\n\n // Functions\n function handleSelect(item: MenuOption<T>, close: () => void) {\n if (item.type === 'action') {\n onSelect(item.id)\n if (item.closeOnSelect ?? true) close()\n }\n\n if (item.type === 'switch') {\n item.onCheckedChange(!item.checked)\n if (item.closeOnSelect ?? false) close()\n }\n }\n\n function renderTrigger({\n ref,\n ariaExpanded,\n onClick\n }: PopoverTriggerRenderProps) {\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: <Not needed>\n // biome-ignore lint/a11y/useKeyWithClickEvents: <Not needed>\n <span\n ref={ref as any}\n style={styles.trigger}\n aria-expanded={ariaExpanded}\n onClick={onClick}\n >\n {trigger}\n </span>\n )\n }\n\n return (\n <Popover\n floatingOptions={floatingOptions}\n trigger={renderTrigger}\n content={({ close }) => (\n <Menu\n depth={0}\n items={items}\n onHover={() => {}}\n width={columnWidth}\n onSelect={item => handleSelect(item as MenuOption<T>, close)}\n />\n )}\n />\n )\n}\n"],"mappings":";;;;;;;;AAIA,SAAgB,oBAAuB,EAAE,MAAM,UAA2B;AACxE,QAAO,OAAO;EACZ,QAAQ;GACN,OAAO;GACP,WAAW;GAEX,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,KAAK;GAEL,cAAc;GAEd,eAAe;GACf,cAAc;GAEd,YAAY;GAEZ,iBACE,KAAK,YAAY,SACb,oCACA;GAEN,SAAS,EACP,WAAW;IACT,YAAY;IACZ,iBAAiB;IAClB,EACF;GACF;EACD,eAAe;GACb,OAAO;GACP,YAAY;GACZ,SAAS;GACT,YAAY;GACb;EACF,CAAC;;;;;ACrBJ,MAAa,WAA6B,UAA2B;CACnE,MAAM,EAAE,MAAM,OAAO,OAAO,SAAS,aAAa;CAClD,MAAM,UAAU,KAAK,SAAS;CAE9B,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAC7C,MAAM,aAAa,OAAsB,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AAK,iBAAiB,KAAM,UAAO;;AAGzC,MAAI,KAAK,SAAS,UAAU;AAC1B,QAAK,gBAAgB,CAAC,KAAK,QAAQ;AACnC,OAAI,KAAK,iBAAiB,MAAO,UAAO;;;CAI5C,SAAS,cAAc,EACrB,KACA,cACA,WAC4B;AAC5B,SAGE,oBAAC;GACM;GACL,OAAO,OAAO;GACd,iBAAe;GACN;aAER;IACI;;AAIX,QACE,oBAAC;EACkB;EACjB,SAAS;EACT,UAAU,EAAE,qBACV,oBAAC;GACC,OAAO;GACA;GACP,eAAe;GACf,OAAO;GACP,WAAU,SAAQ,aAAa,MAAuBC,QAAM;IAC5D;GAEJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Popover-B6DCtCvD.js","names":["Popover: React.FC<PopoverProps>"],"sources":["../src/components/commons/toolkit/Popover/styles.ts","../src/components/commons/toolkit/Popover/types.ts","../src/components/commons/toolkit/Popover/index.tsx"],"sourcesContent":["// Types\nimport type { PopoverProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createPopoverStyles({ hideShadow = false }: PopoverProps) {\n return styled({\n popoverNode: {\n position: 'fixed',\n left: 0,\n top: 0,\n\n zIndex: 10,\n\n padding: '0.25rem',\n\n backgroundColor: 'var(--px-bg)',\n boxShadow: hideShadow ? 'none' : 'var(--px-ring-1)',\n\n borderRadius: 'var(--px-radius-xl)'\n },\n\n trigger: {\n width: 'fit-content',\n height: 'fit-content'\n }\n })\n}\n","// External Libraries\nimport type { MouseEventHandler, ReactNode, RefObject } from 'react'\n\n// Types\nimport type { createPopoverStyles } from './styles'\nimport type { FloatingOptions } from '@hooks/useFloating/types'\nimport type { PaddingProps } from '@hooks/useThemedStyles/types'\n\nexport type PopoverTriggerRenderProps = {\n ariaExpanded: boolean\n ref: RefObject<HTMLElement>\n onClick: () => void\n}\n\nexport interface PopoverProps extends PaddingProps {\n open?: boolean\n hideShadow?: boolean\n closeOnEscape?: boolean\n closeOnOutsideClick?: boolean\n floatingOptions?: FloatingOptions\n anchorRef?: RefObject<HTMLElement>\n\n onOpenChange?: (v: boolean) => void\n onMouseEnter?: MouseEventHandler<HTMLDivElement>\n onMouseLeave?: MouseEventHandler<HTMLDivElement>\n content: (ctx: { close: () => void; widthTrigger: number }) => ReactNode\n trigger?: (props: PopoverTriggerRenderProps) => ReactNode\n\n styles?: Partial<ReturnType<typeof createPopoverStyles>>\n}\n","// External Libraries\n/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\n/** biome-ignore-all lint/correctness/useExhaustiveDependencies: <Not needed> */\nimport type React from 'react'\nimport { createPortal } from 'react-dom'\nimport { useCallback, useEffect, useRef, useState } from 'react'\n\n// Hooks\nimport { useDismiss } from '@hooks/useDismiss'\nimport { useFloating } from '@hooks/useFloating'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { PopoverProps } from './types'\n\n// Styles\nimport { createPopoverStyles } from './styles'\n\nexport * as PopoverTypes from './types'\n\nexport const Popover: React.FC<PopoverProps> = props => {\n const {\n anchorRef,\n floatingOptions,\n closeOnEscape = true,\n open: controlledOpen,\n closeOnOutsideClick = true,\n trigger,\n content,\n onOpenChange,\n onMouseEnter,\n onMouseLeave\n } = props\n\n // Refs\n const triggerRef = useRef<HTMLElement | null>(null)\n const popoverRef = useRef<HTMLDivElement | null>(null)\n const resolvedAnchorRef = (anchorRef ?? triggerRef) as any\n\n // States\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false)\n const [widthTrigger, setWidthTrigger] = useState(\n triggerRef.current?.offsetWidth ?? 0\n )\n\n const open = controlledOpen ?? uncontrolledOpen\n\n // Hooks\n const { styles } = useThemedStyles(props, createPopoverStyles, {\n applyCommonProps: true,\n override: props.styles,\n commonSlot: 'popoverNode',\n pick: p => [p.open, p.content, p.trigger]\n })\n\n const { floatingRef, update } = useFloating(resolvedAnchorRef, {\n offsetY: 6,\n strategy: 'fixed',\n keepInViewport: true,\n placement: 'bottom-start',\n ...floatingOptions\n })\n\n // Functions\n function setOpen(v: boolean) {\n onOpenChange?.(v)\n if (controlledOpen === undefined) setUncontrolledOpen(v)\n }\n\n const close = useCallback(() => setOpen(false), [setOpen])\n\n useDismiss({\n open,\n closeOnEscape,\n closeOnOutsideClick,\n refs: [resolvedAnchorRef, popoverRef],\n onClose: close\n })\n\n // UseEffects\n useEffect(() => {\n if (open) requestAnimationFrame(update)\n\n setWidthTrigger(triggerRef.current?.offsetWidth ?? 0)\n }, [open, update])\n\n useEffect(() => {\n const handleResize = () => {\n setWidthTrigger(triggerRef.current?.offsetWidth ?? 0)\n }\n\n window.addEventListener('resize', handleResize)\n\n return () => {\n window.removeEventListener('resize', handleResize)\n }\n }, [])\n\n const triggerNode =\n trigger?.({\n ariaExpanded: open,\n ref: triggerRef as any,\n onClick: () => setOpen(!open)\n }) ?? null\n\n const popoverNode = open ? (\n <div\n ref={el => {\n popoverRef.current = el\n floatingRef(el)\n }}\n role=\"dialog\"\n style={styles.popoverNode}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onMouseDownCapture={e => e.stopPropagation()}\n onPointerDownCapture={e => e.stopPropagation()}\n >\n {content({ close, widthTrigger })}\n </div>\n ) : null\n\n return (\n <>\n {triggerNode}\n {typeof document !== 'undefined'\n ? createPortal(popoverNode, document.body)\n : null}\n </>\n )\n}\n"],"mappings":";;;;;;;;AAIA,SAAgB,oBAAoB,EAAE,aAAa,SAAuB;AACxE,QAAO,OAAO;EACZ,aAAa;GACX,UAAU;GACV,MAAM;GACN,KAAK;GAEL,QAAQ;GAER,SAAS;GAET,iBAAiB;GACjB,WAAW,aAAa,SAAS;GAEjC,cAAc;GACf;EAED,SAAS;GACP,OAAO;GACP,QAAQ;GACT;EACF,CAAC;;;;;;;;;AELJ,MAAaA,WAAkC,UAAS;CACtD,MAAM,EACJ,WACA,iBACA,gBAAgB,MAChB,MAAM,gBACN,sBAAsB,MACtB,SACA,SACA,cACA,cACA,iBACE;CAGJ,MAAM,aAA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;EACA;EACd,qBAAoB,MAAK,EAAE,iBAAiB;EAC5C,uBAAsB,MAAK,EAAE,iBAAiB;YAE7C,QAAQ;GAAE;GAAO;GAAc,CAAC;GAC7B,GACJ;AAEJ,QACE,4CACG,aACA,OAAO,aAAa,cACjB,aAAa,aAAa,SAAS,KAAK,GACxC,QACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select-DtU_3TOA.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/types.ts","../src/components/commons/inputs/Select/index.tsx"],"sourcesContent":["import { styled } from '@hooks/useThemedStyles/types'\nimport type { OptionItemProps } from './types'\n\nexport function createOptionsStyles({ isSelected }: 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 backgroundColor: isSelected\n ? 'var(--px-background-card-hover)'\n : 'transparent',\n\n __rules: {\n '&:hover': {\n backgroundColor: 'var(--px-background-card-hover) !important'\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 !important',\n outline: `2px solid var(${props.errorMessage ? '--px-color-error' : '--px-color-primary'}) !important`\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 }\n })\n}\n","import type {\n StylesOf,\n TextProps,\n LayoutProps,\n MarginProps\n} from '@hooks/useThemedStyles/types'\nimport type { createSelectStyles } from './styles'\n\nexport interface SelectProps extends LayoutProps, MarginProps {\n label: string\n value: string[]\n placeholder?: string\n options: SelectOption[]\n\n canClear?: boolean\n multiple?: boolean\n required?: boolean\n disabled?: boolean\n hideLabel?: boolean\n errorMessage?: string\n maxVisibleItems?: number\n\n startIcon?: React.ReactNode\n styles?: StylesOf<typeof createSelectStyles>\n\n requiredColor?: string\n labelConfig?: TextProps\n\n onChange: (value: string[]) => void\n}\n\nexport interface SelectOption {\n label: string\n value: string\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 { OptionItem } from './components/OptionItem'\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { Label } from '@components/commons/toolkit/Label'\n\n// Hooks\nimport { useSelect } from './hooks/useSelect'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { SelectProps } from './types'\nimport type { PopoverTriggerRenderProps } from '@components/commons/toolkit/Popover/types'\n\n// Styles\nimport { createSelectStyles } from './styles'\nimport { BasePopover } from '@components/commons/structure/BasePopover'\n\nexport * as SelectTypes from './types'\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 function renderTrigger({\n ref,\n ariaExpanded,\n onClick\n }: PopoverTriggerRenderProps) {\n return (\n <button\n ref={ref as any}\n dir=\"ltr\"\n type=\"button\"\n role=\"combobox\"\n style={styles.content}\n aria-autocomplete=\"none\"\n aria-label={props.label}\n className={classes.content}\n aria-expanded={ariaExpanded}\n onClick={onClick}\n >\n {props.value.length ? props.startIcon : null}\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 }\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 <BasePopover\n p={0}\n hideShadow\n open={open}\n trigger={renderTrigger}\n onOpenChange={togglePanel}\n floatingOptions={{ viewportMargin: 0 }}\n >\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 </BasePopover>\n\n {props.errorMessage ? (\n <span style={styles.error}>{props.errorMessage}</span>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAgB,o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