@mobielnl/elements 0.1.1 → 0.3.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/dist/elements.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.umd.cjs +147 -74
- package/dist/{index-DPm2lMF_.js → index-COkpTNMQ.js} +1 -1
- package/dist/{index-BlJG1vwG.js → index-gTGsN7B4.js} +17678 -16900
- package/dist/index.d.ts +176 -105
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,14 +6,20 @@ import * as z_2 from 'zod';
|
|
|
6
6
|
export declare function ActiveFilterChips({ activeFilters, filterOptions, onFilterRemove, classNames, }: ActiveFilterChipsProps): JSX.Element | null;
|
|
7
7
|
|
|
8
8
|
declare type ActiveFilterChipsClassNames = {
|
|
9
|
+
/** The container of the filter chips */
|
|
9
10
|
container?: string;
|
|
11
|
+
/** The filter chip element */
|
|
10
12
|
filterChip?: FilterChipClassNames;
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
declare type ActiveFilterChipsProps = {
|
|
16
|
+
/** Currently active filter values */
|
|
14
17
|
activeFilters: FilterValue[];
|
|
18
|
+
/** Available filter options to display */
|
|
15
19
|
filterOptions: FilterOption[];
|
|
20
|
+
/** Callback when a filter value is removed */
|
|
16
21
|
onFilterRemove: (filter: FilterValue) => void;
|
|
22
|
+
/** Class slots for styling */
|
|
17
23
|
classNames?: ActiveFilterChipsClassNames;
|
|
18
24
|
};
|
|
19
25
|
|
|
@@ -34,24 +40,29 @@ export declare type ElementsRootProps = {
|
|
|
34
40
|
classNames?: ElementsClassNames;
|
|
35
41
|
};
|
|
36
42
|
|
|
37
|
-
export declare function FilterChip({ filter, filterOption, onRemove, classNames, }: FilterChipProps): JSX.Element;
|
|
43
|
+
export declare function FilterChip({ filter, filterOption, onRemove, classNames, }: FilterChipProps): JSX.Element | null;
|
|
38
44
|
|
|
39
45
|
declare type FilterChipClassNames = {
|
|
46
|
+
/** The base slot of the chip, it is the container of the chip */
|
|
40
47
|
base?: string;
|
|
48
|
+
/** The content slot of the chip, it is the container of the chip children */
|
|
41
49
|
content?: string;
|
|
42
|
-
|
|
43
|
-
avatar?: string;
|
|
50
|
+
/** Close button classes of the chip */
|
|
44
51
|
closeButton?: string;
|
|
45
52
|
};
|
|
46
53
|
|
|
47
54
|
declare type FilterChipProps = {
|
|
55
|
+
/** Filter value */
|
|
48
56
|
filter: FilterValue;
|
|
57
|
+
/** Filter option */
|
|
49
58
|
filterOption: FilterOption;
|
|
59
|
+
/** Callback when the filter is removed */
|
|
50
60
|
onRemove: (filter: FilterValue) => void;
|
|
61
|
+
/** Class slots for styling */
|
|
51
62
|
classNames?: FilterChipClassNames;
|
|
52
63
|
};
|
|
53
64
|
|
|
54
|
-
export declare function FilterModal({
|
|
65
|
+
export declare function FilterModal({ filterOptions, activeFilters, onFilterChange, classNames, }: FilterModalProps): JSX.Element;
|
|
55
66
|
|
|
56
67
|
/**
|
|
57
68
|
* ClassNames for styling different parts of the `FilterModal` component
|
|
@@ -74,32 +85,9 @@ export declare type FilterModalProps = Omit<FiltersProps, 'classNames'> & {
|
|
|
74
85
|
/**
|
|
75
86
|
* Configuration for a single filter option
|
|
76
87
|
*/
|
|
77
|
-
declare type FilterOption =
|
|
78
|
-
/** Unique identifier for the filter */
|
|
79
|
-
id: string;
|
|
80
|
-
/** Display label for the filter
|
|
81
|
-
* @example "Prijs per maand" */
|
|
82
|
-
label: string;
|
|
83
|
-
/** Type of filter control to render */
|
|
84
|
-
type: 'range' | 'select' | 'radio' | 'hidden';
|
|
85
|
-
/** Available options for select-type filters
|
|
86
|
-
* @example ["1 jaar", "2 jaar", "Onbepaalde tijd"] */
|
|
87
|
-
options?: string[] | number[];
|
|
88
|
-
/** Minimum value for range-type filters */
|
|
89
|
-
min?: number;
|
|
90
|
-
/** Maximum value for range-type filters */
|
|
91
|
-
max?: number;
|
|
92
|
-
/** Step increment for range-type filters
|
|
93
|
-
* @example 5 */
|
|
94
|
-
step?: number;
|
|
95
|
-
/** Unit to display with range values
|
|
96
|
-
* @example "€" or "GB" */
|
|
97
|
-
unit?: string;
|
|
98
|
-
/** Format type for the filter value */
|
|
99
|
-
formatType?: 'currency' | 'percentage' | 'decimal' | 'integer' | string;
|
|
100
|
-
};
|
|
88
|
+
declare type FilterOption = NonNullable<GetPageByPathQuery['page']>['pageFilters'][number];
|
|
101
89
|
|
|
102
|
-
export declare function Filters({
|
|
90
|
+
export declare function Filters({ filterOptions, activeFilters, onFilterChange, classNames, }: FiltersProps): JSX.Element | null;
|
|
103
91
|
|
|
104
92
|
/**
|
|
105
93
|
* ClassNames for styling different parts of the `Filters` component
|
|
@@ -116,8 +104,8 @@ export declare type FiltersClassNames = {
|
|
|
116
104
|
/** Filter group label/heading
|
|
117
105
|
* @example "Prijs per maand" */
|
|
118
106
|
filterLabel?: string;
|
|
119
|
-
/** Range filter class styling slots - see type `
|
|
120
|
-
|
|
107
|
+
/** Range filter class styling slots - see type `SliderFilterClassNames` */
|
|
108
|
+
sliderFilter?: SliderFilterClassNames;
|
|
121
109
|
/** Select filter class styling slots - see type `SelectFilterClassNames` */
|
|
122
110
|
selectFilter?: SelectFilterClassNames;
|
|
123
111
|
/** Radio filter class styling slots - see type `RadioFilterClassNames` */
|
|
@@ -126,7 +114,7 @@ export declare type FiltersClassNames = {
|
|
|
126
114
|
|
|
127
115
|
export declare type FiltersProps = {
|
|
128
116
|
/** Available filter options to display */
|
|
129
|
-
|
|
117
|
+
filterOptions: FilterOption[];
|
|
130
118
|
/** Currently active filter values */
|
|
131
119
|
activeFilters: FilterValue[];
|
|
132
120
|
/** Callback when a filter value changes */
|
|
@@ -139,14 +127,16 @@ export declare type FiltersProps = {
|
|
|
139
127
|
* Represents an active filter value selected by the user
|
|
140
128
|
*/
|
|
141
129
|
declare type FilterValue = {
|
|
142
|
-
/** Identifier matching the corresponding `FilterOption
|
|
143
|
-
|
|
130
|
+
/** Identifier slug matching the corresponding `FilterOption.slug` */
|
|
131
|
+
slug: string;
|
|
144
132
|
/** The selected value(s) - type depends on filter type:
|
|
145
|
-
* - string
|
|
146
|
-
* -
|
|
147
|
-
* -
|
|
148
|
-
* -
|
|
149
|
-
|
|
133
|
+
* - `string`: single text value for types: radio/range/min/max
|
|
134
|
+
* - `string[]`: multiple selected options for type select
|
|
135
|
+
* @example "150-400" // Range: from 150 to 400
|
|
136
|
+
* @example "150-" // Min: from 150
|
|
137
|
+
* @example "-400" // Max: up to 400
|
|
138
|
+
* @example ["KPN", "Vodafone", "Odido"] // Select: KPN, Vodafone, Odido */
|
|
139
|
+
value: string | string[];
|
|
150
140
|
};
|
|
151
141
|
|
|
152
142
|
/**
|
|
@@ -178,6 +168,45 @@ export declare type FooterInfoProps = {
|
|
|
178
168
|
hasProduct?: boolean;
|
|
179
169
|
};
|
|
180
170
|
|
|
171
|
+
declare type GetPageByPathQuery = {
|
|
172
|
+
__typename?: 'RootQueryType';
|
|
173
|
+
page?: {
|
|
174
|
+
__typename?: 'Page';
|
|
175
|
+
productCategory: string;
|
|
176
|
+
filter: string;
|
|
177
|
+
filterDefaults: string;
|
|
178
|
+
pageFilters: Array<{
|
|
179
|
+
__typename?: 'PageFilter';
|
|
180
|
+
id: string;
|
|
181
|
+
name: string;
|
|
182
|
+
shortName: string;
|
|
183
|
+
slug: string;
|
|
184
|
+
column: string;
|
|
185
|
+
type: string;
|
|
186
|
+
valueType: string;
|
|
187
|
+
dynamic: boolean;
|
|
188
|
+
min?: number | null;
|
|
189
|
+
max?: number | null;
|
|
190
|
+
rank: number;
|
|
191
|
+
operator: string;
|
|
192
|
+
url?: string | null;
|
|
193
|
+
formatType: string;
|
|
194
|
+
showCounts: boolean;
|
|
195
|
+
options: Array<{
|
|
196
|
+
__typename?: 'PageFilterOption';
|
|
197
|
+
name: string;
|
|
198
|
+
descriptiveName: string;
|
|
199
|
+
value: string;
|
|
200
|
+
}>;
|
|
201
|
+
aliases: Array<{
|
|
202
|
+
__typename?: 'PageFilterAlias';
|
|
203
|
+
name: string;
|
|
204
|
+
value: string;
|
|
205
|
+
}>;
|
|
206
|
+
}>;
|
|
207
|
+
} | null;
|
|
208
|
+
};
|
|
209
|
+
|
|
181
210
|
declare type ListBoxClassNames = {
|
|
182
211
|
base?: string;
|
|
183
212
|
wrapper?: string;
|
|
@@ -221,9 +250,11 @@ declare type PostcodeCheckLoadingClassNames = {
|
|
|
221
250
|
icon?: string;
|
|
222
251
|
/** Wrapper container for the text */
|
|
223
252
|
textWrapper?: string;
|
|
224
|
-
/** Heading text
|
|
253
|
+
/** Heading text
|
|
254
|
+
* @example "Aan het zoeken naar de beste deals..." */
|
|
225
255
|
heading?: string;
|
|
226
|
-
/** Address text
|
|
256
|
+
/** Address text
|
|
257
|
+
* @example "Straatnaam 1, Stad" */
|
|
227
258
|
addressText?: string;
|
|
228
259
|
};
|
|
229
260
|
|
|
@@ -265,7 +296,7 @@ export declare type PricingSectionProps = {
|
|
|
265
296
|
|
|
266
297
|
declare type ProductCategory = 'sim-only-proposition' | 'smartphone-proposition' | 'phone-and-subscription' | 'fixed-proposition';
|
|
267
298
|
|
|
268
|
-
export declare function ProductResults({ productCategory,
|
|
299
|
+
export declare function ProductResults({ productCategory, initialSelectedFilters, limit, propositionCardLayout, classNames, profile, onProfileChange, }: ProductResultsProps): JSX.Element;
|
|
269
300
|
|
|
270
301
|
/**
|
|
271
302
|
* ClassNames for styling different parts of the `ProductResults` component
|
|
@@ -285,6 +316,8 @@ export declare type ProductResultsClassNames = {
|
|
|
285
316
|
modal?: ModalClassNames;
|
|
286
317
|
/** Grid wrapper of the results */
|
|
287
318
|
resultsGrid?: string;
|
|
319
|
+
/** Results not found component class styling slots - see type `ResultsNotFoundClassNames` */
|
|
320
|
+
resultsNotFound?: ResultsNotFoundClassNames;
|
|
288
321
|
/** Proposition card class styling slots - see type `PropositionCardClassNames` */
|
|
289
322
|
propositionCard?: PropositionCardClassNames;
|
|
290
323
|
/** PostcodeCheck loading card class styling slots (only for fixed propositions) - see type `PostcodeCheckLoadingClassNames` */
|
|
@@ -294,8 +327,6 @@ export declare type ProductResultsClassNames = {
|
|
|
294
327
|
export declare type ProductResultsProps = {
|
|
295
328
|
/** Product type of the results */
|
|
296
329
|
productCategory: ProductCategory;
|
|
297
|
-
/** Filter options to display */
|
|
298
|
-
filterOptions?: FilterOption[];
|
|
299
330
|
/** Initial selected filters */
|
|
300
331
|
initialSelectedFilters?: FilterValue[];
|
|
301
332
|
/** Limit the number of propositions to display */
|
|
@@ -621,71 +652,43 @@ export declare type RadioFilterClassNames = {
|
|
|
621
652
|
export declare type RadioFilterProps = {
|
|
622
653
|
/** Unique identifier for this filter */
|
|
623
654
|
id: string;
|
|
624
|
-
/** Available options to display as radio options
|
|
625
|
-
|
|
626
|
-
options: string[] | number[];
|
|
655
|
+
/** Available options to display as radio options */
|
|
656
|
+
options: FilterOption['options'];
|
|
627
657
|
/** Currently selected value */
|
|
628
|
-
value?: string
|
|
658
|
+
value?: string;
|
|
629
659
|
/** Callback when selection changes */
|
|
630
660
|
onChange: (value: string) => void;
|
|
631
661
|
/** Class slots for styling */
|
|
632
662
|
classNames?: RadioFilterClassNames;
|
|
633
663
|
};
|
|
634
664
|
|
|
635
|
-
export declare function RangeFilter({ min, max, step,
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* ClassNames for styling different parts of the `RangeFilter` component
|
|
639
|
-
*/
|
|
640
|
-
export declare type RangeFilterClassNames = {
|
|
641
|
-
/** The foundational slot, encompassing all other slots and elements
|
|
642
|
-
*
|
|
643
|
-
* It serves as the primary container */
|
|
644
|
-
base?: string;
|
|
645
|
-
/** The container for the Slider's label and value
|
|
646
|
-
*
|
|
647
|
-
* It aligns these elements and ensures a consistent layout */
|
|
648
|
-
labelWrapper?: string;
|
|
649
|
-
/** A dedicated slot to display the Slider's label
|
|
650
|
-
* @example "€ 0 - € 100" */
|
|
651
|
-
label?: string;
|
|
652
|
-
/** Displays the current value of the Slider
|
|
653
|
-
*
|
|
654
|
-
* Located within the `labelWrapper` */
|
|
655
|
-
value?: string;
|
|
656
|
-
/** Represents individual steps or intervals on the Slider */
|
|
657
|
-
step?: string;
|
|
658
|
-
/** Denotes specific values or intervals along the Slider */
|
|
659
|
-
mark?: string;
|
|
660
|
-
/** A container for the slider's track, ensuring it is consistently aligned and positioned */
|
|
661
|
-
trackWrapper?: string;
|
|
662
|
-
/** The base bar of the Slider, along which the thumb moves */
|
|
663
|
-
track?: string;
|
|
664
|
-
/** A visual representation of the selected value, filling the track from the start point to the current thumb position */
|
|
665
|
-
filler?: string;
|
|
666
|
-
/** The interactive element that users drag along the track to select a value on the Slider */
|
|
667
|
-
thumb?: string;
|
|
668
|
-
};
|
|
665
|
+
export declare function RangeFilter({ min, max, step, value, options, maxOptionValue, marks, formatType, onChange, classNames, }: SliderFilterProps): JSX.Element;
|
|
669
666
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
667
|
+
declare type ResultsNotFoundClassNames = {
|
|
668
|
+
filterChips?: ActiveFilterChipsClassNames & {
|
|
669
|
+
/** The title element above the filter chips
|
|
670
|
+
* @example "Gekozen filters:" */
|
|
671
|
+
title?: string;
|
|
672
|
+
};
|
|
673
|
+
/** The alert element */
|
|
674
|
+
alert?: {
|
|
675
|
+
/** The main alert container element */
|
|
676
|
+
base?: string;
|
|
677
|
+
/** The alert title element
|
|
678
|
+
* @example "Geen resultaten gevonden" */
|
|
679
|
+
title?: string;
|
|
680
|
+
/** The alert description element
|
|
681
|
+
* @example "Er zijn geen producten gevonden met je gekozen filtercombinatie." */
|
|
682
|
+
description?: string;
|
|
683
|
+
/** The wrapper for the title and description content */
|
|
684
|
+
mainWrapper?: string;
|
|
685
|
+
/** The close button element */
|
|
686
|
+
closeButton?: string;
|
|
687
|
+
/** The wrapper for the alert icon */
|
|
688
|
+
iconWrapper?: string;
|
|
689
|
+
/** The alert icon element */
|
|
690
|
+
alertIcon?: string;
|
|
691
|
+
};
|
|
689
692
|
};
|
|
690
693
|
|
|
691
694
|
export declare function SelectFilter({ id, options, values, onChange, classNames, }: SelectFilterProps): JSX.Element;
|
|
@@ -725,17 +728,85 @@ export declare type SelectFilterClassNames = {
|
|
|
725
728
|
export declare type SelectFilterProps = {
|
|
726
729
|
/** Unique identifier for this filter */
|
|
727
730
|
id: string;
|
|
728
|
-
/** Available options to display as checkboxes
|
|
729
|
-
|
|
730
|
-
options: string[] | number[];
|
|
731
|
+
/** Available options to display as checkboxes */
|
|
732
|
+
options: FilterOption['options'];
|
|
731
733
|
/** Currently selected values */
|
|
732
|
-
values?: string[]
|
|
734
|
+
values?: string[];
|
|
733
735
|
/** Callback when selection changes */
|
|
734
736
|
onChange: (values: string[]) => void;
|
|
735
737
|
/** Class slots for styling */
|
|
736
738
|
classNames?: SelectFilterClassNames;
|
|
737
739
|
};
|
|
738
740
|
|
|
741
|
+
/**
|
|
742
|
+
* ClassNames for styling different parts of the `RangeFilter`, `MinFilter` and `MaxFilter` component
|
|
743
|
+
*/
|
|
744
|
+
export declare type SliderFilterClassNames = {
|
|
745
|
+
/** The foundational slot, encompassing all other slots and elements
|
|
746
|
+
*
|
|
747
|
+
* It serves as the primary container */
|
|
748
|
+
base?: string;
|
|
749
|
+
/** The container for the Slider's label and value
|
|
750
|
+
*
|
|
751
|
+
* It aligns these elements and ensures a consistent layout */
|
|
752
|
+
labelWrapper?: string;
|
|
753
|
+
/** A dedicated slot to display the Slider's label
|
|
754
|
+
* @example "€ 0 - € 100" */
|
|
755
|
+
label?: string;
|
|
756
|
+
/** Displays the current value of the Slider
|
|
757
|
+
*
|
|
758
|
+
* Located within the `labelWrapper` */
|
|
759
|
+
value?: string;
|
|
760
|
+
/** Represents individual steps or intervals on the Slider */
|
|
761
|
+
step?: string;
|
|
762
|
+
/** Denotes specific values or intervals along the Slider */
|
|
763
|
+
mark?: string;
|
|
764
|
+
/** A container for the slider's track, ensuring it is consistently aligned and positioned */
|
|
765
|
+
trackWrapper?: string;
|
|
766
|
+
/** The base bar of the Slider, along which the thumb moves */
|
|
767
|
+
track?: string;
|
|
768
|
+
/** A visual representation of the selected value, filling the track from the start point to the current thumb position */
|
|
769
|
+
filler?: string;
|
|
770
|
+
/** The interactive element that users drag along the track to select a value on the Slider */
|
|
771
|
+
thumb?: string;
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
export declare type SliderFilterProps = {
|
|
775
|
+
/** Unique identifier for this filter */
|
|
776
|
+
id: string;
|
|
777
|
+
/** Minimum value of the range */
|
|
778
|
+
min: number;
|
|
779
|
+
/** Maximum value of the range */
|
|
780
|
+
max: number;
|
|
781
|
+
/** Step increment for the slider
|
|
782
|
+
* @example 5 */
|
|
783
|
+
step: number;
|
|
784
|
+
/** Available fixed values within the slider
|
|
785
|
+
* @example "[0,100,150,200,400,UNLIMITED]" // from 0 to Unlimited */
|
|
786
|
+
options: number[];
|
|
787
|
+
/** The maximum value of the slider, calculated from the options and step */
|
|
788
|
+
maxOptionValue: number;
|
|
789
|
+
/** Currently selected value
|
|
790
|
+
* @example "150-400" // Range: from 150 to 400
|
|
791
|
+
* @example "150-" // Min: from 150
|
|
792
|
+
* @example "-400" // Max: up to 400
|
|
793
|
+
*/
|
|
794
|
+
value?: string;
|
|
795
|
+
/** The marks to display on the Slider's steps. */
|
|
796
|
+
marks: {
|
|
797
|
+
/** The value corresponding to the mark */
|
|
798
|
+
value: number;
|
|
799
|
+
/** The label text of the mark */
|
|
800
|
+
label: string;
|
|
801
|
+
}[];
|
|
802
|
+
/** Format type for the filter value */
|
|
803
|
+
formatType?: FilterOption['formatType'];
|
|
804
|
+
/** Callback when value changes */
|
|
805
|
+
onChange: (value: string) => void;
|
|
806
|
+
/** Class slots for styling */
|
|
807
|
+
classNames?: SliderFilterClassNames;
|
|
808
|
+
};
|
|
809
|
+
|
|
739
810
|
declare type SortSelectClassNames = {
|
|
740
811
|
description?: string;
|
|
741
812
|
errorMessage?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobielnl/elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Mobiel.nl Elements - React component library for partner websites",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"@graphql-codegen/typescript": "^4.1.2",
|
|
49
49
|
"@graphql-codegen/typescript-graphql-request": "^6.2.0",
|
|
50
50
|
"@graphql-codegen/typescript-operations": "^4.4.0",
|
|
51
|
+
"@heroui/alert": "^2.2.27",
|
|
51
52
|
"@heroui/button": "^2.2.24",
|
|
52
53
|
"@heroui/card": "^2.2.23",
|
|
53
54
|
"@heroui/checkbox": "^2.3.24",
|