@neo-ui-kit/react 1.2.1 → 1.3.1

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.
@@ -1,3 +1,7 @@
1
+ import {
2
+ classes,
3
+ mark
4
+ } from "./chunk-BJSFN52W.js";
1
5
  import {
2
6
  canObserveIntersection,
3
7
  createResizeObserver,
@@ -763,6 +767,83 @@ function useSmoothWheel(ref) {
763
767
  }, [ref, enabled]);
764
768
  }
765
769
 
770
+ // src/components/foundation/ThemeProvider/ThemeProvider.tsx
771
+ import { createContext, useContext, useMemo } from "react";
772
+ import { jsx } from "react/jsx-runtime";
773
+ var themes = {
774
+ ruby: ["#ff244c", "#ff7c97"],
775
+ light: ["#e0a43a", "#f3d38f"],
776
+ green: ["#10c99a", "#7cf3d0"],
777
+ violet: ["#9b5cff", "#d3a8ff"]
778
+ };
779
+ var ThemeColorSchemeContext = createContext("dark");
780
+ var ThemePaletteContext = createContext({
781
+ theme: "ruby",
782
+ primary: themes.ruby[0],
783
+ secondary: themes.ruby[1]
784
+ });
785
+ var useThemePalette = () => useContext(ThemePaletteContext);
786
+ var emptyTokens = {};
787
+ function hue(hex) {
788
+ const [r, g, b] = [1, 3, 5].map(
789
+ (i) => parseInt(hex.slice(i, i + 2), 16) / 255
790
+ );
791
+ const max = Math.max(r, g, b);
792
+ const delta = max - Math.min(r, g, b);
793
+ if (!delta) return 0;
794
+ let h = (r - g) / delta + 4;
795
+ if (max === r) h = (g - b) / delta % 6;
796
+ else if (max === g) h = (b - r) / delta + 2;
797
+ return (h * 60 + 360) % 360;
798
+ }
799
+ var ThemeProvider = ({
800
+ theme,
801
+ colorScheme,
802
+ primary,
803
+ secondary,
804
+ accent,
805
+ tokens = emptyTokens,
806
+ style,
807
+ children,
808
+ id,
809
+ className,
810
+ ...attributes
811
+ }) => {
812
+ const inheritedScheme = useContext(ThemeColorSchemeContext);
813
+ const inheritedPalette = useThemePalette();
814
+ const scheme = colorScheme ?? inheritedScheme;
815
+ const selected = theme ?? inheritedPalette.theme;
816
+ const main = primary ?? accent ?? (theme ? themes[theme][0] : inheritedPalette.primary);
817
+ const light = secondary ?? (theme ? themes[theme][1] : inheritedPalette.secondary);
818
+ const vars = useMemo(() => {
819
+ const next = { ...style };
820
+ if (theme !== void 0 || primary !== void 0 || accent !== void 0) next["--ad-primary"] = main;
821
+ if (theme !== void 0 || secondary !== void 0) next["--ad-secondary"] = light;
822
+ for (const [key, value] of Object.entries(tokens))
823
+ next[key.startsWith("--") ? key : `--ad-${key}`] = value;
824
+ const effectivePrimary2 = next["--ad-primary"];
825
+ if (typeof effectivePrimary2 === "string" && /^#[0-9a-f]{6}$/i.test(effectivePrimary2) && next["--ad-hue-shift"] === void 0)
826
+ next["--ad-hue-shift"] = `${Math.round(hue(effectivePrimary2) - hue(themes.ruby[0]))}deg`;
827
+ return next;
828
+ }, [style, main, light, primary, secondary, accent, theme, tokens]);
829
+ const effectivePrimary = String(vars["--ad-primary"] ?? main);
830
+ const effectiveSecondary = String(vars["--ad-secondary"] ?? light);
831
+ const palette = useMemo(() => ({ theme: selected, primary: effectivePrimary, secondary: effectiveSecondary }), [selected, effectivePrimary, effectiveSecondary]);
832
+ return /* @__PURE__ */ jsx(ThemeColorSchemeContext.Provider, { value: scheme, children: /* @__PURE__ */ jsx(ThemePaletteContext.Provider, { value: palette, children: /* @__PURE__ */ jsx(
833
+ "div",
834
+ {
835
+ ...mark("ThemeProvider", attributes),
836
+ id,
837
+ className: classes("ad-theme", className),
838
+ style: vars,
839
+ "data-ad-component": "ThemeProvider",
840
+ "data-ad-theme": selected,
841
+ "data-ad-color-scheme": scheme,
842
+ children
843
+ }
844
+ ) }) });
845
+ };
846
+
766
847
  export {
767
848
  refreshMotion,
768
849
  setMotionFrameRate,
@@ -773,5 +854,8 @@ export {
773
854
  useTick,
774
855
  usePauseOffscreen,
775
856
  useTabShape,
776
- useSmoothWheel
857
+ useSmoothWheel,
858
+ themes,
859
+ useThemePalette,
860
+ ThemeProvider
777
861
  };
@@ -10,6 +10,12 @@ export interface QuantumBackgroundSettings {
10
10
  density: number;
11
11
  /** Share of the scene the field spans: 1 reaches the edges, above 1 runs past them. */
12
12
  fieldSize: number;
13
+ /** 0 keeps the original plane; 1 separates near and far particles in space and speed. */
14
+ particleDepth: number;
15
+ /** Multiplies particle size without changing the field's footprint, 0.5–3. */
16
+ particleScale: number;
17
+ /** 0 keeps the original glow; 1 uses a crisp light core and a compact halo. */
18
+ particleSharpness: number;
13
19
  timeScale: number;
14
20
  nebulaEnabled: boolean;
15
21
  nebulaIntensity: number;
@@ -8,6 +8,8 @@ export interface ThemePickerOption<V extends string = string> {
8
8
  description?: string;
9
9
  /** Picture of the theme (with transparency); the chosen one gets a moving shine. */
10
10
  image?: string;
11
+ /** Optional full-card backdrop, kept separate from the foreground picture. */
12
+ background?: string;
11
13
  /** The theme's own colour for the card's edge and glow. */
12
14
  color?: string;
13
15
  }
@@ -54,6 +54,7 @@
54
54
  /* Gallery: one picture card per theme, edged and lit in that theme's colour. */
55
55
  .ad-theme-picker[data-gallery] {
56
56
  display: grid;
57
+ width: 100%;
57
58
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
58
59
  gap: var(--ad-space-3);
59
60
  }
@@ -63,17 +64,31 @@
63
64
  isolation: isolate;
64
65
  display: grid;
65
66
  grid-template-rows: minmax(0, 1fr) auto;
67
+ min-width: 0;
66
68
  aspect-ratio: 5 / 4;
67
69
  padding: 0;
68
70
  overflow: hidden;
69
71
  border: 0.0625rem solid rgb(from var(--ad-theme-card) r g b / 0.38);
70
72
  border-radius: 0.8rem;
71
73
  background: linear-gradient(135deg, var(--ad-neutral-900), var(--ad-neutral-950));
72
- color: var(--ad-text);
74
+ color: #fff;
73
75
  font: inherit;
74
76
  cursor: pointer;
75
77
  transition: filter 0.18s, box-shadow 0.18s, border-color 0.18s;
76
78
  }
79
+ .ad-theme-card-background {
80
+ position: absolute;
81
+ inset: 0;
82
+ z-index: -1;
83
+ width: 100%;
84
+ height: 100%;
85
+ object-fit: cover;
86
+ pointer-events: none;
87
+ }
88
+ .ad-theme-card:focus-visible {
89
+ outline: 0.125rem solid var(--ad-theme-card);
90
+ outline-offset: 0.2rem;
91
+ }
77
92
  .ad-theme-card:hover {
78
93
  filter: brightness(1.13);
79
94
  }
@@ -88,28 +103,48 @@
88
103
  0 0 1rem rgb(from var(--ad-theme-card) r g b / 0.28);
89
104
  }
90
105
  .ad-theme-card-preview {
106
+ position: relative;
91
107
  display: grid;
92
108
  place-items: center;
93
109
  min-height: 0;
94
- padding: var(--ad-space-2);
110
+ margin: 4% 12% 0.2rem;
95
111
  background: radial-gradient(ellipse at 50% 76%, rgb(from var(--ad-theme-card) r g b / 0.18), transparent 72%);
96
112
  }
97
- .ad-theme-card-preview > :is(img, svg, .ad-image-shine) {
98
- width: auto;
99
- max-width: 100%;
113
+ .ad-theme-card-image {
114
+ position: absolute;
115
+ inset: 0;
116
+ }
117
+ .ad-theme-card-image > :is(img, .ad-image-shine) {
118
+ width: 100%;
100
119
  height: 100%;
101
- aspect-ratio: 1;
120
+ aspect-ratio: auto;
102
121
  object-fit: contain;
103
122
  }
104
123
  .ad-theme-card-caption {
105
124
  display: grid;
106
125
  justify-items: center;
107
- gap: 0.15rem;
108
- padding: var(--ad-space-2);
109
- background: linear-gradient(180deg, transparent, var(--ad-neutral-950));
126
+ gap: 0.1rem;
127
+ padding: 0 0.5rem 0.35rem;
128
+ text-align: center;
129
+ text-shadow: 0 0.125rem 0.4rem #000;
130
+ background: linear-gradient(180deg, transparent, #000b);
131
+ }
132
+ .ad-theme-card-caption > strong {
133
+ font-size: 1em;
134
+ line-height: 1.2;
135
+ overflow-wrap: anywhere;
136
+ }
137
+ .ad-theme-card-caption::after {
138
+ content: "";
139
+ width: 20%;
140
+ height: 0.125rem;
141
+ margin-top: 0.15rem;
142
+ border-radius: 1rem;
143
+ background: var(--ad-theme-card);
144
+ box-shadow: 0 0 0.7rem var(--ad-theme-card);
110
145
  }
111
146
  .ad-theme-card-caption > span {
112
- color: var(--ad-muted);
147
+ color: #fffd;
113
148
  font-size: var(--ad-font-size-caption);
114
149
  text-align: center;
115
150
  }
@@ -1,14 +1,20 @@
1
1
  import { type ComponentType, type ReactNode } from "react";
2
2
  import { type GridResponsive } from "../../layout/Grid/Grid";
3
- export type FieldKind = "text" | "number" | "textarea" | "select" | "autocomplete" | "checkbox" | "switch" | "color" | "date" | "file" | "people" | "slider" | "rotary" | "tags";
4
- export interface FormFieldDefinition<T extends Record<string, unknown> = Record<string, unknown>> {
3
+ import { type FormApi } from "../Form/Form";
4
+ export type FieldKind = "text" | "number" | "textarea" | "select" | "autocomplete" | "checkbox" | "switch" | "color" | "date" | "file" | "people" | "slider" | "rotary" | "tags" | "theme" | "toggle" | "segmented" | "tabs" | "custom";
5
+ export type FormFieldDefinition<T extends Record<string, unknown> = Record<string, unknown>> = {
5
6
  name: string;
6
- kind?: FieldKind;
7
7
  label?: ReactNode;
8
8
  span?: GridResponsive<number | "full">;
9
9
  showWhen?: (values: T) => boolean;
10
10
  props?: Record<string, unknown>;
11
- }
11
+ } & ({
12
+ kind: "custom";
13
+ render: (field: ReturnType<FormApi<T>["field"]>, form: FormApi<T>) => ReactNode;
14
+ } | {
15
+ kind?: Exclude<FieldKind, "custom">;
16
+ render?: never;
17
+ });
12
18
  export type FieldRegistry = Record<string, ComponentType<any>>;
13
19
  export declare const defaultFieldRegistry: FieldRegistry;
14
20
  export interface FormFieldsProps<T extends Record<string, unknown>> {
@@ -12,6 +12,9 @@
12
12
  grid-row-end: span 4;
13
13
  grid-template-rows: subgrid;
14
14
  }
15
+ .ad-form-field[data-custom] {
16
+ display: block;
17
+ }
15
18
  .ad-form-field > * {
16
19
  grid-row: 2;
17
20
  align-self: center;
@@ -15,14 +15,14 @@ export interface LoaderGeneratorProps extends CommonProps {
15
15
  defaultValue?: Partial<LoaderSettings>;
16
16
  onValueChange?: (settings: LoaderSettings) => void;
17
17
  }
18
- export declare const loaderGeneratorAnimations: ("flip" | "fill" | "wave" | "palette" | "pulse" | "spin" | "breathe" | "bounce" | "glow" | "shine" | "wobble")[];
18
+ export declare const loaderGeneratorAnimations: ("flip" | "fill" | "wave" | "palette" | "glow" | "pulse" | "spin" | "breathe" | "bounce" | "shine" | "wobble")[];
19
19
  export declare const loaderSizes: {
20
20
  readonly xs: 4.5;
21
21
  readonly sm: 6.5;
22
22
  readonly md: 9;
23
23
  readonly lg: 12;
24
24
  };
25
- export declare const loaderRenderKey: ({ animation }: Pick<LoaderSettings, "animation">) => "flip" | "fill" | "wave" | "palette" | "pulse" | "spin" | "breathe" | "bounce" | "orbit" | "glow" | "shine" | "wobble" | "radar";
25
+ export declare const loaderRenderKey: ({ animation }: Pick<LoaderSettings, "animation">) => "flip" | "fill" | "wave" | "palette" | "glow" | "pulse" | "spin" | "breathe" | "bounce" | "orbit" | "shine" | "wobble" | "radar";
26
26
  /** Removes large, smoothly connected background regions while preserving enclosed logo details. */
27
27
  export declare function removeBackgroundPixels(pixels: Uint8ClampedArray, width: number, height: number, signal?: AbortSignal): Promise<Uint8ClampedArray<ArrayBufferLike>>;
28
28
  /** Finds a representative visible colour for rings, highlights and image glow. */
package/dist/core.js CHANGED
@@ -1,18 +1,16 @@
1
1
  import {
2
2
  ThemeProvider,
3
- themes
4
- } from "./chunks/chunk-JZ4GDTH5.js";
5
- import {
6
3
  getMotionStats,
7
4
  setMotionFrameRate,
8
5
  subscribeTick,
6
+ themes,
9
7
  useBorder,
10
8
  useDecoration,
11
9
  usePauseOffscreen,
12
10
  useSmoothWheel,
13
11
  useTabShape,
14
12
  useTick
15
- } from "./chunks/chunk-YKCUOZ7V.js";
13
+ } from "./chunks/chunk-WOUWYJ6U.js";
16
14
  import {
17
15
  LocaleProvider,
18
16
  addMessages,
package/dist/forms.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  defaultFieldRegistry,
5
5
  useForm,
6
6
  useFormContext
7
- } from "./chunks/chunk-FNY5E2QO.js";
8
- import "./chunks/chunk-YKCUOZ7V.js";
7
+ } from "./chunks/chunk-TQWTM23C.js";
8
+ import "./chunks/chunk-WOUWYJ6U.js";
9
9
  import "./chunks/chunk-BJSFN52W.js";
10
10
  import "./chunks/chunk-FCOU3ODR.js";
11
11
  export {