@payfit/unity-themes 2.46.13 → 2.46.15

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 (37) hide show
  1. package/dist/css/fonts/heartbreak-eighties/HeartbreakEighties-Oblique.woff +0 -0
  2. package/dist/css/fonts/heartbreak-eighties/HeartbreakEighties-Oblique.woff2 +0 -0
  3. package/dist/css/fonts/heartbreak-eighties/HeartbreakEighties-Regular.woff +0 -0
  4. package/dist/css/fonts/heartbreak-eighties/HeartbreakEighties-Regular.woff2 +0 -0
  5. package/dist/css/generated/proprietary-fonts.css +11 -0
  6. package/dist/css/unity.css +1982 -0
  7. package/dist/esm/components/unity-theme-provider.d.ts +25 -0
  8. package/dist/esm/components/unity-theme-provider.js +34 -0
  9. package/dist/esm/components/unity-theme-provider.test.d.ts +1 -0
  10. package/dist/esm/index.d.ts +5 -0
  11. package/dist/esm/index.js +15 -0
  12. package/dist/esm/scripts/actions/append-animations.d.ts +3 -0
  13. package/dist/esm/scripts/actions/compose-multi-theme.d.ts +15 -0
  14. package/dist/esm/scripts/build.d.ts +1 -0
  15. package/dist/esm/scripts/file-headers/unity.d.ts +2 -0
  16. package/dist/esm/scripts/formats/processors/grid-processor.d.ts +2 -0
  17. package/dist/esm/scripts/formats/processors/typography-processor.d.ts +2 -0
  18. package/dist/esm/scripts/formats/unity-theme.d.ts +3 -0
  19. package/dist/esm/scripts/formats/utils.d.ts +3 -0
  20. package/dist/esm/scripts/transforms/oklch.d.ts +4 -0
  21. package/dist/esm/scripts/transforms/tailwind-animation-token.d.ts +6 -0
  22. package/dist/esm/scripts/transforms/tailwind-color-token.d.ts +7 -0
  23. package/dist/esm/scripts/transforms/tailwind-grid-token.d.ts +7 -0
  24. package/dist/esm/scripts/transforms/tailwind-spacing-token.d.ts +4 -0
  25. package/dist/esm/scripts/transforms/tailwind-text-token.d.ts +4 -0
  26. package/dist/esm/scripts/transforms/tailwind-typography-token.d.ts +3 -0
  27. package/dist/esm/scripts/types.d.ts +21 -0
  28. package/dist/esm/scripts/utils/prefix-transform.d.ts +4 -0
  29. package/dist/esm/utils/cn.d.ts +94 -0
  30. package/dist/esm/utils/cn.js +11 -0
  31. package/dist/esm/utils/merge-config.d.ts +217 -0
  32. package/dist/esm/utils/merge-config.js +172 -0
  33. package/dist/esm/utils/tailwind-merge.d.ts +67 -0
  34. package/dist/esm/utils/tailwind-merge.js +8 -0
  35. package/dist/esm/utils/tailwind-variants.d.ts +44 -0
  36. package/dist/esm/utils/tailwind-variants.js +9 -0
  37. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ import { PropsWithChildren, RefObject } from 'react';
2
+ export type UnityTheme = 'legacy' | 'rebrand';
3
+ interface UnityThemeContextValue {
4
+ theme: UnityTheme;
5
+ setTheme: (theme: UnityTheme) => void;
6
+ }
7
+ export interface UnityThemeProviderProps {
8
+ /** Initial theme. Can be changed at runtime via `useUnityTheme().setTheme`. */
9
+ theme?: UnityTheme;
10
+ /**
11
+ * Element on which `data-uy-theme` is set.
12
+ * - `undefined` (default): uses `document.documentElement` (`<html>`)
13
+ * - A React ref: uses the referenced element
14
+ * - A CSS selector string: uses `document.querySelector(selector)`
15
+ * @default document.documentElement
16
+ */
17
+ target?: RefObject<HTMLElement | null> | string;
18
+ }
19
+ export declare function UnityThemeProvider({ theme: initialTheme, target, children, }: PropsWithChildren<UnityThemeProviderProps>): import("react/jsx-runtime").JSX.Element;
20
+ /**
21
+ * Returns the current theme and a setter to change it at runtime.
22
+ * Returns `"legacy"` with a no-op setter when used outside a provider.
23
+ */
24
+ export declare function useUnityTheme(): UnityThemeContextValue;
25
+ export {};
@@ -0,0 +1,34 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { createContext as i, useState as s, useEffect as f, useContext as h } from "react";
3
+ const o = i({
4
+ // Render legacy by default for backwards compatibility
5
+ theme: "legacy",
6
+ // Intentional noop. Will be replaced by a set dispatcher from React
7
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
8
+ setTheme: () => {
9
+ }
10
+ });
11
+ function d(e) {
12
+ return e === void 0 ? document.documentElement : typeof e == "string" ? document.querySelector(e) : e.current;
13
+ }
14
+ function T({
15
+ theme: e = "legacy",
16
+ target: r,
17
+ children: u
18
+ }) {
19
+ const [t, m] = s(e);
20
+ return f(() => {
21
+ const n = d(r);
22
+ if (n)
23
+ return n.dataset.uyTheme = t, () => {
24
+ delete n.dataset.uyTheme;
25
+ };
26
+ }, [t, r]), /* @__PURE__ */ c(o.Provider, { value: { theme: t, setTheme: m }, children: u });
27
+ }
28
+ function a() {
29
+ return h(o);
30
+ }
31
+ export {
32
+ T as UnityThemeProvider,
33
+ a as useUnityTheme
34
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export * from './utils/cn.js';
2
+ export * from './utils/tailwind-merge.js';
3
+ export * from './utils/tailwind-variants.js';
4
+ export { twMergeConfig } from './utils/merge-config.js';
5
+ export { UnityThemeProvider, useUnityTheme, type UnityTheme, type UnityThemeProviderProps, } from './components/unity-theme-provider.js';
@@ -0,0 +1,15 @@
1
+ import { classNames as o, clsx as m, cn as t } from "./utils/cn.js";
2
+ import { uyMerge as x } from "./utils/tailwind-merge.js";
3
+ import { uyTv as s } from "./utils/tailwind-variants.js";
4
+ import { twMergeConfig as n } from "./utils/merge-config.js";
5
+ import { UnityThemeProvider as c, useUnityTheme as g } from "./components/unity-theme-provider.js";
6
+ export {
7
+ c as UnityThemeProvider,
8
+ o as classNames,
9
+ m as clsx,
10
+ t as cn,
11
+ n as twMergeConfig,
12
+ g as useUnityTheme,
13
+ x as uyMerge,
14
+ s as uyTv
15
+ };
@@ -0,0 +1,3 @@
1
+ import { Config, Dictionary, PlatformConfig } from 'style-dictionary/types';
2
+ export declare function appendAnimations(dictionary: Dictionary, config: PlatformConfig, options: Config): void;
3
+ export declare function removeAnimations(dictionary: Dictionary, config: PlatformConfig, options: Config): void;
@@ -0,0 +1,15 @@
1
+ export interface ComposeInput {
2
+ /** css/variables output for legacy (:root selector) */
3
+ legacyCss: string;
4
+ /** css/variables output for rebrand ([data-uy-theme="rebrand"] selector) */
5
+ rebrandCss: string;
6
+ /** css/unity-theme output (@theme block + grid/typography utilities) */
7
+ themeCss: string;
8
+ /** File header + imports */
9
+ header: string;
10
+ /** Custom variant declarations */
11
+ customVariants: string;
12
+ /** Output path for the composed CSS */
13
+ outputPath: string;
14
+ }
15
+ export declare function composeMultiThemeCss(input: ComposeInput): Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const name = "unity/theme";
2
+ export declare function unityFileHeader(): string[];
@@ -0,0 +1,2 @@
1
+ import { Config, Dictionary, LocalOptions } from 'style-dictionary/types';
2
+ export declare function processGridTokens(dictionary: Dictionary, options: Config & LocalOptions): string;
@@ -0,0 +1,2 @@
1
+ import { Config, Dictionary, LocalOptions } from 'style-dictionary/types';
2
+ export declare function processTypographyTokens(dictionary: Dictionary, _options: Config & LocalOptions): string;
@@ -0,0 +1,3 @@
1
+ import { FormatFnArguments } from 'style-dictionary/types';
2
+ export declare const name = "css/unity-theme";
3
+ export declare function unityThemeFormat(args: FormatFnArguments): Promise<string>;
@@ -0,0 +1,3 @@
1
+ import { Prefixes, ProcessorOptions } from '../types.js.js';
2
+ export declare function getPrefixes(options: ProcessorOptions): Prefixes;
3
+ export declare function processCssVariables(rawCssVars: string, variablePrefix: string): string;
@@ -0,0 +1,4 @@
1
+ import { Token } from 'style-dictionary';
2
+ import { Config, PlatformConfig } from 'style-dictionary/types';
3
+ export declare function filter(token: Token, options: Config): boolean;
4
+ export declare function transform(token: Token, _config: PlatformConfig, options: Config): string;
@@ -0,0 +1,6 @@
1
+ import { Token } from 'style-dictionary';
2
+ import { Config, NameTransform } from 'style-dictionary/types';
3
+ type Transformer = NameTransform['transform'];
4
+ export declare function filter(token: Token, options: Config): boolean;
5
+ export declare const transform: Transformer;
6
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Token } from 'style-dictionary';
2
+ import { NameTransform } from 'style-dictionary/types';
3
+ type Transformer = NameTransform['transform'];
4
+ export declare function filter(token: Token): boolean;
5
+ export declare const tailwindColorTokenNameTransform: Transformer;
6
+ export declare const transform: (token: import('style-dictionary/types').TransformedToken, config: import('style-dictionary/types').PlatformConfig, options: import('style-dictionary/types').Config, vol?: import('style-dictionary/types').Volume) => string | Promise<string>;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Token } from 'style-dictionary';
2
+ import { NameTransform } from 'style-dictionary/types';
3
+ type Transformer = NameTransform['transform'];
4
+ export declare function filter(token: Token): boolean;
5
+ export declare const tailwindGridTokenNameTransform: Transformer;
6
+ export declare const transform: (token: import('style-dictionary/types').TransformedToken, config: import('style-dictionary/types').PlatformConfig, options: import('style-dictionary/types').Config, vol?: import('style-dictionary/types').Volume) => string | Promise<string>;
7
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Token } from 'style-dictionary';
2
+ import { Config, PlatformConfig } from 'style-dictionary/types';
3
+ export declare function filter(token: Token, options: Config): boolean;
4
+ export declare const transform: (token: import('style-dictionary/types').TransformedToken, config: PlatformConfig, options: Config, vol?: import('style-dictionary/types').Volume) => string | Promise<string>;
@@ -0,0 +1,4 @@
1
+ import { Token } from 'style-dictionary';
2
+ import { Config, PlatformConfig } from 'style-dictionary/types';
3
+ export declare function filter(token: Token, options: Config): boolean;
4
+ export declare const transform: (token: import('style-dictionary/types').TransformedToken, config: PlatformConfig, options: Config, vol?: import('style-dictionary/types').Volume) => string | Promise<string>;
@@ -0,0 +1,3 @@
1
+ import { Token } from 'style-dictionary';
2
+ export declare function filter(token: Token): boolean;
3
+ export declare const transform: (token: import('style-dictionary/types').TransformedToken, config: import('style-dictionary/types').PlatformConfig, options: import('style-dictionary/types').Config, vol?: import('style-dictionary/types').Volume) => string | Promise<string>;
@@ -0,0 +1,21 @@
1
+ import { Config, LocalOptions, TransformedToken } from 'style-dictionary/types';
2
+ export type TokenWithCTIAttrs = TransformedToken & {
3
+ attributes: {
4
+ category: string;
5
+ type: string;
6
+ item: string;
7
+ };
8
+ };
9
+ export type BreakpointToken = TransformedToken & {
10
+ $value: string;
11
+ $type: 'dimension';
12
+ };
13
+ export type TypographyGroup = {
14
+ default?: TokenWithCTIAttrs;
15
+ responsive: Map<string, TokenWithCTIAttrs>;
16
+ };
17
+ export type ProcessorOptions = Config & LocalOptions;
18
+ export type Prefixes = {
19
+ classPrefix: string;
20
+ variablePrefix: string;
21
+ };
@@ -0,0 +1,4 @@
1
+ import { NameTransform } from 'style-dictionary/types';
2
+ type Transformer = NameTransform['transform'];
3
+ export declare const prefixTransform: (transformer: Transformer) => Transformer;
4
+ export {};
@@ -0,0 +1,94 @@
1
+ import { cnMerge } from 'tailwind-variants';
2
+ /**
3
+ * Unity-configured class name utility function for merging CSS classes.
4
+ *
5
+ * This is a pre-configured version of tailwind-variants' `cn` function that includes
6
+ * Unity's custom tailwind-merge configuration. It automatically handles Unity's custom
7
+ * class names and resolves conflicts according to Unity design system rules.
8
+ * @param classes - CSS class names to merge
9
+ * @returns Merged and deduplicated class string
10
+ * @example
11
+ * ```tsx
12
+ * import { cn } from '@payfit/unity-themes'
13
+ *
14
+ * // Basic usage
15
+ * const className = cn('uy:p-200', 'uy:bg-surface-primary-default')
16
+ * // → 'uy:p-200 uy:bg-surface-primary-default'
17
+ *
18
+ * // Conflict resolution - last class wins
19
+ * const className = cn('uy:bg-surface-primary-default', 'uy:bg-surface-danger-default')
20
+ * // → 'uy:bg-surface-danger-default'
21
+ *
22
+ * // Conditional classes
23
+ * const className = cn(
24
+ * 'uy:px-200 uy:py-100',
25
+ * isActive && 'uy:bg-surface-primary-default',
26
+ * isDisabled && 'uy:bg-surface-neutral-disabled'
27
+ * )
28
+ *
29
+ * // With component props
30
+ * function Button({ variant, size, className: extraClasses, ...props }) {
31
+ * return (
32
+ * <button
33
+ * className={cn(
34
+ * 'uy:px-200 uy:py-100 uy:rounded-100', // base styles
35
+ * variant === 'primary' && 'uy:bg-surface-primary-default',
36
+ * variant === 'secondary' && 'uy:bg-surface-neutral-default',
37
+ * size === 'large' && 'uy:px-300 uy:py-150',
38
+ * extraClasses // allow override
39
+ * )}
40
+ * {...props}
41
+ * />
42
+ * )
43
+ * }
44
+ * ```
45
+ * @description
46
+ * - Automatically merges conflicting Unity classes using Unity's design system rules
47
+ * - Supports all Unity design tokens: semantic colors, primitive colors, spacing, typography, etc.
48
+ * - Handles conditional classes (falsy values are ignored)
49
+ * - Compatible with standard Tailwind classes alongside Unity classes
50
+ * - Removes duplicate classes and resolves conflicts intelligently
51
+ * @see {@link uyMerge} for the underlying merge function
52
+ * @see {@link twMergeConfig} for the Unity merge configuration details
53
+ */
54
+ export declare const cn: (...params: Parameters<typeof cnMerge>) => import('tailwind-variants').CnReturn;
55
+ /**
56
+ * Alias for {@link cn} - Unity-configured class name utility function.
57
+ *
58
+ * This function is identical to `cn` but provides a more descriptive name
59
+ * for developers who prefer explicit naming conventions.
60
+ * @param classes - CSS class names to merge
61
+ * @returns Merged and deduplicated class string
62
+ * @example
63
+ * ```tsx
64
+ * import { classNames } from '@payfit/unity-themes'
65
+ *
66
+ * const buttonClasses = classNames(
67
+ * 'uy:px-200 uy:py-100',
68
+ * 'uy:bg-surface-primary-default',
69
+ * 'uy:text-content-inverted-default'
70
+ * )
71
+ * ```
72
+ * @see {@link cn} for detailed documentation and examples
73
+ */
74
+ export declare const classNames: (...params: Parameters<typeof cnMerge>) => import('tailwind-variants').CnReturn;
75
+ /**
76
+ * Alias for {@link cn} - Unity-configured class name utility function.
77
+ *
78
+ * This function is identical to `cn` but follows the naming convention
79
+ * popularized by the `clsx` library for developers familiar with that API.
80
+ * @param classes - CSS class names to merge
81
+ * @returns Merged and deduplicated class string
82
+ * @example
83
+ * ```tsx
84
+ * import { clsx } from '@payfit/unity-themes'
85
+ *
86
+ * const cardClasses = clsx(
87
+ * 'uy:p-300 uy:rounded-200',
88
+ * 'uy:bg-surface-neutral-default',
89
+ * isHighlighted && 'uy:border-border-primary-default'
90
+ * )
91
+ * ```
92
+ * @see {@link cn} for detailed documentation and examples
93
+ */
94
+ export declare const clsx: (...params: Parameters<typeof cnMerge>) => import('tailwind-variants').CnReturn;
@@ -0,0 +1,11 @@
1
+ import { cnMerge as e } from "tailwind-variants";
2
+ import { twMergeConfig as r } from "./merge-config.js";
3
+ const o = (...t) => e(...t)({
4
+ twMerge: !0,
5
+ twMergeConfig: r
6
+ }), s = o, m = o, g = o;
7
+ export {
8
+ m as classNames,
9
+ g as clsx,
10
+ s as cn
11
+ };
@@ -0,0 +1,217 @@
1
+ export declare const twMergeConfig: {
2
+ prefix: string;
3
+ extend: {
4
+ classGroups: {
5
+ 'bg-color': {
6
+ bg: ((value: string) => boolean)[];
7
+ }[];
8
+ 'text-color': {
9
+ text: ((value: string) => boolean)[];
10
+ }[];
11
+ 'border-color': {
12
+ border: ((value: string) => boolean)[];
13
+ }[];
14
+ 'outline-color': {
15
+ outline: ((value: string) => boolean)[];
16
+ }[];
17
+ 'ring-color': {
18
+ ring: ((value: string) => boolean)[];
19
+ }[];
20
+ 'ring-offset-color': {
21
+ 'ring-offset': ((value: string) => boolean)[];
22
+ }[];
23
+ 'divide-color': {
24
+ divide: ((value: string) => boolean)[];
25
+ }[];
26
+ 'text-decoration-color': {
27
+ decoration: ((value: string) => boolean)[];
28
+ }[];
29
+ 'gradient-color-from': {
30
+ from: ((value: string) => boolean)[];
31
+ }[];
32
+ 'gradient-color-via': {
33
+ via: ((value: string) => boolean)[];
34
+ }[];
35
+ 'gradient-color-to': {
36
+ to: ((value: string) => boolean)[];
37
+ }[];
38
+ p: {
39
+ p: string[];
40
+ }[];
41
+ px: {
42
+ px: string[];
43
+ }[];
44
+ py: {
45
+ py: string[];
46
+ }[];
47
+ ps: {
48
+ ps: string[];
49
+ }[];
50
+ pe: {
51
+ pe: string[];
52
+ }[];
53
+ pt: {
54
+ pt: string[];
55
+ }[];
56
+ pr: {
57
+ pr: string[];
58
+ }[];
59
+ pb: {
60
+ pb: string[];
61
+ }[];
62
+ pl: {
63
+ pl: string[];
64
+ }[];
65
+ m: {
66
+ m: string[];
67
+ }[];
68
+ mx: {
69
+ mx: string[];
70
+ }[];
71
+ my: {
72
+ my: string[];
73
+ }[];
74
+ ms: {
75
+ ms: string[];
76
+ }[];
77
+ me: {
78
+ me: string[];
79
+ }[];
80
+ mt: {
81
+ mt: string[];
82
+ }[];
83
+ mr: {
84
+ mr: string[];
85
+ }[];
86
+ mb: {
87
+ mb: string[];
88
+ }[];
89
+ ml: {
90
+ ml: string[];
91
+ }[];
92
+ gap: {
93
+ gap: string[];
94
+ }[];
95
+ 'gap-x': {
96
+ 'gap-x': string[];
97
+ }[];
98
+ 'gap-y': {
99
+ 'gap-y': string[];
100
+ }[];
101
+ 'space-x': {
102
+ 'space-x': string[];
103
+ }[];
104
+ 'space-y': {
105
+ 'space-y': string[];
106
+ }[];
107
+ 'scroll-p': {
108
+ 'scroll-p': string[];
109
+ }[];
110
+ 'scroll-px': {
111
+ 'scroll-px': string[];
112
+ }[];
113
+ 'scroll-py': {
114
+ 'scroll-py': string[];
115
+ }[];
116
+ 'scroll-ps': {
117
+ 'scroll-ps': string[];
118
+ }[];
119
+ 'scroll-pe': {
120
+ 'scroll-pe': string[];
121
+ }[];
122
+ 'scroll-pt': {
123
+ 'scroll-pt': string[];
124
+ }[];
125
+ 'scroll-pr': {
126
+ 'scroll-pr': string[];
127
+ }[];
128
+ 'scroll-pb': {
129
+ 'scroll-pb': string[];
130
+ }[];
131
+ 'scroll-pl': {
132
+ 'scroll-pl': string[];
133
+ }[];
134
+ 'scroll-m': {
135
+ 'scroll-m': string[];
136
+ }[];
137
+ 'scroll-mx': {
138
+ 'scroll-mx': string[];
139
+ }[];
140
+ 'scroll-my': {
141
+ 'scroll-my': string[];
142
+ }[];
143
+ 'scroll-ms': {
144
+ 'scroll-ms': string[];
145
+ }[];
146
+ 'scroll-me': {
147
+ 'scroll-me': string[];
148
+ }[];
149
+ 'scroll-mt': {
150
+ 'scroll-mt': string[];
151
+ }[];
152
+ 'scroll-mr': {
153
+ 'scroll-mr': string[];
154
+ }[];
155
+ 'scroll-mb': {
156
+ 'scroll-mb': string[];
157
+ }[];
158
+ 'scroll-ml': {
159
+ 'scroll-ml': string[];
160
+ }[];
161
+ typography: {
162
+ typography: string[];
163
+ }[];
164
+ 'font-size': {
165
+ text: string[];
166
+ }[];
167
+ rounded: {
168
+ rounded: string[];
169
+ }[];
170
+ 'rounded-s': {
171
+ 'rounded-s': string[];
172
+ }[];
173
+ 'rounded-e': {
174
+ 'rounded-e': string[];
175
+ }[];
176
+ 'rounded-t': {
177
+ 'rounded-t': string[];
178
+ }[];
179
+ 'rounded-r': {
180
+ 'rounded-r': string[];
181
+ }[];
182
+ 'rounded-b': {
183
+ 'rounded-b': string[];
184
+ }[];
185
+ 'rounded-l': {
186
+ 'rounded-l': string[];
187
+ }[];
188
+ 'rounded-ss': {
189
+ 'rounded-ss': string[];
190
+ }[];
191
+ 'rounded-se': {
192
+ 'rounded-se': string[];
193
+ }[];
194
+ 'rounded-ee': {
195
+ 'rounded-ee': string[];
196
+ }[];
197
+ 'rounded-es': {
198
+ 'rounded-es': string[];
199
+ }[];
200
+ 'rounded-tl': {
201
+ 'rounded-tl': string[];
202
+ }[];
203
+ 'rounded-tr': {
204
+ 'rounded-tr': string[];
205
+ }[];
206
+ 'rounded-br': {
207
+ 'rounded-br': string[];
208
+ }[];
209
+ 'rounded-bl': {
210
+ 'rounded-bl': string[];
211
+ }[];
212
+ shadow: {
213
+ shadow: string[];
214
+ }[];
215
+ };
216
+ };
217
+ };