enjanga-components-library 1.0.30 → 1.0.31
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/dist/index.d.mts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +6 -5
- package/dist/index.mjs +6 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Node } from '@contentful/rich-text-types';
|
|
3
|
+
import * as react from 'react';
|
|
3
4
|
import { ComponentType, SVGProps } from 'react';
|
|
4
5
|
|
|
5
6
|
interface AH_propsType {
|
|
@@ -225,4 +226,28 @@ interface CRT_propsType {
|
|
|
225
226
|
|
|
226
227
|
declare const CMSRichText: ({ data, className }: CRT_propsType) => react_jsx_runtime.JSX.Element;
|
|
227
228
|
|
|
228
|
-
|
|
229
|
+
/**
|
|
230
|
+
* Custom hook for tracking a component's wrapper and assigning the most appropriate breakpoint.
|
|
231
|
+
* -----------------------------
|
|
232
|
+
*/
|
|
233
|
+
type SizeClass = 'sm' | 'md' | 'lg' | 'xlg' | 'max';
|
|
234
|
+
interface UseContainerSizeOptions {
|
|
235
|
+
/**
|
|
236
|
+
* Record<SizeClass, number> is a TypeScript utility type that creates an object type where:
|
|
237
|
+
* - All keys are from SizeClass ('sm', 'md', 'lg', 'xlg', 'max')
|
|
238
|
+
* - All values are number
|
|
239
|
+
* All keys are from SizeClass ('sm', 'md', 'lg', 'xlg', 'max')
|
|
240
|
+
* - So: { sm: number; md: number; lg: number; xlg: number; max: number; }
|
|
241
|
+
*
|
|
242
|
+
* Partial<...> utility type makes all properties of the object optional.
|
|
243
|
+
* - So: { sm?: number; md?: number; lg?: number; xlg?: number; max?: number; }
|
|
244
|
+
*/
|
|
245
|
+
customBreakpoints?: Partial<Record<SizeClass, number>>;
|
|
246
|
+
defaultSize?: SizeClass;
|
|
247
|
+
}
|
|
248
|
+
declare const useContainerSize: (options?: UseContainerSizeOptions) => {
|
|
249
|
+
containerRef: react.RefObject<HTMLDivElement | null>;
|
|
250
|
+
activeBreakpoint: SizeClass;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export { AppHeader, Banner, BrandLogo, CMSRichText, CP_getPictogram, type CP_nameType, CP_pictogramMap, type CQ_quote_propsType, type CTL_valid_linkTo, ContactButton, CustomPictogram, CustomQuotes, CustomTabs, CustomTile, FeatureText, HeadlinedList, List, SmartText, useContainerSize };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Node } from '@contentful/rich-text-types';
|
|
3
|
+
import * as react from 'react';
|
|
3
4
|
import { ComponentType, SVGProps } from 'react';
|
|
4
5
|
|
|
5
6
|
interface AH_propsType {
|
|
@@ -225,4 +226,28 @@ interface CRT_propsType {
|
|
|
225
226
|
|
|
226
227
|
declare const CMSRichText: ({ data, className }: CRT_propsType) => react_jsx_runtime.JSX.Element;
|
|
227
228
|
|
|
228
|
-
|
|
229
|
+
/**
|
|
230
|
+
* Custom hook for tracking a component's wrapper and assigning the most appropriate breakpoint.
|
|
231
|
+
* -----------------------------
|
|
232
|
+
*/
|
|
233
|
+
type SizeClass = 'sm' | 'md' | 'lg' | 'xlg' | 'max';
|
|
234
|
+
interface UseContainerSizeOptions {
|
|
235
|
+
/**
|
|
236
|
+
* Record<SizeClass, number> is a TypeScript utility type that creates an object type where:
|
|
237
|
+
* - All keys are from SizeClass ('sm', 'md', 'lg', 'xlg', 'max')
|
|
238
|
+
* - All values are number
|
|
239
|
+
* All keys are from SizeClass ('sm', 'md', 'lg', 'xlg', 'max')
|
|
240
|
+
* - So: { sm: number; md: number; lg: number; xlg: number; max: number; }
|
|
241
|
+
*
|
|
242
|
+
* Partial<...> utility type makes all properties of the object optional.
|
|
243
|
+
* - So: { sm?: number; md?: number; lg?: number; xlg?: number; max?: number; }
|
|
244
|
+
*/
|
|
245
|
+
customBreakpoints?: Partial<Record<SizeClass, number>>;
|
|
246
|
+
defaultSize?: SizeClass;
|
|
247
|
+
}
|
|
248
|
+
declare const useContainerSize: (options?: UseContainerSizeOptions) => {
|
|
249
|
+
containerRef: react.RefObject<HTMLDivElement | null>;
|
|
250
|
+
activeBreakpoint: SizeClass;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export { AppHeader, Banner, BrandLogo, CMSRichText, CP_getPictogram, type CP_nameType, CP_pictogramMap, type CQ_quote_propsType, type CTL_valid_linkTo, ContactButton, CustomPictogram, CustomQuotes, CustomTabs, CustomTile, FeatureText, HeadlinedList, List, SmartText, useContainerSize };
|
package/dist/index.js
CHANGED
|
@@ -2338,12 +2338,12 @@ var calcRemToPx = (remVal) => remVal * 16;
|
|
|
2338
2338
|
// src/libs/useContainerSize.ts
|
|
2339
2339
|
var useContainerSize = (options) => {
|
|
2340
2340
|
const ref = React4.useRef(null);
|
|
2341
|
-
const [size, setSize] = React4.useState("max");
|
|
2341
|
+
const [size, setSize] = React4.useState(options?.defaultSize || "max");
|
|
2342
2342
|
const effectiveBreakpoints = {
|
|
2343
|
-
sm: calcRemToPx(parseInt(breakpoints?.sm?.width, 10)),
|
|
2344
|
-
md: calcRemToPx(parseInt(breakpoints?.md?.width, 10)),
|
|
2345
|
-
lg: calcRemToPx(parseInt(breakpoints?.lg?.width, 10)),
|
|
2346
|
-
xlg: calcRemToPx(parseInt(breakpoints?.xlg?.width, 10))
|
|
2343
|
+
sm: options?.customBreakpoints?.sm ?? calcRemToPx(parseInt(breakpoints?.sm?.width, 10)),
|
|
2344
|
+
md: options?.customBreakpoints?.md ?? calcRemToPx(parseInt(breakpoints?.md?.width, 10)),
|
|
2345
|
+
lg: options?.customBreakpoints?.lg ?? calcRemToPx(parseInt(breakpoints?.lg?.width, 10)),
|
|
2346
|
+
xlg: options?.customBreakpoints?.xlg ?? calcRemToPx(parseInt(breakpoints?.xlg?.width, 10))
|
|
2347
2347
|
};
|
|
2348
2348
|
React4.useEffect(() => {
|
|
2349
2349
|
if (!ref.current) return;
|
|
@@ -25870,3 +25870,4 @@ exports.FeatureText = FeatureText_default;
|
|
|
25870
25870
|
exports.HeadlinedList = HeadlinedList_default;
|
|
25871
25871
|
exports.List = List_default;
|
|
25872
25872
|
exports.SmartText = SmartText_default;
|
|
25873
|
+
exports.useContainerSize = useContainerSize;
|
package/dist/index.mjs
CHANGED
|
@@ -2310,12 +2310,12 @@ var calcRemToPx = (remVal) => remVal * 16;
|
|
|
2310
2310
|
// src/libs/useContainerSize.ts
|
|
2311
2311
|
var useContainerSize = (options) => {
|
|
2312
2312
|
const ref = useRef(null);
|
|
2313
|
-
const [size, setSize] = useState("max");
|
|
2313
|
+
const [size, setSize] = useState(options?.defaultSize || "max");
|
|
2314
2314
|
const effectiveBreakpoints = {
|
|
2315
|
-
sm: calcRemToPx(parseInt(breakpoints?.sm?.width, 10)),
|
|
2316
|
-
md: calcRemToPx(parseInt(breakpoints?.md?.width, 10)),
|
|
2317
|
-
lg: calcRemToPx(parseInt(breakpoints?.lg?.width, 10)),
|
|
2318
|
-
xlg: calcRemToPx(parseInt(breakpoints?.xlg?.width, 10))
|
|
2315
|
+
sm: options?.customBreakpoints?.sm ?? calcRemToPx(parseInt(breakpoints?.sm?.width, 10)),
|
|
2316
|
+
md: options?.customBreakpoints?.md ?? calcRemToPx(parseInt(breakpoints?.md?.width, 10)),
|
|
2317
|
+
lg: options?.customBreakpoints?.lg ?? calcRemToPx(parseInt(breakpoints?.lg?.width, 10)),
|
|
2318
|
+
xlg: options?.customBreakpoints?.xlg ?? calcRemToPx(parseInt(breakpoints?.xlg?.width, 10))
|
|
2319
2319
|
};
|
|
2320
2320
|
useEffect(() => {
|
|
2321
2321
|
if (!ref.current) return;
|
|
@@ -25827,4 +25827,4 @@ object-assign/index.js:
|
|
|
25827
25827
|
*)
|
|
25828
25828
|
*/
|
|
25829
25829
|
|
|
25830
|
-
export { AppHeader_default as AppHeader, Banner_default as Banner, BrandLogo_default as BrandLogo, CMSRichText_default as CMSRichText, CP_getPictogram, CP_pictogramMap, ContactButton_default as ContactButton, CustomPictogram_default as CustomPictogram, CustomQuotes_default as CustomQuotes, CustomTabs_default as CustomTabs, CustomTile_default as CustomTile, FeatureText_default as FeatureText, HeadlinedList_default as HeadlinedList, List_default as List, SmartText_default as SmartText };
|
|
25830
|
+
export { AppHeader_default as AppHeader, Banner_default as Banner, BrandLogo_default as BrandLogo, CMSRichText_default as CMSRichText, CP_getPictogram, CP_pictogramMap, ContactButton_default as ContactButton, CustomPictogram_default as CustomPictogram, CustomQuotes_default as CustomQuotes, CustomTabs_default as CustomTabs, CustomTile_default as CustomTile, FeatureText_default as FeatureText, HeadlinedList_default as HeadlinedList, List_default as List, SmartText_default as SmartText, useContainerSize };
|
package/package.json
CHANGED