@mobielnl/elements 0.9.0 → 0.10.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/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { JSX } from 'react/jsx-runtime';
2
+ import { PopoverContentClassNames } from '../../../lib/hooks/usePopoverProps';
2
3
  import { ReactNode } from 'react';
3
4
  import { z } from 'zod';
4
5
  import * as z_2 from 'zod';
@@ -342,6 +343,51 @@ export declare type ElementsRootProps = {
342
343
  css?: string;
343
344
  cssUrl?: string;
344
345
  };
346
+ /**
347
+ * Translations per locale for customizing copy/tone of voice
348
+ *
349
+ * @example
350
+ * translations={{
351
+ * // Locale 'nl' can be partial as undefined values fallback to default 'nl' translations
352
+ * nl: {
353
+ * common: {
354
+ * yes: 'Ja',
355
+ * },
356
+ * },
357
+ * // Locale 'en' can be partial as undefined values fallback to default 'en' translations
358
+ * en: {
359
+ * common: {
360
+ * yes: 'Yes',
361
+ * },
362
+ * },
363
+ * // Other locales require complete translations
364
+ * de: {
365
+ * common: {
366
+ * yes: 'Ja',
367
+ * no: 'Nein',
368
+ * confirm: 'Bestätigen',
369
+ * cancel: 'Abbrechen',
370
+ * loading: 'Laden...',
371
+ * close: 'Schließen',
372
+ * next: 'Weiter',
373
+ * previous: 'Zurück',
374
+ * select: 'Auswählen',
375
+ * save: 'Speichern',
376
+ * back: 'Zurück',
377
+ * },
378
+ * numberPreservation: {
379
+ * ...
380
+ * },
381
+ * ... // complete Translations object
382
+ * }}
383
+ */
384
+ translations?: LocalizedTranslations;
385
+ /**
386
+ * Current locale for the UI
387
+ * @default 'nl'
388
+ * @example locale="en"
389
+ */
390
+ locale?: Locale;
345
391
  };
346
392
 
347
393
  declare type ErrorAlertClassNames = {
@@ -453,6 +499,19 @@ declare type ListBoxClassNames = {
453
499
  selectedIcon?: string;
454
500
  };
455
501
 
502
+ declare type Locale = 'nl' | 'en' | string;
503
+
504
+ declare type LocalizedTranslations = {
505
+ /** Can be partial as undefined values fallback to default 'nl' translations */
506
+ nl: PartialTranslations;
507
+ } | {
508
+ /** Can be partial as undefined values fallback to default 'en' translations */
509
+ en: PartialTranslations;
510
+ } | {
511
+ /** Complete Translations object as there is no fallback object for other locales */
512
+ [locale: string]: Translations;
513
+ };
514
+
456
515
  /**
457
516
  * ClassNames for styling the `MainImage` component within `PropositionCard`
458
517
  */
@@ -476,7 +535,9 @@ declare type MainImageClassNames = {
476
535
  /** Stock indicator icon */
477
536
  icon?: string;
478
537
  /** Stock indicator text
479
- * @example "Direct leverbaar" */
538
+ * @example "Direct leverbaar"
539
+ * @example "Pre-order"
540
+ * @example "In bestelling" */
480
541
  text?: string;
481
542
  };
482
543
  };
@@ -680,12 +741,9 @@ declare type NumberPreservationModalClassNames = {
680
741
  submitButton?: string;
681
742
  };
682
743
 
683
- declare type PopoverContentClassNames = {
684
- base?: string;
685
- trigger?: string;
686
- backdrop?: string;
687
- content?: string;
688
- };
744
+ declare type PartialTranslations = Partial<{
745
+ [key in keyof Translations]: Partial<Translations[key]>;
746
+ }>;
689
747
 
690
748
  declare type PostcodeCheckLoadingClassNames = {
691
749
  /** Base wrapper */
@@ -1067,18 +1125,33 @@ export declare type ProductResultsProps = {
1067
1125
  *
1068
1126
  * Not available for smartphone propositions when no phone is selected */
1069
1127
  showTopPropositions?: boolean;
1070
- /** Customize texts */
1071
- texts?: {
1072
- /** Title above profile buttons
1073
- * @default "Personaliseer" */
1074
- profileTitle?: string;
1075
- /** Title above top propositions (only shown when `showTopPropositions` is set to `true`)
1076
- * @default "Beste providers voor jou" */
1077
- topPropositionsTitle?: string;
1078
- /** Title above all propositions (only shown when `showTopPropositions` is set to `true`)
1079
- * @default "Alle providers op een rijtje" */
1080
- allPropositionsTitle?: string;
1081
- };
1128
+ /** Configure the color of the labels for the propositions
1129
+ *
1130
+ * @example color: 'primary' | 'secondary' | 'default' | 'success' | 'warning' | 'danger'
1131
+ * @default 'primary'
1132
+ *
1133
+ * @example
1134
+ * {
1135
+ * isRetention: 'primary',
1136
+ * isCheapestPhone: 'secondary',
1137
+ * isBudget: 'default',
1138
+ * isBudgetFiber: 'success',
1139
+ * isCombi: 'warning',
1140
+ * isFastestInternet: 'danger',
1141
+ * isBudgetOwnNetwork: 'success',
1142
+ * isBudgetNetwork: 'success'
1143
+ * }
1144
+ *
1145
+ * It is possible to configure a selection of the label types
1146
+ * The other label types will default to 'primary'
1147
+ *
1148
+ * @example
1149
+ * {
1150
+ * isRetention: 'danger',
1151
+ * isCombi: 'warning'
1152
+ * }
1153
+ */
1154
+ labelColorConfig?: Partial<Record<PropositionLabel['type'], PropositionLabel['color']>>;
1082
1155
  /** Initial selected filters */
1083
1156
  initialSelectedFilters?: FilterValue[];
1084
1157
  /** Limit the number of propositions to display */
@@ -1089,7 +1162,7 @@ export declare type ProductResultsProps = {
1089
1162
  initialProfile?: Partial<Profile>;
1090
1163
  /** Callback function to handle profile changes */
1091
1164
  onProfileChange?: (profile: Partial<Profile>) => void;
1092
- /** Callback function to add search params for the click-out URL on the proposition cards */
1165
+ /** Callback function to add search params for the click-out URL */
1093
1166
  addClickoutSearchParams?: (searchParams: URLSearchParams) => URLSearchParams;
1094
1167
  /** Callback function called when an error occurs */
1095
1168
  onError?: (error: Error) => void;
@@ -1301,6 +1374,17 @@ declare type PropositionHeaderClassNames = {
1301
1374
  };
1302
1375
  };
1303
1376
 
1377
+ declare type PropositionLabel = {
1378
+ type: PropositionLabelType;
1379
+ displayName: string;
1380
+ rank: number;
1381
+ color: PropositionLabelColor;
1382
+ };
1383
+
1384
+ declare type PropositionLabelColor = 'primary' | 'secondary' | 'default' | 'success' | 'warning' | 'danger';
1385
+
1386
+ declare type PropositionLabelType = 'isRetention' | 'isCheapestPhone' | 'isBudget' | 'isBudgetFiber' | 'isCombi' | 'isFastestInternet' | 'isBudgetOwnNetwork' | 'isBudgetNetwork';
1387
+
1304
1388
  declare type PropositionOverviewClassNames = {
1305
1389
  /** The base container of the proposition overview */
1306
1390
  base?: string;
@@ -1565,4 +1649,325 @@ declare type TermsClassNames = {
1565
1649
  base?: string;
1566
1650
  } & SectionClassNames;
1567
1651
 
1652
+ declare type Translations = {
1653
+ common: {
1654
+ yes: string;
1655
+ no: string;
1656
+ confirm: string;
1657
+ cancel: string;
1658
+ loading: string;
1659
+ close: string;
1660
+ next: string;
1661
+ previous: string;
1662
+ select: string;
1663
+ save: string;
1664
+ back: string;
1665
+ };
1666
+ numberPreservation: {
1667
+ title: string;
1668
+ description: string;
1669
+ keepCurrentNumber: string;
1670
+ newNumber: string;
1671
+ currentProvider: string;
1672
+ selectProvider: string;
1673
+ invalidNumber: string;
1674
+ subscription: string;
1675
+ prepaid: string;
1676
+ otherProvider: string;
1677
+ };
1678
+ combiDeal: {
1679
+ title: string;
1680
+ description: string;
1681
+ selectHomeProvider: string;
1682
+ selectOtherSubscriptionsOnAddress: string;
1683
+ customerBenefit: string;
1684
+ homeInternet: string;
1685
+ selectOtherSubscriptions: string;
1686
+ otherSubscriptionsDescription: string;
1687
+ otherSubscriptions: string;
1688
+ movingOption: string;
1689
+ otherProvider: string;
1690
+ };
1691
+ postcodeCheck: {
1692
+ loading: string;
1693
+ invalidAddressError: string;
1694
+ title: string;
1695
+ description: string;
1696
+ postalCode: string;
1697
+ houseNumber: string;
1698
+ houseNumberAddition: string;
1699
+ selectProvider: string;
1700
+ homeInternet: string;
1701
+ };
1702
+ profile: {
1703
+ personalizeTitle: string;
1704
+ postcodeCheck: string;
1705
+ enterPostcode: string;
1706
+ numberPreservation: string;
1707
+ askNumberPreservation: string;
1708
+ newNumber: string;
1709
+ customerBenefit: string;
1710
+ };
1711
+ format: {
1712
+ unlimited: string;
1713
+ /** Short version of `unlimited` */
1714
+ unlimited_short: string;
1715
+ gigabyte: string;
1716
+ minutes: string;
1717
+ /** Short version of `minutes` */
1718
+ minutes_short: string;
1719
+ sms: string;
1720
+ year: string;
1721
+ /** Plural of `year` */
1722
+ year_other: string;
1723
+ oneTime: string;
1724
+ month: string;
1725
+ /** Plural of `month` */
1726
+ month_other: string;
1727
+ /** Short version of `month` */
1728
+ month_short: string;
1729
+ /** Plural of `month_short` */
1730
+ month_short_other: string;
1731
+ monthly: string;
1732
+ firstMonth: string;
1733
+ /** Plural of `firstMonth` */
1734
+ firstMonth_other: string;
1735
+ thenMonth: string;
1736
+ /** Plural of `thenMonth` */
1737
+ thenMonth_other: string;
1738
+ afterMonth: string;
1739
+ /** Plural of `afterMonth` */
1740
+ afterMonth_other: string;
1741
+ hour: string;
1742
+ /** Plural of `hour` */
1743
+ hour_other: string;
1744
+ inch: string;
1745
+ centimeter: string;
1746
+ milliampere: string;
1747
+ megabitPerSecond: string;
1748
+ internet: string;
1749
+ from: string;
1750
+ startingFrom: string;
1751
+ to: string;
1752
+ for: string;
1753
+ or: string;
1754
+ average: string;
1755
+ /** Short version of `average` */
1756
+ average_short: string;
1757
+ maximum: string;
1758
+ };
1759
+ labels: {
1760
+ /** Renew with {{providerName}} */
1761
+ renewWith: string;
1762
+ /** Cheapest phone */
1763
+ cheapestPhone: string;
1764
+ /** Budget */
1765
+ budget: string;
1766
+ /** Most affordable with fiber */
1767
+ budgetFiber: string;
1768
+ /** Customer benefits with {{providerName}} */
1769
+ combi: string;
1770
+ /** Customer benefits */
1771
+ combiGeneric: string;
1772
+ /** Fastest internet */
1773
+ fastestInternet: string;
1774
+ /** Most affordable with own network */
1775
+ budgetOwnNetwork: string;
1776
+ /** Most affordable on {{network}}-network */
1777
+ budgetNetwork: string;
1778
+ /** Most affordable on network */
1779
+ budgetNetworkGeneric: string;
1780
+ };
1781
+ propositionCard: {
1782
+ availableStockStatus: string;
1783
+ backorderedStockStatus: string;
1784
+ preOrderStockStatus: string;
1785
+ oneTimeFee: string;
1786
+ deviceDiscount: string;
1787
+ urgentText: string;
1788
+ /** Plural of `urgentText` */
1789
+ urgentText_other: string;
1790
+ cta: string;
1791
+ };
1792
+ fixedInternet: {
1793
+ /** Fiber */
1794
+ 'glasvezel-internet': string;
1795
+ /** Cable */
1796
+ 'kabel-internet': string;
1797
+ /** DSL */
1798
+ 'dsl-internet': string;
1799
+ /** 5G */
1800
+ '5g-internet': string;
1801
+ };
1802
+ filters: {
1803
+ title: string;
1804
+ resetFilters: string;
1805
+ applyFilters: string;
1806
+ chosenFilters: string;
1807
+ sort: string;
1808
+ sortBy: string;
1809
+ show: string;
1810
+ showMore: string;
1811
+ showLess: string;
1812
+ };
1813
+ filterOptions: {
1814
+ brand: string;
1815
+ internal_storage: string;
1816
+ color: string;
1817
+ data: string;
1818
+ minutes: string;
1819
+ credit_fee: string;
1820
+ provider: string;
1821
+ contract_term: string;
1822
+ package: string;
1823
+ data_speed_down: string;
1824
+ data_speed_up: string;
1825
+ monthly_fee: string;
1826
+ price: string;
1827
+ tags_netwerk: string;
1828
+ tags_verbinding: string;
1829
+ tags_esim: string;
1830
+ receivers: string;
1831
+ network_generation: string;
1832
+ };
1833
+ sortOptions: {
1834
+ /** Relevance */
1835
+ top: string;
1836
+ /** Relevance */
1837
+ relevantie: string;
1838
+ /** Best-selling */
1839
+ 'best-verkocht': string;
1840
+ /** Price low-high */
1841
+ 'meest-voordelig': string;
1842
+ /** Download speed */
1843
+ downloadsnelheid: string;
1844
+ /** Upload speed */
1845
+ uploadsnelheid: string;
1846
+ };
1847
+ productResults: {
1848
+ loadMore: string;
1849
+ showMoreOffers: string;
1850
+ noResultsTitle: string;
1851
+ noResultsDescription: string;
1852
+ sortBy: string;
1853
+ topPropositionsTitle: string;
1854
+ allPropositionsTitle: string;
1855
+ };
1856
+ creditInfo: {
1857
+ exampleTitle: string;
1858
+ creditBundleTitle: string;
1859
+ offer: string;
1860
+ totalDeviceCost: string;
1861
+ oneTimeFee: string;
1862
+ totalCreditAmount: string;
1863
+ monthlyPayment: string;
1864
+ contractTerm: string;
1865
+ fixedInterest: string;
1866
+ generalDescription: string;
1867
+ creditBundleDescription: string;
1868
+ };
1869
+ detailsModal: {
1870
+ title: string;
1871
+ renewal: string;
1872
+ chooseTab: string;
1873
+ general: string;
1874
+ bundles: string;
1875
+ conditions: string;
1876
+ channels: string;
1877
+ costs: string;
1878
+ specifications: string;
1879
+ monthlyFee: string;
1880
+ oneTimeFee: string;
1881
+ totalCost: string;
1882
+ provider: string;
1883
+ network: string;
1884
+ networkCoverage: string;
1885
+ networkAdministrator: string;
1886
+ networkType: string;
1887
+ subscriptionType: string;
1888
+ internet: string;
1889
+ calling: string;
1890
+ sms: string;
1891
+ extras: string;
1892
+ television: string;
1893
+ networkGeneration: string;
1894
+ downloadSpeed: string;
1895
+ uploadSpeed: string;
1896
+ contractTerm: string;
1897
+ contractTermTerminable: string;
1898
+ subscription: string;
1899
+ bundle: string;
1900
+ bundleSpeed: string;
1901
+ termsAndConditions: string;
1902
+ maximumDownloadSpeed: string;
1903
+ maximumUploadSpeed: string;
1904
+ numberOfChannels: string;
1905
+ numberOfReceivers: string;
1906
+ outsideBundle: string;
1907
+ subscriptionFlexibility: string;
1908
+ abroad: string;
1909
+ insideEu: string;
1910
+ outsideEu: string;
1911
+ minutesToEu: string;
1912
+ upgradeBundle: string;
1913
+ downgradeBundle: string;
1914
+ dataExceedance: string;
1915
+ bundleExceedanceRates: string;
1916
+ bundleExceedanceRateCeiling: string;
1917
+ bundleExceedanceWarning: string;
1918
+ bundleExceedanceMinutesRounding: string;
1919
+ channelsDescription: string;
1920
+ moreInformation: string;
1921
+ deviceBundle: string;
1922
+ installationFee: string;
1923
+ activationFee: string;
1924
+ cashback: string;
1925
+ priceWithoutSubscription: string;
1926
+ priceWithSubscription: string;
1927
+ devicePrice: string;
1928
+ costPerContractTermTitle: string;
1929
+ costPerContractTermSubtitle: string;
1930
+ deviceDiscountTitle: string;
1931
+ deviceDiscountSubtitle: string;
1932
+ totalCostsOverTerm: string;
1933
+ /** Plural of `totalCostsOverTerm` */
1934
+ totalCostsOverTerm_other: string;
1935
+ totalDeviceDiscount: string;
1936
+ };
1937
+ phoneSelector: {
1938
+ phone: string;
1939
+ selectPhone: string;
1940
+ selectBrand: string;
1941
+ searchPlaceholder: string;
1942
+ popular: string;
1943
+ allBrands: string;
1944
+ selectVersion: string;
1945
+ selectColor: string;
1946
+ };
1947
+ modificationBlocks: {
1948
+ /** One or more mobile subscriptions */
1949
+ 'mobile/odido': string;
1950
+ /** One or more mobile subscriptions */
1951
+ 'mobile/vodafone': string;
1952
+ /** I am younger than 28 years old */
1953
+ 'segment/vodafone/young': string;
1954
+ /** Vodafone Unlimited subscription at my address */
1955
+ 'segment/vodafone/unlimited': string;
1956
+ /** Another mobile subscription from KPN */
1957
+ 'mobile/kpn': string;
1958
+ /** One or more mobile subscriptions */
1959
+ 'mobile/ben': string;
1960
+ /** One or more mobile subscriptions */
1961
+ 'mobile/50plusmobiel': string;
1962
+ /** One or more mobile subscriptions */
1963
+ 'mobile/hollandsnieuwe': string;
1964
+ /** One or more mobile subscriptions */
1965
+ 'mobile/budget': string;
1966
+ /** One or more mobile subscriptions */
1967
+ 'mobile/youfone': string;
1968
+ /** One or more mobile subscriptions */
1969
+ 'mobile/delta': string;
1970
+ };
1971
+ };
1972
+
1568
1973
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobielnl/elements",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Mobiel.nl Elements - React component library for partner websites",
5
5
  "private": false,
6
6
  "type": "module",
@@ -71,10 +71,10 @@
71
71
  "@heroui/tabs": "^2.2.24",
72
72
  "@heroui/theme": "^2.4.23",
73
73
  "@react-stately/flags": "^3.1.2",
74
- "@storybook/addon-a11y": "^9.1.2",
75
- "@storybook/addon-docs": "^9.1.2",
74
+ "@storybook/addon-a11y": "^9.1.17",
75
+ "@storybook/addon-docs": "^9.1.17",
76
76
  "@storybook/blocks": "^8.6.14",
77
- "@storybook/react-vite": "^9.1.2",
77
+ "@storybook/react-vite": "^9.1.17",
78
78
  "@tailwindcss/vite": "^4.1.11",
79
79
  "@types/jest": "^30.0.0",
80
80
  "@types/js-cookie": "^3.0.6",
@@ -88,14 +88,16 @@
88
88
  "globals": "^16.3.0",
89
89
  "graphql": "^16.11.0",
90
90
  "graphql-request": "^7.2.0",
91
+ "i18next": "^25.7.3",
91
92
  "js-cookie": "^3.0.5",
92
93
  "lodash": "^4.17.21",
93
94
  "postcss-prefix-selector": "^2.1.1",
94
95
  "react": "^19.2.1",
95
96
  "react-dom": "^19.2.1",
97
+ "react-i18next": "^16.5.1",
96
98
  "react-use": "^17.6.0",
97
99
  "remark-gfm": "^4.0.1",
98
- "storybook": "^9.1.2",
100
+ "storybook": "^9.1.17",
99
101
  "swr": "^2.3.2",
100
102
  "tailwindcss": "^4.1.16",
101
103
  "typescript": "~5.8.3",