@snack-uikit/utils 2.0.2-preview-85c5f47b.0 → 3.1.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,56 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.1.0 (2023-12-06)
7
+
8
+
9
+ ### Features
10
+
11
+ * **FF-3646:** add ThemeProvider/useThemeContext ([9a2ae54](https://github.com/cloud-ru-tech/snack-uikit/commit/9a2ae5425b6356bede25c89b3b14e60d9e8e9f75))
12
+
13
+
14
+
15
+
16
+
17
+ # 3.0.0 (2023-12-06)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **FF-0:** enhance typings for useThemeConfig ([949fefc](https://github.com/cloud-ru-tech/snack-uikit/commit/949fefc19066087769ebd64b03ab41ad0246d0b2))
23
+ * **FF-1486:** import theme styles in config provider ([ad73d14](https://github.com/cloud-ru-tech/snack-uikit/commit/ad73d149dbbdaec1c360a4765e9c4e9bb91cbed3))
24
+ * **FF-1486:** simplify ts-configs ([3aada76](https://github.com/cloud-ru-tech/snack-uikit/commit/3aada76e6220fa35d4866f830cb934c95d9bc91e))
25
+ * **FF-1486:** use real versions ([252b349](https://github.com/cloud-ru-tech/snack-uikit/commit/252b3494f9a4302d8fb5b54ac879ed1ef3e6f68c))
26
+ * **FF-2255:** new palette migration ([f3bc490](https://github.com/cloud-ru-tech/snack-uikit/commit/f3bc490bb4ddde4353009b55da2d04f87a7d9de9))
27
+ * **FF-2257:** up utils ([5dd5d28](https://github.com/cloud-ru-tech/snack-uikit/commit/5dd5d28cdbe14973dcc36759e7db003249930a4b))
28
+
29
+
30
+ ### Features
31
+
32
+ * **FF-1486:** add token map ([a14a1e1](https://github.com/cloud-ru-tech/snack-uikit/commit/a14a1e1f1ad95e80a4fb664a2a9c5324a33dad48))
33
+ * **FF-1486:** build with ts-node (only scss, without linaria) ([298d5d0](https://github.com/cloud-ru-tech/snack-uikit/commit/298d5d0b42788747e9aa34ffef254411a79ed25f))
34
+ * **FF-1486:** initial storybook ([a50bc6c](https://github.com/cloud-ru-tech/snack-uikit/commit/a50bc6c84bf47026681c2e5eaf78e15a34747180))
35
+ * **FF-1486:** try to build packages with scss ([fae6769](https://github.com/cloud-ru-tech/snack-uikit/commit/fae67699b3a153d09c7e3b7b34580d96a3cfe14b))
36
+ * **FF-1486:** use preview package of figma tokens ([c43bbc6](https://github.com/cloud-ru-tech/snack-uikit/commit/c43bbc65d7de9c686bc83950f7a2c74c780bee69))
37
+ * **FF-1650:** hot reload in storybook ([935d398](https://github.com/cloud-ru-tech/snack-uikit/commit/935d398c256c96fa2a37bcc68991701edef16b58))
38
+ * **FF-1684:** utils package has been introduced ([e3bc345](https://github.com/cloud-ru-tech/snack-uikit/commit/e3bc345c0b32cfc518a17416a00ad880e351f03b))
39
+ * **FF-1800:** esbuild & light/dark theme selector ([bf5d288](https://github.com/cloud-ru-tech/snack-uikit/commit/bf5d288c17452a481820e7430db0806658f56e0c))
40
+ * **FF-1870:** component props processors has been added ([05fe56d](https://github.com/cloud-ru-tech/snack-uikit/commit/05fe56d43ba10713e3af24c4d6b51c38846625a9))
41
+ * **FF-2485:** add useEvent and useDebounce hooks ([978484a](https://github.com/cloud-ru-tech/snack-uikit/commit/978484a5a7a28391d69875df6ecd03570a29a406))
42
+ * **FF-875:** add utils for dependencies graph ([53cd7be](https://github.com/cloud-ru-tech/snack-uikit/commit/53cd7be638f01e573cb52b2417a39f4df4f6089b))
43
+ * infrastructure improvements ([ae537b5](https://github.com/cloud-ru-tech/snack-uikit/commit/ae537b5e37c0050f800c367da290f4f4e30d22ab))
44
+ * **LK-1769:** jest to vitest ([9afff90](https://github.com/cloud-ru-tech/snack-uikit/commit/9afff90db1e60c2255361b396c096c14f923d676))
45
+
46
+
47
+ ### BREAKING CHANGES
48
+
49
+
50
+ * **FF-3823:** move to snack-uikit scope ([ac9e30d](https://github.com/cloud-ru-tech/snack-uikit/commit/ac9e30d574d529b2bf4f5184b70c511c981a6032))
51
+ * **FF-0000:** insert (extract/exclude)DataProps into (extract/exclude)SupportProps ([7aca240](https://github.com/cloud-ru-tech/snack-uikit/commit/7aca2408d5703e0ff440bfd1cde4c8dac6b25cf1))
52
+
53
+
54
+
55
+
6
56
  ## 2.0.1 (2023-11-08)
7
57
 
8
58
  **Note:** Version bump only for package @snack-uikit/utils
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ type UseThemePropsWithDefaultTheme = {
3
+ themeMap: Record<string, string>;
4
+ defaultTheme: string;
5
+ };
6
+ type UseThemeProps = {
7
+ themeMap: Record<string, string>;
8
+ };
9
+ export type ThemeProviderProps = {
10
+ children: ReactNode;
11
+ } & (UseThemePropsWithDefaultTheme | UseThemeProps);
12
+ export declare function ThemeProvider({ children, ...props }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,19 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { useThemeConfig } from '../../hooks';
14
+ import { ThemeContext } from './contexts';
15
+ export function ThemeProvider(_a) {
16
+ var { children } = _a, props = __rest(_a, ["children"]);
17
+ const themeConfig = useThemeConfig(props);
18
+ return _jsx(ThemeContext.Provider, Object.assign({ value: themeConfig }, { children: children }));
19
+ }
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export type ThemeContextType = {
3
+ theme: string | undefined;
4
+ themeClassName: string | undefined;
5
+ changeTheme: ((theme: string) => void) | undefined;
6
+ };
7
+ export declare const ThemeContext: import("react").Context<ThemeContextType>;
8
+ export declare const useThemeContext: () => ThemeContextType;
@@ -0,0 +1,7 @@
1
+ import { createContext, useContext } from 'react';
2
+ export const ThemeContext = createContext({
3
+ theme: undefined,
4
+ themeClassName: undefined,
5
+ changeTheme: undefined,
6
+ });
7
+ export const useThemeContext = () => useContext(ThemeContext);
@@ -0,0 +1,3 @@
1
+ import { useThemeContext } from './contexts';
2
+ export * from './ThemeProvider';
3
+ export { useThemeContext };
@@ -0,0 +1,3 @@
1
+ import { useThemeContext } from './contexts';
2
+ export * from './ThemeProvider';
3
+ export { useThemeContext };
@@ -0,0 +1 @@
1
+ export * from './ThemeProvider';
@@ -0,0 +1 @@
1
+ export * from './ThemeProvider';
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './hooks';
2
2
  export * from './utils';
3
+ export * from './components';
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './hooks';
2
2
  export * from './utils';
3
+ export * from './components';
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Utils",
7
- "version": "2.0.2-preview-85c5f47b.0",
7
+ "version": "3.1.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -31,5 +31,5 @@
31
31
  ],
32
32
  "license": "Apache-2.0",
33
33
  "scripts": {},
34
- "gitHead": "6a7eef41d780d945f64f791448eaa72b9e0ae72d"
34
+ "gitHead": "76a159dde7baccf49dc7b11e1fd7abc31424b42f"
35
35
  }
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ import { useThemeConfig } from '../../hooks';
4
+ import { ThemeContext } from './contexts';
5
+
6
+ type UseThemePropsWithDefaultTheme = { themeMap: Record<string, string>; defaultTheme: string };
7
+ type UseThemeProps = { themeMap: Record<string, string> };
8
+
9
+ export type ThemeProviderProps = { children: ReactNode } & (UseThemePropsWithDefaultTheme | UseThemeProps);
10
+
11
+ export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
12
+ const themeConfig = useThemeConfig(props);
13
+
14
+ return <ThemeContext.Provider value={themeConfig}>{children}</ThemeContext.Provider>;
15
+ }
@@ -0,0 +1,15 @@
1
+ import { createContext, useContext } from 'react';
2
+
3
+ export type ThemeContextType = {
4
+ theme: string | undefined;
5
+ themeClassName: string | undefined;
6
+ changeTheme: ((theme: string) => void) | undefined;
7
+ };
8
+
9
+ export const ThemeContext = createContext<ThemeContextType>({
10
+ theme: undefined,
11
+ themeClassName: undefined,
12
+ changeTheme: undefined,
13
+ });
14
+
15
+ export const useThemeContext = () => useContext<ThemeContextType>(ThemeContext);
@@ -0,0 +1,5 @@
1
+ import { useThemeContext } from './contexts';
2
+
3
+ export * from './ThemeProvider';
4
+
5
+ export { useThemeContext };
@@ -0,0 +1 @@
1
+ export * from './ThemeProvider';
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './hooks';
2
2
  export * from './utils';
3
+ export * from './components';