wex-ui-lib 1.0.3 → 1.0.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.
Files changed (87) hide show
  1. package/dist/index.cjs.js +2295 -0
  2. package/dist/index.cjs.js.map +1 -0
  3. package/dist/index.d.ts +4 -5
  4. package/dist/index.esm.js +2272 -0
  5. package/dist/index.esm.js.map +1 -0
  6. package/dist/types/components/Button/index.d.ts +3 -0
  7. package/dist/types/components/Hero/index.d.ts +3 -0
  8. package/dist/types/components/Navbar/index.d.ts +3 -0
  9. package/dist/types/components/Showcase/index.d.ts +3 -0
  10. package/dist/types/samples/Holik/Homepage.d.ts +2 -0
  11. package/dist/{src → types}/shared/components/Fade.d.ts +1 -1
  12. package/dist/{shared → types/shared}/components/Icon.d.ts +2 -1
  13. package/package.json +28 -19
  14. package/.storybook/main.ts +0 -19
  15. package/.storybook/manager-head.html +0 -1
  16. package/.storybook/preview.ts +0 -15
  17. package/dist/components/Button/index.d.ts +0 -2
  18. package/dist/components/Hero/index.d.ts +0 -2
  19. package/dist/components/Navbar/index.d.ts +0 -2
  20. package/dist/components/Showcase/index.d.ts +0 -2
  21. package/dist/index.js +0 -345
  22. package/dist/index.js.map +0 -1
  23. package/dist/index.mjs +0 -345
  24. package/dist/index.mjs.map +0 -1
  25. package/dist/samples/Holik/Homepage.d.ts +0 -1
  26. package/dist/shared/components/Fade.d.ts +0 -7
  27. package/dist/src/components/Button/index.d.ts +0 -2
  28. package/dist/src/components/Button/index.stories.d.ts +0 -12
  29. package/dist/src/components/Button/index.types.d.ts +0 -10
  30. package/dist/src/components/Hero/index.d.ts +0 -2
  31. package/dist/src/components/Hero/index.stories.d.ts +0 -12
  32. package/dist/src/components/Hero/index.types.d.ts +0 -12
  33. package/dist/src/components/Navbar/index.d.ts +0 -2
  34. package/dist/src/components/Navbar/index.stories.d.ts +0 -7
  35. package/dist/src/components/Navbar/index.types.d.ts +0 -25
  36. package/dist/src/components/Showcase/index.d.ts +0 -2
  37. package/dist/src/components/Showcase/index.stories.d.ts +0 -7
  38. package/dist/src/components/Showcase/index.types.d.ts +0 -9
  39. package/dist/src/samples/Holik/Homepage.d.ts +0 -1
  40. package/dist/src/samples/Holik/index.stories.d.ts +0 -10
  41. package/dist/src/shared/components/Icon.d.ts +0 -11
  42. package/dist/src/shared/styles/animations.d.ts +0 -6
  43. package/dist/src/shared/styles/theme.d.ts +0 -7
  44. package/dist/src/shared/types.d.ts +0 -15
  45. package/dist/src/shared/utils/formatters.d.ts +0 -2
  46. package/dist/src/shared/utils/useIntObs.d.ts +0 -19
  47. package/public/logo.png +0 -0
  48. package/rollup.config.mjs +0 -42
  49. package/src/components/Button/index.stories.tsx +0 -54
  50. package/src/components/Button/index.tsx +0 -157
  51. package/src/components/Button/index.types.ts +0 -11
  52. package/src/components/Hero/index.stories.tsx +0 -40
  53. package/src/components/Hero/index.tsx +0 -76
  54. package/src/components/Hero/index.types.ts +0 -13
  55. package/src/components/Navbar/index.stories.tsx +0 -59
  56. package/src/components/Navbar/index.tsx +0 -196
  57. package/src/components/Navbar/index.types.ts +0 -27
  58. package/src/components/Showcase/index.stories.tsx +0 -54
  59. package/src/components/Showcase/index.tsx +0 -66
  60. package/src/components/Showcase/index.types.ts +0 -9
  61. package/src/index.ts +0 -6
  62. package/src/samples/Holik/Homepage.tsx +0 -141
  63. package/src/samples/Holik/index.stories.tsx +0 -17
  64. package/src/shared/components/Fade.tsx +0 -48
  65. package/src/shared/components/Icon.tsx +0 -81
  66. package/src/shared/styles/animations.ts +0 -80
  67. package/src/shared/styles/global.css +0 -6
  68. package/src/shared/styles/theme.ts +0 -7
  69. package/src/shared/types.ts +0 -18
  70. package/src/shared/utils/formatters.ts +0 -12
  71. package/src/shared/utils/useIntObs.ts +0 -112
  72. package/tsconfig.json +0 -30
  73. /package/dist/{components → types/components}/Button/index.stories.d.ts +0 -0
  74. /package/dist/{components → types/components}/Button/index.types.d.ts +0 -0
  75. /package/dist/{components → types/components}/Hero/index.stories.d.ts +0 -0
  76. /package/dist/{components → types/components}/Hero/index.types.d.ts +0 -0
  77. /package/dist/{components → types/components}/Navbar/index.stories.d.ts +0 -0
  78. /package/dist/{components → types/components}/Navbar/index.types.d.ts +0 -0
  79. /package/dist/{components → types/components}/Showcase/index.stories.d.ts +0 -0
  80. /package/dist/{components → types/components}/Showcase/index.types.d.ts +0 -0
  81. /package/dist/{src → types}/index.d.ts +0 -0
  82. /package/dist/{samples → types/samples}/Holik/index.stories.d.ts +0 -0
  83. /package/dist/{shared → types/shared}/styles/animations.d.ts +0 -0
  84. /package/dist/{shared → types/shared}/styles/theme.d.ts +0 -0
  85. /package/dist/{shared → types/shared}/types.d.ts +0 -0
  86. /package/dist/{shared → types/shared}/utils/formatters.d.ts +0 -0
  87. /package/dist/{shared → types/shared}/utils/useIntObs.d.ts +0 -0
@@ -1,112 +0,0 @@
1
- import { useEffect, useRef, useState, MutableRefObject } from 'react';
2
-
3
- interface UseIntObsOptions {
4
- threshold?: number | number[];
5
- root?: any;
6
- rootMargin?: string;
7
- freezeOnceVisible?: boolean;
8
- initialIsIntersecting?: boolean;
9
- onChange?: (isIntersecting: boolean, entry: IntersectionObserverEntry) => void;
10
- }
11
-
12
- interface IntObsState {
13
- isIntersecting: boolean;
14
- entry?: IntersectionObserverEntry;
15
- }
16
-
17
- type UseIntObsResult = [
18
- (node: Element | null) => void,
19
- boolean,
20
- IntersectionObserverEntry | undefined
21
- ] & {
22
- ref: (node: Element | null) => void;
23
- isIntersecting: boolean;
24
- entry: IntersectionObserverEntry | undefined;
25
- };
26
-
27
- export function useIntObs({
28
- threshold = 0,
29
- root = null,
30
- rootMargin = '0%',
31
- freezeOnceVisible = false,
32
- initialIsIntersecting = false,
33
- onChange,
34
- }: UseIntObsOptions = {}): UseIntObsResult {
35
- const [ref, setRef] = useState<Element | null>(null);
36
- const [state, setState] = useState<IntObsState>(() => ({
37
- isIntersecting: initialIsIntersecting,
38
- entry: undefined,
39
- }));
40
-
41
- const callbackRef = useRef<(isIntersecting: boolean, entry: IntersectionObserverEntry) => void>(undefined);
42
- callbackRef.current = onChange;
43
-
44
- const frozen = state.entry?.isIntersecting && freezeOnceVisible;
45
-
46
- useEffect(() => {
47
- if (!ref || frozen || !('IntersectionObserver' in window)) return;
48
-
49
- let unobserve: (() => void) | undefined;
50
-
51
- const observer = new IntersectionObserver(
52
- (entries) => {
53
- const thresholds = Array.isArray(observer.thresholds)
54
- ? observer.thresholds
55
- : [observer.thresholds];
56
-
57
- entries.forEach((entry) => {
58
- const isIntersecting =
59
- entry.isIntersecting &&
60
- thresholds.some((threshold) => entry.intersectionRatio >= threshold);
61
-
62
- setState({ isIntersecting, entry });
63
-
64
- if (callbackRef.current) {
65
- callbackRef.current(isIntersecting, entry);
66
- }
67
-
68
- if (isIntersecting && freezeOnceVisible && unobserve) {
69
- unobserve();
70
- unobserve = undefined;
71
- }
72
- });
73
- },
74
- { threshold, root, rootMargin }
75
- );
76
-
77
- observer.observe(ref);
78
-
79
- unobserve = () => observer.unobserve(ref);
80
-
81
- return () => {
82
- observer.disconnect();
83
- };
84
- }, [ref, JSON.stringify(threshold), root, rootMargin, frozen, freezeOnceVisible]);
85
-
86
- const prevRef = useRef<Element | null>(null);
87
-
88
- useEffect(() => {
89
- if (
90
- !ref &&
91
- state.entry?.target &&
92
- !freezeOnceVisible &&
93
- !frozen &&
94
- prevRef.current !== state.entry.target
95
- ) {
96
- prevRef.current = state.entry.target as Element;
97
- setState({ isIntersecting: initialIsIntersecting, entry: undefined });
98
- }
99
- }, [ref, state.entry, freezeOnceVisible, frozen, initialIsIntersecting]);
100
-
101
- const result: UseIntObsResult = [
102
- setRef,
103
- !!state.isIntersecting,
104
- state.entry,
105
- ] as UseIntObsResult;
106
-
107
- result.ref = result[0];
108
- result.isIntersecting = result[1];
109
- result.entry = result[2];
110
-
111
- return result;
112
- }
package/tsconfig.json DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
4
- "lib": [
5
- "dom",
6
- "dom.iterable",
7
- "esnext"
8
- ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
9
- "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
10
- "skipLibCheck": true, /* Skip type checking all .d.ts files. */
11
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
12
- "allowSyntheticDefaultImports": true,
13
- "strict": true, /* Enable all strict type-checking options. */
14
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
15
- "noFallthroughCasesInSwitch": true,
16
- "module": "esnext", /* Specify what module code is generated. */
17
- "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
18
- "resolveJsonModule": true, /* Enable importing .json files. */
19
- "noEmit": true, /* Disable emitting files from a compilation. */
20
- "jsx": "react-jsx",
21
- "rootDir": ".",
22
- "declaration": true,
23
- "sourceMap": true,
24
- "outDir": "dist",
25
- "emitDeclarationOnly": true
26
- },
27
- "include": [
28
- "src"
29
- ]
30
- }
File without changes
File without changes
File without changes