@drjoshcsimmons/scl 0.1.2 → 0.1.3
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 +202 -13
- package/dist/index100.js +49 -218
- package/dist/index101.js +8 -649
- package/dist/index102.js +628 -159
- package/dist/index103.js +180 -3
- package/dist/index104.js +15 -30
- package/dist/index106.js +21 -12
- package/dist/index107.js +3 -15
- package/dist/index108.js +32 -3
- package/dist/index109.js +12 -32
- package/dist/index11.js +2 -2
- package/dist/index110.js +12 -18
- package/dist/index112.js +1 -1
- package/dist/index115.js +1 -1
- package/dist/index116.js +1 -1
- package/dist/index117.js +2 -25
- package/dist/index118.js +2 -29
- package/dist/index119.js +25 -5
- package/dist/index12.js +1 -1
- package/dist/index120.js +29 -2
- package/dist/index121.js +5 -2
- package/dist/index125.js +1 -1
- package/dist/index126.js +1 -1
- package/dist/index13.js +2 -2
- package/dist/index130.js +1 -1
- package/dist/index14.js +2 -2
- package/dist/index15.js +2 -2
- package/dist/index17.js +4 -4
- package/dist/index18.js +2 -2
- package/dist/index20.js +2 -2
- package/dist/index21.js +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.js +2 -2
- package/dist/index24.js +1 -1
- package/dist/index25.js +4 -4
- package/dist/index27.js +3 -3
- package/dist/index29.js +1 -1
- package/dist/index31.js +1 -1
- package/dist/index36.js +1 -1
- package/dist/index37.js +1 -1
- package/dist/index4.js +2 -2
- package/dist/index45.js +108 -220
- package/dist/index46.js +33 -11
- package/dist/index47.js +118 -33
- package/dist/index48.js +62 -107
- package/dist/index49.js +237 -61
- package/dist/index5.js +1 -1
- package/dist/index50.js +9 -310
- package/dist/index51.js +237 -12
- package/dist/index52.js +11 -260
- package/dist/index53.js +18 -12
- package/dist/index54.js +856 -56
- package/dist/index55.js +9 -254
- package/dist/index56.js +205 -229
- package/dist/index57.js +5 -3
- package/dist/index58.js +11 -125
- package/dist/index59.js +60 -12
- package/dist/index6.js +1 -1
- package/dist/index60.js +252 -16
- package/dist/index61.js +511 -206
- package/dist/index62.js +241 -11
- package/dist/index63.js +260 -11
- package/dist/index64.js +12 -241
- package/dist/index65.js +12 -236
- package/dist/index66.js +392 -487
- package/dist/index67.js +8 -8
- package/dist/index68.js +325 -119
- package/dist/index69.js +66 -320
- package/dist/index7.js +1 -1
- package/dist/index70.js +299 -71
- package/dist/index71.js +12 -435
- package/dist/index72.js +1 -1
- package/dist/index73.js +204 -828
- package/dist/index74.js +130 -9
- package/dist/index75.js +3 -3
- package/dist/index76.js +66 -5
- package/dist/index77.js +23 -64
- package/dist/index78.js +6 -51
- package/dist/index79.js +54 -4
- package/dist/index8.js +1 -1
- package/dist/index80.js +49 -24
- package/dist/index81.js +4 -34
- package/dist/index82.js +32 -67
- package/dist/index83.js +68 -10
- package/dist/index84.js +10 -54
- package/dist/index85.js +54 -10
- package/dist/index86.js +11 -30
- package/dist/index87.js +30 -13
- package/dist/index88.js +11 -44
- package/dist/index89.js +5 -7
- package/dist/index9.js +2 -2
- package/dist/index90.js +24 -14
- package/dist/index91.js +44 -123
- package/dist/index92.js +7 -134
- package/dist/index93.js +4 -14
- package/dist/index94.js +122 -12
- package/dist/index95.js +14 -8
- package/dist/index96.js +133 -48
- package/dist/index97.js +216 -51
- package/dist/index98.js +14 -6
- package/dist/index99.js +30 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,74 @@
|
|
|
1
|
+
```
|
|
2
|
+
_____ __________
|
|
3
|
+
/ ___// ____/ __ \
|
|
4
|
+
\__ \/ / / / / /
|
|
5
|
+
___/ / /___/ /_/ /
|
|
6
|
+
/____/\____/_____/
|
|
7
|
+
|
|
8
|
+
SIMSIES COMPONENT LIBRARY
|
|
9
|
+
"because copy-pasting is for normies"
|
|
10
|
+
```
|
|
11
|
+
|
|
1
12
|
# SCL - Simsies Component Library
|
|
2
13
|
|
|
14
|
+
[](https://jcpsimmons.github.io/scl/)
|
|
15
|
+
[](https://www.npmjs.com/package/@drjoshcsimmons/scl)
|
|
16
|
+
[](https://opensource.org/licenses/MIT)
|
|
17
|
+
|
|
3
18
|
A BASED React component library that doesn't suck. Built on [shadcn/ui](https://ui.shadcn.com/), Radix primitives, and Tailwind CSS because I'm not a masochist who writes CSS from scratch anymore.
|
|
4
19
|
|
|
5
|
-
|
|
20
|
+
```
|
|
21
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
22
|
+
║ ║
|
|
23
|
+
║ > npm install @drjoshcsimmons/scl ║
|
|
24
|
+
║ ║
|
|
25
|
+
║ [████████████████████████████████████████] 100% ║
|
|
26
|
+
║ ║
|
|
27
|
+
║ ✓ installed 1 package ║
|
|
28
|
+
║ ✓ your code now has TASTE ║
|
|
29
|
+
║ ✓ maidens acquired ║
|
|
30
|
+
║ ║
|
|
31
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
32
|
+
```
|
|
6
33
|
|
|
7
34
|
## What the hell is this?
|
|
8
35
|
|
|
9
|
-
It's my personal component library. I got tired of copy-pasting the same damn components between projects, so I made this. Now I just `npm install` and get on with my life.
|
|
36
|
+
It's my personal component library. I got tired of copy-pasting the same damn components between projects, so I made this. Now I just `npm install` and get on with my life like a functional adult.
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
┌─────────────────────┐
|
|
40
|
+
│ VIRGIN DEVS: │
|
|
41
|
+
│ "Let me just │
|
|
42
|
+
│ copy this file │
|
|
43
|
+
│ real quick..." │
|
|
44
|
+
└─────────┬───────────┘
|
|
45
|
+
│
|
|
46
|
+
▼
|
|
47
|
+
┌─────────────────────┐
|
|
48
|
+
│ *3 hours later* │
|
|
49
|
+
│ "Why doesn't this │
|
|
50
|
+
│ work anymore" │
|
|
51
|
+
└─────────────────────┘
|
|
52
|
+
|
|
53
|
+
vs.
|
|
54
|
+
|
|
55
|
+
┌─────────────────────┐
|
|
56
|
+
│ CHAD SCL USERS: │
|
|
57
|
+
│ npm install │
|
|
58
|
+
│ *ships product* │
|
|
59
|
+
│ *goes outside* │
|
|
60
|
+
└─────────────────────┘
|
|
61
|
+
```
|
|
10
62
|
|
|
11
63
|
## Installation
|
|
12
64
|
|
|
13
65
|
```bash
|
|
14
66
|
npm install @drjoshcsimmons/scl
|
|
67
|
+
# or
|
|
68
|
+
pnpm add @drjoshcsimmons/scl
|
|
69
|
+
# or
|
|
70
|
+
yarn add @drjoshcsimmons/scl
|
|
71
|
+
# (we don't discriminate against package managers here)
|
|
15
72
|
```
|
|
16
73
|
|
|
17
74
|
## Usage
|
|
@@ -32,17 +89,36 @@ function App() {
|
|
|
32
89
|
|
|
33
90
|
## Components
|
|
34
91
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
92
|
+
```
|
|
93
|
+
┌──────────────────────────────────────────────────────────────────┐
|
|
94
|
+
│ COMPONENT ARSENAL │
|
|
95
|
+
├──────────────────────────────────────────────────────────────────┤
|
|
96
|
+
│ │
|
|
97
|
+
│ ┌─ LAYOUT ─────────────────────────────────────────────────┐ │
|
|
98
|
+
│ │ Accordion • Card • Collapsible • Scroll Area │ │
|
|
99
|
+
│ │ Separator • Sheet • Tabs • Resizable │ │
|
|
100
|
+
│ └──────────────────────────────────────────────────────────┘ │
|
|
101
|
+
│ │
|
|
102
|
+
│ ┌─ FORMS ──────────────────────────────────────────────────┐ │
|
|
103
|
+
│ │ Button • Checkbox • Input • Label • Radio Group │ │
|
|
104
|
+
│ │ Select • Slider • Switch • Textarea • Toggle │ │
|
|
105
|
+
│ └──────────────────────────────────────────────────────────┘ │
|
|
106
|
+
│ │
|
|
107
|
+
│ ┌─ DATA DISPLAY ───────────────────────────────────────────┐ │
|
|
108
|
+
│ │ Avatar • Badge • Progress • Skeleton • Table • Tooltip │ │
|
|
109
|
+
│ └──────────────────────────────────────────────────────────┘ │
|
|
110
|
+
│ │
|
|
111
|
+
│ ┌─ FEEDBACK ───────────────────────────────────────────────┐ │
|
|
112
|
+
│ │ Alert • Alert Dialog • Dialog • Popover • Dropdown Menu │ │
|
|
113
|
+
│ └──────────────────────────────────────────────────────────┘ │
|
|
114
|
+
│ │
|
|
115
|
+
│ ┌─ WEIRD CUSTOM SHIT ──────────────────────────────────────┐ │
|
|
116
|
+
│ │ Dithered Image • Statusline • Terminal Textarea │ │
|
|
117
|
+
│ │ Code Editor (with VIM MODE because we're not animals) │ │
|
|
118
|
+
│ └──────────────────────────────────────────────────────────┘ │
|
|
119
|
+
│ │
|
|
120
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
121
|
+
```
|
|
46
122
|
|
|
47
123
|
## Development
|
|
48
124
|
|
|
@@ -58,16 +134,129 @@ pnpm test
|
|
|
58
134
|
|
|
59
135
|
# Build the library
|
|
60
136
|
pnpm build
|
|
137
|
+
|
|
138
|
+
# Type check (for the paranoid)
|
|
139
|
+
pnpm typecheck
|
|
61
140
|
```
|
|
62
141
|
|
|
63
142
|
## Storybook
|
|
64
143
|
|
|
65
144
|
Check out the components at [jcpsimmons.github.io/scl](https://jcpsimmons.github.io/scl/)
|
|
66
145
|
|
|
146
|
+
```
|
|
147
|
+
┌─────────────────────────────────────┐
|
|
148
|
+
│ │
|
|
149
|
+
│ STORYBOOK PREVIEW: │
|
|
150
|
+
│ │
|
|
151
|
+
│ ┌─────────────────────────────┐ │
|
|
152
|
+
│ │ [=========] Button │ │
|
|
153
|
+
│ │ [ ● ] Toggle │ │
|
|
154
|
+
│ │ [████░░░░░] Progress │ │
|
|
155
|
+
│ │ ┌─────────┐ Card │ │
|
|
156
|
+
│ │ │ Content │ │ │
|
|
157
|
+
│ │ └─────────┘ │ │
|
|
158
|
+
│ └─────────────────────────────┘ │
|
|
159
|
+
│ │
|
|
160
|
+
│ (but cooler because retro theme) │
|
|
161
|
+
│ │
|
|
162
|
+
└─────────────────────────────────────┘
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## The Aesthetic
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
╔════════════════════════════════════════════════════════════════════╗
|
|
169
|
+
║ ║
|
|
170
|
+
║ This library has a RETRO TERMINAL AESTHETIC because: ║
|
|
171
|
+
║ ║
|
|
172
|
+
║ • No border-radius (corners are for cowards) ║
|
|
173
|
+
║ • No shadows (we live in FLATLAND) ║
|
|
174
|
+
║ • BigBlueTerm437 monospace font (embrace the CRT vibes) ║
|
|
175
|
+
║ • CSS variables for theming (HSL colors because we're not ║
|
|
176
|
+
║ savages who use hex in 2024) ║
|
|
177
|
+
║ • Dark mode (obviously) ║
|
|
178
|
+
║ ║
|
|
179
|
+
║ If you want rounded corners and drop shadows, Material UI is ║
|
|
180
|
+
║ ──────────────────────────────────────────────> that way ║
|
|
181
|
+
║ ║
|
|
182
|
+
╚════════════════════════════════════════════════════════════════════╝
|
|
183
|
+
```
|
|
184
|
+
|
|
67
185
|
## Why "Simsies"?
|
|
68
186
|
|
|
69
187
|
It's my name. Well, part of it. Don't overthink it.
|
|
70
188
|
|
|
189
|
+
```
|
|
190
|
+
___________________
|
|
191
|
+
< Simmons -> Simsies >
|
|
192
|
+
-------------------
|
|
193
|
+
\ ^__^
|
|
194
|
+
\ (oo)\_______
|
|
195
|
+
(__)\ )\/\
|
|
196
|
+
||----w |
|
|
197
|
+
|| ||
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Tech Stack
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
┌────────────────────────────────────────────────────────┐
|
|
204
|
+
│ │
|
|
205
|
+
│ React ──────────────► Because it's 2024 │
|
|
206
|
+
│ │ │
|
|
207
|
+
│ ▼ │
|
|
208
|
+
│ Radix UI ──────────► Accessibility handled │
|
|
209
|
+
│ │ │
|
|
210
|
+
│ ▼ │
|
|
211
|
+
│ Tailwind CSS ──────► Utility classes go brrrr │
|
|
212
|
+
│ │ │
|
|
213
|
+
│ ▼ │
|
|
214
|
+
│ CVA ────────────────► Variants without the pain │
|
|
215
|
+
│ │ │
|
|
216
|
+
│ ▼ │
|
|
217
|
+
│ TypeScript ─────────► Red squiggles save lives │
|
|
218
|
+
│ │ │
|
|
219
|
+
│ ▼ │
|
|
220
|
+
│ Vite ───────────────► Fast AF builds │
|
|
221
|
+
│ │ │
|
|
222
|
+
│ ▼ │
|
|
223
|
+
│ Vitest ─────────────► Tests that don't take forever │
|
|
224
|
+
│ │
|
|
225
|
+
└────────────────────────────────────────────────────────┘
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Contributing
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
┌───────────────────────────────────────────────┐
|
|
232
|
+
│ │
|
|
233
|
+
│ 1. Fork the repo │
|
|
234
|
+
│ 2. Make your changes │
|
|
235
|
+
│ 3. Write tests (non-negotiable) │
|
|
236
|
+
│ 4. Open a PR │
|
|
237
|
+
│ 5. ??? │
|
|
238
|
+
│ 6. Profit │
|
|
239
|
+
│ │
|
|
240
|
+
└───────────────────────────────────────────────┘
|
|
241
|
+
```
|
|
242
|
+
|
|
71
243
|
## License
|
|
72
244
|
|
|
73
245
|
MIT - Do whatever the fuck you want with it.
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
████████████████████████████████████████████████████████████
|
|
249
|
+
█ █
|
|
250
|
+
█ "I used to copy-paste components like a peasant. █
|
|
251
|
+
█ Now I npm install SCL and actually touch grass." █
|
|
252
|
+
█ █
|
|
253
|
+
█ - Some developer, probably █
|
|
254
|
+
█ █
|
|
255
|
+
████████████████████████████████████████████████████████████
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
<p align="center">
|
|
261
|
+
<sub>Made with ☕ and mass quantities of mass quantities by <a href="https://github.com/jcpsimmons">@jcpsimmons</a></sub>
|
|
262
|
+
</p>
|
package/dist/index100.js
CHANGED
|
@@ -1,221 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
var S = function(r) {
|
|
2
|
+
if (typeof document > "u")
|
|
3
|
+
return null;
|
|
4
|
+
var u = Array.isArray(r) ? r[0] : r;
|
|
5
|
+
return u.ownerDocument.body;
|
|
6
|
+
}, f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {}, h = 0, W = function(r) {
|
|
7
|
+
return r && (r.host || W(r.parentNode));
|
|
8
|
+
}, D = function(r, u) {
|
|
9
|
+
return u.map(function(e) {
|
|
10
|
+
if (r.contains(e))
|
|
11
|
+
return e;
|
|
12
|
+
var n = W(e);
|
|
13
|
+
return n && r.contains(n) ? n : (console.error("aria-hidden", e, "in not contained inside", r, ". Doing nothing"), null);
|
|
14
|
+
}).filter(function(e) {
|
|
15
|
+
return !!e;
|
|
16
|
+
});
|
|
17
|
+
}, E = function(r, u, e, n) {
|
|
18
|
+
var i = D(u, Array.isArray(r) ? r : [r]);
|
|
19
|
+
p[e] || (p[e] = /* @__PURE__ */ new WeakMap());
|
|
20
|
+
var s = p[e], l = [], o = /* @__PURE__ */ new Set(), b = new Set(i), y = function(t) {
|
|
21
|
+
!t || o.has(t) || (o.add(t), y(t.parentNode));
|
|
22
|
+
};
|
|
23
|
+
i.forEach(y);
|
|
24
|
+
var A = function(t) {
|
|
25
|
+
!t || b.has(t) || Array.prototype.forEach.call(t.children, function(a) {
|
|
26
|
+
if (o.has(a))
|
|
27
|
+
A(a);
|
|
28
|
+
else
|
|
29
|
+
try {
|
|
30
|
+
var c = a.getAttribute(n), w = c !== null && c !== "false", d = (f.get(a) || 0) + 1, M = (s.get(a) || 0) + 1;
|
|
31
|
+
f.set(a, d), s.set(a, M), l.push(a), d === 1 && w && v.set(a, !0), M === 1 && a.setAttribute(e, "true"), w || a.setAttribute(n, "true");
|
|
32
|
+
} catch (k) {
|
|
33
|
+
console.error("aria-hidden: cannot operate on ", a, k);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return A(u), o.clear(), h++, function() {
|
|
38
|
+
l.forEach(function(t) {
|
|
39
|
+
var a = f.get(t) - 1, c = s.get(t) - 1;
|
|
40
|
+
f.set(t, a), s.set(t, c), a || (v.has(t) || t.removeAttribute(n), v.delete(t)), c || t.removeAttribute(e);
|
|
41
|
+
}), h--, h || (f = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {});
|
|
42
|
+
};
|
|
43
|
+
}, C = function(r, u, e) {
|
|
44
|
+
e === void 0 && (e = "data-aria-hidden");
|
|
45
|
+
var n = Array.from(Array.isArray(r) ? r : [r]), i = S(r);
|
|
46
|
+
return i ? (n.push.apply(n, Array.from(i.querySelectorAll("[aria-live], script"))), E(n, i, e, "aria-hidden")) : function() {
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
15
49
|
};
|
|
16
|
-
U.displayName = N;
|
|
17
|
-
var q = "PopperAnchor", G = p.forwardRef(
|
|
18
|
-
(e, s) => {
|
|
19
|
-
const { __scopePopper: a, virtualRef: t, ...i } = e, r = Z(q, a), o = p.useRef(null), w = j(s, o), n = p.useRef(null);
|
|
20
|
-
return p.useEffect(() => {
|
|
21
|
-
const c = n.current;
|
|
22
|
-
n.current = (t == null ? void 0 : t.current) || o.current, c !== n.current && r.onAnchorChange(n.current);
|
|
23
|
-
}), t ? null : /* @__PURE__ */ f(z.div, { ...i, ref: w });
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
G.displayName = q;
|
|
27
|
-
var _ = "PopperContent", [He, We] = L(_), J = p.forwardRef(
|
|
28
|
-
(e, s) => {
|
|
29
|
-
var Y, M, X, D, F, k;
|
|
30
|
-
const {
|
|
31
|
-
__scopePopper: a,
|
|
32
|
-
side: t = "bottom",
|
|
33
|
-
sideOffset: i = 0,
|
|
34
|
-
align: r = "center",
|
|
35
|
-
alignOffset: o = 0,
|
|
36
|
-
arrowPadding: w = 0,
|
|
37
|
-
avoidCollisions: n = !0,
|
|
38
|
-
collisionBoundary: c = [],
|
|
39
|
-
collisionPadding: x = 0,
|
|
40
|
-
sticky: m = "partial",
|
|
41
|
-
hideWhenDetached: y = !1,
|
|
42
|
-
updatePositionStrategy: A = "optimized",
|
|
43
|
-
onPlaced: l,
|
|
44
|
-
...d
|
|
45
|
-
} = e, v = Z(_, a), [h, C] = p.useState(null), ee = j(s, (P) => C(P)), [E, te] = p.useState(null), u = Ne(E), re = (u == null ? void 0 : u.width) ?? 0, $ = (u == null ? void 0 : u.height) ?? 0, oe = t + (r !== "center" ? "-" + r : ""), ne = typeof x == "number" ? x : { top: 0, right: 0, bottom: 0, left: 0, ...x }, H = Array.isArray(c) ? c : [c], ae = H.length > 0, b = {
|
|
46
|
-
padding: ne,
|
|
47
|
-
boundary: H.filter(Ye),
|
|
48
|
-
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
49
|
-
altBoundary: ae
|
|
50
|
-
}, { refs: ie, floatingStyles: W, placement: se, isPositioned: S, middlewareData: g } = xe({
|
|
51
|
-
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
52
|
-
strategy: "fixed",
|
|
53
|
-
placement: oe,
|
|
54
|
-
whileElementsMounted: (...P) => _e(...P, {
|
|
55
|
-
animationFrame: A === "always"
|
|
56
|
-
}),
|
|
57
|
-
elements: {
|
|
58
|
-
reference: v.anchor
|
|
59
|
-
},
|
|
60
|
-
middleware: [
|
|
61
|
-
Pe({ mainAxis: i + $, alignmentAxis: o }),
|
|
62
|
-
n && ye({
|
|
63
|
-
mainAxis: !0,
|
|
64
|
-
crossAxis: !1,
|
|
65
|
-
limiter: m === "partial" ? Se() : void 0,
|
|
66
|
-
...b
|
|
67
|
-
}),
|
|
68
|
-
n && Ae({ ...b }),
|
|
69
|
-
ve({
|
|
70
|
-
...b,
|
|
71
|
-
apply: ({ elements: P, rects: B, availableWidth: he, availableHeight: ue }) => {
|
|
72
|
-
const { width: ge, height: we } = B.reference, R = P.floating.style;
|
|
73
|
-
R.setProperty("--radix-popper-available-width", `${he}px`), R.setProperty("--radix-popper-available-height", `${ue}px`), R.setProperty("--radix-popper-anchor-width", `${ge}px`), R.setProperty("--radix-popper-anchor-height", `${we}px`);
|
|
74
|
-
}
|
|
75
|
-
}),
|
|
76
|
-
E && Ce({ element: E, padding: w }),
|
|
77
|
-
Me({ arrowWidth: re, arrowHeight: $ }),
|
|
78
|
-
y && be({ strategy: "referenceHidden", ...b })
|
|
79
|
-
]
|
|
80
|
-
}), [I, ce] = V(se), O = Ee(l);
|
|
81
|
-
T(() => {
|
|
82
|
-
S && (O == null || O());
|
|
83
|
-
}, [S, O]);
|
|
84
|
-
const pe = (Y = g.arrow) == null ? void 0 : Y.x, de = (M = g.arrow) == null ? void 0 : M.y, le = ((X = g.arrow) == null ? void 0 : X.centerOffset) !== 0, [fe, me] = p.useState();
|
|
85
|
-
return T(() => {
|
|
86
|
-
h && me(window.getComputedStyle(h).zIndex);
|
|
87
|
-
}, [h]), /* @__PURE__ */ f(
|
|
88
|
-
"div",
|
|
89
|
-
{
|
|
90
|
-
ref: ie.setFloating,
|
|
91
|
-
"data-radix-popper-content-wrapper": "",
|
|
92
|
-
style: {
|
|
93
|
-
...W,
|
|
94
|
-
transform: S ? W.transform : "translate(0, -200%)",
|
|
95
|
-
// keep off the page when measuring
|
|
96
|
-
minWidth: "max-content",
|
|
97
|
-
zIndex: fe,
|
|
98
|
-
"--radix-popper-transform-origin": [
|
|
99
|
-
(D = g.transformOrigin) == null ? void 0 : D.x,
|
|
100
|
-
(F = g.transformOrigin) == null ? void 0 : F.y
|
|
101
|
-
].join(" "),
|
|
102
|
-
// hide the content if using the hide middleware and should be hidden
|
|
103
|
-
// set visibility to hidden and disable pointer events so the UI behaves
|
|
104
|
-
// as if the PopperContent isn't there at all
|
|
105
|
-
...((k = g.hide) == null ? void 0 : k.referenceHidden) && {
|
|
106
|
-
visibility: "hidden",
|
|
107
|
-
pointerEvents: "none"
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
dir: e.dir,
|
|
111
|
-
children: /* @__PURE__ */ f(
|
|
112
|
-
He,
|
|
113
|
-
{
|
|
114
|
-
scope: a,
|
|
115
|
-
placedSide: I,
|
|
116
|
-
onArrowChange: te,
|
|
117
|
-
arrowX: pe,
|
|
118
|
-
arrowY: de,
|
|
119
|
-
shouldHideArrow: le,
|
|
120
|
-
children: /* @__PURE__ */ f(
|
|
121
|
-
z.div,
|
|
122
|
-
{
|
|
123
|
-
"data-side": I,
|
|
124
|
-
"data-align": ce,
|
|
125
|
-
...d,
|
|
126
|
-
ref: ee,
|
|
127
|
-
style: {
|
|
128
|
-
...d.style,
|
|
129
|
-
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
130
|
-
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
131
|
-
animation: S ? void 0 : "none"
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
)
|
|
135
|
-
}
|
|
136
|
-
)
|
|
137
|
-
}
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
J.displayName = _;
|
|
142
|
-
var K = "PopperArrow", Ie = {
|
|
143
|
-
top: "bottom",
|
|
144
|
-
right: "left",
|
|
145
|
-
bottom: "top",
|
|
146
|
-
left: "right"
|
|
147
|
-
}, Q = p.forwardRef(function(s, a) {
|
|
148
|
-
const { __scopePopper: t, ...i } = s, r = We(K, t), o = Ie[r.placedSide];
|
|
149
|
-
return (
|
|
150
|
-
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
151
|
-
// doesn't report size as we'd expect on SVG elements.
|
|
152
|
-
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
153
|
-
/* @__PURE__ */ f(
|
|
154
|
-
"span",
|
|
155
|
-
{
|
|
156
|
-
ref: r.onArrowChange,
|
|
157
|
-
style: {
|
|
158
|
-
position: "absolute",
|
|
159
|
-
left: r.arrowX,
|
|
160
|
-
top: r.arrowY,
|
|
161
|
-
[o]: 0,
|
|
162
|
-
transformOrigin: {
|
|
163
|
-
top: "",
|
|
164
|
-
right: "0 0",
|
|
165
|
-
bottom: "center 0",
|
|
166
|
-
left: "100% 0"
|
|
167
|
-
}[r.placedSide],
|
|
168
|
-
transform: {
|
|
169
|
-
top: "translateY(100%)",
|
|
170
|
-
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
171
|
-
bottom: "rotate(180deg)",
|
|
172
|
-
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
173
|
-
}[r.placedSide],
|
|
174
|
-
visibility: r.shouldHideArrow ? "hidden" : void 0
|
|
175
|
-
},
|
|
176
|
-
children: /* @__PURE__ */ f(
|
|
177
|
-
Oe,
|
|
178
|
-
{
|
|
179
|
-
...i,
|
|
180
|
-
ref: a,
|
|
181
|
-
style: {
|
|
182
|
-
...i.style,
|
|
183
|
-
// ensures the element can be measured correctly (mostly for if SVG)
|
|
184
|
-
display: "block"
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
}
|
|
189
|
-
)
|
|
190
|
-
);
|
|
191
|
-
});
|
|
192
|
-
Q.displayName = K;
|
|
193
|
-
function Ye(e) {
|
|
194
|
-
return e !== null;
|
|
195
|
-
}
|
|
196
|
-
var Me = (e) => ({
|
|
197
|
-
name: "transformOrigin",
|
|
198
|
-
options: e,
|
|
199
|
-
fn(s) {
|
|
200
|
-
var v, h, C;
|
|
201
|
-
const { placement: a, rects: t, middlewareData: i } = s, o = ((v = i.arrow) == null ? void 0 : v.centerOffset) !== 0, w = o ? 0 : e.arrowWidth, n = o ? 0 : e.arrowHeight, [c, x] = V(a), m = { start: "0%", center: "50%", end: "100%" }[x], y = (((h = i.arrow) == null ? void 0 : h.x) ?? 0) + w / 2, A = (((C = i.arrow) == null ? void 0 : C.y) ?? 0) + n / 2;
|
|
202
|
-
let l = "", d = "";
|
|
203
|
-
return c === "bottom" ? (l = o ? m : `${y}px`, d = `${-n}px`) : c === "top" ? (l = o ? m : `${y}px`, d = `${t.floating.height + n}px`) : c === "right" ? (l = `${-n}px`, d = o ? m : `${A}px`) : c === "left" && (l = `${t.floating.width + n}px`, d = o ? m : `${A}px`), { data: { x: l, y: d } };
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
function V(e) {
|
|
207
|
-
const [s, a = "center"] = e.split("-");
|
|
208
|
-
return [s, a];
|
|
209
|
-
}
|
|
210
|
-
var qe = U, Ge = G, Je = J, Ke = Q;
|
|
211
50
|
export {
|
|
212
|
-
|
|
213
|
-
Ke as Arrow,
|
|
214
|
-
Je as Content,
|
|
215
|
-
U as Popper,
|
|
216
|
-
G as PopperAnchor,
|
|
217
|
-
Q as PopperArrow,
|
|
218
|
-
J as PopperContent,
|
|
219
|
-
qe as Root,
|
|
220
|
-
Ue as createPopperScope
|
|
51
|
+
C as hideOthers
|
|
221
52
|
};
|