@orioncactuscorp/ui 1.12.2 → 1.14.0
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/CHANGELOG.md +100 -0
- package/README.md +92 -12
- package/dist/components/Badge/Badge.css +1 -1
- package/dist/components/Badge/Badge.module.scss.js +12 -12
- package/dist/components/FloatingWindow/FloatingWindow.css +1 -0
- package/dist/components/FloatingWindow/FloatingWindow.js +692 -0
- package/dist/components/FloatingWindow/FloatingWindow.module.scss.js +17 -0
- package/dist/components/FloatingWindow/FloatingWindowManager.js +36 -0
- package/dist/components/FloatingWindow/contexts.js +25 -0
- package/dist/components/FloatingWindow/geometry.js +222 -0
- package/dist/components/FloatingWindow/stack.js +31 -0
- package/dist/components/FloatingWindow.d.ts +6 -0
- package/dist/components/FloatingWindow.js +18 -0
- package/dist/components/Modal/Modal.css +1 -1
- package/dist/components/Modal/Modal.js +534 -715
- package/dist/components/Modal/Modal.module.scss.js +46 -44
- package/dist/components/Modal/initialFocus.js +11 -0
- package/dist/components/Modal/useModalDrag.js +328 -310
- package/dist/components/internal/ModalPresentation.js +359 -0
- package/dist/index.js +108 -92
- package/dist/styles.css +3 -2
- package/dist/ui/src/components/Badge/types.d.ts +1 -1
- package/dist/ui/src/components/Badge/types.d.ts.map +1 -1
- package/dist/ui/src/components/FloatingWindow/FloatingWindow.d.ts +32 -0
- package/dist/ui/src/components/FloatingWindow/FloatingWindow.d.ts.map +1 -0
- package/dist/ui/src/components/FloatingWindow/FloatingWindowManager.d.ts +4 -0
- package/dist/ui/src/components/FloatingWindow/FloatingWindowManager.d.ts.map +1 -0
- package/dist/ui/src/components/FloatingWindow/contexts.d.ts +36 -0
- package/dist/ui/src/components/FloatingWindow/contexts.d.ts.map +1 -0
- package/dist/ui/src/components/FloatingWindow/geometry.d.ts +31 -0
- package/dist/ui/src/components/FloatingWindow/geometry.d.ts.map +1 -0
- package/dist/ui/src/components/FloatingWindow/index.d.ts +4 -0
- package/dist/ui/src/components/FloatingWindow/index.d.ts.map +1 -0
- package/dist/ui/src/components/FloatingWindow/stack.d.ts +9 -0
- package/dist/ui/src/components/FloatingWindow/stack.d.ts.map +1 -0
- package/dist/ui/src/components/FloatingWindow/types.d.ts +121 -0
- package/dist/ui/src/components/FloatingWindow/types.d.ts.map +1 -0
- package/dist/ui/src/components/Modal/Modal.d.ts +1 -1
- package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/contexts.d.ts +3 -0
- package/dist/ui/src/components/Modal/contexts.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/initialFocus.d.ts +18 -0
- package/dist/ui/src/components/Modal/initialFocus.d.ts.map +1 -0
- package/dist/ui/src/components/Modal/types.d.ts +9 -1
- package/dist/ui/src/components/Modal/types.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -1
- package/dist/ui/src/components/internal/ModalPresentation.d.ts +61 -0
- package/dist/ui/src/components/internal/ModalPresentation.d.ts.map +1 -0
- package/dist/ui/src/index.d.ts +2 -0
- package/dist/ui/src/index.d.ts.map +1 -1
- package/dist/ui/src/utils/motion.d.ts.map +1 -1
- package/dist/utils/motion.js +194 -135
- package/docs/api-conventions.md +2 -5
- package/docs/motion.md +4 -0
- package/docs/selector-contract.md +58 -0
- package/package.json +2 -2
package/dist/utils/motion.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ocSpring as
|
|
2
|
-
const
|
|
1
|
+
import { ocSpring as U } from "./spring.js";
|
|
2
|
+
const g = [
|
|
3
3
|
"feedback",
|
|
4
4
|
"fade",
|
|
5
5
|
"reject",
|
|
@@ -11,13 +11,13 @@ const f = [
|
|
|
11
11
|
"gesture",
|
|
12
12
|
"ambient",
|
|
13
13
|
"continuous"
|
|
14
|
-
],
|
|
14
|
+
], S = [
|
|
15
15
|
"change",
|
|
16
16
|
"enter",
|
|
17
17
|
"exit",
|
|
18
18
|
"release",
|
|
19
19
|
"loop"
|
|
20
|
-
],
|
|
20
|
+
], O = ["quick", "normal", "slow"], T = [
|
|
21
21
|
"auto",
|
|
22
22
|
"preserve",
|
|
23
23
|
"fade",
|
|
@@ -94,7 +94,7 @@ const f = [
|
|
|
94
94
|
release: "cubic-bezier(0.32, 0.72, 0, 1)"
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
},
|
|
97
|
+
}, Y = o, z = {
|
|
98
98
|
feedback: "feedback",
|
|
99
99
|
fade: "fade",
|
|
100
100
|
reject: "feedback",
|
|
@@ -106,7 +106,7 @@ const f = [
|
|
|
106
106
|
gesture: "feedback",
|
|
107
107
|
ambient: "static",
|
|
108
108
|
continuous: "static"
|
|
109
|
-
},
|
|
109
|
+
}, G = /* @__PURE__ */ new Set([
|
|
110
110
|
"opacity",
|
|
111
111
|
"color",
|
|
112
112
|
"background-color",
|
|
@@ -115,13 +115,13 @@ const f = [
|
|
|
115
115
|
"outline-color",
|
|
116
116
|
"fill",
|
|
117
117
|
"stroke"
|
|
118
|
-
]),
|
|
118
|
+
]), K = {
|
|
119
119
|
disclosure: { preset: "smooth" },
|
|
120
120
|
surface: { preset: "smooth" },
|
|
121
121
|
sheet: { preset: "smooth" },
|
|
122
122
|
expand: { preset: "smooth" },
|
|
123
123
|
move: { preset: "smooth" }
|
|
124
|
-
},
|
|
124
|
+
}, H = {
|
|
125
125
|
reject: {
|
|
126
126
|
change: { preset: "smooth" },
|
|
127
127
|
enter: { preset: "smooth" }
|
|
@@ -142,39 +142,58 @@ const f = [
|
|
|
142
142
|
},
|
|
143
143
|
exit: null
|
|
144
144
|
}
|
|
145
|
-
},
|
|
146
|
-
if (
|
|
145
|
+
}, J = H, Q = (t, e) => e.includes(t), p = (t, e, r) => {
|
|
146
|
+
if (!Q(e, r))
|
|
147
147
|
throw new Error(`Unknown oc-motion ${t}: ${e}.`);
|
|
148
148
|
return e;
|
|
149
|
-
},
|
|
149
|
+
}, W = (t) => {
|
|
150
150
|
if (!Number.isFinite(t) || t < 0)
|
|
151
151
|
throw new Error("oc-motion durationFactor must be a non-negative number.");
|
|
152
152
|
return t;
|
|
153
|
-
},
|
|
153
|
+
}, X = (t) => {
|
|
154
154
|
if (t !== void 0) {
|
|
155
155
|
if (!Number.isFinite(t))
|
|
156
156
|
throw new Error("oc-motion extraBounce must be a finite number.");
|
|
157
157
|
return t;
|
|
158
158
|
}
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
}, l = (t, e) => {
|
|
160
|
+
if (!Number.isFinite(e) || e < 0)
|
|
161
|
+
throw new Error(`oc-motion ${t} must be a non-negative finite number.`);
|
|
162
|
+
return e;
|
|
163
|
+
}, Z = /^\+?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i, d = (t, e, r) => {
|
|
164
|
+
const i = e.trim();
|
|
165
|
+
if (!i) return r;
|
|
166
|
+
if (!Z.test(i))
|
|
167
|
+
throw new Error(
|
|
168
|
+
`oc-motion CSS token ${t} must be a non-negative unitless number.`
|
|
169
|
+
);
|
|
170
|
+
const a = Number(i);
|
|
171
|
+
return l(`CSS token ${t}`, a);
|
|
172
|
+
}, R = (t, e) => {
|
|
173
|
+
const i = t.trim().match(/^(-?\d*\.?\d+)(ms|s)?$/);
|
|
174
|
+
if (!i) return e;
|
|
175
|
+
const a = Number.parseFloat(i[1]);
|
|
176
|
+
return !Number.isFinite(a) || a < 0 ? e : i[2] === "ms" ? a / 1e3 : a;
|
|
177
|
+
}, n = (t, e) => typeof t?.getPropertyValue == "function" ? t.getPropertyValue(e).trim() : "", s = (t, e, r) => {
|
|
178
|
+
const i = n(t, e);
|
|
179
|
+
if (!i) return r;
|
|
180
|
+
const a = R(i, Number.NaN);
|
|
181
|
+
if (!Number.isFinite(a) || a < 0)
|
|
182
|
+
throw new Error(
|
|
183
|
+
`oc-motion CSS token ${e} must be a non-negative finite duration in seconds or milliseconds.`
|
|
184
|
+
);
|
|
185
|
+
return a;
|
|
186
|
+
}, w = (t, e) => {
|
|
168
187
|
const r = { ...t };
|
|
169
|
-
for (const
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
...t[
|
|
173
|
-
...
|
|
188
|
+
for (const i of g) {
|
|
189
|
+
const a = e?.[i];
|
|
190
|
+
a && (r[i] = {
|
|
191
|
+
...t[i],
|
|
192
|
+
...a
|
|
174
193
|
});
|
|
175
194
|
}
|
|
176
195
|
return r;
|
|
177
|
-
},
|
|
196
|
+
}, ee = (t) => ({
|
|
178
197
|
durationFactor: t?.durationFactor ?? o.durationFactor,
|
|
179
198
|
durationFactorReduced: t?.durationFactorReduced ?? o.durationFactorReduced,
|
|
180
199
|
durationFactorPreserve: t?.durationFactorPreserve ?? o.durationFactorPreserve,
|
|
@@ -186,7 +205,7 @@ const f = [
|
|
|
186
205
|
...o.durationByIntent,
|
|
187
206
|
...t?.durationByIntent
|
|
188
207
|
},
|
|
189
|
-
durationByPhase:
|
|
208
|
+
durationByPhase: w(
|
|
190
209
|
o.durationByPhase,
|
|
191
210
|
t?.durationByPhase
|
|
192
211
|
),
|
|
@@ -194,118 +213,141 @@ const f = [
|
|
|
194
213
|
...o.timingByIntent,
|
|
195
214
|
...t?.timingByIntent
|
|
196
215
|
},
|
|
197
|
-
timingByPhase:
|
|
216
|
+
timingByPhase: w(
|
|
198
217
|
o.timingByPhase,
|
|
199
218
|
t?.timingByPhase
|
|
200
219
|
)
|
|
201
220
|
});
|
|
202
|
-
function
|
|
221
|
+
function _(t) {
|
|
203
222
|
const e = t && typeof getComputedStyle == "function" ? getComputedStyle(t) : null;
|
|
204
223
|
return {
|
|
205
224
|
durationFactor: d(
|
|
225
|
+
"--oc-motion-duration-factor",
|
|
206
226
|
n(e, "--oc-motion-duration-factor"),
|
|
207
227
|
o.durationFactor
|
|
208
228
|
),
|
|
209
229
|
durationFactorReduced: d(
|
|
230
|
+
"--oc-motion-duration-factor-reduced",
|
|
210
231
|
n(e, "--oc-motion-duration-factor-reduced"),
|
|
211
232
|
o.durationFactorReduced
|
|
212
233
|
),
|
|
213
234
|
durationFactorPreserve: d(
|
|
235
|
+
"--oc-motion-duration-factor-preserve",
|
|
214
236
|
n(e, "--oc-motion-duration-factor-preserve"),
|
|
215
237
|
o.durationFactorPreserve
|
|
216
238
|
),
|
|
217
239
|
paceFactor: {
|
|
218
240
|
quick: d(
|
|
241
|
+
"--oc-motion-pace-quick",
|
|
219
242
|
n(e, "--oc-motion-pace-quick"),
|
|
220
243
|
o.paceFactor.quick
|
|
221
244
|
),
|
|
222
245
|
normal: d(
|
|
246
|
+
"--oc-motion-pace-normal",
|
|
223
247
|
n(e, "--oc-motion-pace-normal"),
|
|
224
248
|
o.paceFactor.normal
|
|
225
249
|
),
|
|
226
250
|
slow: d(
|
|
251
|
+
"--oc-motion-pace-slow",
|
|
227
252
|
n(e, "--oc-motion-pace-slow"),
|
|
228
253
|
o.paceFactor.slow
|
|
229
254
|
)
|
|
230
255
|
},
|
|
231
256
|
durationByIntent: {
|
|
232
|
-
feedback:
|
|
233
|
-
|
|
257
|
+
feedback: s(
|
|
258
|
+
e,
|
|
259
|
+
"--oc-motion-duration-feedback",
|
|
234
260
|
o.durationByIntent.feedback
|
|
235
261
|
),
|
|
236
|
-
fade:
|
|
237
|
-
|
|
262
|
+
fade: s(
|
|
263
|
+
e,
|
|
264
|
+
"--oc-motion-duration-fade",
|
|
238
265
|
o.durationByIntent.fade
|
|
239
266
|
),
|
|
240
|
-
reject:
|
|
241
|
-
|
|
267
|
+
reject: s(
|
|
268
|
+
e,
|
|
269
|
+
"--oc-motion-duration-reject",
|
|
242
270
|
o.durationByIntent.reject
|
|
243
271
|
),
|
|
244
|
-
disclosure:
|
|
245
|
-
|
|
272
|
+
disclosure: s(
|
|
273
|
+
e,
|
|
274
|
+
"--oc-motion-duration-disclosure",
|
|
246
275
|
o.durationByIntent.disclosure
|
|
247
276
|
),
|
|
248
|
-
surface:
|
|
249
|
-
|
|
277
|
+
surface: s(
|
|
278
|
+
e,
|
|
279
|
+
"--oc-motion-duration-surface",
|
|
250
280
|
o.durationByIntent.surface
|
|
251
281
|
),
|
|
252
|
-
sheet:
|
|
253
|
-
|
|
282
|
+
sheet: s(
|
|
283
|
+
e,
|
|
284
|
+
"--oc-motion-duration-sheet",
|
|
254
285
|
o.durationByIntent.sheet
|
|
255
286
|
),
|
|
256
|
-
expand:
|
|
257
|
-
|
|
287
|
+
expand: s(
|
|
288
|
+
e,
|
|
289
|
+
"--oc-motion-duration-expand",
|
|
258
290
|
o.durationByIntent.expand
|
|
259
291
|
),
|
|
260
|
-
move:
|
|
261
|
-
|
|
292
|
+
move: s(
|
|
293
|
+
e,
|
|
294
|
+
"--oc-motion-duration-move",
|
|
262
295
|
o.durationByIntent.move
|
|
263
296
|
),
|
|
264
|
-
gesture:
|
|
265
|
-
|
|
297
|
+
gesture: s(
|
|
298
|
+
e,
|
|
299
|
+
"--oc-motion-duration-gesture",
|
|
266
300
|
o.durationByIntent.gesture
|
|
267
301
|
),
|
|
268
|
-
ambient:
|
|
269
|
-
|
|
302
|
+
ambient: s(
|
|
303
|
+
e,
|
|
304
|
+
"--oc-motion-duration-ambient",
|
|
270
305
|
o.durationByIntent.ambient
|
|
271
306
|
),
|
|
272
|
-
continuous:
|
|
273
|
-
|
|
307
|
+
continuous: s(
|
|
308
|
+
e,
|
|
309
|
+
"--oc-motion-duration-continuous",
|
|
274
310
|
o.durationByIntent.continuous
|
|
275
311
|
)
|
|
276
312
|
},
|
|
277
313
|
durationByPhase: {
|
|
278
314
|
disclosure: {
|
|
279
|
-
exit:
|
|
280
|
-
|
|
315
|
+
exit: s(
|
|
316
|
+
e,
|
|
317
|
+
"--oc-motion-duration-disclosure-exit",
|
|
281
318
|
o.durationByPhase.disclosure?.exit ?? o.durationByIntent.disclosure
|
|
282
319
|
)
|
|
283
320
|
},
|
|
284
321
|
surface: {
|
|
285
|
-
exit:
|
|
286
|
-
|
|
322
|
+
exit: s(
|
|
323
|
+
e,
|
|
324
|
+
"--oc-motion-duration-surface-exit",
|
|
287
325
|
o.durationByPhase.surface?.exit ?? o.durationByIntent.surface
|
|
288
326
|
)
|
|
289
327
|
},
|
|
290
328
|
sheet: {
|
|
291
|
-
exit:
|
|
292
|
-
|
|
329
|
+
exit: s(
|
|
330
|
+
e,
|
|
331
|
+
"--oc-motion-duration-sheet-exit",
|
|
293
332
|
o.durationByPhase.sheet?.exit ?? o.durationByIntent.sheet
|
|
294
333
|
),
|
|
295
|
-
release:
|
|
296
|
-
|
|
334
|
+
release: s(
|
|
335
|
+
e,
|
|
336
|
+
"--oc-motion-duration-sheet-release",
|
|
297
337
|
o.durationByPhase.sheet?.release ?? o.durationByIntent.sheet
|
|
298
338
|
)
|
|
299
339
|
},
|
|
300
340
|
expand: {
|
|
301
|
-
exit:
|
|
302
|
-
|
|
341
|
+
exit: s(
|
|
342
|
+
e,
|
|
343
|
+
"--oc-motion-duration-expand-exit",
|
|
303
344
|
o.durationByPhase.expand?.exit ?? o.durationByIntent.expand
|
|
304
345
|
)
|
|
305
346
|
},
|
|
306
347
|
gesture: {
|
|
307
|
-
release:
|
|
308
|
-
|
|
348
|
+
release: s(
|
|
349
|
+
e,
|
|
350
|
+
"--oc-motion-duration-gesture-release",
|
|
309
351
|
o.durationByPhase.gesture?.release ?? o.durationByIntent.gesture
|
|
310
352
|
)
|
|
311
353
|
}
|
|
@@ -343,115 +385,132 @@ function N(t) {
|
|
|
343
385
|
}
|
|
344
386
|
};
|
|
345
387
|
}
|
|
346
|
-
function
|
|
347
|
-
return
|
|
388
|
+
function D(t, e = "auto") {
|
|
389
|
+
return p("intent", t, g), p("reduced policy", e, T), e === "auto" ? z[t] : e;
|
|
348
390
|
}
|
|
349
|
-
function
|
|
350
|
-
return
|
|
391
|
+
function j(t) {
|
|
392
|
+
return G.has(t);
|
|
351
393
|
}
|
|
352
|
-
function
|
|
394
|
+
function M({
|
|
353
395
|
property: t,
|
|
354
396
|
reducedMotion: e,
|
|
355
397
|
reducedPolicy: r
|
|
356
398
|
}) {
|
|
357
|
-
return !e || r === "preserve" ? !0 : r === "static" || t === void 0 ? !1 :
|
|
399
|
+
return !e || r === "preserve" ? !0 : r === "static" || t === void 0 ? !1 : j(t);
|
|
358
400
|
}
|
|
359
|
-
const
|
|
360
|
-
const
|
|
401
|
+
const x = (t, e, r, i) => t[e]?.[r] ?? i, te = (t, e, r, i) => {
|
|
402
|
+
const a = J[t], m = a !== void 0 && Object.prototype.hasOwnProperty.call(a, e) ? a[e] : void 0;
|
|
361
403
|
if (m === null) return null;
|
|
362
|
-
const c = m ??
|
|
404
|
+
const c = m ?? K[t];
|
|
363
405
|
if (c === void 0) return null;
|
|
364
|
-
const
|
|
406
|
+
const f = r === void 0 ? void 0 : c.propertyExtraBounce?.[r];
|
|
365
407
|
return {
|
|
366
408
|
preset: (r === void 0 ? void 0 : c.propertyPreset?.[r]) ?? c.preset,
|
|
367
|
-
extraBounce:
|
|
409
|
+
extraBounce: i ?? f ?? c.extraBounce
|
|
368
410
|
};
|
|
369
411
|
};
|
|
370
|
-
function
|
|
412
|
+
function oe({
|
|
371
413
|
intent: t,
|
|
372
414
|
phase: e = "change",
|
|
373
415
|
pace: r = "normal",
|
|
374
|
-
durationFactor:
|
|
375
|
-
extraBounce:
|
|
416
|
+
durationFactor: i = 1,
|
|
417
|
+
extraBounce: a,
|
|
376
418
|
reduced: m = "auto",
|
|
377
419
|
reducedMotion: c = !1,
|
|
378
|
-
property:
|
|
379
|
-
element:
|
|
380
|
-
tokens:
|
|
420
|
+
property: f,
|
|
421
|
+
element: b,
|
|
422
|
+
tokens: q
|
|
381
423
|
}) {
|
|
382
|
-
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
),
|
|
386
|
-
property:
|
|
424
|
+
p("intent", t, g), p("phase", e, S), p("pace", r, O);
|
|
425
|
+
const I = W(i), F = X(a), u = ee(
|
|
426
|
+
q ?? _(b)
|
|
427
|
+
), B = D(t, m), v = M({
|
|
428
|
+
property: f,
|
|
387
429
|
reducedMotion: c,
|
|
388
|
-
reducedPolicy:
|
|
389
|
-
}),
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
430
|
+
reducedPolicy: B
|
|
431
|
+
}), k = l(
|
|
432
|
+
"duration factor token",
|
|
433
|
+
c && B === "preserve" ? u.durationFactorPreserve : c ? u.durationFactorReduced : u.durationFactor
|
|
434
|
+
), h = l(
|
|
435
|
+
"duration token",
|
|
436
|
+
x(
|
|
437
|
+
u.durationByPhase,
|
|
438
|
+
t,
|
|
439
|
+
e,
|
|
440
|
+
u.durationByIntent[t]
|
|
441
|
+
)
|
|
442
|
+
), E = l(
|
|
443
|
+
"pace factor token",
|
|
444
|
+
u.paceFactor[r]
|
|
445
|
+
), A = v ? h * k * E * I : 0, y = l(
|
|
446
|
+
"effective duration",
|
|
447
|
+
A
|
|
448
|
+
), C = v && y > 0, $ = x(
|
|
395
449
|
u.timingByPhase,
|
|
396
450
|
t,
|
|
397
451
|
e,
|
|
398
452
|
u.timingByIntent[t]
|
|
399
|
-
),
|
|
453
|
+
), P = te(
|
|
400
454
|
t,
|
|
401
455
|
e,
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
),
|
|
405
|
-
if (!
|
|
456
|
+
f,
|
|
457
|
+
F
|
|
458
|
+
), N = P !== null;
|
|
459
|
+
if (!N && F !== void 0)
|
|
406
460
|
throw new Error(
|
|
407
461
|
"oc-motion extraBounce is only supported for spring-backed motion."
|
|
408
462
|
);
|
|
409
|
-
const
|
|
463
|
+
const V = x(
|
|
464
|
+
o.durationByPhase,
|
|
465
|
+
t,
|
|
466
|
+
e,
|
|
467
|
+
o.durationByIntent[t]
|
|
468
|
+
), L = y > 0 ? y : h > 0 ? h : V;
|
|
410
469
|
return {
|
|
411
470
|
intent: t,
|
|
412
471
|
phase: e,
|
|
413
472
|
pace: r,
|
|
414
473
|
reduced: m,
|
|
415
|
-
reducedPolicy:
|
|
474
|
+
reducedPolicy: B,
|
|
416
475
|
reducedMotion: c,
|
|
417
|
-
property:
|
|
418
|
-
durationFactor:
|
|
419
|
-
durationFactorToken:
|
|
420
|
-
paceFactor:
|
|
421
|
-
durationSeconds:
|
|
422
|
-
timingFunction:
|
|
423
|
-
animate:
|
|
424
|
-
springBacked:
|
|
425
|
-
spring:
|
|
426
|
-
duration:
|
|
427
|
-
extraBounce:
|
|
476
|
+
property: f,
|
|
477
|
+
durationFactor: I,
|
|
478
|
+
durationFactorToken: k,
|
|
479
|
+
paceFactor: E,
|
|
480
|
+
durationSeconds: y,
|
|
481
|
+
timingFunction: $,
|
|
482
|
+
animate: C,
|
|
483
|
+
springBacked: N,
|
|
484
|
+
spring: U[P?.preset ?? "smooth"]({
|
|
485
|
+
duration: L,
|
|
486
|
+
extraBounce: P?.extraBounce
|
|
428
487
|
})
|
|
429
488
|
};
|
|
430
489
|
}
|
|
431
|
-
const
|
|
432
|
-
intents:
|
|
433
|
-
phases:
|
|
434
|
-
paces:
|
|
435
|
-
reducedPolicies:
|
|
436
|
-
defaultTokens:
|
|
437
|
-
parseDuration:
|
|
438
|
-
readTokens:
|
|
439
|
-
resolve:
|
|
440
|
-
resolveReducedPolicy:
|
|
441
|
-
isFeedbackSafeProperty:
|
|
442
|
-
shouldAnimateProperty:
|
|
490
|
+
const re = {
|
|
491
|
+
intents: g,
|
|
492
|
+
phases: S,
|
|
493
|
+
paces: O,
|
|
494
|
+
reducedPolicies: T,
|
|
495
|
+
defaultTokens: Y,
|
|
496
|
+
parseDuration: R,
|
|
497
|
+
readTokens: _,
|
|
498
|
+
resolve: oe,
|
|
499
|
+
resolveReducedPolicy: D,
|
|
500
|
+
isFeedbackSafeProperty: j,
|
|
501
|
+
shouldAnimateProperty: M
|
|
443
502
|
};
|
|
444
503
|
export {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
504
|
+
j as isOcMotionFeedbackSafeProperty,
|
|
505
|
+
re as ocMotion,
|
|
506
|
+
Y as ocMotionDefaultTokens,
|
|
507
|
+
g as ocMotionIntents,
|
|
508
|
+
O as ocMotionPaces,
|
|
509
|
+
S as ocMotionPhases,
|
|
510
|
+
T as ocMotionReducedPolicies,
|
|
511
|
+
R as parseOcMotionDuration,
|
|
512
|
+
_ as readOcMotionTokens,
|
|
513
|
+
oe as resolveOcMotion,
|
|
514
|
+
D as resolveOcMotionReducedPolicy,
|
|
515
|
+
M as shouldAnimateOcMotionProperty
|
|
457
516
|
};
|
package/docs/api-conventions.md
CHANGED
|
@@ -83,8 +83,5 @@ named preset이 아니라 외부 문맥이나 직접 지정한 치수로 크기
|
|
|
83
83
|
직접·custom·상속 크기가 필요한 경우에는 해당 예외의 목적을 컴포넌트 API에
|
|
84
84
|
문서화합니다.
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
`Badge`의 `size='tiny'`는 표준 named size 밖에 있는 현행 호환성 예외입니다.
|
|
89
|
-
현재 public API는 유지하며, 다음 major 릴리스에서 `xsmall`로 정규화할
|
|
90
|
-
예정입니다. 변경 시 migration note로 안내합니다.
|
|
86
|
+
`Badge`의 작은 preset도 `size='xsmall'`을 사용하므로 모든 named size가 이
|
|
87
|
+
표준 순서를 따릅니다.
|
package/docs/motion.md
CHANGED
|
@@ -17,6 +17,10 @@ oc-motion($properties, $intent, $phase, $pace)
|
|
|
17
17
|
|
|
18
18
|
React runtime에서 height/expand처럼 CSS transition만으로 안정적으로 다루기 어려운 motion은 `@orioncactuscorp/ui/utils/motion`과 `@orioncactuscorp/ui/react/motion` subpath를 사용합니다. 이 runtime layer도 같은 intent, phase, pace, reduced-motion policy, `--oc-motion-duration-factor*` token vocabulary를 공유하고, 실제 프레임 계산은 low-level `ocSpring` engine에 위임합니다.
|
|
19
19
|
|
|
20
|
+
Runtime motion도 CSS helper와 동일하게 최종 계산 duration이 `0`이면 spring을 시작하지 않고 최종 상태로 즉시 완료합니다. instance factor, global factor token, intent duration, phase duration 중 어느 값으로 `0`이 만들어져도 같은 계약을 적용합니다. `resolveOcMotion`을 직접 사용하는 consumer는 `animate`가 `true`일 때만 반환된 `spring`을 scheduler에 전달해야 합니다.
|
|
21
|
+
|
|
22
|
+
Runtime duration, duration factor, pace factor는 모두 `0` 이상의 유한한 값이어야 합니다. CSS의 factor/pace token은 표준 CSS `<number>` 형태의 단위 없는 숫자만 허용하므로 `+1.2`, `5e-1` 같은 표기는 유효하지만, `1s`, `0px`, 숫자 뒤 임의 문자열처럼 CSS 계산과 runtime 해석이 달라질 수 있는 값은 설정 오류로 처리합니다. 여러 multiplier를 곱한 최종 duration이 overflow로 비유한 값이 되는 경우(예: 매우 큰 programmatic factor 조합)도 오류입니다.
|
|
23
|
+
|
|
20
24
|
## 빠른 시작
|
|
21
25
|
|
|
22
26
|
```scss
|
|
@@ -54,6 +54,15 @@
|
|
|
54
54
|
|
|
55
55
|
variant(`light`/`normal`/`strong`)는 `--oc-interaction-opacity-*` 토큰 값만 바꿉니다.
|
|
56
56
|
|
|
57
|
+
## Badge 계약
|
|
58
|
+
|
|
59
|
+
| Component | Root selector | Visual selectors | Stable parts |
|
|
60
|
+
| --------- | --------------------------- | --------------------------------------------------------------------------------------------------------- | ------------ |
|
|
61
|
+
| `Badge` | `data-oc-component="badge"` | `data-oc-variant="normal\|accent\|overlay"`, `data-oc-size="xsmall\|small"`, `data-oc-interactive="true"` | `content` |
|
|
62
|
+
|
|
63
|
+
`Badge`의 작은 named size는 `data-oc-size="xsmall"`을 사용합니다. 이전
|
|
64
|
+
`data-oc-size="tiny"` 값은 major 변경으로 제거됐습니다.
|
|
65
|
+
|
|
57
66
|
## Field 레이아웃 계약
|
|
58
67
|
|
|
59
68
|
`Field`는 label/control/message compound 구조를 유지한 채 vertical/horizontal orientation을 노출합니다.
|
|
@@ -198,6 +207,53 @@ Tab content는 inline padding 없이 배치되고 배경색이 transparent인 se
|
|
|
198
207
|
- `data-oc-scrollable="true"`는 body에 보이는 scrollport 밖 overflow가 있다는 뜻입니다. 이 상태에서 직속 footer `ActionArea`는 block-end padding을 유지하고 `--oc-action-area-padding-block-start: 0`을 받으며, 대응하는 block-start 간격은 body에 예약됩니다.
|
|
199
208
|
- `ActionAreaLayout.ActionArea background="auto"`는 scroll 상태를 자식 `ActionArea`의 background 계약에 매핑합니다: body가 스크롤 가능하고 바닥에 닿지 않은 동안만 `data-oc-background="true"`가 방출됩니다. `data-oc-background`는 시각 gradient/background 상태이며 body 예약의 근거로 사용하지 마세요.
|
|
200
209
|
|
|
210
|
+
## FloatingWindow 계약
|
|
211
|
+
|
|
212
|
+
FloatingWindow는 anchor 기반 geometry와 dialog 시맨틱을 Modal 기본 surface presentation에 결합합니다. 기본 `FloatingWindowRoot`는 modeless이고 `ModalWindowRoot`는 modal focus 정책, 배경 입력을 차단하는 backdrop, Modal popup scale/fade motion을 적용합니다. ModalWindow backdrop은 기본적으로 렌더링하며 필요한 경우 `backdrop="hidden"`으로 시각적 dimmer만 숨길 수 있습니다.
|
|
213
|
+
|
|
214
|
+
| Layer/slot | Selector | 책임 |
|
|
215
|
+
| ----------- | -------------------------------------------------------------------------- | -------------------------------------------- |
|
|
216
|
+
| Backdrop | `data-oc-component="floating-window-backdrop"` + `data-oc-part="backdrop"` | ModalWindow 기본 dimmer와 배경 pointer 차단 |
|
|
217
|
+
| Positioner | `data-oc-component="floating-window-positioner"` | fixed positioning과 manager 주입 stack level |
|
|
218
|
+
| Window | `data-oc-component="floating-window"` + `data-oc-part="window"` | dialog 시맨틱과 anchor/free 좌표 |
|
|
219
|
+
| Drag handle | `data-oc-part="drag-handle"` + `data-oc-draggable="true\|false"` | 명시적인 pointer drag 시작 영역 |
|
|
220
|
+
| Surface | `data-oc-part="surface-motion"` + `data-oc-part="surface"` | Modal popup presentation과 `data-oc-resize` |
|
|
221
|
+
| Header | `data-oc-component="modal-header"` | Modal 기본 header slot |
|
|
222
|
+
| Navigation | `data-oc-component="modal-navigation-section"` | Modal 기본 disclosure navigation |
|
|
223
|
+
| Body | `data-oc-component="modal-body"` | Modal 기본 scrollable body |
|
|
224
|
+
| Footer | `data-oc-component="modal-footer"` | Modal 기본 footer slot |
|
|
225
|
+
| Close | `data-oc-component="modal-close"` | dialog close action |
|
|
226
|
+
|
|
227
|
+
Window은 `data-oc-positioned="true\|false"`, `data-oc-window-positioning="anchored\|free"`, `data-oc-window-presentation="floating\|modal"`, `data-oc-window-modality="modeless\|trap-focus\|modal"`, `data-oc-side`, `data-oc-alignment`를 노출합니다. presentation은 사용한 Root 구성을 구분하는 호환 메타데이터이며 모든 presentation은 동일한 Modal popup surface motion을 사용합니다. modality는 focus와 background interaction 계약을 나타냅니다. pointer drag 중에는 `data-oc-window-dragging="true"`가 설정됩니다. `data-oc-side`는 collision flip 뒤 실제 side이고, `data-oc-alignment`는 alignment flip 뒤의 semantic alignment입니다. alignment shift는 같은 alignment 의도를 유지한 채 좌표만 boundary 안으로 보정합니다.
|
|
228
|
+
|
|
229
|
+
Drag handle 내부의 `button`, `a`, form control, `contenteditable` 요소는 drag를 시작하지 않습니다. 그 밖의 custom interactive target은 `data-oc-window-no-drag`로 같은 동작을 선언할 수 있습니다. 이 attribute는 drag gesture의 opt-out 계약이며 시각 selector가 아닙니다.
|
|
230
|
+
|
|
231
|
+
Manager는 일반 pointer와 focus intent를 window activation으로 해석하지만 `data-oc-part="close"` intent는 activation에서 제외합니다. 따라서 클릭 가능한 비활성 modeless window의 Close는 stack 순서를 바꾸지 않고 해당 위치에서 종료 모션을 실행합니다. modal backdrop과 inert 영역 뒤의 window는 이 예외와 관계없이 상호작용할 수 없습니다.
|
|
232
|
+
|
|
233
|
+
`FloatingWindowHeader`와 `FloatingWindowNavigationSection`은 surface 최상단을 소유하는 대체 관계의 chrome입니다. 기본 조합에서는 둘을 함께 렌더링하지 않습니다. `FloatingWindowNavigationSection`은 기본적으로 title을 dialog title로 등록하며, 별도의 custom title owner를 제공할 때만 `titleAsDialogTitle={false}`를 사용합니다.
|
|
234
|
+
|
|
235
|
+
modeless `FloatingWindowRoot`는 열릴 때 현재 focus를 유지합니다. `ModalWindowRoot`는 Modal과 같은 초기 focus resolver를 사용해 등록된 visible title을 우선하고, title이 없으면 첫 tabbable 요소로 fallback합니다. 이 정책은 DOM상 close button이 먼저 있다는 이유만으로 닫기 동작을 자동 강조하지 않기 위한 dialog interaction 계약입니다.
|
|
236
|
+
|
|
237
|
+
FloatingWindow surface 크기·radius·padding은 Modal의 `--oc-modal-*` popup 계약을 사용합니다. `resize="fixed"`는 Modal fixed surface와 같은 내부 body scroll contract를 활성화하며, surface의 `data-oc-scrollable`, Header의 `data-oc-sticky`, Footer의 `data-oc-background`를 실제 scroll state에 맞춰 갱신합니다. Footer의 ActionArea 조합은 Modal과 같은 direct-child selector 계약을 사용합니다.
|
|
238
|
+
|
|
239
|
+
`FloatingWindowManager` 안의 window는 고유한 `windowId`로 등록되며 다음 managed state를 노출합니다.
|
|
240
|
+
|
|
241
|
+
| Selector | 의미 |
|
|
242
|
+
| ----------------------------------- | -------------------------------------------- |
|
|
243
|
+
| `[data-oc-window-active='true']` | 현재 manager stack의 활성 window |
|
|
244
|
+
| `[data-oc-window-active='false']` | 열려 있지만 비활성인 managed window |
|
|
245
|
+
| `--oc-floating-window-stack-offset` | manager가 정규화한 backdrop/window 쌍 offset |
|
|
246
|
+
|
|
247
|
+
Manager는 modeless window보다 modal과 `trap-focus` window를 위에 유지합니다. 동일 modality tier에서는 open, pointer, focus 활성화 순서가 stack을 결정하며 Escape와 outside dismissal은 활성 window 하나에만 허용됩니다. Manager 밖에서는 `data-oc-window-active`를 출력하지 않습니다.
|
|
248
|
+
|
|
249
|
+
여러 focus-owning window가 열려도 Base UI modal/inert ownership은 활성 window 하나에만 부여됩니다. 비활성 modal과 `trap-focus` window는 요청 modality와 stack tier를 보존하지만 아래에 있는 동안 document inert를 중복 적용하지 않습니다.
|
|
250
|
+
|
|
251
|
+
| Variable | Default | Scope |
|
|
252
|
+
| ----------------------------------- | ---------------------------------------------------- | ----------------------------- |
|
|
253
|
+
| `--oc-floating-window-stack-offset` | `0`; `stackLevel` prop이 manager-owned offset을 주입 | backdrop/window stacking pair |
|
|
254
|
+
|
|
255
|
+
`--oc-floating-window-x`, `--oc-floating-window-y`는 geometry runtime이 소유하는 live 좌표이므로 consumer style override 대상으로 사용하지 않습니다.
|
|
256
|
+
|
|
201
257
|
## Modal 레이어 계약
|
|
202
258
|
|
|
203
259
|
Modal은 transition motion과 시각 clipping을 분리합니다.
|
|
@@ -216,6 +272,8 @@ Modal은 transition motion과 시각 clipping을 분리합니다.
|
|
|
216
272
|
|
|
217
273
|
시각 커스터마이즈는 `data-oc-part="surface"` 또는 component contract 변수를 대상으로 하세요. `surface-motion`은 transition/placement/drag 동작을 의도적으로 바꿀 때만 대상입니다.
|
|
218
274
|
|
|
275
|
+
Modal의 기본 `initialFocus="auto"`는 `ModalHeader`의 visible title을 `tabIndex={-1}`인 정적 문맥 시작점으로 사용합니다. title이 없으면 첫 tabbable 요소로 fallback합니다. `first-interactive`, `title`, ref/function으로 업무 의미에 맞는 대상을 명시할 수 있으며, 되돌리기 어려운 확인 dialog는 가장 덜 파괴적인 action을 지정하는 것이 권장됩니다. title focus는 일반 Tab 순서에 추가되지 않으며 첫 Tab부터 기존 control 순환이 시작됩니다.
|
|
276
|
+
|
|
219
277
|
- `ModalContent`의 `className`은 motion layer, visual surface, bottom fill 세 레이어에 적용됩니다 — 공개 `--oc-modal-*` 변수 override가 layout 계산까지 도달하게 하기 위함입니다. `style`은 visual surface에 적용되며, `style`의 CSS custom property는 motion/bottom fill 레이어로도 전달됩니다.
|
|
220
278
|
- `data-starting-style`/`data-ending-style`은 Base UI가 motion layer에 방출합니다.
|
|
221
279
|
- `data-oc-modal-backdrop="hidden"`으로 정착하면 backdrop 레이어는 렌더링되지 않습니다. 전환 중 잠시 남는 exiting backdrop 요소에 layout/hit-testing/커스터마이즈를 의존하지 마세요.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orioncactuscorp/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "orioncactus UI foundations and core primitives",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"vitest": "^3.2.4"
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
|
-
"@orioncactuscorp/icons": "^1.
|
|
129
|
+
"@orioncactuscorp/icons": "^1.13.0",
|
|
130
130
|
"@base-ui-components/react": "^1.0.0-rc.0"
|
|
131
131
|
}
|
|
132
132
|
}
|