@kingsimba/nc-ui 0.1.24 → 0.1.26

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/dist/index.d.ts CHANGED
@@ -1132,4 +1132,20 @@ export declare function ViewportProvider({ children }: {
1132
1132
  children: ReactNode;
1133
1133
  }): JSX_2.Element;
1134
1134
 
1135
+ export declare function YamlTextArea({ value, onChange, onValidationChange, readOnly, minHeight, maxHeight, debounceMs, className, style, language, }: YamlTextAreaProps): JSX_2.Element;
1136
+
1137
+ export declare interface YamlTextAreaProps {
1138
+ value: string;
1139
+ onChange: (value: string) => void;
1140
+ onValidationChange?: (isValid: boolean, error?: string) => void;
1141
+ readOnly?: boolean;
1142
+ minHeight?: number;
1143
+ maxHeight?: number;
1144
+ debounceMs?: number;
1145
+ className?: string;
1146
+ style?: default_2.CSSProperties;
1147
+ /** Language for syntax highlighting and validation. Default: 'yaml'. */
1148
+ language?: 'yaml' | 'json';
1149
+ }
1150
+
1135
1151
  export { }
package/dist/index.js CHANGED
@@ -6,8 +6,9 @@ import { d as xe, E as rt, R as ot, T as st, g as it, V as ct, b as at, a as lt,
6
6
  import ke, { useState as E, useRef as W, useMemo as me, useEffect as B, createContext as se, useContext as J, Children as ut, isValidElement as pt, forwardRef as ft, useImperativeHandle as ht, useCallback as O, Suspense as mt } from "react";
7
7
  import { createPortal as ue } from "react-dom";
8
8
  import { useTranslation as Q } from "react-i18next";
9
- import gt from "i18next";
10
- import { c as bt } from "./clsx-OuTLNxxd.js";
9
+ import { c as gt } from "./YamlTextArea-ee1d1TLc.js";
10
+ import { Y as fr } from "./YamlTextArea-ee1d1TLc.js";
11
+ import bt from "i18next";
11
12
  function He({
12
13
  size: e = "default",
13
14
  color: t,
@@ -396,7 +397,7 @@ function Bn({
396
397
  t == null || t(M), h(!1), k(""), P && ((D = w.current) == null || D.blur());
397
398
  }, Z = () => {
398
399
  t == null || t(void 0), k(""), h(!1);
399
- }, G = (M) => {
400
+ }, Y = (M) => {
400
401
  if (!m) {
401
402
  (M.key === "ArrowDown" || M.key === "ArrowUp") && (h(!0), M.preventDefault());
402
403
  return;
@@ -450,7 +451,7 @@ function Bn({
450
451
  }, 0))), c || (M = w.current) == null || M.blur();
451
452
  },
452
453
  onChange: (M) => c && k(M.target.value),
453
- onKeyDown: G,
454
+ onKeyDown: Y,
454
455
  value: m && c ? g : (y == null ? void 0 : y.label) || "",
455
456
  readOnly: o || !c,
456
457
  style: {
@@ -814,7 +815,7 @@ function St({ visible: e, onClick: t, size: n = "default" }) {
814
815
  }
815
816
  );
816
817
  }
817
- function Gn({
818
+ function Yn({
818
819
  value: e,
819
820
  defaultValue: t = "",
820
821
  onChange: n,
@@ -835,9 +836,9 @@ function Gn({
835
836
  validator: k,
836
837
  showErrorMessage: v = !0
837
838
  }) {
838
- const N = W(null), w = W(null), [A, $] = E(!1), [L, T] = E(!1), y = e !== void 0, [R, C] = E(t), S = y ? e : R, z = k ? k(S) : null, F = !!z, Z = p === "password", G = Z && m && !a && !h, M = l && S && !a && L, P = b === "small" ? 32 : 44;
839
+ const N = W(null), w = W(null), [A, $] = E(!1), [L, T] = E(!1), y = e !== void 0, [R, C] = E(t), S = y ? e : R, z = k ? k(S) : null, F = !!z, Z = p === "password", Y = Z && m && !a && !h, M = l && S && !a && L, P = b === "small" ? 32 : 44;
839
840
  let D = 12;
840
- M && G ? D = P * 2 : (M || G) && (D = P);
841
+ M && Y ? D = P * 2 : (M || Y) && (D = P);
841
842
  const V = u ? b === "small" ? 28 : 34 : void 0, Ze = () => {
842
843
  var te, ce;
843
844
  y || C(""), n == null || n(""), o == null || o(), h ? (te = w.current) == null || te.focus() : (ce = N.current) == null || ce.focus();
@@ -898,13 +899,13 @@ function Gn({
898
899
  }
899
900
  }
900
901
  ),
901
- M && /* @__PURE__ */ s(Ct, { onClick: Ze, size: b, rightOffset: G ? P + 4 : 4 }),
902
- G && /* @__PURE__ */ s(St, { visible: A, onClick: () => $(!A), size: b })
902
+ M && /* @__PURE__ */ s(Ct, { onClick: Ze, size: b, rightOffset: Y ? P + 4 : 4 }),
903
+ Y && /* @__PURE__ */ s(St, { visible: A, onClick: () => $(!A), size: b })
903
904
  ] }),
904
905
  F && v && /* @__PURE__ */ s("span", { className: "nc-error-message", children: z })
905
906
  ] });
906
907
  }
907
- function Yn({
908
+ function Gn({
908
909
  children: e,
909
910
  onClick: t,
910
911
  showBorder: n = !0,
@@ -1704,7 +1705,7 @@ const tr = {
1704
1705
  show: (e) => Lt(e)
1705
1706
  };
1706
1707
  function nr(e) {
1707
- const t = gt.createInstance(), n = {};
1708
+ const t = bt.createInstance(), n = {};
1708
1709
  for (const o in e)
1709
1710
  n[o] = { translation: e[o] };
1710
1711
  const r = typeof document < "u" && document.documentElement.lang || "en";
@@ -1932,7 +1933,7 @@ class Ht {
1932
1933
  this.listeners.forEach((t) => t());
1933
1934
  }
1934
1935
  }
1935
- const Y = new Ht(), Ve = se(null);
1936
+ const G = new Ht(), Ve = se(null);
1936
1937
  function Wt() {
1937
1938
  const e = J(Ve);
1938
1939
  if (!e)
@@ -2012,7 +2013,7 @@ class Vt extends ke.Component {
2012
2013
  ) : this.props.children;
2013
2014
  }
2014
2015
  }
2015
- function Ge({ appId: e, isActive: t, onClose: n }) {
2016
+ function Ye({ appId: e, isActive: t, onClose: n }) {
2016
2017
  const { t: r } = Q(), o = oe.get(e), [i, a] = E(""), [c, l] = E(null), [p, f] = E(null), [b, d] = E(!1), [u, m] = E(!1);
2017
2018
  ke.useEffect(() => {
2018
2019
  o != null && o.titleKey && a(r(o.titleKey));
@@ -2101,16 +2102,16 @@ function Ge({ appId: e, isActive: t, onClose: n }) {
2101
2102
  }
2102
2103
  );
2103
2104
  }
2104
- const fe = 768, he = 1024, Ye = {
2105
+ const fe = 768, he = 1024, Ge = {
2105
2106
  isMobile: !1,
2106
2107
  isTablet: !1,
2107
2108
  isDesktop: !0,
2108
2109
  width: typeof window < "u" ? window.innerWidth : 1024,
2109
2110
  height: typeof window < "u" ? window.innerHeight : 768
2110
- }, je = se(Ye);
2111
+ }, je = se(Ge);
2111
2112
  function rr({ children: e }) {
2112
2113
  const [t, n] = E(() => {
2113
- if (typeof window > "u") return Ye;
2114
+ if (typeof window > "u") return Ge;
2114
2115
  const r = window.innerWidth, o = window.innerHeight;
2115
2116
  return {
2116
2117
  isMobile: r < fe,
@@ -2137,7 +2138,7 @@ function rr({ children: e }) {
2137
2138
  function Ke() {
2138
2139
  return J(je);
2139
2140
  }
2140
- const Ne = "-", Gt = (e) => {
2141
+ const Ne = "-", Yt = (e) => {
2141
2142
  const t = jt(e), {
2142
2143
  conflictingClassGroups: n,
2143
2144
  conflictingClassGroupModifiers: r
@@ -2145,7 +2146,7 @@ const Ne = "-", Gt = (e) => {
2145
2146
  return {
2146
2147
  getClassGroupId: (a) => {
2147
2148
  const c = a.split(Ne);
2148
- return c[0] === "" && c.length !== 1 && c.shift(), _e(c, t) || Yt(a);
2149
+ return c[0] === "" && c.length !== 1 && c.shift(), _e(c, t) || Gt(a);
2149
2150
  },
2150
2151
  getConflictingClassGroupIds: (a, c) => {
2151
2152
  const l = n[a] || [];
@@ -2165,7 +2166,7 @@ const Ne = "-", Gt = (e) => {
2165
2166
  return (a = t.validators.find(({
2166
2167
  validator: c
2167
2168
  }) => c(i))) == null ? void 0 : a.classGroupId;
2168
- }, Be = /^\[(.+)\]$/, Yt = (e) => {
2169
+ }, Be = /^\[(.+)\]$/, Gt = (e) => {
2169
2170
  if (Be.test(e)) {
2170
2171
  const t = Be.exec(e)[1], n = t == null ? void 0 : t.substring(0, t.indexOf(":"));
2171
2172
  if (n)
@@ -2283,7 +2284,7 @@ const Ne = "-", Gt = (e) => {
2283
2284
  }, Jt = (e) => ({
2284
2285
  cache: Ut(e.cacheSize),
2285
2286
  parseClassName: qt(e),
2286
- ...Gt(e)
2287
+ ...Yt(e)
2287
2288
  }), Qt = /\s+/, Zt = (e, t) => {
2288
2289
  const {
2289
2290
  parseClassName: n,
@@ -2366,7 +2367,7 @@ const H = (e) => {
2366
2367
  // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
2367
2368
  sn.test(e) && !cn.test(e)
2368
2369
  ), Je = () => !1, vn = (e) => an.test(e), wn = (e) => ln.test(e), yn = () => {
2369
- const e = H("colors"), t = H("spacing"), n = H("blur"), r = H("brightness"), o = H("borderColor"), i = H("borderRadius"), a = H("borderSpacing"), c = H("borderWidth"), l = H("contrast"), p = H("grayscale"), f = H("hueRotate"), b = H("invert"), d = H("gap"), u = H("gradientColorStops"), m = H("gradientColorStopPositions"), h = H("inset"), g = H("margin"), k = H("opacity"), v = H("padding"), N = H("saturate"), w = H("scale"), A = H("sepia"), $ = H("skew"), L = H("space"), T = H("translate"), y = () => ["auto", "contain", "none"], R = () => ["auto", "hidden", "clip", "visible", "scroll"], C = () => ["auto", I, t], S = () => [I, t], z = () => ["", j, q], F = () => ["auto", re, I], Z = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], G = () => ["solid", "dashed", "dotted", "double", "none"], M = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], P = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], D = () => ["", "0", I], ge = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], V = () => [re, I];
2370
+ const e = H("colors"), t = H("spacing"), n = H("blur"), r = H("brightness"), o = H("borderColor"), i = H("borderRadius"), a = H("borderSpacing"), c = H("borderWidth"), l = H("contrast"), p = H("grayscale"), f = H("hueRotate"), b = H("invert"), d = H("gap"), u = H("gradientColorStops"), m = H("gradientColorStopPositions"), h = H("inset"), g = H("margin"), k = H("opacity"), v = H("padding"), N = H("saturate"), w = H("scale"), A = H("sepia"), $ = H("skew"), L = H("space"), T = H("translate"), y = () => ["auto", "contain", "none"], R = () => ["auto", "hidden", "clip", "visible", "scroll"], C = () => ["auto", I, t], S = () => [I, t], z = () => ["", j, q], F = () => ["auto", re, I], Z = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], Y = () => ["solid", "dashed", "dotted", "double", "none"], M = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], P = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], D = () => ["", "0", I], ge = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], V = () => [re, I];
2370
2371
  return {
2371
2372
  cacheSize: 500,
2372
2373
  separator: ":",
@@ -3181,7 +3182,7 @@ const H = (e) => {
3181
3182
  * @see https://tailwindcss.com/docs/text-decoration-style
3182
3183
  */
3183
3184
  "text-decoration-style": [{
3184
- decoration: [...G(), "wavy"]
3185
+ decoration: [...Y(), "wavy"]
3185
3186
  }],
3186
3187
  /**
3187
3188
  * Text Decoration Thickness
@@ -3555,7 +3556,7 @@ const H = (e) => {
3555
3556
  * @see https://tailwindcss.com/docs/border-style
3556
3557
  */
3557
3558
  "border-style": [{
3558
- border: [...G(), "hidden"]
3559
+ border: [...Y(), "hidden"]
3559
3560
  }],
3560
3561
  /**
3561
3562
  * Divide Width X
@@ -3593,7 +3594,7 @@ const H = (e) => {
3593
3594
  * @see https://tailwindcss.com/docs/divide-style
3594
3595
  */
3595
3596
  "divide-style": [{
3596
- divide: G()
3597
+ divide: Y()
3597
3598
  }],
3598
3599
  /**
3599
3600
  * Border Color
@@ -3670,7 +3671,7 @@ const H = (e) => {
3670
3671
  * @see https://tailwindcss.com/docs/outline-style
3671
3672
  */
3672
3673
  "outline-style": [{
3673
- outline: ["", ...G()]
3674
+ outline: ["", ...Y()]
3674
3675
  }],
3675
3676
  /**
3676
3677
  * Outline Offset
@@ -4396,10 +4397,10 @@ const H = (e) => {
4396
4397
  };
4397
4398
  }, xn = /* @__PURE__ */ tn(yn);
4398
4399
  function kn(...e) {
4399
- return xn(bt(e));
4400
+ return xn(gt(e));
4400
4401
  }
4401
4402
  function or({ autoWidth: e = !0, className: t, style: n }) {
4402
- const [r, o] = E(() => _.getActiveAppId()), [i, a] = E(() => Y.getRunningApps()), { isMobile: c } = Ke();
4403
+ const [r, o] = E(() => _.getActiveAppId()), [i, a] = E(() => G.getRunningApps()), { isMobile: c } = Ke();
4403
4404
  B(() => {
4404
4405
  const g = _.subscribe("activeAppId", (k) => {
4405
4406
  o(k);
@@ -4407,16 +4408,16 @@ function or({ autoWidth: e = !0, className: t, style: n }) {
4407
4408
  return () => {
4408
4409
  g();
4409
4410
  };
4410
- }, []), B(() => Y.subscribe(() => {
4411
- a(Y.getRunningApps());
4411
+ }, []), B(() => G.subscribe(() => {
4412
+ a(G.getRunningApps());
4412
4413
  }), []), B(() => {
4413
4414
  if (!new URLSearchParams(window.location.search).has("app")) {
4414
4415
  const v = _.getActiveAppId();
4415
- v && !Y.isRunning(v) && Y.launchApp(v);
4416
+ v && !G.isRunning(v) && G.launchApp(v);
4416
4417
  }
4417
4418
  }, []);
4418
4419
  const l = (g) => {
4419
- Y.closeApp(g);
4420
+ G.closeApp(g);
4420
4421
  }, p = r ? oe.get(r) : null, b = (p == null ? void 0 : p.width) ?? 400, d = r !== null, h = { ...{
4421
4422
  overflow: "hidden",
4422
4423
  display: d ? "flex" : "none",
@@ -4426,7 +4427,7 @@ function or({ autoWidth: e = !0, className: t, style: n }) {
4426
4427
  ...e && d ? { width: c ? "100%" : b } : {}
4427
4428
  }, ...n };
4428
4429
  return /* @__PURE__ */ s("div", { className: kn("nc-app-panel", t), style: h, children: i.map((g) => /* @__PURE__ */ s(
4429
- Ge,
4430
+ Ye,
4430
4431
  {
4431
4432
  appId: g.appId,
4432
4433
  isActive: r === g.appId,
@@ -4440,7 +4441,7 @@ function sr({
4440
4441
  className: t = "",
4441
4442
  showIndicators: n = !0
4442
4443
  }) {
4443
- const { isMobile: r } = Ke(), [o, i] = E(() => _.getActiveAppId()), [a, c] = E(() => Y.getRunningApps());
4444
+ const { isMobile: r } = Ke(), [o, i] = E(() => _.getActiveAppId()), [a, c] = E(() => G.getRunningApps());
4444
4445
  B(() => {
4445
4446
  const u = _.subscribe("activeAppId", (m) => {
4446
4447
  i(m);
@@ -4448,11 +4449,11 @@ function sr({
4448
4449
  return () => {
4449
4450
  u();
4450
4451
  };
4451
- }, []), B(() => Y.subscribe(() => {
4452
- c(Y.getRunningApps());
4452
+ }, []), B(() => G.subscribe(() => {
4453
+ c(G.getRunningApps());
4453
4454
  }), []);
4454
4455
  const l = (u) => {
4455
- o === u ? Y.setActiveApp(null) : Y.launchApp(u);
4456
+ o === u ? G.setActiveApp(null) : G.launchApp(u);
4456
4457
  }, p = e.map((u) => oe.get(u)).filter((u) => !!u), f = a.filter((u) => !e.includes(u.appId)).map((u) => ({ running: u, def: oe.get(u.appId) })).filter((u) => !!u.def), b = (u) => a.some((m) => m.appId === u), d = r ? 24 : 28;
4457
4458
  return /* @__PURE__ */ x("div", { className: `nc-app-taskbar ${r ? "nc-mobile" : "nc-desktop"} ${t}`, children: [
4458
4459
  p.map((u) => {
@@ -4514,7 +4515,7 @@ function ir({
4514
4515
  style: i,
4515
4516
  onClick: (l) => l.stopPropagation(),
4516
4517
  children: /* @__PURE__ */ s(
4517
- Ge,
4518
+ Ye,
4518
4519
  {
4519
4520
  appId: e,
4520
4521
  isActive: !0,
@@ -4616,7 +4617,7 @@ function dr() {
4616
4617
  export {
4617
4618
  He as ActivityIndicator,
4618
4619
  Tn as Alert,
4619
- Ge as AppContainer,
4620
+ Ye as AppContainer,
4620
4621
  Ve as AppContext,
4621
4622
  ir as AppDialog,
4622
4623
  or as AppPanel,
@@ -4634,9 +4635,9 @@ export {
4634
4635
  ne as DialogClose,
4635
4636
  Hn as EditButton,
4636
4637
  On as Hyperlink,
4637
- Gn as Input,
4638
+ Yn as Input,
4638
4639
  jn as ListGroup,
4639
- Yn as ListGroupItem,
4640
+ Gn as ListGroupItem,
4640
4641
  _n as MonthRangePicker,
4641
4642
  Kn as MultiSelect,
4642
4643
  dr as NavStackContainer,
@@ -4652,12 +4653,13 @@ export {
4652
4653
  Qn as Toggle,
4653
4654
  Wn as TrashButton,
4654
4655
  rr as ViewportProvider,
4656
+ fr as YamlTextArea,
4655
4657
  oe as appRegistry,
4656
4658
  _ as appStateStore,
4657
4659
  kn as cn,
4658
4660
  nr as createAppI18nFactory,
4659
4661
  tr as notificationManager,
4660
- Y as runningAppsStore,
4662
+ G as runningAppsStore,
4661
4663
  Lt as showNotification,
4662
4664
  Wt as useApp,
4663
4665
  At as useDialog,