@synnaxlabs/pluto 0.28.1 → 0.28.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.
@@ -0,0 +1,127 @@
1
+ import { ak as T, f as D, al as N, am as O, an as w, ao as I, ap as z, aq as A, ar as B, as as C, at as _ } from "./Toggle-Q3wJPeGh.js";
2
+ import { j as t } from "./jsx-runtime-B6kdoens.js";
3
+ import { m as S, w as k } from "./aggregator-J7DZKy5x.js";
4
+ import { useState as q } from "react";
5
+ import { C as i, g as E } from "./css-BHfxGWOW.js";
6
+ import { S as y } from "./Pack-CcDPYCmE.js";
7
+ const M = ({
8
+ value: s,
9
+ onChange: a,
10
+ onBlur: e,
11
+ onlyChangeOnBlur: l,
12
+ ...p
13
+ }) => {
14
+ const [c, o] = q(null), m = (r, x = !1) => {
15
+ let n = r.toString();
16
+ o(n);
17
+ let u = new S(r, "UTC");
18
+ n.length < 23 && (n += ".000"), u = u.add(
19
+ BigInt(
20
+ S.now().date().getTimezoneOffset() - u.date().getTimezoneOffset()
21
+ ) * k.MINUTE.valueOf()
22
+ );
23
+ let j = !1;
24
+ try {
25
+ j = u.fString("ISO", "local").slice(0, -1) === n;
26
+ } catch (h) {
27
+ console.error(h);
28
+ }
29
+ j && !l && (a(Number(u.valueOf())), o(null)), x && (j && a(Number(u.valueOf())), o(null));
30
+ }, g = (r) => {
31
+ m(r.target.value, !0), o(null), e == null || e(r);
32
+ }, f = (r) => {
33
+ l && r.key === "Enter" && r.currentTarget.blur();
34
+ }, d = new S(s, "UTC").fString("ISO", "local").slice(0, -1);
35
+ return /* @__PURE__ */ t.jsx(
36
+ T,
37
+ {
38
+ type: "datetime-local",
39
+ onBlur: g,
40
+ required: !1,
41
+ onKeyDown: f,
42
+ value: c ?? d,
43
+ onChange: m,
44
+ ...p
45
+ }
46
+ );
47
+ }, b = ({
48
+ className: s,
49
+ variant: a = "error",
50
+ ...e
51
+ }) => /* @__PURE__ */ t.jsx(
52
+ D,
53
+ {
54
+ className: i(
55
+ i.B("input-help-text"),
56
+ i.BM("input-help-text", a),
57
+ s
58
+ ),
59
+ level: "small",
60
+ ...e
61
+ }
62
+ ), v = ({
63
+ className: s,
64
+ required: a = !1,
65
+ children: e,
66
+ ...l
67
+ }) => /* @__PURE__ */ t.jsxs("label", { className: i(i.B("input-label"), s), ...l, children: [
68
+ e,
69
+ " ",
70
+ a && /* @__PURE__ */ t.jsx("span", { className: i.B("required-indicator"), children: "*" })
71
+ ] }), U = (s, a = "x") => s ?? (E.construct(a) === "y" ? "stretch" : "center"), V = ({
72
+ label: s,
73
+ showLabel: a = !0,
74
+ helpText: e,
75
+ direction: l = "y",
76
+ className: p,
77
+ children: c,
78
+ required: o,
79
+ align: m,
80
+ size: g = "small",
81
+ padHelpText: f = !1,
82
+ helpTextVariant: d,
83
+ showHelpText: r = !0,
84
+ ...x
85
+ }) => {
86
+ let n;
87
+ return r === !1 && a === !1 ? /* @__PURE__ */ t.jsx(t.Fragment, { children: c }) : (l === "x" ? n = /* @__PURE__ */ t.jsxs(y, { direction: "y", size: "small", children: [
88
+ c,
89
+ (f || e != null && e.length > 0) && /* @__PURE__ */ t.jsx(b, { variant: d, children: e })
90
+ ] }) : n = /* @__PURE__ */ t.jsxs(y, { direction: "y", size: 1 / 3, children: [
91
+ c,
92
+ (f || e != null && e.length > 0) && /* @__PURE__ */ t.jsx(b, { variant: d, children: e })
93
+ ] }), /* @__PURE__ */ t.jsxs(
94
+ y,
95
+ {
96
+ className: i(i.B("input-item"), p),
97
+ direction: l,
98
+ size: g,
99
+ align: U(m, l),
100
+ ...x,
101
+ children: [
102
+ a && /* @__PURE__ */ t.jsx(v, { required: o, children: s }),
103
+ n
104
+ ]
105
+ }
106
+ ));
107
+ }, G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
108
+ __proto__: null,
109
+ Date: N,
110
+ DateTime: M,
111
+ DragButton: O,
112
+ HelpText: b,
113
+ Item: V,
114
+ Label: v,
115
+ Numeric: w,
116
+ Switch: I,
117
+ Text: T,
118
+ TextArea: z,
119
+ Time: A,
120
+ combineDateAndTimeValue: B,
121
+ useDate: C,
122
+ useTime: _
123
+ }, Symbol.toStringTag, { value: "Module" }));
124
+ export {
125
+ V as I,
126
+ G as e
127
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("./Toggle-GfklnU2t.cjs"),s=require("./jsx-runtime-Cek9Ww4S.cjs"),j=require("./aggregator-C5NNOlCt.cjs"),y=require("react"),l=require("./css-C4GOlJsi.cjs"),E=require("./Pack-BNnq0Pnk.cjs"),C=({value:r,onChange:n,onBlur:e,onlyChangeOnBlur:a,...d})=>{const[m,c]=y.useState(null),x=(i,p=!1)=>{let u=i.toString();c(u);let o=new j.m(i,"UTC");u.length<23&&(u+=".000"),o=o.add(BigInt(j.m.now().date().getTimezoneOffset()-o.date().getTimezoneOffset())*j.w.MINUTE.valueOf());let T=!1;try{T=o.fString("ISO","local").slice(0,-1)===u}catch(D){console.error(D)}T&&!a&&(n(Number(o.valueOf())),c(null)),p&&(T&&n(Number(o.valueOf())),c(null))},g=i=>{x(i.target.value,!0),c(null),e==null||e(i)},S=i=>{a&&i.key==="Enter"&&i.currentTarget.blur()},f=new j.m(r,"UTC").fString("ISO","local").slice(0,-1);return s.jsxRuntimeExports.jsx(t.Text$1,{type:"datetime-local",onBlur:g,required:!1,onKeyDown:S,value:m??f,onChange:x,...d})},R=({className:r,variant:n="error",...e})=>s.jsxRuntimeExports.jsx(t.Text,{className:l.CSS(l.CSS.B("input-help-text"),l.CSS.BM("input-help-text",n),r),level:"small",...e}),b=({className:r,required:n=!1,children:e,...a})=>s.jsxRuntimeExports.jsxs("label",{className:l.CSS(l.CSS.B("input-label"),r),...a,children:[e," ",n&&s.jsxRuntimeExports.jsx("span",{className:l.CSS.B("required-indicator"),children:"*"})]}),v=(r,n="x")=>r??(l.g.construct(n)==="y"?"stretch":"center"),h=({label:r,showLabel:n=!0,helpText:e,direction:a="y",className:d,children:m,required:c,align:x,size:g="small",padHelpText:S=!1,helpTextVariant:f,showHelpText:i=!0,...p})=>{let u;return i===!1&&n===!1?s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m}):(a==="x"?u=s.jsxRuntimeExports.jsxs(E.Space,{direction:"y",size:"small",children:[m,(S||e!=null&&e.length>0)&&s.jsxRuntimeExports.jsx(R,{variant:f,children:e})]}):u=s.jsxRuntimeExports.jsxs(E.Space,{direction:"y",size:1/3,children:[m,(S||e!=null&&e.length>0)&&s.jsxRuntimeExports.jsx(R,{variant:f,children:e})]}),s.jsxRuntimeExports.jsxs(E.Space,{className:l.CSS(l.CSS.B("input-item"),d),direction:a,size:g,align:v(x,a),...p,children:[n&&s.jsxRuntimeExports.jsx(b,{required:c,children:r}),u]}))},N=Object.freeze(Object.defineProperty({__proto__:null,Date:t.Date,DateTime:C,DragButton:t.DragButton,HelpText:R,Item:h,Label:b,Numeric:t.Numeric,Switch:t.Switch$1,Text:t.Text$1,TextArea:t.TextArea,Time:t.Time,combineDateAndTimeValue:t.combineDateAndTimeValue,useDate:t.useDate,useTime:t.useTime},Symbol.toStringTag,{value:"Module"}));exports.Item=h;exports.external=N;