@mobielnl/elements 0.1.1 → 0.2.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 +72 -67
- package/dist/{index-BlJG1vwG.js → index-Cojc9OdQ.js} +15472 -14854
- package/dist/{index-DPm2lMF_.js → index-CyWFCJP8.js} +1 -1
- package/dist/index.d.ts +136 -80
- package/package.json +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { i as q, n as Ue, a as Pt, c as Y, p as Ve, w as he, b as $e, d as Ft, t as Dt, e as Kn, v as Bn, f as Ln, g as _n, h as Et, j as Un, k as $n, l as k, m as Gn, o as jn, q as fe, r as st, s as Ot, u as Wn, x as Hn, y as zn, z as It, A as qn, B as Yn, C as Xn, D as Zn, E as Jn, F as Rt, G as Nt, H as kt, I as Kt } from "./index-
|
|
2
|
+
import { i as q, n as Ue, a as Pt, c as Y, p as Ve, w as he, b as $e, d as Ft, t as Dt, e as Kn, v as Bn, f as Ln, g as _n, h as Et, j as Un, k as $n, l as k, m as Gn, o as jn, q as fe, r as st, s as Ot, u as Wn, x as Hn, y as zn, z as It, A as qn, B as Yn, C as Xn, D as Zn, E as Jn, F as Rt, G as Nt, H as kt, I as Kt } from "./index-Cojc9OdQ.js";
|
|
3
3
|
import { Fragment as Qn } from "react";
|
|
4
4
|
var _e = typeof globalThis < "u" && globalThis.process ? globalThis.process : { env: { NODE_ENV: "production" } };
|
|
5
5
|
function es(t, e) {
|
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
|
|
|
@@ -37,21 +43,26 @@ export declare type ElementsRootProps = {
|
|
|
37
43
|
export declare function FilterChip({ filter, filterOption, onRemove, classNames, }: FilterChipProps): JSX.Element;
|
|
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
|
|
@@ -81,25 +92,22 @@ declare type FilterOption = {
|
|
|
81
92
|
* @example "Prijs per maand" */
|
|
82
93
|
label: string;
|
|
83
94
|
/** Type of filter control to render */
|
|
84
|
-
type: 'range' | 'select' | 'radio' | 'hidden';
|
|
95
|
+
type: 'range' | 'min' | 'max' | 'select' | 'radio' | 'hidden';
|
|
85
96
|
/** Available options for select-type filters
|
|
86
97
|
* @example ["1 jaar", "2 jaar", "Onbepaalde tijd"] */
|
|
87
|
-
options?: string[]
|
|
88
|
-
/** Minimum value for
|
|
98
|
+
options?: string[];
|
|
99
|
+
/** Minimum value for slider-type filters */
|
|
89
100
|
min?: number;
|
|
90
|
-
/** Maximum value for
|
|
101
|
+
/** Maximum value for slider-type filters */
|
|
91
102
|
max?: number;
|
|
92
|
-
/** Step increment for
|
|
103
|
+
/** Step increment for slider-type filters
|
|
93
104
|
* @example 5 */
|
|
94
105
|
step?: number;
|
|
95
|
-
/** Unit to display with range values
|
|
96
|
-
* @example "€" or "GB" */
|
|
97
|
-
unit?: string;
|
|
98
106
|
/** Format type for the filter value */
|
|
99
|
-
formatType?: '
|
|
107
|
+
formatType?: 'price' | 'data' | 'minutes' | 'sms' | 'months' | 'data_speed' | 'hours' | 'inches' | 'centimeters' | 'milliamperes';
|
|
100
108
|
};
|
|
101
109
|
|
|
102
|
-
export declare function Filters({
|
|
110
|
+
export declare function Filters({ filterOptions, activeFilters, onFilterChange, classNames, }: FiltersProps): JSX.Element | null;
|
|
103
111
|
|
|
104
112
|
/**
|
|
105
113
|
* ClassNames for styling different parts of the `Filters` component
|
|
@@ -116,8 +124,8 @@ export declare type FiltersClassNames = {
|
|
|
116
124
|
/** Filter group label/heading
|
|
117
125
|
* @example "Prijs per maand" */
|
|
118
126
|
filterLabel?: string;
|
|
119
|
-
/** Range filter class styling slots - see type `
|
|
120
|
-
|
|
127
|
+
/** Range filter class styling slots - see type `SliderFilterClassNames` */
|
|
128
|
+
sliderFilter?: SliderFilterClassNames;
|
|
121
129
|
/** Select filter class styling slots - see type `SelectFilterClassNames` */
|
|
122
130
|
selectFilter?: SelectFilterClassNames;
|
|
123
131
|
/** Radio filter class styling slots - see type `RadioFilterClassNames` */
|
|
@@ -126,7 +134,7 @@ export declare type FiltersClassNames = {
|
|
|
126
134
|
|
|
127
135
|
export declare type FiltersProps = {
|
|
128
136
|
/** Available filter options to display */
|
|
129
|
-
|
|
137
|
+
filterOptions: FilterOption[];
|
|
130
138
|
/** Currently active filter values */
|
|
131
139
|
activeFilters: FilterValue[];
|
|
132
140
|
/** Callback when a filter value changes */
|
|
@@ -142,11 +150,13 @@ declare type FilterValue = {
|
|
|
142
150
|
/** Identifier matching the corresponding `FilterOption[id]` */
|
|
143
151
|
id: string;
|
|
144
152
|
/** The selected value(s) - type depends on filter type:
|
|
145
|
-
* - string
|
|
146
|
-
* -
|
|
147
|
-
* -
|
|
148
|
-
* -
|
|
149
|
-
|
|
153
|
+
* - `string`: single text value for types: radio/range/min/max
|
|
154
|
+
* - `string[]`: multiple selected options for type select
|
|
155
|
+
* @example "150-400" // Range: from 150 to 400
|
|
156
|
+
* @example "150-" // Min: from 150
|
|
157
|
+
* @example "-400" // Max: up to 400
|
|
158
|
+
* @example ["KPN", "Vodafone", "Odido"] // Select: KPN, Vodafone, Odido */
|
|
159
|
+
value: string | string[];
|
|
150
160
|
};
|
|
151
161
|
|
|
152
162
|
/**
|
|
@@ -221,9 +231,11 @@ declare type PostcodeCheckLoadingClassNames = {
|
|
|
221
231
|
icon?: string;
|
|
222
232
|
/** Wrapper container for the text */
|
|
223
233
|
textWrapper?: string;
|
|
224
|
-
/** Heading text
|
|
234
|
+
/** Heading text
|
|
235
|
+
* @example "Aan het zoeken naar de beste deals..." */
|
|
225
236
|
heading?: string;
|
|
226
|
-
/** Address text
|
|
237
|
+
/** Address text
|
|
238
|
+
* @example "Straatnaam 1, Stad" */
|
|
227
239
|
addressText?: string;
|
|
228
240
|
};
|
|
229
241
|
|
|
@@ -285,6 +297,8 @@ export declare type ProductResultsClassNames = {
|
|
|
285
297
|
modal?: ModalClassNames;
|
|
286
298
|
/** Grid wrapper of the results */
|
|
287
299
|
resultsGrid?: string;
|
|
300
|
+
/** Results not found component class styling slots - see type `ResultsNotFoundClassNames` */
|
|
301
|
+
resultsNotFound?: ResultsNotFoundClassNames;
|
|
288
302
|
/** Proposition card class styling slots - see type `PropositionCardClassNames` */
|
|
289
303
|
propositionCard?: PropositionCardClassNames;
|
|
290
304
|
/** PostcodeCheck loading card class styling slots (only for fixed propositions) - see type `PostcodeCheckLoadingClassNames` */
|
|
@@ -623,69 +637,42 @@ export declare type RadioFilterProps = {
|
|
|
623
637
|
id: string;
|
|
624
638
|
/** Available options to display as radio options
|
|
625
639
|
* @example ["1 jaar", "2 jaar", "Onbepaalde tijd"] */
|
|
626
|
-
options: string[]
|
|
640
|
+
options: string[];
|
|
627
641
|
/** Currently selected value */
|
|
628
|
-
value?: string
|
|
642
|
+
value?: string;
|
|
629
643
|
/** Callback when selection changes */
|
|
630
644
|
onChange: (value: string) => void;
|
|
631
645
|
/** Class slots for styling */
|
|
632
646
|
classNames?: RadioFilterClassNames;
|
|
633
647
|
};
|
|
634
648
|
|
|
635
|
-
export declare function RangeFilter({ min, max, step,
|
|
649
|
+
export declare function RangeFilter({ min, max, step, value, options, maxOptionValue, marks, formatType, onChange, classNames, }: SliderFilterProps): JSX.Element;
|
|
636
650
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
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
|
-
};
|
|
669
|
-
|
|
670
|
-
export declare type RangeFilterProps = {
|
|
671
|
-
/** Unique identifier for this filter */
|
|
672
|
-
id: string;
|
|
673
|
-
/** Minimum value of the range */
|
|
674
|
-
min: number;
|
|
675
|
-
/** Maximum value of the range */
|
|
676
|
-
max: number;
|
|
677
|
-
/** Step increment for the slider
|
|
678
|
-
* @example 5 */
|
|
679
|
-
step?: number;
|
|
680
|
-
/** Unit to display with values
|
|
681
|
-
* @example "€" or "GB" */
|
|
682
|
-
unit?: string;
|
|
683
|
-
/** Currently selected range [min, max] */
|
|
684
|
-
value?: [number, number];
|
|
685
|
-
/** Callback when range changes */
|
|
686
|
-
onChange: (value: [number, number]) => void;
|
|
687
|
-
/** Class slots for styling */
|
|
688
|
-
classNames?: RangeFilterClassNames;
|
|
651
|
+
declare type ResultsNotFoundClassNames = {
|
|
652
|
+
filterChips?: ActiveFilterChipsClassNames & {
|
|
653
|
+
/** The title element above the filter chips
|
|
654
|
+
* @example "Gekozen filters:" */
|
|
655
|
+
title?: string;
|
|
656
|
+
};
|
|
657
|
+
/** The alert element */
|
|
658
|
+
alert?: {
|
|
659
|
+
/** The main alert container element */
|
|
660
|
+
base?: string;
|
|
661
|
+
/** The alert title element
|
|
662
|
+
* @example "Geen resultaten gevonden" */
|
|
663
|
+
title?: string;
|
|
664
|
+
/** The alert description element
|
|
665
|
+
* @example "Er zijn geen producten gevonden met je gekozen filtercombinatie." */
|
|
666
|
+
description?: string;
|
|
667
|
+
/** The wrapper for the title and description content */
|
|
668
|
+
mainWrapper?: string;
|
|
669
|
+
/** The close button element */
|
|
670
|
+
closeButton?: string;
|
|
671
|
+
/** The wrapper for the alert icon */
|
|
672
|
+
iconWrapper?: string;
|
|
673
|
+
/** The alert icon element */
|
|
674
|
+
alertIcon?: string;
|
|
675
|
+
};
|
|
689
676
|
};
|
|
690
677
|
|
|
691
678
|
export declare function SelectFilter({ id, options, values, onChange, classNames, }: SelectFilterProps): JSX.Element;
|
|
@@ -727,15 +714,84 @@ export declare type SelectFilterProps = {
|
|
|
727
714
|
id: string;
|
|
728
715
|
/** Available options to display as checkboxes
|
|
729
716
|
* @example ["1 jaar", "2 jaar", "Onbepaalde tijd"] */
|
|
730
|
-
options: string[]
|
|
717
|
+
options: string[];
|
|
731
718
|
/** Currently selected values */
|
|
732
|
-
values?: string[]
|
|
719
|
+
values?: string[];
|
|
733
720
|
/** Callback when selection changes */
|
|
734
721
|
onChange: (values: string[]) => void;
|
|
735
722
|
/** Class slots for styling */
|
|
736
723
|
classNames?: SelectFilterClassNames;
|
|
737
724
|
};
|
|
738
725
|
|
|
726
|
+
/**
|
|
727
|
+
* ClassNames for styling different parts of the `RangeFilter`, `MinFilter` and `MaxFilter` component
|
|
728
|
+
*/
|
|
729
|
+
export declare type SliderFilterClassNames = {
|
|
730
|
+
/** The foundational slot, encompassing all other slots and elements
|
|
731
|
+
*
|
|
732
|
+
* It serves as the primary container */
|
|
733
|
+
base?: string;
|
|
734
|
+
/** The container for the Slider's label and value
|
|
735
|
+
*
|
|
736
|
+
* It aligns these elements and ensures a consistent layout */
|
|
737
|
+
labelWrapper?: string;
|
|
738
|
+
/** A dedicated slot to display the Slider's label
|
|
739
|
+
* @example "€ 0 - € 100" */
|
|
740
|
+
label?: string;
|
|
741
|
+
/** Displays the current value of the Slider
|
|
742
|
+
*
|
|
743
|
+
* Located within the `labelWrapper` */
|
|
744
|
+
value?: string;
|
|
745
|
+
/** Represents individual steps or intervals on the Slider */
|
|
746
|
+
step?: string;
|
|
747
|
+
/** Denotes specific values or intervals along the Slider */
|
|
748
|
+
mark?: string;
|
|
749
|
+
/** A container for the slider's track, ensuring it is consistently aligned and positioned */
|
|
750
|
+
trackWrapper?: string;
|
|
751
|
+
/** The base bar of the Slider, along which the thumb moves */
|
|
752
|
+
track?: string;
|
|
753
|
+
/** A visual representation of the selected value, filling the track from the start point to the current thumb position */
|
|
754
|
+
filler?: string;
|
|
755
|
+
/** The interactive element that users drag along the track to select a value on the Slider */
|
|
756
|
+
thumb?: string;
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
export declare type SliderFilterProps = {
|
|
760
|
+
/** Unique identifier for this filter */
|
|
761
|
+
id: string;
|
|
762
|
+
/** Minimum value of the range */
|
|
763
|
+
min: number;
|
|
764
|
+
/** Maximum value of the range */
|
|
765
|
+
max: number;
|
|
766
|
+
/** Step increment for the slider
|
|
767
|
+
* @example 5 */
|
|
768
|
+
step: number;
|
|
769
|
+
/** Available fixed values within the slider
|
|
770
|
+
* @example "[0,100,150,200,400,UNLIMITED]" // from 0 to Unlimited */
|
|
771
|
+
options: number[];
|
|
772
|
+
/** The maximum value of the slider, calculated from the options and step */
|
|
773
|
+
maxOptionValue: number;
|
|
774
|
+
/** Currently selected value
|
|
775
|
+
* @example "150-400" // Range: from 150 to 400
|
|
776
|
+
* @example "150-" // Min: from 150
|
|
777
|
+
* @example "-400" // Max: up to 400
|
|
778
|
+
*/
|
|
779
|
+
value?: string;
|
|
780
|
+
/** The marks to display on the Slider's steps. */
|
|
781
|
+
marks: {
|
|
782
|
+
/** The value corresponding to the mark */
|
|
783
|
+
value: number;
|
|
784
|
+
/** The label text of the mark */
|
|
785
|
+
label: string;
|
|
786
|
+
}[];
|
|
787
|
+
/** Format type for the filter value */
|
|
788
|
+
formatType?: FilterOption['formatType'];
|
|
789
|
+
/** Callback when value changes */
|
|
790
|
+
onChange: (value: string) => void;
|
|
791
|
+
/** Class slots for styling */
|
|
792
|
+
classNames?: SliderFilterClassNames;
|
|
793
|
+
};
|
|
794
|
+
|
|
739
795
|
declare type SortSelectClassNames = {
|
|
740
796
|
description?: string;
|
|
741
797
|
errorMessage?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobielnl/elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.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",
|