tcce-design-system-test 0.3.3 → 0.3.5

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.
Binary file
Binary file
@@ -14,6 +14,8 @@ import { RefAttributes } from 'react';
14
14
  import { RemixiconComponentType } from '@remixicon/react';
15
15
  import { RuleSet } from 'styled-components';
16
16
  import { Substitute } from 'styled-components/dist/types';
17
+ import { toast } from 'sonner';
18
+ import { ToasterProps } from 'sonner';
17
19
 
18
20
  /**
19
21
  * Valid input types supported by the FormField component
@@ -138,6 +140,8 @@ export declare interface CheckboxSpecificProps {
138
140
 
139
141
  declare type ColorKey = 'primary' | 'orange' | 'white' | 'gray';
140
142
 
143
+ declare type ColorKey_2 = 'primary' | 'orange' | 'white' | 'gray';
144
+
141
145
  /**
142
146
  * Helper to create field configurations for common patterns
143
147
  */
@@ -515,7 +519,7 @@ declare interface IconProps {
515
519
  iconProps?: Record<string, unknown>;
516
520
  }
517
521
 
518
- declare type IconSizes = 'tn' | 'sm' | 'md' | 'lg';
522
+ export declare type IconSizes = 'tn' | 'sm' | 'md' | 'lg';
519
523
 
520
524
  export declare const IconWrapperStyles: RuleSet<object>;
521
525
 
@@ -563,6 +567,11 @@ export declare interface InputWithIconsProps extends WithIconsProps {
563
567
  hasRightIcon?: boolean;
564
568
  }
565
569
 
570
+ /**
571
+ * Type guard to check if a string is a valid AllowedInputType
572
+ */
573
+ export declare const isAllowedInputType: (t: string) => t is AllowedInputType;
574
+
566
575
  export declare const Label: default_2.FC<BaseLabelProps>;
567
576
 
568
577
  export declare type LabelSize = 'sm' | 'md' | 'lg';
@@ -667,7 +676,9 @@ export declare interface NavigationItem {
667
676
  * @param fields - Array of field configurations
668
677
  * @returns Normalized field configurations with valid types
669
678
  */
670
- export declare const normalizeFieldTypes: (fields: Partial<FieldConfig>[]) => FieldConfig[];
679
+ export declare const normalizeFieldTypes: (fields: Array<Partial<FieldConfig> & {
680
+ type?: string;
681
+ }>) => FieldConfig[];
671
682
 
672
683
  /**
673
684
  * Transforms select options to the expected format
@@ -1022,7 +1033,7 @@ export declare interface TextAreaSpecificProps {
1022
1033
  rows?: number;
1023
1034
  }
1024
1035
 
1025
- export declare const toast: unknown;
1036
+ export { toast }
1026
1037
 
1027
1038
  /**
1028
1039
  * ToastProvider component for displaying toast notifications.
@@ -1032,7 +1043,11 @@ export declare const toast: unknown;
1032
1043
  *
1033
1044
  * @returns The rendered ToastProvider component.
1034
1045
  */
1035
- export declare const ToastProvider: () => JSX.Element;
1046
+ export declare const ToastProvider: ({ spinnerColor, ...props }: ToastProviderProps) => JSX.Element;
1047
+
1048
+ declare type ToastProviderProps = ToasterProps & {
1049
+ spinnerColor?: ColorKey_2;
1050
+ };
1036
1051
 
1037
1052
  /**
1038
1053
  * Validates if a complete code meets certain criteria
@@ -6695,7 +6695,7 @@ const vt = new tg(), eg = (t, e) => {
6695
6695
  ...e,
6696
6696
  id: n
6697
6697
  }), n;
6698
- }, ng = (t) => t && typeof t == "object" && "ok" in t && typeof t.ok == "boolean" && "status" in t && typeof t.status == "number", rg = eg, ig = () => vt.toasts, og = () => vt.getActiveToasts(), sg = Object.assign(rg, {
6698
+ }, ng = (t) => t && typeof t == "object" && "ok" in t && typeof t.ok == "boolean" && "status" in t && typeof t.status == "number", rg = eg, ig = () => vt.toasts, og = () => vt.getActiveToasts(), Qy = Object.assign(rg, {
6699
6699
  success: vt.success,
6700
6700
  info: vt.info,
6701
6701
  warning: vt.warning,
@@ -6713,15 +6713,15 @@ Up("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;
6713
6713
  function Tn(t) {
6714
6714
  return t.label !== void 0;
6715
6715
  }
6716
- const ag = 3, lg = "24px", cg = "16px", Os = 4e3, ug = 356, dg = 14, hg = 45, fg = 200;
6716
+ const sg = 3, ag = "24px", lg = "16px", Os = 4e3, cg = 356, ug = 14, dg = 45, hg = 200;
6717
6717
  function Lt(...t) {
6718
6718
  return t.filter(Boolean).join(" ");
6719
6719
  }
6720
- function mg(t) {
6720
+ function fg(t) {
6721
6721
  const [e, n] = t.split("-"), r = [];
6722
6722
  return e && r.push(e), n && r.push(n), r;
6723
6723
  }
6724
- const pg = (t) => {
6724
+ const mg = (t) => {
6725
6725
  var e, n, r, i, s, o, a, l, u;
6726
6726
  const { invert: d, toast: c, unstyled: h, interacting: f, setHeights: m, visibleToasts: y, heights: b, index: g, toasts: w, expanded: v, removeToast: A, defaultRichColors: T, closeButton: S, style: C, cancelButtonStyle: E, actionButtonStyle: M, className: _ = "", descriptionClassName: D = "", duration: K, position: U, gap: Tt, expandByDefault: et, classNames: O, icons: V, closeButtonAriaLabel: F = "Close toast" } = t, [I, j] = x.useState(null), [nt, rt] = x.useState(null), [B, G] = x.useState(!1), [Y, st] = x.useState(!1), [$t, H] = x.useState(!1), [yt, qt] = x.useState(!1), [_t, pt] = x.useState(!1), [Sc, nr] = x.useState(0), [Tc, Ki] = x.useState(0), Ke = x.useRef(c.duration || K || Os), Yi = x.useRef(null), Ht = x.useRef(null), Cc = g === 0, kc = g + 1 <= y, wt = c.type, ve = c.dismissible !== !1, Pc = c.className || "", Ac = c.descriptionClassName || "", hn = x.useMemo(() => b.findIndex((N) => N.toastId === c.id) || 0, [
6727
6727
  b,
@@ -6793,7 +6793,7 @@ const pg = (t) => {
6793
6793
  const Zt = x.useCallback(() => {
6794
6794
  st(!0), nr(be.current), m((N) => N.filter((at) => at.toastId !== c.id)), setTimeout(() => {
6795
6795
  A(c);
6796
- }, fg);
6796
+ }, hg);
6797
6797
  }, [
6798
6798
  c,
6799
6799
  A,
@@ -6890,7 +6890,7 @@ const pg = (t) => {
6890
6890
  if (yt || !ve) return;
6891
6891
  xe.current = null;
6892
6892
  const St = Number(((N = Ht.current) == null ? void 0 : N.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), fn = Number(((at = Ht.current) == null ? void 0 : at.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), ut = (/* @__PURE__ */ new Date()).getTime() - ((ht = Yi.current) == null ? void 0 : ht.getTime()), Ct = I === "x" ? St : fn, mn = Math.abs(Ct) / ut;
6893
- if (Math.abs(Ct) >= hg || mn > 0.11) {
6893
+ if (Math.abs(Ct) >= dg || mn > 0.11) {
6894
6894
  nr(be.current), c.onDismiss == null || c.onDismiss.call(c, c), rt(I === "x" ? St > 0 ? "right" : "left" : fn > 0 ? "down" : "up"), Zt(), qt(!0);
6895
6895
  return;
6896
6896
  } else {
@@ -6904,7 +6904,7 @@ const pg = (t) => {
6904
6904
  if (!xe.current || !ve || ((at = window.getSelection()) == null ? void 0 : at.toString().length) > 0) return;
6905
6905
  const ut = N.clientY - xe.current.y, Ct = N.clientX - xe.current.x;
6906
6906
  var mn;
6907
- const Mt = (mn = t.swipeDirections) != null ? mn : mg(U);
6907
+ const Mt = (mn = t.swipeDirections) != null ? mn : fg(U);
6908
6908
  !I && (Math.abs(Ct) > 1 || Math.abs(ut) > 1) && j(Math.abs(Ct) > Math.abs(ut) ? "x" : "y");
6909
6909
  let Vt = {
6910
6910
  x: 0,
@@ -6972,13 +6972,13 @@ function js() {
6972
6972
  const t = document.documentElement.getAttribute("dir");
6973
6973
  return t === "auto" || !t ? window.getComputedStyle(document.documentElement).direction : t;
6974
6974
  }
6975
- function gg(t, e) {
6975
+ function pg(t, e) {
6976
6976
  const n = {};
6977
6977
  return [
6978
6978
  t,
6979
6979
  e
6980
6980
  ].forEach((r, i) => {
6981
- const s = i === 1, o = s ? "--mobile-offset" : "--offset", a = s ? cg : lg;
6981
+ const s = i === 1, o = s ? "--mobile-offset" : "--offset", a = s ? lg : ag;
6982
6982
  function l(u) {
6983
6983
  [
6984
6984
  "top",
@@ -6999,11 +6999,11 @@ function gg(t, e) {
6999
6999
  }) : l(a);
7000
7000
  }), n;
7001
7001
  }
7002
- const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7002
+ const gg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7003
7003
  const { id: r, invert: i, position: s = "bottom-right", hotkey: o = [
7004
7004
  "altKey",
7005
7005
  "KeyT"
7006
- ], expand: a, closeButton: l, className: u, offset: d, mobileOffset: c, theme: h = "light", richColors: f, duration: m, style: y, visibleToasts: b = ag, toastOptions: g, dir: w = js(), gap: v = dg, icons: A, containerAriaLabel: T = "Notifications" } = e, [S, C] = x.useState([]), E = x.useMemo(() => r ? S.filter((B) => B.toasterId === r) : S.filter((B) => !B.toasterId), [
7006
+ ], expand: a, closeButton: l, className: u, offset: d, mobileOffset: c, theme: h = "light", richColors: f, duration: m, style: y, visibleToasts: b = sg, toastOptions: g, dir: w = js(), gap: v = ug, icons: A, containerAriaLabel: T = "Notifications" } = e, [S, C] = x.useState([]), E = x.useMemo(() => r ? S.filter((B) => B.toasterId === r) : S.filter((B) => !B.toasterId), [
7007
7007
  S,
7008
7008
  r
7009
7009
  ]), M = x.useMemo(() => Array.from(new Set([
@@ -7118,10 +7118,10 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7118
7118
  "data-x-position": $t,
7119
7119
  style: {
7120
7120
  "--front-toast-height": `${((Y = _[0]) == null ? void 0 : Y.height) || 0}px`,
7121
- "--width": `${ug}px`,
7121
+ "--width": `${cg}px`,
7122
7122
  "--gap": `${v}px`,
7123
7123
  ...y,
7124
- ...gg(d, c)
7124
+ ...pg(d, c)
7125
7125
  },
7126
7126
  onBlur: (H) => {
7127
7127
  nt.current && !H.currentTarget.contains(H.relatedTarget) && (nt.current = !1, j.current && (j.current.focus({
@@ -7143,7 +7143,7 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7143
7143
  onPointerUp: () => et(!1)
7144
7144
  }, E.filter((H) => !H.position && G === 0 || H.position === B).map((H, yt) => {
7145
7145
  var qt, _t;
7146
- return /* @__PURE__ */ x.createElement(pg, {
7146
+ return /* @__PURE__ */ x.createElement(mg, {
7147
7147
  key: H.id,
7148
7148
  icons: A,
7149
7149
  index: yt,
@@ -7174,8 +7174,8 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7174
7174
  });
7175
7175
  })) : null;
7176
7176
  }));
7177
- }), Qy = () => /* @__PURE__ */ p(
7178
- yg,
7177
+ }), tv = ({ spinnerColor: t = "orange", ...e }) => /* @__PURE__ */ p(
7178
+ gg,
7179
7179
  {
7180
7180
  position: "bottom-center",
7181
7181
  theme: "light",
@@ -7188,10 +7188,11 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7188
7188
  className: "my-toast"
7189
7189
  },
7190
7190
  icons: {
7191
- loading: /* @__PURE__ */ p(jp, { color: "orange" })
7192
- }
7191
+ loading: /* @__PURE__ */ p(jp, { color: t })
7192
+ },
7193
+ ...e
7193
7194
  }
7194
- ), tv = sg, vg = {
7195
+ ), yg = {
7195
7196
  elevated: P`
7196
7197
  background-color: var(--color-main-white);
7197
7198
  box-shadow: var(--shadow-black-card);
@@ -7222,7 +7223,7 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7222
7223
  border: none;
7223
7224
  }
7224
7225
  `
7225
- }, bg = {
7226
+ }, vg = {
7226
7227
  sm: P`
7227
7228
  padding: 0.75rem;
7228
7229
  gap: 0.5rem;
@@ -7235,7 +7236,7 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7235
7236
  padding: 1.25rem;
7236
7237
  gap: 0.5rem;
7237
7238
  `
7238
- }, xg = P`
7239
+ }, bg = P`
7239
7240
  transition:
7240
7241
  box-shadow 0.3s ease-out,
7241
7242
  background-color 0.3s ease-out,
@@ -7255,7 +7256,7 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7255
7256
  &:focus-visible {
7256
7257
  outline-color: var(--color-main-blue-primary);
7257
7258
  }
7258
- `, wg = P`
7259
+ `, xg = P`
7259
7260
  opacity: 0.6;
7260
7261
  cursor: not-allowed;
7261
7262
  pointer-events: none;
@@ -7264,7 +7265,7 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7264
7265
  transform: none;
7265
7266
  box-shadow: inherit;
7266
7267
  }
7267
- `, Sg = k.div`
7268
+ `, wg = k.div`
7268
7269
  display: flex;
7269
7270
  flex-direction: column;
7270
7271
  border-radius: var(--border-radius-card);
@@ -7272,10 +7273,10 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7272
7273
  height: 100%;
7273
7274
  outline: 2px solid transparent;
7274
7275
  outline-offset: -1px;
7275
- ${({ $variant: t }) => vg[t]}
7276
- ${({ $clickable: t }) => t && xg}
7277
- ${({ $disabled: t }) => t && wg}
7278
- ${({ $size: t }) => bg[t]}
7276
+ ${({ $variant: t }) => yg[t]}
7277
+ ${({ $clickable: t }) => t && bg}
7278
+ ${({ $disabled: t }) => t && xg}
7279
+ ${({ $size: t }) => vg[t]}
7279
7280
  `, ev = ({
7280
7281
  variant: t = "elevated",
7281
7282
  size: e = "md",
@@ -7288,7 +7289,7 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7288
7289
  n || r && r(a);
7289
7290
  };
7290
7291
  return /* @__PURE__ */ p(
7291
- Sg,
7292
+ wg,
7292
7293
  {
7293
7294
  $variant: t,
7294
7295
  $size: e,
@@ -7304,7 +7305,7 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7304
7305
  children: i
7305
7306
  }
7306
7307
  );
7307
- }, Tg = k.div`
7308
+ }, Sg = k.div`
7308
7309
  display: flex;
7309
7310
  align-items: center;
7310
7311
  align-self: stretch;
@@ -7312,14 +7313,14 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7312
7313
  `, nv = ({
7313
7314
  children: t,
7314
7315
  ...e
7315
- }) => /* @__PURE__ */ p(Tg, { ...e, children: t }), Cg = k.div`
7316
+ }) => /* @__PURE__ */ p(Sg, { ...e, children: t }), Tg = k.div`
7316
7317
  flex: 1;
7317
7318
  display: flex;
7318
7319
  flex-direction: column;
7319
7320
  `, rv = ({
7320
7321
  children: t,
7321
7322
  ...e
7322
- }) => /* @__PURE__ */ p(Cg, { ...e, children: t }), kg = k.div`
7323
+ }) => /* @__PURE__ */ p(Tg, { ...e, children: t }), Cg = k.div`
7323
7324
  display: flex;
7324
7325
  align-items: center;
7325
7326
  align-self: stretch;
@@ -7327,7 +7328,7 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7327
7328
  `, iv = ({
7328
7329
  children: t,
7329
7330
  ...e
7330
- }) => /* @__PURE__ */ p(kg, { ...e, children: t }), Pg = {
7331
+ }) => /* @__PURE__ */ p(Cg, { ...e, children: t }), kg = {
7331
7332
  sm: P`
7332
7333
  ${z[12]}
7333
7334
  `,
@@ -7337,9 +7338,9 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7337
7338
  lg: P`
7338
7339
  ${z[18]}
7339
7340
  `
7340
- }, Ag = k.div`
7341
+ }, Pg = k.div`
7341
7342
  color: var(--color-main-warning-state);
7342
- ${({ $size: t }) => Pg[t]}
7343
+ ${({ $size: t }) => kg[t]}
7343
7344
  font-weight: 400;
7344
7345
  margin-top: 0.25rem;
7345
7346
  display: flex;
@@ -7350,7 +7351,7 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7350
7351
  className: e,
7351
7352
  size: n = "md",
7352
7353
  ...r
7353
- }) => /* @__PURE__ */ p(Ag, { className: e, $size: n, ...r, children: t }), Eg = {
7354
+ }) => /* @__PURE__ */ p(Pg, { className: e, $size: n, ...r, children: t }), Ag = {
7354
7355
  sm: P`
7355
7356
  ${z[16]}
7356
7357
  `,
@@ -7360,12 +7361,12 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7360
7361
  lg: P`
7361
7362
  ${z[30]}
7362
7363
  `
7363
- }, Dg = k.label`
7364
+ }, Eg = k.label`
7364
7365
  color: var(--color-main-blue-primary);
7365
- ${({ $size: t }) => Eg[t]}
7366
- ${({ $disabled: t }) => t && $g}
7366
+ ${({ $size: t }) => Ag[t]}
7367
+ ${({ $disabled: t }) => t && Dg}
7367
7368
  cursor: ${({ $disabled: t, $htmlFor: e }) => t || !e ? "default" : "pointer"};
7368
- `, $g = P`
7369
+ `, Dg = P`
7369
7370
  cursor: not-allowed;
7370
7371
  opacity: 0.6;
7371
7372
  `, Hi = ({
@@ -7377,7 +7378,7 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7377
7378
  size: s = "md",
7378
7379
  ...o
7379
7380
  }) => /* @__PURE__ */ R(
7380
- Dg,
7381
+ Eg,
7381
7382
  {
7382
7383
  className: n,
7383
7384
  htmlFor: e,
@@ -7390,7 +7391,7 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7390
7391
  r && /* @__PURE__ */ p("span", { style: { color: "var(--color-main-warning-state)" }, children: "*" })
7391
7392
  ]
7392
7393
  }
7393
- ), Mg = [
7394
+ ), $g = [
7394
7395
  "text",
7395
7396
  "email",
7396
7397
  "password",
@@ -7406,10 +7407,10 @@ const yg = /* @__PURE__ */ x.forwardRef(function(e, n) {
7406
7407
  "checkbox",
7407
7408
  "radio",
7408
7409
  "pin"
7409
- ], ov = (t) => t.map((e) => ({
7410
+ ], Mg = (t) => $g.includes(t), ov = (t) => t.map((e) => ({
7410
7411
  name: e.name || "",
7411
7412
  label: e.label || "",
7412
- type: Mg.includes(e.type) ? e.type : "text",
7413
+ type: e.type && Mg(e.type) ? e.type : "text",
7413
7414
  placeholder: e.placeholder,
7414
7415
  required: e.required || !1,
7415
7416
  disabled: e.disabled || !1,
@@ -10412,7 +10413,7 @@ const zy = k.div`
10412
10413
  /* @__PURE__ */ p(_y, { className: u, children: t })
10413
10414
  ] }), hv = (t) => /* @__PURE__ */ p(Y0, { children: /* @__PURE__ */ p(Hy, { ...t }) });
10414
10415
  export {
10415
- Mg as ALLOWED_INPUT_TYPES,
10416
+ $g as ALLOWED_INPUT_TYPES,
10416
10417
  nc as BaseInput,
10417
10418
  Bs as Button,
10418
10419
  jp as ButtonSpinner,
@@ -10457,7 +10458,7 @@ export {
10457
10458
  dv as TermsAndConditions,
10458
10459
  ai as Text,
10459
10460
  oc as TextAreaInput,
10460
- Qy as ToastProvider,
10461
+ tv as ToastProvider,
10461
10462
  yc as baseContentTableStyles,
10462
10463
  Ue as baseFieldStyles,
10463
10464
  Ui as baseInputStyles,
@@ -10475,6 +10476,7 @@ export {
10475
10476
  Us as hasPermission,
10476
10477
  Sa as headingBoldStyles,
10477
10478
  Yu as headingRegularStyles,
10479
+ Mg as isAllowedInputType,
10478
10480
  ov as normalizeFieldTypes,
10479
10481
  sv as normalizeSelectOptions,
10480
10482
  tr as sizeStyles,
@@ -10482,6 +10484,6 @@ export {
10482
10484
  vc as tableIconContainerStyles,
10483
10485
  gy as tableResponsiveMixin,
10484
10486
  my as tableVariants,
10485
- tv as toast,
10487
+ Qy as toast,
10486
10488
  cv as validateCode
10487
10489
  };