fina-react-ds 1.0.0 → 1.0.2

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.
Files changed (31) hide show
  1. package/dist/components/calendar.js +206 -0
  2. package/dist/components/date-picker.js +63 -0
  3. package/dist/components/select.js +12 -12
  4. package/dist/components/separator.js +29 -0
  5. package/dist/components/sheet.js +17 -5
  6. package/dist/components/sidebar.js +620 -0
  7. package/dist/components/simple-tooltip.js +17 -0
  8. package/dist/components/skeleton.js +18 -0
  9. package/dist/components/sonner.js +24 -0
  10. package/dist/components/switch.js +34 -0
  11. package/dist/components/textarea.js +23 -0
  12. package/dist/components/tooltip.js +61 -0
  13. package/dist/hooks/use-mobile.js +17 -0
  14. package/dist/index.d.ts +13 -3
  15. package/dist/index.js +140 -93
  16. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +12 -0
  17. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +21 -0
  18. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchFn.js +36 -0
  19. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +18 -0
  20. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/fr/_lib/formatDistance.js +72 -0
  21. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/fr/_lib/formatLong.js +33 -0
  22. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/fr/_lib/formatRelative.js +13 -0
  23. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/fr/_lib/localize.js +123 -0
  24. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/fr/_lib/match.js +112 -0
  25. package/dist/node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/fr.js +21 -0
  26. package/dist/node_modules/@radix-ui/react-separator/dist/index.js +27 -0
  27. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +47 -40
  28. package/dist/node_modules/@radix-ui/react-switch/dist/index.js +136 -0
  29. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +348 -0
  30. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +32 -0
  31. package/package.json +1 -1
@@ -0,0 +1,348 @@
1
+ var $ = Object.defineProperty;
2
+ var v = (t, o) => $(t, "name", { value: o, configurable: !0 });
3
+ import * as s from "react";
4
+ import { composeEventHandlers as b } from "../../primitive/dist/index.js";
5
+ import { useComposedRefs as S } from "../../react-compose-refs/dist/index.js";
6
+ import { createContextScope as z } from "../../react-context/dist/index.js";
7
+ import { DismissableLayer as J } from "../../react-dismissable-layer/dist/index.js";
8
+ import { useId as Q } from "../../react-id/dist/index.js";
9
+ import { createPopperScope as G, Root as Z, Anchor as ee, Arrow as te, Content as oe } from "../../react-popper/dist/index.js";
10
+ import { Portal as re } from "../../react-portal/dist/index.js";
11
+ import { Presence as j } from "../../react-presence/dist/index.js";
12
+ import { Primitive as ne } from "../../react-primitive/dist/index.js";
13
+ import { createSlottable as se } from "../../react-slot/dist/index.js";
14
+ import { useControllableState as ie } from "../../react-use-controllable-state/dist/index.js";
15
+ import { Root as ae } from "../../react-visually-hidden/dist/index.js";
16
+ import { jsx as f, jsxs as le } from "react/jsx-runtime";
17
+ var [D, Ge] = z("Tooltip", [
18
+ G
19
+ ]), O = G(), F = "TooltipProvider", ce = 700, L = "tooltip.open", [ue, M] = D(F), B = /* @__PURE__ */ v((t) => {
20
+ const {
21
+ __scopeTooltip: o,
22
+ delayDuration: e = ce,
23
+ skipDelayDuration: r = 300,
24
+ disableHoverableContent: n = !1,
25
+ children: a
26
+ } = t, l = s.useRef(!0), h = s.useRef(!1), i = s.useRef(0);
27
+ return s.useEffect(() => {
28
+ const p = i.current;
29
+ return () => window.clearTimeout(p);
30
+ }, []), /* @__PURE__ */ f(
31
+ ue,
32
+ {
33
+ scope: o,
34
+ isOpenDelayedRef: l,
35
+ delayDuration: e,
36
+ onOpen: s.useCallback(() => {
37
+ window.clearTimeout(i.current), l.current = !1;
38
+ }, []),
39
+ onClose: s.useCallback(() => {
40
+ window.clearTimeout(i.current), i.current = window.setTimeout(
41
+ () => l.current = !0,
42
+ r
43
+ );
44
+ }, [r]),
45
+ isPointerInTransitRef: h,
46
+ onPointerInTransitChange: s.useCallback((p) => {
47
+ h.current = p;
48
+ }, []),
49
+ disableHoverableContent: n,
50
+ children: a
51
+ }
52
+ );
53
+ }, "TooltipProvider");
54
+ B.displayName = F;
55
+ var _ = "Tooltip", [pe, A] = D(_), U = /* @__PURE__ */ v((t) => {
56
+ const {
57
+ __scopeTooltip: o,
58
+ children: e,
59
+ open: r,
60
+ defaultOpen: n,
61
+ onOpenChange: a,
62
+ disableHoverableContent: l,
63
+ delayDuration: h
64
+ } = t, i = M(_, t.__scopeTooltip), p = O(o), [c, d] = s.useState(null), m = Q(), u = s.useRef(0), T = l ?? i.disableHoverableContent, C = h ?? i.delayDuration, y = s.useRef(!1), [g, x] = ie({
65
+ prop: r,
66
+ defaultProp: n ?? !1,
67
+ onChange: /* @__PURE__ */ v((N) => {
68
+ N ? (i.onOpen(), document.dispatchEvent(new CustomEvent(L))) : i.onClose(), a == null || a(N);
69
+ }, "onChange"),
70
+ caller: _
71
+ }), P = s.useMemo(() => g ? y.current ? "delayed-open" : "instant-open" : "closed", [g]), E = s.useCallback(() => {
72
+ window.clearTimeout(u.current), u.current = 0, y.current = !1, x(!0);
73
+ }, [x]), R = s.useCallback(() => {
74
+ window.clearTimeout(u.current), u.current = 0, x(!1);
75
+ }, [x]), H = s.useCallback(() => {
76
+ window.clearTimeout(u.current), u.current = window.setTimeout(() => {
77
+ y.current = !0, x(!0), u.current = 0;
78
+ }, C);
79
+ }, [C, x]);
80
+ return s.useEffect(() => () => {
81
+ u.current && (window.clearTimeout(u.current), u.current = 0);
82
+ }, []), /* @__PURE__ */ f(Z, { ...p, children: /* @__PURE__ */ f(
83
+ pe,
84
+ {
85
+ scope: o,
86
+ contentId: m,
87
+ open: g,
88
+ stateAttribute: P,
89
+ trigger: c,
90
+ onTriggerChange: d,
91
+ onTriggerEnter: s.useCallback(() => {
92
+ i.isOpenDelayedRef.current ? H() : E();
93
+ }, [i.isOpenDelayedRef, H, E]),
94
+ onTriggerLeave: s.useCallback(() => {
95
+ T ? R() : (window.clearTimeout(u.current), u.current = 0);
96
+ }, [R, T]),
97
+ onOpen: E,
98
+ onClose: R,
99
+ disableHoverableContent: T,
100
+ children: e
101
+ }
102
+ ) });
103
+ }, "Tooltip");
104
+ U.displayName = _;
105
+ var k = "TooltipTrigger", V = s.forwardRef(
106
+ (t, o) => {
107
+ const { __scopeTooltip: e, ...r } = t, n = A(k, e), a = M(k, e), l = O(e), h = s.useRef(null), i = S(o, h, n.onTriggerChange), p = s.useRef(!1), c = s.useRef(!1), d = s.useCallback(() => p.current = !1, []);
108
+ return s.useEffect(() => () => document.removeEventListener("pointerup", d), [d]), /* @__PURE__ */ f(ee, { asChild: !0, ...l, children: /* @__PURE__ */ f(
109
+ ne.button,
110
+ {
111
+ "aria-describedby": n.open ? n.contentId : void 0,
112
+ "data-state": n.stateAttribute,
113
+ ...r,
114
+ ref: i,
115
+ onPointerMove: b(t.onPointerMove, (m) => {
116
+ m.pointerType !== "touch" && !c.current && !a.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
117
+ }),
118
+ onPointerLeave: b(t.onPointerLeave, () => {
119
+ n.onTriggerLeave(), c.current = !1;
120
+ }),
121
+ onPointerDown: b(t.onPointerDown, () => {
122
+ n.open && n.onClose(), p.current = !0, document.addEventListener("pointerup", d, { once: !0 });
123
+ }),
124
+ onFocus: b(t.onFocus, () => {
125
+ p.current || n.onOpen();
126
+ }),
127
+ onBlur: b(t.onBlur, n.onClose),
128
+ onClick: b(t.onClick, n.onClose)
129
+ }
130
+ ) });
131
+ }
132
+ );
133
+ V.displayName = k;
134
+ var I = "TooltipPortal", [de, fe] = D(I, {
135
+ forceMount: void 0
136
+ }), Y = /* @__PURE__ */ v((t) => {
137
+ const { __scopeTooltip: o, forceMount: e, children: r, container: n } = t, a = A(I, o);
138
+ return /* @__PURE__ */ f(de, { scope: o, forceMount: e, children: /* @__PURE__ */ f(j, { present: e || a.open, children: /* @__PURE__ */ f(re, { asChild: !0, container: n, children: r }) }) });
139
+ }, "TooltipPortal");
140
+ Y.displayName = I;
141
+ var w = "TooltipContent", q = s.forwardRef(
142
+ (t, o) => {
143
+ const e = fe(w, t.__scopeTooltip), { forceMount: r = e.forceMount, side: n = "top", ...a } = t, l = A(w, t.__scopeTooltip);
144
+ return /* @__PURE__ */ f(j, { present: r || l.open, children: l.disableHoverableContent ? /* @__PURE__ */ f(X, { side: n, ...a, ref: o }) : /* @__PURE__ */ f(ve, { side: n, ...a, ref: o }) });
145
+ }
146
+ ), ve = s.forwardRef((t, o) => {
147
+ const e = A(w, t.__scopeTooltip), r = M(w, t.__scopeTooltip), n = s.useRef(null), a = S(o, n), [l, h] = s.useState(null), { trigger: i, onClose: p } = e, c = n.current, { onPointerInTransitChange: d } = r, m = s.useCallback(() => {
148
+ h(null), d(!1);
149
+ }, [d]), u = s.useCallback(
150
+ (T, C) => {
151
+ const y = T.currentTarget, g = { x: T.clientX, y: T.clientY }, x = ye(g, y.getBoundingClientRect()), P = Ce(g, x), E = xe(C.getBoundingClientRect()), R = be([...P, ...E]);
152
+ h(R), d(!0);
153
+ },
154
+ [d]
155
+ );
156
+ return s.useEffect(() => () => m(), [m]), s.useEffect(() => {
157
+ if (i && c) {
158
+ const T = /* @__PURE__ */ v((y) => u(y, c), "handleTriggerLeave"), C = /* @__PURE__ */ v((y) => u(y, i), "handleContentLeave");
159
+ return i.addEventListener("pointerleave", T), c.addEventListener("pointerleave", C), () => {
160
+ i.removeEventListener("pointerleave", T), c.removeEventListener("pointerleave", C);
161
+ };
162
+ }
163
+ }, [i, c, u, m]), s.useEffect(() => {
164
+ if (l) {
165
+ const T = /* @__PURE__ */ v((C) => {
166
+ const y = C.target, g = { x: C.clientX, y: C.clientY }, x = (i == null ? void 0 : i.contains(y)) || (c == null ? void 0 : c.contains(y)), P = !ge(g, l);
167
+ x ? m() : P && (m(), p());
168
+ }, "handleTrackPointerGrace");
169
+ return document.addEventListener("pointermove", T), () => document.removeEventListener("pointermove", T);
170
+ }
171
+ }, [i, c, l, p, m]), /* @__PURE__ */ f(X, { ...t, ref: a });
172
+ }), [he, me] = D(_, { isInside: !1 }), Te = se("TooltipContent"), X = s.forwardRef(
173
+ (t, o) => {
174
+ const {
175
+ __scopeTooltip: e,
176
+ children: r,
177
+ "aria-label": n,
178
+ onEscapeKeyDown: a,
179
+ onPointerDownOutside: l,
180
+ ...h
181
+ } = t, i = A(w, e), p = O(e), { onClose: c } = i;
182
+ return s.useEffect(() => (document.addEventListener(L, c), () => document.removeEventListener(L, c)), [c]), s.useEffect(() => {
183
+ if (i.trigger) {
184
+ const d = /* @__PURE__ */ v((m) => {
185
+ const u = m.target;
186
+ u != null && u.contains(i.trigger) && c();
187
+ }, "handleScroll");
188
+ return window.addEventListener("scroll", d, { capture: !0 }), () => window.removeEventListener("scroll", d, { capture: !0 });
189
+ }
190
+ }, [i.trigger, c]), /* @__PURE__ */ f(
191
+ J,
192
+ {
193
+ asChild: !0,
194
+ disableOutsidePointerEvents: !1,
195
+ onEscapeKeyDown: a,
196
+ onPointerDownOutside: l,
197
+ onFocusOutside: /* @__PURE__ */ v((d) => d.preventDefault(), "onFocusOutside"),
198
+ onDismiss: c,
199
+ children: /* @__PURE__ */ le(
200
+ oe,
201
+ {
202
+ "data-state": i.stateAttribute,
203
+ ...p,
204
+ ...h,
205
+ ref: o,
206
+ style: {
207
+ ...h.style,
208
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
209
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
210
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
211
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
212
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
213
+ },
214
+ children: [
215
+ /* @__PURE__ */ f(Te, { children: r }),
216
+ /* @__PURE__ */ f(he, { scope: e, isInside: !0, children: /* @__PURE__ */ f(ae, { id: i.contentId, role: "tooltip", children: n || r }) })
217
+ ]
218
+ }
219
+ )
220
+ }
221
+ );
222
+ }
223
+ );
224
+ q.displayName = w;
225
+ var K = "TooltipArrow", W = s.forwardRef(
226
+ (t, o) => {
227
+ const { __scopeTooltip: e, ...r } = t, n = O(e);
228
+ return me(
229
+ K,
230
+ e
231
+ ).isInside ? null : /* @__PURE__ */ f(te, { ...n, ...r, ref: o });
232
+ }
233
+ );
234
+ W.displayName = K;
235
+ function ye(t, o) {
236
+ const e = Math.abs(o.top - t.y), r = Math.abs(o.bottom - t.y), n = Math.abs(o.right - t.x), a = Math.abs(o.left - t.x);
237
+ switch (Math.min(e, r, n, a)) {
238
+ case a:
239
+ return "left";
240
+ case n:
241
+ return "right";
242
+ case e:
243
+ return "top";
244
+ case r:
245
+ return "bottom";
246
+ default:
247
+ throw new Error("unreachable");
248
+ }
249
+ }
250
+ v(ye, "getExitSideFromRect");
251
+ function Ce(t, o, e = 5) {
252
+ const r = [];
253
+ switch (o) {
254
+ case "top":
255
+ r.push(
256
+ { x: t.x - e, y: t.y + e },
257
+ { x: t.x + e, y: t.y + e }
258
+ );
259
+ break;
260
+ case "bottom":
261
+ r.push(
262
+ { x: t.x - e, y: t.y - e },
263
+ { x: t.x + e, y: t.y - e }
264
+ );
265
+ break;
266
+ case "left":
267
+ r.push(
268
+ { x: t.x + e, y: t.y - e },
269
+ { x: t.x + e, y: t.y + e }
270
+ );
271
+ break;
272
+ case "right":
273
+ r.push(
274
+ { x: t.x - e, y: t.y - e },
275
+ { x: t.x - e, y: t.y + e }
276
+ );
277
+ break;
278
+ }
279
+ return r;
280
+ }
281
+ v(Ce, "getPaddedExitPoints");
282
+ function xe(t) {
283
+ const { top: o, right: e, bottom: r, left: n } = t;
284
+ return [
285
+ { x: n, y: o },
286
+ { x: e, y: o },
287
+ { x: e, y: r },
288
+ { x: n, y: r }
289
+ ];
290
+ }
291
+ v(xe, "getPointsFromRect");
292
+ function ge(t, o) {
293
+ const { x: e, y: r } = t;
294
+ let n = !1;
295
+ for (let a = 0, l = o.length - 1; a < o.length; l = a++) {
296
+ const h = o[a], i = o[l], p = h.x, c = h.y, d = i.x, m = i.y;
297
+ c > r != m > r && e < (d - p) * (r - c) / (m - c) + p && (n = !n);
298
+ }
299
+ return n;
300
+ }
301
+ v(ge, "isPointInPolygon");
302
+ function be(t) {
303
+ const o = t.slice();
304
+ return o.sort((e, r) => e.x < r.x ? -1 : e.x > r.x ? 1 : e.y < r.y ? -1 : e.y > r.y ? 1 : 0), we(o);
305
+ }
306
+ v(be, "getHull");
307
+ function we(t) {
308
+ if (t.length <= 1) return t.slice();
309
+ const o = [];
310
+ for (let r = 0; r < t.length; r++) {
311
+ const n = t[r];
312
+ for (; o.length >= 2; ) {
313
+ const a = o[o.length - 1], l = o[o.length - 2];
314
+ if ((a.x - l.x) * (n.y - l.y) >= (a.y - l.y) * (n.x - l.x)) o.pop();
315
+ else break;
316
+ }
317
+ o.push(n);
318
+ }
319
+ o.pop();
320
+ const e = [];
321
+ for (let r = t.length - 1; r >= 0; r--) {
322
+ const n = t[r];
323
+ for (; e.length >= 2; ) {
324
+ const a = e[e.length - 1], l = e[e.length - 2];
325
+ if ((a.x - l.x) * (n.y - l.y) >= (a.y - l.y) * (n.x - l.x)) e.pop();
326
+ else break;
327
+ }
328
+ e.push(n);
329
+ }
330
+ return e.pop(), o.length === 1 && e.length === 1 && o[0].x === e[0].x && o[0].y === e[0].y ? o : o.concat(e);
331
+ }
332
+ v(we, "getHullPresorted");
333
+ var je = B, Fe = U, Be = V, Ue = Y, Ve = q, Ye = W;
334
+ export {
335
+ Ye as Arrow,
336
+ Ve as Content,
337
+ Ue as Portal,
338
+ je as Provider,
339
+ Fe as Root,
340
+ U as Tooltip,
341
+ W as TooltipArrow,
342
+ q as TooltipContent,
343
+ Y as TooltipPortal,
344
+ B as TooltipProvider,
345
+ V as TooltipTrigger,
346
+ Be as Trigger,
347
+ Ge as createTooltipScope
348
+ };
@@ -0,0 +1,32 @@
1
+ import * as a from "react";
2
+ import { Primitive as o } from "../../react-primitive/dist/index.js";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ var d = Object.freeze({
5
+ // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
6
+ position: "absolute",
7
+ border: 0,
8
+ width: 1,
9
+ height: 1,
10
+ padding: 0,
11
+ margin: -1,
12
+ overflow: "hidden",
13
+ clip: "rect(0, 0, 0, 0)",
14
+ whiteSpace: "nowrap",
15
+ wordWrap: "normal"
16
+ }), l = "VisuallyHidden", e = a.forwardRef(
17
+ (r, i) => /* @__PURE__ */ t(
18
+ o.span,
19
+ {
20
+ ...r,
21
+ ref: i,
22
+ style: { ...d, ...r.style }
23
+ }
24
+ )
25
+ );
26
+ e.displayName = l;
27
+ var p = e;
28
+ export {
29
+ p as Root,
30
+ d as VISUALLY_HIDDEN_STYLES,
31
+ e as VisuallyHidden
32
+ };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "https://github.com/F1na/fina-react-ds"
6
6
  },
7
7
  "private": false,
8
- "version": "1.0.0",
8
+ "version": "1.0.2",
9
9
  "type": "module",
10
10
  "files": [
11
11
  "dist"