@mobielnl/elements 0.5.0 → 0.6.1
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 +138 -128
- package/dist/elements.css +1 -1
- package/dist/elements.js +14 -11
- package/dist/elements.umd.cjs +164 -154
- package/dist/{index-Bqq_Hib9.js → index-DAyzaGWL.js} +16758 -16461
- package/dist/{index-D18KRxRT.js → index-DkHYB7u1.js} +1 -1
- package/dist/index.d.ts +145 -12
- package/package.json +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { r as pt, t as Z, i as Re, a as q, n as De, p as mt, b as fn, c as Ve, d as pn, v as mn, e as gn, f as x, g as le, s as vn, h as yn, j as Ie, k as H, l as gt, m as Y, o as bn, q as Tn, u as te, w as ue, x as I, y as ne, z as Vn, A as An, B as vt, C as Ne, D as Sn, E as wn, F as Pn, G as D, H as yt, I as bt, J as Tt, K as je, L as Vt, M as xn, N as Cn, O as Mn, P as ze, Q as Fn, R as On, S as Rn, T as Dn, U as In, V as Nn, W as Kn, X as En, Y as Bn, Z as Ln, _ as kn } from "./index-
|
|
2
|
+
import { r as pt, t as Z, i as Re, a as q, n as De, p as mt, b as fn, c as Ve, d as pn, v as mn, e as gn, f as x, g as le, s as vn, h as yn, j as Ie, k as H, l as gt, m as Y, o as bn, q as Tn, u as te, w as ue, x as I, y as ne, z as Vn, A as An, B as vt, C as Ne, D as Sn, E as wn, F as Pn, G as D, H as yt, I as bt, J as Tt, K as je, L as Vt, M as xn, N as Cn, O as Mn, P as ze, Q as Fn, R as On, S as Rn, T as Dn, U as In, V as Nn, W as Kn, X as En, Y as Bn, Z as Ln, _ as kn } from "./index-DAyzaGWL.js";
|
|
3
3
|
import { Fragment as _n } from "react";
|
|
4
4
|
var ae = typeof globalThis < "u" && globalThis.process ? globalThis.process : { env: { NODE_ENV: "production" } };
|
|
5
5
|
function At(t, e) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import { ErrorInfo } from 'react';
|
|
1
3
|
import { JSX } from 'react/jsx-runtime';
|
|
4
|
+
import { JSXElementConstructor } from 'react';
|
|
5
|
+
import { ReactElement } from 'react';
|
|
2
6
|
import { ReactNode } from 'react';
|
|
7
|
+
import { ReactPortal } from 'react';
|
|
3
8
|
import { z } from 'zod';
|
|
4
9
|
import * as z_2 from 'zod';
|
|
5
10
|
|
|
@@ -96,6 +101,57 @@ export declare type ElementsRootProps = {
|
|
|
96
101
|
};
|
|
97
102
|
};
|
|
98
103
|
|
|
104
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
105
|
+
state: ErrorBoundaryState;
|
|
106
|
+
static getDerivedStateFromError(_error: Error): ErrorBoundaryState;
|
|
107
|
+
componentDidCatch(error: Error, _errorInfo: ErrorInfo): void;
|
|
108
|
+
render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | JSX.Element | null | undefined;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export declare type ErrorBoundaryProps = {
|
|
112
|
+
/** The content to be wrapped by the ErrorBoundary */
|
|
113
|
+
children: ReactNode;
|
|
114
|
+
/** Callback function called when an error is caught */
|
|
115
|
+
onError?: (error: Error) => void;
|
|
116
|
+
/** Custom fallback UI to render when an error occurs */
|
|
117
|
+
fallback?: ReactNode;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export declare type ErrorBoundaryState = {
|
|
121
|
+
hasError: boolean;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export declare function ErrorComponent({ classNames }: ErrorComponentProps): JSX.Element;
|
|
125
|
+
|
|
126
|
+
export declare type ErrorComponentClassNames = {
|
|
127
|
+
/** Main wrapper container for the error component */
|
|
128
|
+
base?: string;
|
|
129
|
+
/** Alert component class styling slots */
|
|
130
|
+
alert?: {
|
|
131
|
+
/** Alert container */
|
|
132
|
+
base?: string;
|
|
133
|
+
/** Alert title text */
|
|
134
|
+
title?: string;
|
|
135
|
+
/** Alert description text */
|
|
136
|
+
description?: string;
|
|
137
|
+
/** Alert main content wrapper */
|
|
138
|
+
mainWrapper?: string;
|
|
139
|
+
/** Alert close button */
|
|
140
|
+
closeButton?: string;
|
|
141
|
+
/** Alert icon wrapper */
|
|
142
|
+
iconWrapper?: string;
|
|
143
|
+
/** Alert icon */
|
|
144
|
+
alertIcon?: string;
|
|
145
|
+
};
|
|
146
|
+
/** Refresh page button */
|
|
147
|
+
button?: string;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export declare type ErrorComponentProps = {
|
|
151
|
+
/** Class slots for styling */
|
|
152
|
+
classNames?: ErrorComponentClassNames;
|
|
153
|
+
};
|
|
154
|
+
|
|
99
155
|
export declare function FilterChip({ filter, filterOption, onRemove, classNames, }: FilterChipProps): JSX.Element | null;
|
|
100
156
|
|
|
101
157
|
declare type FilterChipClassNames = {
|
|
@@ -445,7 +501,7 @@ export declare type PricingSectionProps = Pick<PropositionCardProps, 'onInfoClic
|
|
|
445
501
|
|
|
446
502
|
declare type ProductCategory = 'sim-only-proposition' | 'fixed-proposition' | 'smartphone-proposition' | 'smartphone-proposition-extended';
|
|
447
503
|
|
|
448
|
-
export declare function ProductResults({ productCategory, initialSelectedFilters, limit, classNames,
|
|
504
|
+
export declare function ProductResults({ productCategory, initialSelectedFilters, limit, classNames, initialProfile, onProfileChange, onError, }: ProductResultsProps): JSX.Element;
|
|
449
505
|
|
|
450
506
|
/**
|
|
451
507
|
* ClassNames for styling different parts of the `ProductResults` component
|
|
@@ -488,10 +544,12 @@ export declare type ProductResultsProps = {
|
|
|
488
544
|
limit?: number;
|
|
489
545
|
/** Class slots for styling */
|
|
490
546
|
classNames?: ProductResultsClassNames;
|
|
491
|
-
/**
|
|
492
|
-
|
|
547
|
+
/** Initial user profile */
|
|
548
|
+
initialProfile?: Partial<Profile>;
|
|
493
549
|
/** Callback function to handle profile changes */
|
|
494
550
|
onProfileChange?: (profile: Partial<Profile>) => void;
|
|
551
|
+
/** Callback function called when an error occurs */
|
|
552
|
+
onError?: (error: Error) => void;
|
|
495
553
|
};
|
|
496
554
|
|
|
497
555
|
/**
|
|
@@ -547,11 +605,16 @@ export declare type PromotionsListClassNames = {
|
|
|
547
605
|
item?: string;
|
|
548
606
|
/** Checkmark icon for each promotion item */
|
|
549
607
|
promotionIcon?: string;
|
|
608
|
+
/** Urgent text chip */
|
|
609
|
+
urgentChip?: string;
|
|
550
610
|
};
|
|
551
611
|
|
|
552
612
|
export declare type PromotionsListProps = {
|
|
553
613
|
/** Promotions to display */
|
|
554
614
|
promotions: string[];
|
|
615
|
+
/** Urgent text to display as a chip above promotions
|
|
616
|
+
* @example "Actie nog 6 dagen" */
|
|
617
|
+
urgentText?: string;
|
|
555
618
|
/** Class slots for styling */
|
|
556
619
|
classNames?: PromotionsListClassNames;
|
|
557
620
|
};
|
|
@@ -597,21 +660,24 @@ export declare type PropositionCardClassNames = {
|
|
|
597
660
|
/** Call To Action button
|
|
598
661
|
* @example "Bekijk" */
|
|
599
662
|
button?: string;
|
|
663
|
+
/** Card wrapper (container for the label and card) */
|
|
664
|
+
cardWrapper?: string;
|
|
665
|
+
/** Label text styling */
|
|
666
|
+
label?: string;
|
|
600
667
|
};
|
|
601
668
|
|
|
602
669
|
export declare type PropositionCardProps = {
|
|
670
|
+
/** Click handler on the card */
|
|
671
|
+
onClick: (e: {
|
|
672
|
+
target: Element;
|
|
673
|
+
}) => void;
|
|
603
674
|
/** Click handler to open the details modal */
|
|
604
675
|
onInfoClick: (tab: 'general' | 'conditions' | 'channels' | 'costs') => void;
|
|
605
676
|
/** Whether the proposition is disabled */
|
|
606
677
|
disabled?: boolean;
|
|
607
|
-
/**
|
|
608
|
-
|
|
609
|
-
/** Product title
|
|
610
|
-
* @example "iPhone 17" */
|
|
678
|
+
/** Product title - should include brand + phone name
|
|
679
|
+
* @example "Apple iPhone 17" */
|
|
611
680
|
productTitle?: string;
|
|
612
|
-
/** Product subtitle (brand)
|
|
613
|
-
* @example "Apple" */
|
|
614
|
-
productSubtitle?: string;
|
|
615
681
|
/** Product image URL */
|
|
616
682
|
productImageUrl?: string;
|
|
617
683
|
/** Product image alt text */
|
|
@@ -658,6 +724,9 @@ export declare type PropositionCardProps = {
|
|
|
658
724
|
/** Urgent text for urgent special promotion
|
|
659
725
|
* @example "Actie nog 6 dagen" */
|
|
660
726
|
urgentText?: string;
|
|
727
|
+
/** Label text to display above the card
|
|
728
|
+
* @example "Meest gekozen" */
|
|
729
|
+
label?: string;
|
|
661
730
|
/** Class slots for styling */
|
|
662
731
|
classNames?: PropositionCardClassNames;
|
|
663
732
|
horizontal?: boolean;
|
|
@@ -681,23 +750,35 @@ export declare type PropositionHeaderClassNames = {
|
|
|
681
750
|
* @example "Onbp min / sms"
|
|
682
751
|
* @example "Glasvezel" */
|
|
683
752
|
subtitle?: string;
|
|
753
|
+
/** Specifications container */
|
|
754
|
+
specifications?: string;
|
|
684
755
|
};
|
|
685
756
|
|
|
686
757
|
export declare type PropositionHeaderProps = {
|
|
758
|
+
/** Product title (for smartphone propositions) - should include brand + phone name
|
|
759
|
+
* @example "Apple iPhone 17" */
|
|
760
|
+
productTitle?: string;
|
|
687
761
|
/** Proposition title text
|
|
688
762
|
* @example "30 GB"
|
|
689
763
|
* @example "100 Mb/s" */
|
|
690
|
-
|
|
764
|
+
propositionTitle: string;
|
|
691
765
|
/** Proposition subtitle text
|
|
692
766
|
* @example "Onbp min / sms"
|
|
693
767
|
* @example "Glasvezel" */
|
|
694
|
-
|
|
768
|
+
propositionSubtitle: string;
|
|
695
769
|
/** Proposition provider image URL */
|
|
696
770
|
imageUrl?: string;
|
|
697
771
|
/** Proposition provider image alt text */
|
|
698
772
|
imageAlt?: string;
|
|
699
773
|
/** Whether the proposition has a product/phone */
|
|
700
774
|
hasProduct: boolean;
|
|
775
|
+
/** Proposition specifications */
|
|
776
|
+
propositionSpecifications?: {
|
|
777
|
+
slug: string;
|
|
778
|
+
title: string;
|
|
779
|
+
}[];
|
|
780
|
+
/** Click handler to open the details modal */
|
|
781
|
+
onInfoClick?: (tab: 'general' | 'conditions' | 'channels' | 'costs') => void;
|
|
701
782
|
/** Class slots for styling */
|
|
702
783
|
classNames?: PropositionHeaderClassNames;
|
|
703
784
|
horizontal?: boolean;
|
|
@@ -862,6 +943,58 @@ export declare type SelectFilterProps = {
|
|
|
862
943
|
classNames?: SelectFilterClassNames;
|
|
863
944
|
};
|
|
864
945
|
|
|
946
|
+
export declare function Selector({ classNames, onClick, disabled, title, description, imageUrl, imageAlt, Icon, avatarName, selected, }: SelectorProps): JSX.Element;
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* ClassNames for styling different parts of the `Selector` component
|
|
950
|
+
*/
|
|
951
|
+
export declare type SelectorClassNames = {
|
|
952
|
+
/** Title text styling */
|
|
953
|
+
title?: string;
|
|
954
|
+
/** Description text styling */
|
|
955
|
+
description?: string;
|
|
956
|
+
/** Main button wrapper */
|
|
957
|
+
button?: string;
|
|
958
|
+
/** Badge component (visible when not selected) */
|
|
959
|
+
badge?: string;
|
|
960
|
+
/** Avatar component displaying the image or icon */
|
|
961
|
+
avatar?: {
|
|
962
|
+
/** Base wrapper styling for the avatar container */
|
|
963
|
+
base?: string;
|
|
964
|
+
/** Image element styling */
|
|
965
|
+
img?: string;
|
|
966
|
+
/** Name text styling (when displaying initials) */
|
|
967
|
+
name?: string;
|
|
968
|
+
/** Icon wrapper styling */
|
|
969
|
+
icon?: string;
|
|
970
|
+
/** Fallback content styling (when no image is available) */
|
|
971
|
+
fallback?: string;
|
|
972
|
+
};
|
|
973
|
+
};
|
|
974
|
+
|
|
975
|
+
export declare type SelectorProps = {
|
|
976
|
+
/** Class slots for styling */
|
|
977
|
+
classNames?: SelectorClassNames;
|
|
978
|
+
/** Main title text */
|
|
979
|
+
title: string;
|
|
980
|
+
/** Optional description text below the title */
|
|
981
|
+
description?: string;
|
|
982
|
+
/** Whether the selector is in selected state */
|
|
983
|
+
selected?: boolean;
|
|
984
|
+
/** Click handler for the selector */
|
|
985
|
+
onClick: () => void;
|
|
986
|
+
/** Icon component to display as fallback when no image is provided */
|
|
987
|
+
Icon?: React.ElementType;
|
|
988
|
+
/** Name to display as initials in the avatar when no image is available */
|
|
989
|
+
avatarName?: string;
|
|
990
|
+
/** Image URL for the avatar */
|
|
991
|
+
imageUrl?: string | null;
|
|
992
|
+
/** Alt text for the image */
|
|
993
|
+
imageAlt?: string | null;
|
|
994
|
+
/** Whether the selector is disabled */
|
|
995
|
+
disabled?: boolean;
|
|
996
|
+
};
|
|
997
|
+
|
|
865
998
|
/**
|
|
866
999
|
* ClassNames for styling different parts of the `RangeFilter`, `MinFilter` and `MaxFilter` component
|
|
867
1000
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobielnl/elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Mobiel.nl Elements - React component library for partner websites",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"@react-stately/flags": "^3.1.2",
|
|
74
74
|
"@storybook/addon-a11y": "^9.1.2",
|
|
75
75
|
"@storybook/addon-docs": "^9.1.2",
|
|
76
|
+
"@storybook/blocks": "^8.6.14",
|
|
76
77
|
"@storybook/react-vite": "^9.1.2",
|
|
77
78
|
"@tailwindcss/vite": "^4.1.11",
|
|
78
79
|
"@types/jest": "^30.0.0",
|