@apple-pie/slice 0.1.10 → 0.1.12
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/README.md +96 -176
- package/dist/cjs/chunks/{Avatar-Czt-12Ih.js → Avatar-CUaQ3kN1.js} +5 -5
- package/dist/cjs/chunks/{AvatarGroup-CGH2zY7a.js → AvatarGroup-B3M7o4Hh.js} +23 -20
- package/dist/cjs/chunks/{Button-mVVfNCqC.js → Button-DXvjvGtY.js} +12 -11
- package/dist/cjs/chunks/{ButtonBar-CFAb4bfQ.js → ButtonBar-BZ6sme27.js} +7 -7
- package/dist/cjs/chunks/{Camera-BGV_tNUP.js → Camera-rVC4KI4v.js} +1 -1
- package/dist/cjs/chunks/{CheckBox-DyOgP15i.js → CheckBox-DQRLqTAK.js} +1 -1
- package/dist/cjs/chunks/{Chip-Z8erRdWG.js → Chip-Pv9-KTnh.js} +11 -10
- package/dist/cjs/chunks/{DivInput-DdZA8S1k.js → DivInput-DO3Dgbjp.js} +4 -4
- package/dist/cjs/chunks/{DropDown-Ce8aU2va.js → DropDown-C3AZ5b_b.js} +49 -50
- package/dist/cjs/chunks/{ErrorSummary-By4CjJ9a.js → ErrorSummary-BTgAd3sK.js} +47 -25
- package/dist/cjs/chunks/{FileList-CCAtVNDo.js → FileList-BHwBIics.js} +4 -4
- package/dist/cjs/chunks/{Grouper-BbovOSYw.js → Grouper-D4yyHHkM.js} +1 -1
- package/dist/cjs/chunks/{Icon-N0YJuKQf.js → Icon-D1EB8S5r.js} +6 -5
- package/dist/cjs/chunks/{IconButton-BXotgG2u.js → IconButton-B07Ttxbr.js} +11 -11
- package/dist/cjs/chunks/Label-CTzvGcds.js +102 -0
- package/dist/cjs/chunks/{Pager-Da9AqSFN.js → Pager-BN37VYEC.js} +1 -1
- package/dist/cjs/chunks/{ProgressIndicator-CyFcr6Dk.js → ProgressIndicator-BGqIwycX.js} +1 -1
- package/dist/cjs/chunks/{PromptInput-D317oh1e.js → PromptInput-z6TuhHsG.js} +1 -1
- package/dist/cjs/chunks/{RadioButton-B8GIKGm-.js → RadioButton-DuIsM4lu.js} +21 -17
- package/dist/cjs/chunks/{RadioButtonList-3o1IvhdC.js → RadioButtonList-bu11ILyw.js} +20 -13
- package/dist/cjs/chunks/{Switch-BiTshVLM.js → Switch-Cbn0ql3B.js} +15 -11
- package/dist/cjs/chunks/{TabBar-DZ2y7owf.js → TabBar-Bcq_n4Mk.js} +8 -8
- package/dist/cjs/chunks/{TextArea-2w4E6d2H.js → TextArea-BSKbDOEt.js} +17 -24
- package/dist/cjs/chunks/{TextField-BAcYBHb1.js → TextField-BNacOZVx.js} +50 -70
- package/dist/cjs/chunks/{Tip-59T3TUN4.js → Tip-DAxoyMyA.js} +7 -6
- package/dist/cjs/chunks/{Toast-skIBuJ3b.js → Toast-CZzAWG0S.js} +1 -1
- package/dist/cjs/chunks/{UploadArea-CxYAAs7Q.js → UploadArea-CKuE4rtg.js} +6 -6
- package/dist/cjs/chunks/{localDBStore-BHEk_9fJ.js → localDBStore-zyDhaEiP.js} +42 -10
- package/dist/cjs/components/Avatar/index.js +1 -1
- package/dist/cjs/components/AvatarGroup/index.js +2 -2
- package/dist/cjs/components/Button/index.js +3 -3
- package/dist/cjs/components/ButtonBar/index.js +2 -2
- package/dist/cjs/components/Camera/index.js +3 -3
- package/dist/cjs/components/CheckBox/index.js +2 -2
- package/dist/cjs/components/Chip/index.js +2 -2
- package/dist/cjs/components/DivInput/index.js +1 -1
- package/dist/cjs/components/DropDown/index.js +2 -2
- package/dist/cjs/components/ErrorSummary/index.js +6 -2
- package/dist/cjs/components/FileList/index.js +3 -3
- package/dist/cjs/components/Grouper/index.js +2 -2
- package/dist/cjs/components/Icon/index.js +1 -1
- package/dist/cjs/components/IconButton/index.js +2 -2
- package/dist/cjs/components/Label/index.js +7 -5
- package/dist/cjs/components/Pager/index.js +1 -1
- package/dist/cjs/components/Progress/index.js +2 -2
- package/dist/cjs/components/PromptInput/index.js +5 -5
- package/dist/cjs/components/RadioButton/index.js +2 -2
- package/dist/cjs/components/RadioButtonList/index.js +3 -3
- package/dist/cjs/components/Switch/index.js +1 -1
- package/dist/cjs/components/TabBar/index.js +3 -3
- package/dist/cjs/components/TextArea/index.js +4 -4
- package/dist/cjs/components/Textfield/index.js +5 -6
- package/dist/cjs/components/Tip/index.js +1 -1
- package/dist/cjs/components/Toast/index.js +2 -2
- package/dist/cjs/components/UploadArea/index.js +8 -7
- package/dist/cjs/hooks/useObserveTheme.js +5 -5
- package/dist/cjs/hooks/useTheme.js +2 -2
- package/dist/cjs/index.js +8 -3
- package/dist/cjs/providers/ThemeProvider.js +12 -9
- package/dist/cjs/providers.js +4 -3
- package/dist/cjs/stores/LocalDB.js +1 -1
- package/dist/cjs/stores.js +1 -1
- package/dist/esm/chunks/{Avatar-DCCbj2eA.mjs → Avatar-CSLVUF_y.mjs} +5 -5
- package/dist/esm/chunks/{AvatarGroup-BaD2Xmda.mjs → AvatarGroup--ELW-bO1.mjs} +23 -20
- package/dist/esm/chunks/{Button-m0XAJsq5.mjs → Button-daLv0i7S.mjs} +13 -12
- package/dist/esm/chunks/{ButtonBar-CNQHRn77.mjs → ButtonBar-DXK8meQq.mjs} +7 -7
- package/dist/esm/chunks/{Camera-7TuowjX_.mjs → Camera-BqmVsVKy.mjs} +2 -2
- package/dist/esm/chunks/{CheckBox-DO9hTdv8.mjs → CheckBox-BsaYFNC6.mjs} +1 -1
- package/dist/esm/chunks/{Chip-BqneFUOR.mjs → Chip-BRZeD1OX.mjs} +11 -10
- package/dist/esm/chunks/{DivInput-Ch9XjfWd.mjs → DivInput-DeSpC8Wm.mjs} +4 -4
- package/dist/esm/chunks/{DropDown-Cvf2d_3u.mjs → DropDown-DOJvg96J.mjs} +48 -51
- package/dist/esm/chunks/{ErrorSummary-S0shes-m.mjs → ErrorSummary-CHLkvdHk.mjs} +52 -27
- package/dist/esm/chunks/{FileList-Ckix8gUY.mjs → FileList-5LElsgoE.mjs} +5 -5
- package/dist/esm/chunks/{Grouper-B_FutfjV.mjs → Grouper-DR14qDXP.mjs} +1 -1
- package/dist/esm/chunks/{Icon-C92f63Ib.mjs → Icon-CUSQtytG.mjs} +6 -5
- package/dist/esm/chunks/{IconButton-4O5S9S9G.mjs → IconButton-DG69Vlhj.mjs} +11 -11
- package/dist/esm/chunks/Label-CRsE7o3D.mjs +115 -0
- package/dist/esm/chunks/{Pager-BlLYeA2F.mjs → Pager-BYT7_mCb.mjs} +1 -1
- package/dist/esm/chunks/{ProgressIndicator-CfM2c4ty.mjs → ProgressIndicator-D7paCpgY.mjs} +1 -1
- package/dist/esm/chunks/{PromptInput-C6liKbFf.mjs → PromptInput-CpxUcInZ.mjs} +3 -3
- package/dist/esm/chunks/{RadioButton-COEnChNW.mjs → RadioButton-B5ZF5oJ_.mjs} +22 -18
- package/dist/esm/chunks/{RadioButtonList-De3rbLQb.mjs → RadioButtonList-D9ZAZgkK.mjs} +22 -13
- package/dist/esm/chunks/{Switch-Cv6LABsW.mjs → Switch-BhCOo5Lu.mjs} +15 -11
- package/dist/esm/chunks/{TabBar-qiozE5zA.mjs → TabBar-BK7OcjPl.mjs} +9 -9
- package/dist/esm/chunks/{TextArea-DKRF4Irr.mjs → TextArea-BmsEj6IA.mjs} +18 -25
- package/dist/esm/chunks/{TextField-CGOR6507.mjs → TextField-DWPpevsj.mjs} +54 -72
- package/dist/esm/chunks/{Tip-CroDIKO4.mjs → Tip-BnKB9qMi.mjs} +7 -6
- package/dist/esm/chunks/{Toast-CM493gMR.mjs → Toast-DPHLwDES.mjs} +1 -1
- package/dist/esm/chunks/{UploadArea-DNAH-Bu5.mjs → UploadArea-DPiOaNpc.mjs} +9 -9
- package/dist/esm/chunks/{localDBStore-C-Ch2MFq.mjs → localDBStore-B4jkR5Jx.mjs} +42 -10
- package/dist/esm/components/Avatar/index.mjs +1 -1
- package/dist/esm/components/AvatarGroup/index.mjs +2 -2
- package/dist/esm/components/Button/index.mjs +3 -3
- package/dist/esm/components/ButtonBar/index.mjs +2 -2
- package/dist/esm/components/Camera/index.mjs +3 -3
- package/dist/esm/components/CheckBox/index.mjs +2 -2
- package/dist/esm/components/Chip/index.mjs +2 -2
- package/dist/esm/components/DivInput/index.mjs +1 -1
- package/dist/esm/components/DropDown/index.mjs +5 -5
- package/dist/esm/components/ErrorSummary/index.mjs +21 -1
- package/dist/esm/components/FileList/index.mjs +3 -3
- package/dist/esm/components/Grouper/index.mjs +2 -2
- package/dist/esm/components/Icon/index.mjs +1 -1
- package/dist/esm/components/IconButton/index.mjs +2 -2
- package/dist/esm/components/Label/index.mjs +1 -19
- package/dist/esm/components/Pager/index.mjs +1 -1
- package/dist/esm/components/Progress/index.mjs +2 -2
- package/dist/esm/components/PromptInput/index.mjs +5 -5
- package/dist/esm/components/RadioButton/index.mjs +2 -2
- package/dist/esm/components/RadioButtonList/index.mjs +4 -4
- package/dist/esm/components/Switch/index.mjs +1 -1
- package/dist/esm/components/TabBar/index.mjs +3 -3
- package/dist/esm/components/TextArea/index.mjs +4 -4
- package/dist/esm/components/Textfield/index.mjs +7 -7
- package/dist/esm/components/Tip/index.mjs +1 -1
- package/dist/esm/components/Toast/index.mjs +2 -2
- package/dist/esm/components/UploadArea/index.mjs +7 -7
- package/dist/esm/hooks/useObserveTheme.mjs +5 -5
- package/dist/esm/hooks/useTheme.mjs +2 -2
- package/dist/esm/index.mjs +27 -27
- package/dist/esm/providers/ThemeProvider.mjs +13 -8
- package/dist/esm/providers.mjs +2 -0
- package/dist/esm/stores/LocalDB.mjs +1 -1
- package/dist/esm/stores.mjs +1 -1
- package/dist/types/components/Avatar/_types.d.ts +3 -0
- package/dist/types/components/AvatarGroup/_types.d.ts +3 -0
- package/dist/types/components/Button/Button.d.ts +6 -2
- package/dist/types/components/Button/_types.d.ts +3 -1
- package/dist/types/components/ButtonBar/_types.d.ts +4 -0
- package/dist/types/components/Chip/_types.d.ts +5 -1
- package/dist/types/components/DivInput/_types.d.ts +2 -0
- package/dist/types/components/DropDown/DropDown.d.ts +2 -3
- package/dist/types/components/DropDown/_types.d.ts +20 -14
- package/dist/types/components/ErrorSummary/ErrorSummary.d.ts +1 -2
- package/dist/types/components/ErrorSummary/_types.d.ts +7 -4
- package/dist/types/components/FileList/_types.d.ts +1 -0
- package/dist/types/components/IconButton/_types.d.ts +3 -0
- package/dist/types/components/Label/Label.d.ts +1 -1
- package/dist/types/components/Label/_types.d.ts +18 -8
- package/dist/types/components/Label/index.d.ts +1 -0
- package/dist/types/components/RadioButton/RadioButton.d.ts +1 -1
- package/dist/types/components/RadioButton/_types.d.ts +12 -11
- package/dist/types/components/RadioButtonList/RadioButtonList.d.ts +1 -1
- package/dist/types/components/RadioButtonList/_types.d.ts +8 -6
- package/dist/types/components/Switch/Switch.d.ts +1 -1
- package/dist/types/components/Switch/_types.d.ts +7 -3
- package/dist/types/components/TabBar/_types.d.ts +2 -2
- package/dist/types/components/TextArea/_types.d.ts +5 -6
- package/dist/types/components/Textfield/_types.d.ts +14 -20
- package/dist/types/components/Tip/_types.d.ts +4 -1
- package/dist/types/components/UploadArea/UploadArea.d.ts +10 -2
- package/dist/types/components/UploadArea/_types.d.ts +5 -1
- package/dist/types/components/playHelpers.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/providers/ThemeProvider.d.ts +1 -1
- package/dist/types/utils/functions/files.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/chunks/Label-CZvJbATa.js +0 -118
- package/dist/esm/chunks/Label-7ezP3eHw.mjs +0 -131
- package/dist/types/components/Switch/Switch.stories.d.ts +0 -5
package/README.md
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
# Slice (`@apple-pie/slice`)
|
|
2
2
|
|
|
3
|
-
Slice is a TypeScript-first React UI kit with theme tokens,
|
|
3
|
+
Slice is a TypeScript-first React UI kit with typed theme tokens, composable components, hooks, optional Zustand stores, worker-backed uploads, Storybook documentation, and benchmark tooling.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The package is currently in beta. Until `1.0.0`, breaking API changes may still happen.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Documentation and showcase: https://slice-uikit.com
|
|
9
|
-
- Repository: access is limited to authorized contributors/collaborators.
|
|
10
|
-
|
|
11
|
-
## What is included
|
|
12
|
-
|
|
13
|
-
- 30+ reusable UI components (inputs, buttons, navigation, overlays, feedback, layout, icons, upload UI, camera/stream UI)
|
|
14
|
-
- Theme system with light/dark presets and typed theme tokens
|
|
15
|
-
- React hooks for theme, window sizing, keyboard shortcuts, local storage, resize, and more
|
|
16
|
-
- Optional Zustand-powered stores (`tip`, `uploads`, `window`, `SSE`, `WS`, `LocalDB`)
|
|
17
|
-
- Utility functions and low-level objects such as `IndexedDB`, `SSEConnection`, and `WSConnection`
|
|
18
|
-
- Rollup + TypeScript build pipeline for CJS, ESM, and declaration output
|
|
19
|
-
- Component performance benchmarks powered by Vitest
|
|
7
|
+
Docs and showcase: https://slice-uikit.com
|
|
20
8
|
|
|
21
9
|
## Installation
|
|
22
10
|
|
|
@@ -24,52 +12,55 @@ Slice is a TypeScript-first React UI kit with theme tokens, utility hooks, optio
|
|
|
24
12
|
npm install @apple-pie/slice
|
|
25
13
|
```
|
|
26
14
|
|
|
27
|
-
|
|
15
|
+
Required peer dependencies:
|
|
28
16
|
|
|
29
17
|
```bash
|
|
30
18
|
npm install react react-dom motion
|
|
31
19
|
```
|
|
32
20
|
|
|
33
|
-
Optional
|
|
21
|
+
Optional peer dependency for store APIs:
|
|
34
22
|
|
|
35
23
|
```bash
|
|
36
24
|
npm install zustand
|
|
37
25
|
```
|
|
38
26
|
|
|
39
|
-
## Quick
|
|
27
|
+
## Quick Start
|
|
40
28
|
|
|
41
29
|
```tsx
|
|
42
|
-
import {
|
|
30
|
+
import { Avatar, Button, ThemeProvider, useTheme } from '@apple-pie/slice';
|
|
43
31
|
|
|
44
32
|
function ThemeToggle() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
const theme = useTheme();
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Button
|
|
37
|
+
label={theme.isDark ? 'Switch to Light' : 'Switch to Dark'}
|
|
38
|
+
onClick={() => theme.toggle()}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
52
41
|
}
|
|
53
42
|
|
|
54
43
|
export default function App() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
44
|
+
return (
|
|
45
|
+
<ThemeProvider system>
|
|
46
|
+
<Avatar size={32} first="John" last="Appleseed" />
|
|
47
|
+
<ThemeToggle />
|
|
48
|
+
</ThemeProvider>
|
|
49
|
+
);
|
|
61
50
|
}
|
|
62
51
|
```
|
|
63
52
|
|
|
64
|
-
|
|
53
|
+
`ThemeProvider` is the default theme bootstrap for the library. It sets the active `data-slice-theme` value on the document root, renders a `data-slice-theme-scope` wrapper, and pulls in the packaged theme CSS token files used by components and Storybook.
|
|
65
54
|
|
|
66
|
-
|
|
55
|
+
## Package Surface
|
|
56
|
+
|
|
57
|
+
Primary entrypoint:
|
|
67
58
|
|
|
68
59
|
```ts
|
|
69
|
-
import { Avatar,
|
|
60
|
+
import { Avatar, ThemeProvider, useTheme } from '@apple-pie/slice';
|
|
70
61
|
```
|
|
71
62
|
|
|
72
|
-
|
|
63
|
+
Published subpaths:
|
|
73
64
|
|
|
74
65
|
- `@apple-pie/slice/components/*`
|
|
75
66
|
- `@apple-pie/slice/hooks`
|
|
@@ -78,131 +69,82 @@ Subpath imports are also published:
|
|
|
78
69
|
- `@apple-pie/slice/providers/*`
|
|
79
70
|
- `@apple-pie/slice/stores`
|
|
80
71
|
- `@apple-pie/slice/stores/*`
|
|
81
|
-
- `@apple-pie/slice/utils`
|
|
82
|
-
- `@apple-pie/slice/utils/objects`
|
|
83
|
-
- `@apple-pie/slice/workers/*`
|
|
84
72
|
- `@apple-pie/slice/theme`
|
|
85
73
|
- `@apple-pie/slice/theme/colors`
|
|
86
74
|
- `@apple-pie/slice/theme/corners`
|
|
87
75
|
- `@apple-pie/slice/theme/elevations`
|
|
76
|
+
- `@apple-pie/slice/theme/motion`
|
|
88
77
|
- `@apple-pie/slice/theme/type`
|
|
89
78
|
- `@apple-pie/slice/theme/themes`
|
|
79
|
+
- `@apple-pie/slice/utils`
|
|
80
|
+
- `@apple-pie/slice/utils/objects`
|
|
81
|
+
- `@apple-pie/slice/workers/*`
|
|
90
82
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
- `Avatar`, `AvatarGroup`, `Badge`, `CheckBox`, `DivInput`, `Dot`, `DropDown`
|
|
94
|
-
- `Camera`
|
|
95
|
-
- `ErrorSummary`, `FileIcon`, `FileList`, `FlexDiv`, `Grouper`, `Icon`, `IconButton`
|
|
96
|
-
- `PromptInput`, `Overlay`, `Pager`, `ProgressIndicator`, `DoneCheck`
|
|
97
|
-
- `RadioButton`, `RadioButtonList`, `Slider`, `Spacer`, `Switch`, `TabBar`
|
|
98
|
-
- `TextField`, `TextArea`, `Tip`, `Toast`, `Button`, `ButtonBar`
|
|
99
|
-
- `Chip`, `Label`, `DraggablePanel`, `UploadArea`
|
|
100
|
-
|
|
101
|
-
Example:
|
|
83
|
+
Example subpath imports:
|
|
102
84
|
|
|
103
|
-
```
|
|
104
|
-
import {
|
|
105
|
-
import {
|
|
106
|
-
import
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return (
|
|
112
|
-
<>
|
|
113
|
-
<Camera
|
|
114
|
-
ref={cameraRef}
|
|
115
|
-
width={400}
|
|
116
|
-
height={320}
|
|
117
|
-
sessionSettings={{
|
|
118
|
-
videoDeviceId: 'preferred-video-device-id',
|
|
119
|
-
micDeviceId: 'preferred-mic-device-id',
|
|
120
|
-
}}
|
|
121
|
-
/>
|
|
122
|
-
<button onClick={() => cameraRef.current?.snapshot?.()}>
|
|
123
|
-
Take Snapshot
|
|
124
|
-
</button>
|
|
125
|
-
<button onClick={() => cameraRef.current?.toggleVideo?.()}>
|
|
126
|
-
Toggle Video
|
|
127
|
-
</button>
|
|
128
|
-
</>
|
|
129
|
-
);
|
|
130
|
-
}
|
|
85
|
+
```ts
|
|
86
|
+
import { Avatar } from '@apple-pie/slice/components/Avatar';
|
|
87
|
+
import { useTheme } from '@apple-pie/slice/hooks/useTheme';
|
|
88
|
+
import { ThemeProvider } from '@apple-pie/slice/providers/ThemeProvider';
|
|
89
|
+
import { useUploadsActions } from '@apple-pie/slice/stores/uploads';
|
|
90
|
+
import { lightTheme } from '@apple-pie/slice/theme/themes';
|
|
91
|
+
import { IndexedDB } from '@apple-pie/slice/utils/objects';
|
|
131
92
|
```
|
|
132
93
|
|
|
133
|
-
##
|
|
134
|
-
|
|
135
|
-
- `useTheme`, `useObserveTheme`
|
|
136
|
-
- `useKeyboardShortcuts`
|
|
137
|
-
- `useDoubleClick`
|
|
138
|
-
- `useToolTip`
|
|
139
|
-
- `useLastUpdated`
|
|
140
|
-
- `useLocalStore`
|
|
141
|
-
- `useWindow` with optional geolocation helpers (`geolocationSupported`, `location`, `locationError`, `gettingLocation`, `requestGeolocation`)
|
|
142
|
-
- `useObserveResize`
|
|
143
|
-
|
|
144
|
-
## Stores (optional)
|
|
94
|
+
## What’s Included
|
|
145
95
|
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
96
|
+
- 30+ React components covering inputs, navigation, overlays, feedback, media, layout, upload, and utility UI
|
|
97
|
+
- Theme tokens and presets for colors, corners, elevations, motion, typography, and full light/dark themes
|
|
98
|
+
- React hooks for theme state, resize observation, keyboard shortcuts, local storage, double-click, tooltips, and window helpers
|
|
99
|
+
- Optional Zustand stores for `LocalDB`, `SSE`, `WS`, `tip`, `toast`, `uploads`, and `window`
|
|
100
|
+
- Worker-backed uploads via `@apple-pie/slice/workers/uploads`
|
|
101
|
+
- Utility functions plus low-level `IndexedDB`, `SSEConnection`, and `WSConnection` helpers
|
|
152
102
|
|
|
153
|
-
|
|
103
|
+
## Upload Worker Example
|
|
154
104
|
|
|
155
105
|
```tsx
|
|
106
|
+
import { useEffect, useRef } from 'react';
|
|
156
107
|
import { UploadArea } from '@apple-pie/slice';
|
|
157
108
|
import {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
109
|
+
createUploadsWorker,
|
|
110
|
+
useUploads,
|
|
111
|
+
useUploadsActions,
|
|
112
|
+
useUploadsWorkerStatus,
|
|
162
113
|
} from '@apple-pie/slice/stores/uploads';
|
|
163
|
-
import { useEffect, useRef } from 'react';
|
|
164
114
|
|
|
165
115
|
function UploadsExample() {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
{uploads.map((upload) => (
|
|
196
|
-
<div key={upload.id}>
|
|
197
|
-
{upload.file.name} - {upload.status} - {upload.progress ?? 0}%
|
|
198
|
-
</div>
|
|
199
|
-
))}
|
|
200
|
-
</div>
|
|
201
|
-
);
|
|
116
|
+
const workerRef = useRef<Worker | null>(null);
|
|
117
|
+
const uploads = useUploads();
|
|
118
|
+
const workerStatus = useUploadsWorkerStatus();
|
|
119
|
+
const actions = useUploadsActions();
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (workerRef.current) return;
|
|
123
|
+
workerRef.current = createUploadsWorker();
|
|
124
|
+
actions.initialize({ uploadURL: '/api/uploads' }, workerRef.current);
|
|
125
|
+
}, [actions]);
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<div>
|
|
129
|
+
<UploadArea
|
|
130
|
+
busy={workerStatus === 'busy'}
|
|
131
|
+
files={uploads.map((upload) => ({
|
|
132
|
+
id: upload.id,
|
|
133
|
+
file: upload.file,
|
|
134
|
+
progress: upload.progress,
|
|
135
|
+
error: upload.error,
|
|
136
|
+
}))}
|
|
137
|
+
onUpload={(files) => actions.push(files)}
|
|
138
|
+
showProgress={true}
|
|
139
|
+
title={'Upload files'}
|
|
140
|
+
message={'Drag and drop files here or click to upload'}
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
202
144
|
}
|
|
203
145
|
```
|
|
204
146
|
|
|
205
|
-
|
|
147
|
+
If your app needs an explicit worker URL, import the built worker asset from the worker subpath:
|
|
206
148
|
|
|
207
149
|
```ts
|
|
208
150
|
import { createUploadsWorker, uploadsActions } from '@apple-pie/slice/stores/uploads';
|
|
@@ -212,49 +154,27 @@ const worker = createUploadsWorker(uploadsWorkerUrl);
|
|
|
212
154
|
uploadsActions.initialize({ uploadURL: '/api/uploads' }, worker);
|
|
213
155
|
```
|
|
214
156
|
|
|
215
|
-
This worker URL pattern assumes modern frontend tooling such as Vite or similar browser-focused bundlers.
|
|
216
|
-
|
|
217
|
-
## Theme exports
|
|
218
|
-
|
|
219
|
-
- Presets: `lightTheme`, `darkTheme`
|
|
220
|
-
- Color tokens: `light`, `dark`
|
|
221
|
-
- Elevation tokens: `elevations` / `Elevation`
|
|
222
|
-
- Types: `SliceTheme`, `Colors`, `Type`, `Corners`, `Elevations`
|
|
223
|
-
|
|
224
|
-
## Utilities
|
|
225
|
-
|
|
226
|
-
- Package utilities are published from `@apple-pie/slice/utils`
|
|
227
|
-
- Low-level utility objects such as `IndexedDB`, `SSEConnection`, and `WSConnection` are also published from `@apple-pie/slice/utils/objects`
|
|
228
|
-
- Internal utility source lives under `src/utils/functions/*`
|
|
229
|
-
- Shared utility CSS modules live under `src/utils/styling/*`
|
|
230
|
-
|
|
231
157
|
## Development
|
|
232
158
|
|
|
233
159
|
```bash
|
|
234
|
-
npm run dev
|
|
235
|
-
npm run storybook
|
|
236
|
-
npm run test
|
|
237
|
-
npm run benchmark
|
|
238
|
-
npm run
|
|
239
|
-
npm run build
|
|
240
|
-
npm run lint
|
|
160
|
+
npm run dev
|
|
161
|
+
npm run storybook
|
|
162
|
+
npm run test
|
|
163
|
+
npm run benchmark
|
|
164
|
+
npm run build
|
|
165
|
+
npm run build:min
|
|
166
|
+
npm run lint
|
|
241
167
|
```
|
|
242
168
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
Build architecture details: `contributor-docs/build-architecture.md`
|
|
246
|
-
|
|
247
|
-
## Build outputs
|
|
169
|
+
`npm run build` produces:
|
|
248
170
|
|
|
249
|
-
|
|
171
|
+
- CommonJS in `dist/cjs`
|
|
172
|
+
- ESM in `dist/esm`
|
|
173
|
+
- type declarations in `dist/types`
|
|
174
|
+
- shared CSS modules in `dist/css`
|
|
250
175
|
|
|
251
|
-
|
|
252
|
-
- `dist/cjs` for CommonJS
|
|
253
|
-
- `dist/types` for `.d.ts`
|
|
254
|
-
- `dist/css` for shared utility css modules
|
|
176
|
+
## Contributors
|
|
255
177
|
|
|
256
|
-
|
|
178
|
+
Contribution setup and workflow: [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
257
179
|
|
|
258
|
-
|
|
259
|
-
- Storybook docs (`*.stories.*` and `documentation/**`) are excluded from publishable type output.
|
|
260
|
-
- Named media query aliases are compiled via PostCSS custom media. Definitions live in `src/theme/breakpoints/custom-media.css` and can be used in CSS as `@media (--bp-tablet) { ... }`.
|
|
180
|
+
Build and publish architecture details: [contributor-docs/build-architecture.md](./contributor-docs/build-architecture.md)
|
|
@@ -6,7 +6,7 @@ styleInject_es.styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tju
|
|
|
6
6
|
|
|
7
7
|
const Avatar = React.memo(props => {
|
|
8
8
|
var _a;
|
|
9
|
-
const {email: email, name: name, image: image = "", borderSize: borderSize = 0, color: color, borderColor: borderColor, borderColorHover: borderColorHover, outerBorderSize: outerBorderSize, outerBorderColor: outerBorderColor, bgColor: bgColor, onClick: onClick, onKeyDown: onKeyDown, fontSize: fontSize, onToolTip: onToolTip = () => null, size: size = 34, frame: frame = 34, tabIndex: tabIndex = 0} = props, divAttributes = tslib_es6.__rest(props, [ "email", "name", "image", "borderSize", "color", "borderColor", "borderColorHover", "outerBorderSize", "outerBorderColor", "bgColor", "onClick", "onKeyDown", "fontSize", "onToolTip", "size", "frame", "tabIndex" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", ref = React.useRef(null), [textSize, setTextSize] = React.useState("inherit"), initials = React.useMemo(() => {
|
|
9
|
+
const {email: email, name: name, image: image = "", textColor: textColor, borderWidth: borderWidth, borderSize: borderSize = 0, color: color, borderColor: borderColor, borderColorHover: borderColorHover, outerBorderSize: outerBorderSize, outerBorderColor: outerBorderColor, backgroundColor: backgroundColor, bgColor: bgColor, onClick: onClick, onKeyDown: onKeyDown, fontSize: fontSize, onToolTip: onToolTip = () => null, size: size = 34, frame: frame = 34, tabIndex: tabIndex = 0} = props, divAttributes = tslib_es6.__rest(props, [ "email", "name", "image", "textColor", "borderWidth", "borderSize", "color", "borderColor", "borderColorHover", "outerBorderSize", "outerBorderColor", "backgroundColor", "bgColor", "onClick", "onKeyDown", "fontSize", "onToolTip", "size", "frame", "tabIndex" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", ref = React.useRef(null), [textSize, setTextSize] = React.useState("inherit"), resolvedTextColor = null != textColor ? textColor : color, resolvedBorderWidth = null != borderWidth ? borderWidth : borderSize, resolvedBackgroundColor = null != backgroundColor ? backgroundColor : bgColor, initials = React.useMemo(() => {
|
|
10
10
|
if (!name && !email) return "";
|
|
11
11
|
if (name) {
|
|
12
12
|
let last;
|
|
@@ -49,16 +49,16 @@ const Avatar = React.memo(props => {
|
|
|
49
49
|
}, [ onClick, onKeyDown ]), avatarVars = React.useMemo(() => ({
|
|
50
50
|
"--avatar-size": misc.setStyle(size),
|
|
51
51
|
"--avatar-frame": misc.setStyle(frame),
|
|
52
|
-
"--avatar-border": `${
|
|
53
|
-
"--avatar-color": null !=
|
|
54
|
-
"--avatar-bg-color": null !=
|
|
52
|
+
"--avatar-border": `${resolvedBorderWidth}px`,
|
|
53
|
+
"--avatar-color": null != resolvedTextColor ? resolvedTextColor : "var(--core-text-primary)",
|
|
54
|
+
"--avatar-bg-color": null != resolvedBackgroundColor ? resolvedBackgroundColor : "var(--core-surface-secondary)",
|
|
55
55
|
"--avatar-border-color": null != borderColor ? borderColor : "var(--core-outline-primary)",
|
|
56
56
|
"--avatar-border-color-hover": null != borderColorHover ? borderColorHover : "var(--core-outline-special)",
|
|
57
57
|
"--avatar-bg-image": `${bgImage}`,
|
|
58
58
|
"--avatar-font-size": misc.setStyle(textSize),
|
|
59
59
|
"--avatar-outer-border-size": misc.setStyle(outerBorderSize),
|
|
60
60
|
"--avatar-outer-border-color": null != outerBorderColor ? outerBorderColor : "var(--core-surface-primary)"
|
|
61
|
-
}), [ size, frame,
|
|
61
|
+
}), [ size, frame, resolvedBorderWidth, resolvedTextColor, resolvedBackgroundColor, borderColor, borderColorHover, bgImage, textSize, outerBorderSize, outerBorderColor ]), classNames = React.useMemo(() => `${css_wrapper}${divClass}`, [ divClass ]);
|
|
62
62
|
return jsxRuntime.jsx("div", Object.assign({
|
|
63
63
|
id: divId,
|
|
64
64
|
className: classNames,
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), Avatar = require("./Avatar-
|
|
3
|
+
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), Avatar = require("./Avatar-CUaQ3kN1.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css_wrapper = "AvatarGroup-module_wrapper__MtOyq flexBox-module_rowStart__4tcxS", css_avatar = "AvatarGroup-module_avatar__5NVpW";
|
|
4
4
|
|
|
5
5
|
styleInject_es.styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.AvatarGroup-module_wrapper__MtOyq {\n\tgap: var(--ag-gap);\n\tmargin: var(--ag-margin);\n}\n\n.AvatarGroup-module_avatar__5NVpW {\n\tdisplay: inline-block;\n\tmargin-left: var(--ag-overlap);\n\tborder-radius: 100%;\n\t&:first-child {\n\t\tmargin-left: 0;\n\t}\n}\n");
|
|
6
6
|
|
|
7
7
|
const AvatarGroup = React.memo(props => {
|
|
8
|
-
const {avatars: avatars = [], size: size = 32, borderSize: borderSize = 3, overlap: overlap = 8, gap: gap = 0, borderColor: borderColor, borderColorHover: borderColorHover, outerBorderSize: outerBorderSize = 3, outerBorderColor: outerBorderColor = "var(--core-surface-primary)", margin: margin = 0, onToolTip: onToolTip = () => null} = props, divAttributes = tslib_es6.__rest(props, [ "avatars", "size", "borderSize", "overlap", "gap", "borderColor", "borderColorHover", "outerBorderSize", "outerBorderColor", "margin", "onToolTip" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", cssVars = React.useMemo(() => ({
|
|
8
|
+
const {avatars: avatars = [], size: size = 32, borderWidth: borderWidth, borderSize: borderSize = 3, overlap: overlap = 8, gap: gap = 0, borderColor: borderColor, borderColorHover: borderColorHover, outerBorderSize: outerBorderSize = 3, outerBorderColor: outerBorderColor = "var(--core-surface-primary)", margin: margin = 0, onToolTip: onToolTip = () => null} = props, divAttributes = tslib_es6.__rest(props, [ "avatars", "size", "borderWidth", "borderSize", "overlap", "gap", "borderColor", "borderColorHover", "outerBorderSize", "outerBorderColor", "margin", "onToolTip" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", resolvedBorderWidth = null != borderWidth ? borderWidth : borderSize, cssVars = React.useMemo(() => ({
|
|
9
9
|
"--ag-gap": `${null != gap ? gap : 0}px`,
|
|
10
10
|
"--ag-margin": `${null != margin ? margin : 0}px`,
|
|
11
11
|
"--ag-overlap": (overlap > 0 ? -overlap : 0) + "px"
|
|
12
|
-
}), [ overlap, gap, margin ]), renderedAvatars = React.useMemo(() => avatars ? avatars.map((avatar, index) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
}), [ overlap, gap, margin ]), renderedAvatars = React.useMemo(() => avatars ? avatars.map((avatar, index) => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
return jsxRuntime.jsx("div", {
|
|
15
|
+
className: css_avatar,
|
|
16
|
+
children: jsxRuntime.jsx(Avatar.Avatar, {
|
|
17
|
+
name: `${avatar.first} ${avatar.last}`,
|
|
18
|
+
email: avatar.email,
|
|
19
|
+
image: avatar.image || avatar.avatar,
|
|
20
|
+
size: size,
|
|
21
|
+
frame: size,
|
|
22
|
+
borderWidth: resolvedBorderWidth,
|
|
23
|
+
borderColor: borderColor,
|
|
24
|
+
borderColorHover: borderColorHover,
|
|
25
|
+
outerBorderSize: outerBorderSize,
|
|
26
|
+
outerBorderColor: outerBorderColor,
|
|
27
|
+
textColor: null !== (_a = avatar.textColor) && void 0 !== _a ? _a : avatar.color,
|
|
28
|
+
backgroundColor: null !== (_b = avatar.backgroundColor) && void 0 !== _b ? _b : avatar.bgColor,
|
|
29
|
+
onToolTip: onToolTip
|
|
30
|
+
})
|
|
31
|
+
}, `avatar_${avatar.email}_${index}`);
|
|
32
|
+
}) : null, [ avatars, size, resolvedBorderWidth, borderColor, borderColorHover, outerBorderSize, outerBorderColor, onToolTip ]), classNames = React.useMemo(() => `${css_wrapper}${divClass}`, [ divClass ]);
|
|
30
33
|
return jsxRuntime.jsx("div", Object.assign({
|
|
31
34
|
id: divId,
|
|
32
35
|
className: classNames,
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), react = require("motion/react"), React = require("react"), Badge = require("./Badge-CY_DG6cD.js"), Dot = require("./Dot-_HCJ3qxd.js"), Icon = require("./Icon-
|
|
3
|
+
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), react = require("motion/react"), React = require("react"), Badge = require("./Badge-CY_DG6cD.js"), Dot = require("./Dot-_HCJ3qxd.js"), Icon = require("./Icon-D1EB8S5r.js"), ProgressIndicator = require("./ProgressIndicator-BGqIwycX.js"), sharedTypes = require("./sharedTypes-gCECyn2N.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css = {
|
|
4
4
|
button: "Button-module_button__2ZuB7 flexBox-module_row__z24tF",
|
|
5
5
|
label: "Button-module_label__UJ3Zt",
|
|
6
6
|
count: "Button-module_count__DFxVB flexBox-module_row__z24tF",
|
|
7
7
|
icon: "Button-module_icon__-43u5 flexBox-module_row__z24tF",
|
|
8
|
+
xs: "Button-module_xs__cF6m0 type-module_body-xs-regular__ZAFft",
|
|
8
9
|
m: "Button-module_m__DR-gs type-module_body-m-regular__LuQBA",
|
|
9
10
|
l: "Button-module_l__0E0yI type-module_body-l-regular__lOYbg",
|
|
10
11
|
s: "Button-module_s__dSKOL type-module_body-s-regular__vRHSP"
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
styleInject_es.styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.type-module_body-xs-regular__ZAFft {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-medium__s3KvF {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-bold__Lhqqq {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.25px;\n}.type-module_body-s-regular__vRHSP {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-medium__tjdFc {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-bold__Iy-VX {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-m-regular__LuQBA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-medium__uW1on {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-bold__UBcvQ {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-l-regular__lOYbg {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-medium__BqRC7 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-bold__Fh2dt {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-xl-regular__pF2kC {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-medium__BeyrH {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-bold__Ruknj {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_heading-s-medium__z8L3G {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-bold__0O3g6 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-bold__KXxEB {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-medium__cJeEA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-medium__eRe05 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-bold__Xmwtf {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-medium__5q1m3 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-bold__k9VFV {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.Button-module_button__2ZuB7 {\n\tposition: relative;\n\tuser-select: none;\n\t-webkit-user-select: none;\n\tappearance: none;\n\t-webkit-appearance: none;\n\tbackground-image: none;\n\toutline: none;\n}\n\n.Button-module_label__UJ3Zt {\n\tuser-select: none;\n\t-webkit-user-select: none;\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\twhite-space: nowrap;\n\tword-break: break-all;\n\tdisplay: -webkit-box;\n\t-webkit-line-clamp: 1;\n\t-webkit-box-orient: vertical;\n\t&:hover {\n\t\ttext-decoration: var(--ui-button-decoration);\n\t}\n}\n\n.Button-module_count__DFxVB {\n\tposition: absolute;\n\ttop: 0;\n\tright: 0;\n\ttransform: translateX(10px) translateY(-2px);\n}\n\n.Button-module_icon__-43u5 {\n\tmin-width: var(--ui-button-icon-size);\n\tmin-height: var(--ui-button-icon-size);\n\theight: var(--ui-button-icon-size);\n\twidth: var(--ui-button-icon-size);\n}\n\n.Button-module_m__DR-gs {\n}\n\n.Button-module_l__0E0yI {\n}\n\n.Button-module_s__dSKOL {\n}\n");
|
|
14
|
+
styleInject_es.styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.type-module_body-xs-regular__ZAFft {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-medium__s3KvF {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-bold__Lhqqq {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.25px;\n}.type-module_body-s-regular__vRHSP {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-medium__tjdFc {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-bold__Iy-VX {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-m-regular__LuQBA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-medium__uW1on {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-bold__UBcvQ {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-l-regular__lOYbg {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-medium__BqRC7 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-bold__Fh2dt {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-xl-regular__pF2kC {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-medium__BeyrH {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-bold__Ruknj {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_heading-s-medium__z8L3G {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-bold__0O3g6 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-bold__KXxEB {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-medium__cJeEA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-medium__eRe05 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-bold__Xmwtf {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-medium__5q1m3 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-bold__k9VFV {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.Button-module_button__2ZuB7 {\n\tposition: relative;\n\tuser-select: none;\n\t-webkit-user-select: none;\n\tappearance: none;\n\t-webkit-appearance: none;\n\tbackground-image: none;\n\toutline: none;\n}\n\n.Button-module_label__UJ3Zt {\n\tuser-select: none;\n\t-webkit-user-select: none;\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\twhite-space: nowrap;\n\tword-break: break-all;\n\tdisplay: -webkit-box;\n\t-webkit-line-clamp: 1;\n\t-webkit-box-orient: vertical;\n\t&:hover {\n\t\ttext-decoration: var(--ui-button-decoration);\n\t}\n}\n\n.Button-module_count__DFxVB {\n\tposition: absolute;\n\ttop: 0;\n\tright: 0;\n\ttransform: translateX(10px) translateY(-2px);\n}\n\n.Button-module_icon__-43u5 {\n\tmin-width: var(--ui-button-icon-size);\n\tmin-height: var(--ui-button-icon-size);\n\theight: var(--ui-button-icon-size);\n\twidth: var(--ui-button-icon-size);\n}\n\n.Button-module_xs__cF6m0 {\n}\n\n.Button-module_m__DR-gs {\n}\n\n.Button-module_l__0E0yI {\n}\n\n.Button-module_s__dSKOL {\n}\n");
|
|
14
15
|
|
|
15
16
|
const ButtonComponent = React.forwardRef((props, buttonRef) => {
|
|
16
|
-
const {children: children, size: size = "medium", variant: variant = "outline", label: label, labelSize: labelSize = "m", iconRight: iconRight, iconLeft: iconLeft, count: count = (void 0 === props.count ? void 0 : Number(props.count)), showDot: showDot, tooltip: tooltip, round: round = !1, state: state = "normal", fill: fill = !1, iconSize: iconSize = (void 0 === props.iconSize ? 20 : Number(props.iconSize)), width: width = "min-content", underline: underline = !1, borderRadius: borderRadius, iconColor: iconColor, bgColor: bgColor, bgColorDisabled: bgColorDisabled, labelColor: labelColor, transition: transition, variants: variants, initial: initial, animate: animate, exit: exit, paddingRight: paddingRight, paddingLeft: paddingLeft, progress: progress = !1, working: working = !1, duration: duration, trigger: trigger = !1, destructive: destructive = !1, onClick: onClick = () => null, onToolTip: onToolTip = () => null} = props, divAttributes = tslib_es6.__rest(props, [ "children", "size", "variant", "label", "labelSize", "iconRight", "iconLeft", "count", "showDot", "tooltip", "round", "state", "fill", "iconSize", "width", "underline", "borderRadius", "iconColor", "bgColor", "bgColorDisabled", "labelColor", "transition", "variants", "initial", "animate", "exit", "paddingRight", "paddingLeft", "progress", "working", "duration", "trigger", "destructive", "onClick", "onToolTip" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", [btnState, setBtnState] = React.useState(state), [lockedWidth, setLockedWidth] = React.useState(void 0), [playing, setPlaying] = React.useState(working), ref = React.useRef(null), lockCurrentWidth = React.useCallback(() => {
|
|
17
|
+
const {children: children, size: size = "medium", variant: variant = "outline", label: label, labelSize: labelSize = "m", iconRight: iconRight, iconLeft: iconLeft, count: count = (void 0 === props.count ? void 0 : Number(props.count)), showDot: showDot, tooltip: tooltip, round: round = !1, state: state = "normal", fill: fill = !1, iconSize: iconSize = (void 0 === props.iconSize ? 20 : Number(props.iconSize)), width: width = "min-content", underline: underline = !1, borderRadius: borderRadius, iconColor: iconColor, backgroundColor: backgroundColor, backgroundColorDisabled: backgroundColorDisabled, bgColor: bgColor, bgColorDisabled: bgColorDisabled, labelColor: labelColor, transition: transition, variants: variants, initial: initial, animate: animate, exit: exit, paddingRight: paddingRight, paddingLeft: paddingLeft, progress: progress = !1, working: working = !1, duration: duration, trigger: trigger = !1, destructive: destructive = !1, onClick: onClick = () => null, onToolTip: onToolTip = () => null} = props, divAttributes = tslib_es6.__rest(props, [ "children", "size", "variant", "label", "labelSize", "iconRight", "iconLeft", "count", "showDot", "tooltip", "round", "state", "fill", "iconSize", "width", "underline", "borderRadius", "iconColor", "backgroundColor", "backgroundColorDisabled", "bgColor", "bgColorDisabled", "labelColor", "transition", "variants", "initial", "animate", "exit", "paddingRight", "paddingLeft", "progress", "working", "duration", "trigger", "destructive", "onClick", "onToolTip" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", resolvedBackgroundColor = null != backgroundColor ? backgroundColor : bgColor, resolvedBackgroundColorDisabled = null != backgroundColorDisabled ? backgroundColorDisabled : bgColorDisabled, [btnState, setBtnState] = React.useState(state), [lockedWidth, setLockedWidth] = React.useState(void 0), [playing, setPlaying] = React.useState(working), ref = React.useRef(null), lockCurrentWidth = React.useCallback(() => {
|
|
17
18
|
ref.current && setLockedWidth(ref.current.offsetWidth);
|
|
18
19
|
}, []), handleClick = React.useCallback(e => {
|
|
19
20
|
onToolTip(null), "disabled" !== btnState && (progress && duration ? (lockCurrentWidth(),
|
|
@@ -40,9 +41,9 @@ const ButtonComponent = React.forwardRef((props, buttonRef) => {
|
|
|
40
41
|
disabled: iconColor || destructiveColor(!0)
|
|
41
42
|
},
|
|
42
43
|
background: {
|
|
43
|
-
normal:
|
|
44
|
-
hover:
|
|
45
|
-
disabled:
|
|
44
|
+
normal: resolvedBackgroundColor || (destructive ? "var(--feedback-warning)" : "var(--core-button-primary)"),
|
|
45
|
+
hover: resolvedBackgroundColor || (destructive ? "var(--feedback-warning)" : "var(--core-button-primary)"),
|
|
46
|
+
disabled: resolvedBackgroundColorDisabled || "var(--core-button-disabled)"
|
|
46
47
|
},
|
|
47
48
|
borderColor: {
|
|
48
49
|
normal: "transparent",
|
|
@@ -54,7 +55,7 @@ const ButtonComponent = React.forwardRef((props, buttonRef) => {
|
|
|
54
55
|
hover: labelColor || (destructive ? "white" : "var(--core-text-light)"),
|
|
55
56
|
disabled: "var(--core-text-disabled)"
|
|
56
57
|
}
|
|
57
|
-
}), [ labelColor, destructive, destructiveColor,
|
|
58
|
+
}), [ labelColor, destructive, destructiveColor, resolvedBackgroundColor, resolvedBackgroundColorDisabled, iconColor ]), outline = React.useMemo(() => ({
|
|
58
59
|
border: "1px",
|
|
59
60
|
iconColor: {
|
|
60
61
|
normal: iconColor || destructiveColor(!0),
|
|
@@ -62,9 +63,9 @@ const ButtonComponent = React.forwardRef((props, buttonRef) => {
|
|
|
62
63
|
disabled: iconColor || destructiveColor(!0)
|
|
63
64
|
},
|
|
64
65
|
background: {
|
|
65
|
-
normal:
|
|
66
|
-
hover:
|
|
67
|
-
disabled:
|
|
66
|
+
normal: resolvedBackgroundColor || "var(--core-surface-primary)",
|
|
67
|
+
hover: resolvedBackgroundColor || "var(--core-surface-primary)",
|
|
68
|
+
disabled: resolvedBackgroundColorDisabled || "var(--core-surface-primary)"
|
|
68
69
|
},
|
|
69
70
|
borderColor: {
|
|
70
71
|
normal: destructive ? "var(--feedback-warning)" : "var(--core-outline-primary)",
|
|
@@ -76,7 +77,7 @@ const ButtonComponent = React.forwardRef((props, buttonRef) => {
|
|
|
76
77
|
hover: labelColor || (destructive ? "var(--feedback-warning)" : "var(--core-text-special)"),
|
|
77
78
|
disabled: "var(--core-text-disabled)"
|
|
78
79
|
}
|
|
79
|
-
}), [ labelColor, destructive, destructiveColor,
|
|
80
|
+
}), [ labelColor, destructive, destructiveColor, resolvedBackgroundColor, resolvedBackgroundColorDisabled, iconColor ]), text = React.useMemo(() => ({
|
|
80
81
|
border: "1px",
|
|
81
82
|
iconColor: {
|
|
82
83
|
normal: destructiveColor(!0),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), misc = require("./misc-BTF7BCZW.js"), Icon = require("./Icon-
|
|
3
|
+
var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), misc = require("./misc-BTF7BCZW.js"), Icon = require("./Icon-D1EB8S5r.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css_wrapper = "ButtonBar-module_wrapper__FYZ3s flexBox-module_rowStart__4tcxS", css_button = "ButtonBar-module_button__bMR3h flexBox-module_row__z24tF", css_selected = "ButtonBar-module_selected__wKvmi";
|
|
4
4
|
|
|
5
5
|
styleInject_es.styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.ButtonBar-module_wrapper__FYZ3s {\n\tborder-radius: var(--bb-border-radius);\n\tborder: var(--bb-border-size) solid var(--bb-border-color);\n\toverflow: hidden;\n}\n\n.ButtonBar-module_label__UcAS1 {\n\tcolor: var(--bb-label-color);\n\tpadding-right: 4px;\n}\n\n.ButtonBar-module_button__bMR3h {\n\theight: var(--bb-button-size);\n\twidth: var(--bb-button-size);\n\tmin-height: var(--bb-button-size);\n\tmin-width: var(--bb-button-size);\n\tcursor: pointer;\n\tbackground: var(--bb-bg-color);\n\tborder: 0;\n\tborder-right: var(--bb-border-size) solid var(--bb-border-color);\n\tuser-select: none;\n\t-webkit-user-select: none;\n\tappearance: none;\n\t-webkit-appearance: none;\n\t&:first-child {\n\t\tpadding-left: 4px;\n\t}\n\t&:last-child {\n\t\tborder-right: none;\n\t\tpadding-right: 4px;\n\t}\n\t&:hover {\n\t\tbackground: var(--bb-bg-color-hover);\n\t}\n}\n\n.ButtonBar-module_selected__wKvmi {\n\tbackground: var(--bb-bg-color-active);\n\tcolor: var(--core-link-primary);\n}\n");
|
|
6
6
|
|
|
7
7
|
const ButtonBar = React.memo(function(props) {
|
|
8
|
-
const {buttons: buttons = [], selected: selected, toggle: toggle = !0, buttonSize: buttonSize = 44, iconSize: iconSize = 20, borderSize: borderSize = 1, borderRadius: borderRadius = 100, borderColor: borderColor = "var(--core-outline-primary)", bgColor: bgColor = "var(--core-surface-primary)", bgColorHover: bgColorHover = "var(--core-surface-secondary)", bgColorActive: bgColorActive = "var(--core-surface-secondary)", labelColor: labelColor = "var(--core-text-primary)", onClick: onClick = button => null, onChange: onChange = button => null, onToolTip: onToolTip = () => null} = props, divAttributes = tslib_es6.__rest(props, [ "buttons", "selected", "toggle", "buttonSize", "iconSize", "borderSize", "borderRadius", "borderColor", "bgColor", "bgColorHover", "bgColorActive", "labelColor", "onClick", "onChange", "onToolTip" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", [hovered, setHovered] = React.useState(-1), [selectedIndex, setSelectedIndex] = React.useState(selected);
|
|
8
|
+
const {buttons: buttons = [], selected: selected, toggle: toggle = !0, buttonSize: buttonSize = 44, iconSize: iconSize = 20, borderWidth: borderWidth, borderSize: borderSize = 1, borderRadius: borderRadius = 100, borderColor: borderColor = "var(--core-outline-primary)", backgroundColor: backgroundColor, backgroundColorHover: backgroundColorHover, backgroundColorActive: backgroundColorActive, bgColor: bgColor = "var(--core-surface-primary)", bgColorHover: bgColorHover = "var(--core-surface-secondary)", bgColorActive: bgColorActive = "var(--core-surface-secondary)", labelColor: labelColor = "var(--core-text-primary)", onClick: onClick = button => null, onChange: onChange = button => null, onToolTip: onToolTip = () => null} = props, divAttributes = tslib_es6.__rest(props, [ "buttons", "selected", "toggle", "buttonSize", "iconSize", "borderWidth", "borderSize", "borderRadius", "borderColor", "backgroundColor", "backgroundColorHover", "backgroundColorActive", "bgColor", "bgColorHover", "bgColorActive", "labelColor", "onClick", "onChange", "onToolTip" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", resolvedBorderWidth = null != borderWidth ? borderWidth : borderSize, resolvedBackgroundColor = null != backgroundColor ? backgroundColor : bgColor, resolvedBackgroundColorHover = null != backgroundColorHover ? backgroundColorHover : bgColorHover, resolvedBackgroundColorActive = null != backgroundColorActive ? backgroundColorActive : bgColorActive, [hovered, setHovered] = React.useState(-1), [selectedIndex, setSelectedIndex] = React.useState(selected);
|
|
9
9
|
React.useEffect(() => setSelectedIndex(selected), [ selected ]);
|
|
10
10
|
const handleMouseEnter = React.useCallback(index => {
|
|
11
11
|
setHovered(index);
|
|
@@ -14,15 +14,15 @@ const ButtonBar = React.memo(function(props) {
|
|
|
14
14
|
}, []), handleClick = React.useCallback((button, index) => {
|
|
15
15
|
onClick(button), toggle && (setSelectedIndex(index), onChange(button));
|
|
16
16
|
}, [ onChange, onClick, toggle ]), buttonClass = React.useCallback(index => toggle && selectedIndex === index ? css_selected : "", [ selectedIndex, toggle ]), iconColor = React.useCallback(index => toggle && selectedIndex === index ? "var(--core-text-special)" : hovered === index ? "var(--core-text-primary)" : "var(--core-text-secondary)", [ selectedIndex, hovered, toggle ]), cssVars = React.useMemo(() => ({
|
|
17
|
-
"--bb-border-size": `${
|
|
17
|
+
"--bb-border-size": `${resolvedBorderWidth}px`,
|
|
18
18
|
"--bb-border-radius": misc.setStyle(borderRadius),
|
|
19
19
|
"--bb-border-color": borderColor,
|
|
20
|
-
"--bb-bg-color":
|
|
21
|
-
"--bb-bg-color-hover":
|
|
22
|
-
"--bb-bg-color-active":
|
|
20
|
+
"--bb-bg-color": resolvedBackgroundColor,
|
|
21
|
+
"--bb-bg-color-hover": resolvedBackgroundColorHover,
|
|
22
|
+
"--bb-bg-color-active": resolvedBackgroundColorActive,
|
|
23
23
|
"--bb-label-color": labelColor,
|
|
24
24
|
"--bb-button-size": `${buttonSize}px`
|
|
25
|
-
}), [
|
|
25
|
+
}), [ resolvedBorderWidth, borderRadius, borderColor, resolvedBackgroundColor, labelColor, resolvedBackgroundColorHover, buttonSize, resolvedBackgroundColorActive ]), barButtons = React.useMemo(() => null == buttons ? void 0 : buttons.map((button, index) => jsxRuntime.jsx(BarButton, {
|
|
26
26
|
classNames: `${css_button} ${buttonClass(index)}`,
|
|
27
27
|
onMouseEnter: () => handleMouseEnter(index),
|
|
28
28
|
onMouseLeave: handleMouseLeave,
|