@entur/utils 1.0.0-alpha.0 → 1.0.0-next.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Utils
2
2
 
3
- This package contains the different utils shared across the Entur Designsystem packages.
3
+ This package contains the different utils shared across the Entur Linje packages.
4
4
 
5
5
  > ## Think twice before adding stuff here
6
6
  >
@@ -1,7 +1,4 @@
1
- /** These polymorphic types are derrived from Ben Ilegbodu's article available at the following link:
2
- * https://www.benmvp.com/blog/forwarding-refs-polymorphic-react-component-typescript/
3
- */
4
- import React from 'react';
1
+ import { default as React } from 'react';
5
2
  export type PropsOf<C extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any>> = JSX.LibraryManagedAttributes<C, React.ComponentPropsWithoutRef<C>>;
6
3
  type AsProp<C extends React.ElementType> = {
7
4
  /**
@@ -1,10 +1,12 @@
1
+ @use 'sass:color';
2
+
1
3
  /// Slightly lighten a color
2
4
  /// @access public
3
5
  /// @param {Color} $color - color to tint
4
6
  /// @param {Number} $percentage - percentage of `$color` in returned color
5
7
  /// @return {Color}
6
8
  @function tint($color, $percentage) {
7
- @return mix(white, $color, $percentage);
9
+ @return color.mix(white, $color, $percentage);
8
10
  }
9
11
 
10
12
  /// Slightly darken a color
@@ -13,5 +15,5 @@
13
15
  /// @param {Number} $percentage - percentage of `$color` in returned color
14
16
  /// @return {Color}
15
17
  @function shade($color, $percentage) {
16
- @return mix(black, $color, $percentage);
18
+ @return color.mix(black, $color, $percentage);
17
19
  }
package/dist/index.d.ts CHANGED
@@ -9,6 +9,6 @@ export * from './useOnEscape';
9
9
  export * from './useWindowDimensions';
10
10
  export * from './ConditionalWrapper';
11
11
  export * from './warnAboutMissingStyles';
12
- export * from './types';
12
+ export * from './types/variants';
13
13
  export * from './getNodeText';
14
- export * from './consentUtils';
14
+ export * from './useControllableProp';
@@ -0,0 +1,11 @@
1
+ // Top-level layer order (lowest to highest precedence)
2
+ @layer core, third-party, components, utilities, app;
3
+
4
+ // Foundation: resets, design tokens (CSS variables), and base element styles
5
+ @layer core.reset, core.tokens, core.base;
6
+
7
+ // Third-party: vendor CSS imports, then DS overrides to tame them
8
+ @layer third-party.imports, third-party.overrides;
9
+
10
+ // Components: primitives (buttons, icons), composites (datepicker, dropdown), then cross-component overrides
11
+ @layer components.primitives, components.composites, components.overrides;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const mergeRefs: <T extends HTMLElement>(...refs: (import("react").MutableRefObject<T> | import("react").ForwardedRef<T> | ((node: T | null) => void) | undefined)[]) => (node: T) => void;
1
+ export declare const mergeRefs: <T extends HTMLElement>(...refs: (React.MutableRefObject<T> | React.ForwardedRef<T> | ((node: T | null) => void) | undefined)[]) => (node: T) => void;
@@ -0,0 +1,6 @@
1
+ export type UseControllablePropType<T> = {
2
+ prop?: T;
3
+ updater?: (value?: T) => void;
4
+ defaultValue: T;
5
+ };
6
+ export declare function useControllableProp<T>({ prop, updater, defaultValue, }: UseControllablePropType<T>): [T, (arg: T) => void];
@@ -1,2 +1,2 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
2
  export declare const useOnClickOutside: (refs: (React.RefObject<HTMLElement> | React.MutableRefObject<any>)[], handler: () => void) => void;
@@ -1,2 +1,2 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
2
  export declare const useOnEscape: (ref: React.RefObject<any> | React.MutableRefObject<any>, handler: () => void) => void;
@@ -1 +1,12 @@
1
+ /**
2
+ * @deprecated Use `useId()` from React directly instead.
3
+ * Will be removed in a future major version.
4
+ *
5
+ * ```diff
6
+ * - import { useRandomId } from '@entur/utils';
7
+ * - const id = useRandomId('eds-my-component');
8
+ * + import { useId } from 'react';
9
+ * + const id = `eds-my-component${useId()}`;
10
+ * ```
11
+ */
1
12
  export declare const useRandomId: (prefix?: string) => string;
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const React = require("react");
4
+ const warning = require("tiny-warning");
5
+ function useDebounce(callBack, debounceTime) {
6
+ const timeoutRef = React.useRef();
7
+ React.useEffect(() => {
8
+ return () => {
9
+ if (timeoutRef.current) {
10
+ clearTimeout(timeoutRef.current);
11
+ }
12
+ };
13
+ }, []);
14
+ const debouncedFunc = (...args) => {
15
+ if (timeoutRef.current) {
16
+ clearTimeout(timeoutRef.current);
17
+ }
18
+ timeoutRef.current = setTimeout(() => {
19
+ callBack(...args);
20
+ }, debounceTime);
21
+ };
22
+ return debouncedFunc;
23
+ }
24
+ const useRandomId = (prefix) => {
25
+ const id = React.useId();
26
+ return prefix ? `${prefix}${id}` : id;
27
+ };
28
+ function useOnMount(callback) {
29
+ const hasRun = React.useRef(false);
30
+ React.useEffect(() => {
31
+ if (!hasRun.current) {
32
+ hasRun.current = true;
33
+ callback();
34
+ }
35
+ }, [callback]);
36
+ }
37
+ const mergeRefs = (...refs) => {
38
+ return (node) => {
39
+ for (const ref of refs) {
40
+ if (typeof ref === "function") {
41
+ ref(node);
42
+ } else if (ref) ref.current = node;
43
+ }
44
+ };
45
+ };
46
+ const useForceUpdate = () => {
47
+ const [_, setValue] = React.useState(0);
48
+ return () => setValue((value) => value + 1);
49
+ };
50
+ const useOnClickOutside = (refs, handler) => {
51
+ React.useEffect(() => {
52
+ const listener = (event) => {
53
+ if (refs.some((ref) => elementContainsEventTarget(ref.current, event))) {
54
+ return;
55
+ }
56
+ handler();
57
+ };
58
+ document.addEventListener("mousedown", listener);
59
+ document.addEventListener("touchstart", listener);
60
+ return () => {
61
+ document.removeEventListener("mousedown", listener);
62
+ document.removeEventListener("touchstart", listener);
63
+ };
64
+ }, [refs, handler]);
65
+ };
66
+ const elementContainsEventTarget = (element, event) => {
67
+ if (!element) {
68
+ return false;
69
+ }
70
+ if (element.contains(event.target)) {
71
+ return true;
72
+ }
73
+ if (event.composed && event.composedPath) {
74
+ const contains = event.composedPath().find((target) => {
75
+ if (target === window) {
76
+ return false;
77
+ }
78
+ return element.contains(target);
79
+ });
80
+ return contains;
81
+ }
82
+ return false;
83
+ };
84
+ const useOnEscape = (ref, handler) => {
85
+ React.useEffect(() => {
86
+ const runIfKeyIsEscape = (event) => {
87
+ if (event.key === "Escape") handler();
88
+ };
89
+ const currentRef = ref.current;
90
+ currentRef?.addEventListener("keydown", runIfKeyIsEscape);
91
+ return () => currentRef?.removeEventListener("keydown", runIfKeyIsEscape);
92
+ }, [ref, handler]);
93
+ };
94
+ const subscribe = (callback) => {
95
+ window.addEventListener("resize", callback);
96
+ return () => window.removeEventListener("resize", callback);
97
+ };
98
+ let cachedSnapshot = { width: void 0, height: void 0 };
99
+ const getSnapshot = () => {
100
+ const width = window.innerWidth;
101
+ const height = window.innerHeight;
102
+ if (cachedSnapshot.width !== width || cachedSnapshot.height !== height) {
103
+ cachedSnapshot = { width, height };
104
+ }
105
+ return cachedSnapshot;
106
+ };
107
+ const serverSnapshot = {
108
+ width: void 0,
109
+ height: void 0
110
+ };
111
+ const getServerSnapshot = () => serverSnapshot;
112
+ const useWindowDimensions = () => {
113
+ return React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
114
+ };
115
+ const ConditionalWrapper = ({
116
+ condition,
117
+ wrapper,
118
+ children
119
+ }) => condition ? wrapper(children) : children;
120
+ const packagesToCheck = /* @__PURE__ */ new Set();
121
+ let checkTimeoutId;
122
+ function checkAndWarn() {
123
+ const missingImports = Array.from(packagesToCheck).filter(
124
+ (namespace) => parseInt(
125
+ window.getComputedStyle(document.documentElement).getPropertyValue(`--eds-${namespace}`)
126
+ ) !== 1
127
+ ).sort();
128
+ const singleMissingImport = missingImports.length === 1;
129
+ warning(
130
+ missingImports.length === 0,
131
+ `You are missing ${singleMissingImport ? "a CSS import" : `${missingImports.length} CSS imports`}!
132
+
133
+ Please add the following CSS import${singleMissingImport ? "" : "s"} somewhere in your app:
134
+
135
+ ${missingImports.map((namespace) => ` @import '@entur/${namespace}/dist/styles.css';`).join("\n")}
136
+ `
137
+ );
138
+ }
139
+ function warnAboutMissingStyles(...namespaces) {
140
+ if (typeof window === "undefined" || typeof process !== "undefined" && process?.env?.TEST === "true" || typeof process !== "undefined" && process?.env?.NODE_ENV === "production") {
141
+ return;
142
+ }
143
+ window.clearTimeout(checkTimeoutId);
144
+ namespaces.forEach((namespace) => packagesToCheck.add(namespace));
145
+ checkTimeoutId = window.setTimeout(checkAndWarn, 1e3);
146
+ }
147
+ const getNodeText = (node) => {
148
+ if (node === null || node === void 0) return "";
149
+ if (["string", "number"].includes(typeof node)) return node.toString();
150
+ if (node instanceof Array) return node.map(getNodeText).join("").trim();
151
+ if (typeof node === "object")
152
+ return getNodeText(node.props?.children ?? "").trim();
153
+ return "unknown";
154
+ };
155
+ function useControllableProp({
156
+ prop,
157
+ updater = () => void 0,
158
+ defaultValue
159
+ }) {
160
+ const [internalState, setInternalState] = React.useState(defaultValue);
161
+ React.useEffect(() => {
162
+ if (prop !== void 0) {
163
+ setInternalState(prop);
164
+ }
165
+ }, [prop]);
166
+ return prop === void 0 ? [internalState, setInternalState] : [prop, updater];
167
+ }
168
+ exports.ConditionalWrapper = ConditionalWrapper;
169
+ exports.getNodeText = getNodeText;
170
+ exports.mergeRefs = mergeRefs;
171
+ exports.useControllableProp = useControllableProp;
172
+ exports.useDebounce = useDebounce;
173
+ exports.useForceUpdate = useForceUpdate;
174
+ exports.useOnClickOutside = useOnClickOutside;
175
+ exports.useOnEscape = useOnEscape;
176
+ exports.useOnMount = useOnMount;
177
+ exports.useRandomId = useRandomId;
178
+ exports.useWindowDimensions = useWindowDimensions;
179
+ exports.warnAboutMissingStyles = warnAboutMissingStyles;
180
+ //# sourceMappingURL=utils.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs.js","sources":["../src/useDebounce.ts","../src/useRandomId.ts","../src/useOnMount.ts","../src/mergeRefs.ts","../src/useForceUpdate.ts","../src/useOnClickOutside.ts","../src/useOnEscape.ts","../src/useWindowDimensions.ts","../src/ConditionalWrapper.tsx","../src/warnAboutMissingStyles.ts","../src/getNodeText.ts","../src/useControllableProp.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nexport function useDebounce<T extends (...args: any[]) => any>(\n callBack: T,\n debounceTime: number,\n) {\n const timeoutRef = useRef<ReturnType<typeof setTimeout>>();\n\n useEffect(() => {\n return () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n };\n }, []);\n\n const debouncedFunc = (...args: any[]) => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = setTimeout(() => {\n callBack(...args);\n }, debounceTime);\n };\n\n return debouncedFunc as T;\n}\n","import { useId } from 'react';\n\n/**\n * @deprecated Use `useId()` from React directly instead.\n * Will be removed in a future major version.\n *\n * ```diff\n * - import { useRandomId } from '@entur/utils';\n * - const id = useRandomId('eds-my-component');\n * + import { useId } from 'react';\n * + const id = `eds-my-component${useId()}`;\n * ```\n */\nexport const useRandomId = (prefix?: string): string => {\n const id = useId();\n return prefix ? `${prefix}${id}` : id;\n};\n","import React from 'react';\n\nexport function useOnMount(callback: () => void): void {\n const hasRun = React.useRef<boolean>(false);\n\n React.useEffect(() => {\n if (!hasRun.current) {\n hasRun.current = true;\n callback();\n }\n }, [callback]);\n}\n","export const mergeRefs = <T extends HTMLElement>(\n ...refs: (\n | React.MutableRefObject<T>\n | React.ForwardedRef<T>\n | ((node: T | null) => void)\n | undefined\n )[]\n) => {\n return (node: T) => {\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) ref.current = node;\n }\n };\n};\n","import { useState } from 'react';\n\nexport const useForceUpdate = () => {\n const [_, setValue] = useState(0);\n return () => setValue(value => value + 1);\n};\n","import React, { useEffect } from 'react';\n\nexport const useOnClickOutside = (\n refs: (React.RefObject<HTMLElement> | React.MutableRefObject<any>)[],\n handler: () => void,\n) => {\n useEffect(() => {\n const listener = (event: Event) => {\n // If the ref contains the clicked element, then the click is not outside\n if (refs.some(ref => elementContainsEventTarget(ref.current, event))) {\n return;\n }\n\n handler();\n };\n\n document.addEventListener('mousedown', listener);\n document.addEventListener('touchstart', listener);\n\n return () => {\n document.removeEventListener('mousedown', listener);\n document.removeEventListener('touchstart', listener);\n };\n }, [refs, handler]);\n};\n\nconst elementContainsEventTarget = (\n element: HTMLElement | null,\n event: Event,\n) => {\n if (!element) {\n return false;\n }\n\n if (element.contains(event.target as Node)) {\n return true;\n }\n\n // For elements inside a Shadow DOM we need to check the composedPath\n if (event.composed && event.composedPath) {\n const contains = event.composedPath().find(target => {\n if (target === window) {\n return false;\n }\n return element.contains(target as Node);\n });\n return contains;\n }\n\n return false;\n};\n","import React, { useEffect } from 'react';\n\nexport const useOnEscape = (\n ref: React.RefObject<any> | React.MutableRefObject<any>,\n handler: () => void,\n) => {\n useEffect(() => {\n const runIfKeyIsEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape') handler();\n };\n\n const currentRef = ref.current;\n currentRef?.addEventListener('keydown', runIfKeyIsEscape);\n\n return () => currentRef?.removeEventListener('keydown', runIfKeyIsEscape);\n }, [ref, handler]);\n};\n","import { useSyncExternalStore } from 'react';\n\ntype WindowDimensions = {\n width: number | undefined;\n height: number | undefined;\n};\n\nconst subscribe = (callback: () => void) => {\n window.addEventListener('resize', callback);\n return () => window.removeEventListener('resize', callback);\n};\n\nlet cachedSnapshot: WindowDimensions = { width: undefined, height: undefined };\n\nconst getSnapshot = (): WindowDimensions => {\n const width = window.innerWidth;\n const height = window.innerHeight;\n if (cachedSnapshot.width !== width || cachedSnapshot.height !== height) {\n cachedSnapshot = { width, height };\n }\n return cachedSnapshot;\n};\n\nconst serverSnapshot: WindowDimensions = {\n width: undefined,\n height: undefined,\n};\nconst getServerSnapshot = () => serverSnapshot;\n\nexport const useWindowDimensions = (): WindowDimensions => {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n};\n","type ConditionalWrapperType = {\n condition: boolean;\n wrapper: any;\n children: any;\n};\n\nexport const ConditionalWrapper = ({\n condition,\n wrapper,\n children,\n}: ConditionalWrapperType) => (condition ? wrapper(children) : children);\n","import warning from 'tiny-warning';\n\nconst packagesToCheck: Set<string> = new Set();\nlet checkTimeoutId: number;\n\nfunction checkAndWarn() {\n const missingImports = Array.from(packagesToCheck)\n .filter(\n namespace =>\n parseInt(\n window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(`--eds-${namespace}`),\n ) !== 1,\n )\n .sort();\n\n // Finally, we warn about those pesky imports\n const singleMissingImport = missingImports.length === 1;\n warning(\n missingImports.length === 0,\n `You are missing ${\n singleMissingImport\n ? 'a CSS import'\n : `${missingImports.length} CSS imports`\n }!\n\nPlease add the following CSS import${\n singleMissingImport ? '' : 's'\n } somewhere in your app:\n\n${missingImports\n .map(namespace => `\\t@import '@entur/${namespace}/dist/styles.css';`)\n .join('\\n')}\n`,\n );\n}\n\n/** Warns the developer if they have forgotten to include styles */\nexport function warnAboutMissingStyles(...namespaces: string[]): void {\n // We skip this check in production, and when we build static sites\n if (\n typeof window === 'undefined' ||\n (typeof process !== 'undefined' && process?.env?.TEST === 'true') ||\n (typeof process !== 'undefined' && process?.env?.NODE_ENV === 'production')\n ) {\n return;\n }\n // First, let's clear earlier calls to setTimeout\n window.clearTimeout(checkTimeoutId);\n\n // Next, let's add all namespaces to the set of packages to check\n namespaces.forEach(namespace => packagesToCheck.add(namespace));\n\n // Finally. let's trigger a run of the checker.\n checkTimeoutId = window.setTimeout(checkAndWarn, 1000);\n}\n","// with inspiration from https://stackoverflow.com/questions/50428910/get-text-content-from-node-in-react\nexport const getNodeText = (\n node: React.ReactNode | string | number | string[] | number[],\n): string => {\n if (node === null || node === undefined) return '';\n if (['string', 'number'].includes(typeof node)) return node.toString();\n if (node instanceof Array) return node.map(getNodeText).join('').trim();\n if (typeof node === 'object')\n // @ts-expect-error props does exist for react nodes\n return getNodeText(node.props?.children ?? '').trim();\n return 'unknown';\n};\n","import { useEffect, useState } from 'react';\nexport type UseControllablePropType<T> = {\n prop?: T;\n updater?: (value?: T) => void;\n defaultValue: T;\n};\nexport function useControllableProp<T>({\n prop,\n updater = () => undefined,\n defaultValue,\n}: UseControllablePropType<T>): [T, (arg: T) => void] {\n const [internalState, setInternalState] = useState<T>(defaultValue);\n useEffect(() => {\n if (prop !== undefined) {\n setInternalState(prop);\n }\n }, [prop]);\n return prop === undefined\n ? [internalState, setInternalState]\n : [prop, updater];\n}\n"],"names":["useRef","useEffect","useId","useState","useSyncExternalStore"],"mappings":";;;;AAEO,SAAS,YACd,UACA,cACA;AACA,QAAM,aAAaA,MAAAA,OAAA;AAEnBC,QAAAA,UAAU,MAAM;AACd,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,qBAAa,WAAW,OAAO;AAAA,MACjC;AAAA,IACF;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,QAAM,gBAAgB,IAAI,SAAgB;AACxC,QAAI,WAAW,SAAS;AACtB,mBAAa,WAAW,OAAO;AAAA,IACjC;AAEA,eAAW,UAAU,WAAW,MAAM;AACpC,eAAS,GAAG,IAAI;AAAA,IAClB,GAAG,YAAY;AAAA,EACjB;AAEA,SAAO;AACT;ACdO,MAAM,cAAc,CAAC,WAA4B;AACtD,QAAM,KAAKC,MAAAA,MAAA;AACX,SAAO,SAAS,GAAG,MAAM,GAAG,EAAE,KAAK;AACrC;ACdO,SAAS,WAAW,UAA4B;AACrD,QAAM,SAAS,MAAM,OAAgB,KAAK;AAE1C,QAAM,UAAU,MAAM;AACpB,QAAI,CAAC,OAAO,SAAS;AACnB,aAAO,UAAU;AACjB,eAAA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AACf;ACXO,MAAM,YAAY,IACpB,SAMA;AACH,SAAO,CAAC,SAAY;AAClB,eAAW,OAAO,MAAM;AACtB,UAAI,OAAO,QAAQ,YAAY;AAC7B,YAAI,IAAI;AAAA,MACV,WAAW,IAAK,KAAI,UAAU;AAAA,IAChC;AAAA,EACF;AACF;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