@tui-cruises/mein-schiff-web-react-component-library 3.0.7 → 3.1.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/CHANGELOG.md +32 -0
- package/README.md +1 -2
- package/index.tsx +1 -6
- package/package.json +17 -33
- package/src/components/core/Accordion/Accordion.tsx +1 -1
- package/src/components/core/Accordion/AccordionItem.tsx +1 -1
- package/src/components/core/AlertDialog/AlertDialog.tsx +1 -1
- package/src/components/core/Button/Button.tsx +4 -7
- package/src/components/core/Calendar/Calendar.tsx +97 -92
- package/src/components/core/Chip/Chip.tsx +101 -0
- package/src/components/core/Chip/index.ts +1 -0
- package/src/components/core/Dialog/Dialog.tsx +5 -2
- package/src/components/core/FormLabel/FormLabel.tsx +2 -5
- package/src/components/core/Pagination/Pagination.tsx +1 -1
- package/src/components/core/PhoneNumberInput/PhoneNumberInput.tsx +1 -1
- package/src/components/core/PriceInput/PriceInput.tsx +1 -1
- package/src/components/core/Stepper/Stepper.tsx +1 -1
- package/src/components/core/SwitchToggle/SwitchToggle.tsx +1 -1
- package/src/components/core/Tabs/Tabs.tsx +197 -88
- package/src/components/core/TextButton/TextButton.tsx +16 -21
- package/src/helpers/children.ts +6 -1
- package/src/helpers/locale.ts +1 -0
- package/src/helpers/price.ts +1 -1
- package/src/helpers/slot.tsx +8 -2
- package/src/libs/phone-number/types.ts +292 -0
- package/src/libs/tracking/core/event-tracker.ts +85 -0
- package/src/libs/tracking/core/index.ts +2 -0
- package/src/libs/tracking/core/utag.ts +68 -0
- package/src/libs/tracking/errors/event-error.ts +9 -0
- package/src/libs/tracking/errors/general-error.ts +20 -0
- package/src/libs/tracking/errors/index.ts +2 -0
- package/src/libs/tracking/index.ts +4 -0
- package/src/libs/tracking/types/click-attribution.ts +36 -0
- package/src/libs/tracking/types/events/add-to-wishlist.ts +25 -0
- package/src/libs/tracking/types/events/auth-sign-in.ts +4 -0
- package/src/libs/tracking/types/events/auth-sign-out.ts +3 -0
- package/src/libs/tracking/types/events/auth-sign-up.ts +8 -0
- package/src/libs/tracking/types/events/click.ts +4 -0
- package/src/libs/tracking/types/events/cruise-quick-search.ts +7 -0
- package/src/libs/tracking/types/events/cruise-search-no-results.ts +6 -0
- package/src/libs/tracking/types/events/cruise-search-sort.ts +4 -0
- package/src/libs/tracking/types/events/cruise-search.ts +7 -0
- package/src/libs/tracking/types/events/custom.ts +9 -0
- package/src/libs/tracking/types/events/dynamic-yield.ts +7 -0
- package/src/libs/tracking/types/events/error.ts +13 -0
- package/src/libs/tracking/types/events/excursion-search-filter.ts +5 -0
- package/src/libs/tracking/types/events/excursion-search.ts +3 -0
- package/src/libs/tracking/types/events/faq-search.ts +5 -0
- package/src/libs/tracking/types/events/form-error.ts +5 -0
- package/src/libs/tracking/types/events/form-interaction.ts +5 -0
- package/src/libs/tracking/types/events/form-submit-success.ts +4 -0
- package/src/libs/tracking/types/events/index.ts +97 -0
- package/src/libs/tracking/types/events/interest-form.ts +6 -0
- package/src/libs/tracking/types/events/layer-click.ts +5 -0
- package/src/libs/tracking/types/events/layer-close.ts +4 -0
- package/src/libs/tracking/types/events/layer-open-rule.ts +4 -0
- package/src/libs/tracking/types/events/layer-open-user.ts +4 -0
- package/src/libs/tracking/types/events/module-click.ts +6 -0
- package/src/libs/tracking/types/events/newsletter.ts +11 -0
- package/src/libs/tracking/types/events/port-search-filter.ts +4 -0
- package/src/libs/tracking/types/events/travel-constellation.ts +5 -0
- package/src/libs/tracking/types/events/travel-credit.ts +9 -0
- package/src/libs/tracking/types/events/video.ts +10 -0
- package/src/libs/tracking/types/events/view-item-list.ts +16 -0
- package/src/libs/tracking/types/events/view-item.ts +27 -0
- package/src/libs/tracking/types/form-attribution.ts +22 -0
- package/src/libs/tracking/types/index.ts +5 -0
- package/src/libs/tracking/types/page-view-data.ts +44 -0
- package/src/libs/tracking/types/tracker.ts +21 -0
- package/src/{helpers → libs/tracking/types}/types.ts +3 -2
- package/src/libs/tracking/utils/config.ts +7 -0
- package/src/libs/tracking/utils/index.ts +5 -0
- package/src/libs/tracking/utils/logger.ts +41 -0
- package/src/libs/tracking/utils/normalize-tracking-value.ts +52 -0
- package/src/libs/tracking/utils/serialize-tracking-props.ts +39 -0
- package/src/libs/tracking/utils/window-tracker-state.ts +107 -0
- package/public/videos/placeholder.mp4 +0 -0
- package/src/assets/images/placeholder-blueish.jpg +0 -0
- package/src/assets/images/placeholder-sepia.jpg +0 -0
- package/src/assets/images/placeholder.jpg +0 -0
- package/src/components/shared/NextFontMeinSchiffSansPro/NextFontMeinSchiffSansPro.tsx +0 -160
- package/src/components/shared/NextFontMeinSchiffSansPro/index.ts +0 -1
- package/src/components/shared/UniversalCarousel/CarouselContext.ts +0 -61
- package/src/components/shared/UniversalCarousel/CarouselDefaultPagination.tsx +0 -92
- package/src/components/shared/UniversalCarousel/CarouselInterface.tsx +0 -152
- package/src/components/shared/UniversalCarousel/CarouselStage.tsx +0 -235
- package/src/components/shared/UniversalCarousel/UniversalCarousel.tsx +0 -125
- package/src/components/shared/UniversalCarousel/helpers.ts +0 -211
- package/src/components/shared/UniversalCarousel/index.ts +0 -4
- package/src/helpers/cookies.ts +0 -22
- package/src/helpers/dateToYearMonthDay.ts +0 -17
- package/src/helpers/elementVisibility.ts +0 -53
- package/src/helpers/ssr.ts +0 -5
- package/src/hooks/use-intersection-observer.ts +0 -190
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [3.1.1](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/compare/v3.1.0...v3.1.1) (2025-10-30)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **Chip:** add Chip component (EC-2491) ([3b7efbe](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/3b7efbe4c8edccb9187bcae9dd72fee1d7cadc07))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **Calendar:** typography ([77578c0](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/77578c01e26b6544f124e427a3a51072d6d9d315))
|
|
16
|
+
* **Tabs:** add hover border style ([e9e45e5](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/e9e45e54cdcb3efd5d5e11bddaeda9106707b499))
|
|
17
|
+
|
|
18
|
+
## [3.1.0](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/compare/v3.0.7...v3.1.0) (2025-10-28)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **Accordion:** update Radix UI dependency ([a17bc66](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/a17bc66e4564b9fa09abff135733358a4d6bfaf0))
|
|
24
|
+
* **Calendar:** update based on latest web composition variant ([c9d480b](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/c9d480ba84873350844ee9400f0180cbb36ff7e2))
|
|
25
|
+
* **NextFontMeinSchiffSansPro:** delete 'NextFontMeinSchiffSansPro' from core components ([87299aa](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/87299aa78cb362447c93ebc9d502256cc72d14be))
|
|
26
|
+
* **Storybook:** Storybook 9.x upgrade ([82a34fa](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/82a34fa6048f2f8a46cc99cc456b1688ac38e8a5))
|
|
27
|
+
* **Tracking:** use local Tealium types ([d7ae1ab](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/d7ae1ab35eccbe87d586dcf40f9d5d63e9624502))
|
|
28
|
+
* **UniversalCarousel:** delete 'UniversalCarousel' from core components ([5b1023b](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/5b1023bc3d420c93556ad582604bdd0d44cb548c))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* **Storybook:** preview background colors ([cfbbfa0](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/cfbbfa000dbd7ae0c63ea95ff9a82d6f8a681e59))
|
|
34
|
+
* **Tabs:** remove UniversalCarousel and fully refactor component ([4e8dd4b](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/4e8dd4b16dffe7931c14f3809814e5e7d52f7d50))
|
|
35
|
+
* **twMerge:** use tailwind-merge ([431d126](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/431d126e890c6251b8258f77f9d5ee946ecbb105))
|
|
36
|
+
|
|
5
37
|
### [3.0.7](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/compare/v3.0.6...v3.0.7) (2025-10-23)
|
|
6
38
|
|
|
7
39
|
### [3.0.6](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/compare/v2.2.11...v3.0.6) (2025-10-23)
|
package/README.md
CHANGED
package/index.tsx
CHANGED
|
@@ -10,6 +10,7 @@ export * from './src/components/core/ButtonGroup';
|
|
|
10
10
|
export * from './src/components/core/Calendar';
|
|
11
11
|
export * from './src/components/core/Checkbox';
|
|
12
12
|
export * from './src/components/core/CheckboxField';
|
|
13
|
+
export * from './src/components/core/Chip';
|
|
13
14
|
export * from './src/components/core/Countdown';
|
|
14
15
|
export * from './src/components/core/DataTable';
|
|
15
16
|
export * from './src/components/core/Dialog';
|
|
@@ -47,10 +48,6 @@ export * from './src/components/core/Tabs';
|
|
|
47
48
|
export * from './src/components/core/TextButton';
|
|
48
49
|
export * from './src/components/core/Toast';
|
|
49
50
|
|
|
50
|
-
// Shared Components
|
|
51
|
-
export * from './src/components/shared/NextFontMeinSchiffSansPro'; // @revisit: Utils
|
|
52
|
-
export * from './src/components/shared/UniversalCarousel';
|
|
53
|
-
|
|
54
51
|
/**
|
|
55
52
|
* Hooks
|
|
56
53
|
*/
|
|
@@ -58,7 +55,6 @@ export * from './src/hooks/use-active-screen-names';
|
|
|
58
55
|
export * from './src/hooks/use-screen-name';
|
|
59
56
|
export * from './src/hooks/use-screen-name-at-least';
|
|
60
57
|
export * from './src/hooks/use-toasts';
|
|
61
|
-
export * from './src/hooks/use-intersection-observer';
|
|
62
58
|
export * from './src/hooks/use-store';
|
|
63
59
|
|
|
64
60
|
/**
|
|
@@ -68,6 +64,5 @@ export * from './src/helpers/store';
|
|
|
68
64
|
export * from './src/helpers/screen';
|
|
69
65
|
export * from './src/helpers/responsive-property';
|
|
70
66
|
export { expandString } from './src/helpers/i18n';
|
|
71
|
-
export * from './src/helpers/elementVisibility';
|
|
72
67
|
|
|
73
68
|
export * from '@radix-ui/react-slot';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tui-cruises/mein-schiff-web-react-component-library",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"main": "./index.tsx",
|
|
5
5
|
"types": "./index.tsx",
|
|
6
6
|
"type": "module",
|
|
@@ -11,8 +11,6 @@
|
|
|
11
11
|
"dev": "storybook dev -p 6006",
|
|
12
12
|
"build-storybook": "storybook build",
|
|
13
13
|
"release": "standard-version",
|
|
14
|
-
"pack:public": "node scripts/prepare-pack.mjs",
|
|
15
|
-
"prepack": "npm run pack:public",
|
|
16
14
|
"generate-icon-components": "node icons-import-svgs/generate-icons.cjs && prettier --write icons"
|
|
17
15
|
},
|
|
18
16
|
"config": {
|
|
@@ -37,7 +35,7 @@
|
|
|
37
35
|
"README.md"
|
|
38
36
|
],
|
|
39
37
|
"dependencies": {
|
|
40
|
-
"@radix-ui/react-accordion": "^1.
|
|
38
|
+
"@radix-ui/react-accordion": "^1.2.12",
|
|
41
39
|
"@radix-ui/react-alert-dialog": "^1.0.4",
|
|
42
40
|
"@radix-ui/react-checkbox": "^1.0.4",
|
|
43
41
|
"@radix-ui/react-collapsible": "^1.0.3",
|
|
@@ -52,16 +50,12 @@
|
|
|
52
50
|
"@radix-ui/react-toast": "^1.1.5",
|
|
53
51
|
"@radix-ui/react-tooltip": "^1.1.2",
|
|
54
52
|
"@tui-cruises/mein-schiff-web-tailwind-config": "^2.0.16",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"@tuic/logger": "^1.0.0",
|
|
58
|
-
"@tuic/tailwind-config": "^1.0.0",
|
|
59
|
-
"@tuic/tracking": "^1.0.0",
|
|
53
|
+
"ajv": "^8.17.1",
|
|
54
|
+
"ajv-keywords": "^5.1.0",
|
|
60
55
|
"d3": "^7.9.0",
|
|
61
56
|
"date-fns": "^3.4.0",
|
|
62
57
|
"dompurify": "^3.0.6",
|
|
63
58
|
"eslint-config-next": "^13.4.8",
|
|
64
|
-
"friendly-challenge": "^0.9.16",
|
|
65
59
|
"libphonenumber-js": "^1.10.54",
|
|
66
60
|
"lodash": "^4.17.21",
|
|
67
61
|
"luxon": "^3.5.0",
|
|
@@ -70,29 +64,19 @@
|
|
|
70
64
|
"react-country-flag": "^3.1.0",
|
|
71
65
|
"react-day-picker": "^9.9.0",
|
|
72
66
|
"react-dom": "^19.1.1",
|
|
73
|
-
"react-is": "
|
|
74
|
-
"react-slider": "^2.0.6",
|
|
67
|
+
"react-is": "*",
|
|
75
68
|
"react-youtube": "^10.1.0",
|
|
76
|
-
"tailwind-merge": "^3.2.0"
|
|
69
|
+
"tailwind-merge": "^3.2.0",
|
|
70
|
+
"react-slider": "^2.0.6"
|
|
77
71
|
},
|
|
78
72
|
"devDependencies": {
|
|
79
73
|
"@babel/preset-env": "^7.26.9",
|
|
80
74
|
"@babel/preset-react": "^7.26.3",
|
|
81
75
|
"@babel/preset-typescript": "^7.26.0",
|
|
82
|
-
"@
|
|
83
|
-
"@storybook/addon-
|
|
84
|
-
"@storybook/addon-
|
|
85
|
-
"@storybook/
|
|
86
|
-
"@storybook/addon-essentials": "^8.6.12",
|
|
87
|
-
"@storybook/addon-interactions": "^8.6.12",
|
|
88
|
-
"@storybook/addon-mdx-gfm": "^8.6.12",
|
|
89
|
-
"@storybook/blocks": "^8.6.12",
|
|
90
|
-
"@storybook/manager-api": "^8.6.12",
|
|
91
|
-
"@storybook/nextjs": "^8.6.12",
|
|
92
|
-
"@storybook/preview-api": "^8.6.12",
|
|
93
|
-
"@storybook/react": "^8.6.12",
|
|
94
|
-
"@storybook/test": "^8.6.12",
|
|
95
|
-
"@storybook/theming": "^8.6.12",
|
|
76
|
+
"@storybook/addon-a11y": "9.1.15",
|
|
77
|
+
"@storybook/addon-designs": "^10.0.2",
|
|
78
|
+
"@storybook/addon-docs": "9.1.15",
|
|
79
|
+
"@storybook/nextjs": "9.1.15",
|
|
96
80
|
"@svgr/cli": "^8.0.1",
|
|
97
81
|
"@types/d3": "^7.4.3",
|
|
98
82
|
"@types/lodash": "^4.17.13",
|
|
@@ -102,20 +86,20 @@
|
|
|
102
86
|
"@types/react-slider": "^1.3.6",
|
|
103
87
|
"autoprefixer": "^10.4.14",
|
|
104
88
|
"chromatic": "^11.27.0",
|
|
105
|
-
"commitizen": "^
|
|
106
|
-
"esbuild": "^0.
|
|
89
|
+
"commitizen": "^3.0.0",
|
|
90
|
+
"esbuild": "^0.25.11",
|
|
107
91
|
"eslint": "^8.47.0",
|
|
92
|
+
"eslint-plugin-storybook": "9.1.15",
|
|
108
93
|
"postcss": "^8.4.26",
|
|
109
94
|
"prettier": "^3.0.3",
|
|
110
95
|
"prettier-plugin-tailwindcss": "^0.4.1",
|
|
111
|
-
"prop-types": "^15.8.1",
|
|
112
96
|
"react-markdown": "^10.0.0",
|
|
113
97
|
"standard-version": "^9.5.0",
|
|
114
|
-
"storybook": "
|
|
115
|
-
"storybook-version": "^0.1.
|
|
98
|
+
"storybook": "9.1.15",
|
|
99
|
+
"storybook-version": "^0.1.4",
|
|
116
100
|
"tailwindcss": "^3.4.17",
|
|
117
101
|
"ts-loader": "^9.5.2",
|
|
118
102
|
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
119
103
|
"typescript": "^5.7.3"
|
|
120
104
|
}
|
|
121
|
-
}
|
|
105
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { EventClickElement } from '
|
|
3
|
+
import { EventClickElement } from '../../../libs/tracking';
|
|
4
4
|
import { type ElementType, FC, LiHTMLAttributes, ReactNode } from 'react';
|
|
5
5
|
import { Divider } from '../../core/Divider';
|
|
6
6
|
import { IconButton } from '../../core/IconButton';
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
12
12
|
import { Button } from '../../core/Button';
|
|
13
13
|
import { ButtonGroup } from '../../core/ButtonGroup';
|
|
14
|
-
import { EventClickArea, EventClickElement } from '
|
|
14
|
+
import { EventClickArea, EventClickElement } from '../../../libs/tracking';
|
|
15
15
|
import { twJoin } from 'tailwind-merge';
|
|
16
16
|
|
|
17
17
|
type ActionBase = {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { Icon, IconName } from '../../core/Icon';
|
|
2
|
-
import {
|
|
3
|
-
ButtonHTMLAttributes,
|
|
4
|
-
RefObject
|
|
5
|
-
} from 'react';
|
|
2
|
+
import { ButtonHTMLAttributes, RefObject } from 'react';
|
|
6
3
|
import { twJoin, twMerge } from 'tailwind-merge';
|
|
7
4
|
import { Slot, Slottable } from '@radix-ui/react-slot';
|
|
8
5
|
import { Skeleton, SkeletonTextLines } from '../../core/Skeleton';
|
|
9
6
|
import { LoadingSpinner } from '../../core/LoadingSpinner';
|
|
10
|
-
import { DataAttributes } from '../../../
|
|
7
|
+
import { DataAttributes } from '../../../libs/tracking';
|
|
11
8
|
|
|
12
9
|
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &
|
|
13
10
|
DataAttributes & {
|
|
@@ -20,7 +17,7 @@ export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &
|
|
|
20
17
|
active?: boolean;
|
|
21
18
|
hasFullWidthOnMobile?: boolean;
|
|
22
19
|
indicating?: boolean;
|
|
23
|
-
ref?: RefObject<HTMLButtonElement
|
|
20
|
+
ref?: RefObject<HTMLButtonElement>;
|
|
24
21
|
};
|
|
25
22
|
|
|
26
23
|
const ButtonRenderFunction = (props: ButtonProps) => {
|
|
@@ -188,4 +185,4 @@ const ButtonRenderFunction = (props: ButtonProps) => {
|
|
|
188
185
|
);
|
|
189
186
|
};
|
|
190
187
|
|
|
191
|
-
export const Button = ButtonRenderFunction
|
|
188
|
+
export const Button = ButtonRenderFunction;
|
|
@@ -4,21 +4,21 @@ import * as React from 'react';
|
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
5
|
import {
|
|
6
6
|
DayPicker,
|
|
7
|
-
PropsBase,
|
|
8
|
-
DayPickerMultipleProps,
|
|
9
|
-
DayPickerRangeProps,
|
|
10
|
-
DayPickerSingleProps,
|
|
11
7
|
Matcher,
|
|
8
|
+
useDayPicker,
|
|
9
|
+
UI,
|
|
10
|
+
SelectionState,
|
|
11
|
+
DayFlag,
|
|
12
12
|
} from 'react-day-picker';
|
|
13
13
|
import { de, enGB } from 'date-fns/locale';
|
|
14
|
-
|
|
15
14
|
import { twJoin } from 'tailwind-merge';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { differenceInMonths
|
|
15
|
+
import { IconButton, TextButton } from '../../../../index';
|
|
16
|
+
import { Locale as I18nLocale } from '../../../helpers/locale';
|
|
17
|
+
import { differenceInMonths } from 'date-fns';
|
|
18
|
+
import { Locale } from 'date-fns';
|
|
19
19
|
|
|
20
|
-
type
|
|
21
|
-
localeCode?:
|
|
20
|
+
export type CalendarProps = React.ComponentProps<typeof DayPicker> & {
|
|
21
|
+
localeCode?: I18nLocale;
|
|
22
22
|
useShowMoreButtonOnMobile?: boolean;
|
|
23
23
|
showPrevMonthsButtonLabel?: string;
|
|
24
24
|
showNextMonthsButtonLabel?: string;
|
|
@@ -26,12 +26,7 @@ type BaseProps = Omit<PropsBase, 'locale' | 'fromDate'> & {
|
|
|
26
26
|
pastIsPickable?: boolean;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
| (BaseProps & DayPickerSingleProps)
|
|
31
|
-
| (BaseProps & DayPickerMultipleProps)
|
|
32
|
-
| (BaseProps & DayPickerRangeProps);
|
|
33
|
-
|
|
34
|
-
const DEFAULT_LOCALE: string = 'de';
|
|
29
|
+
const DEFAULT_LOCALE: I18nLocale = 'de';
|
|
35
30
|
|
|
36
31
|
/**
|
|
37
32
|
* Calendar integration
|
|
@@ -176,27 +171,17 @@ function Calendar({
|
|
|
176
171
|
setNoMoreMonthsToAddNext(false);
|
|
177
172
|
}
|
|
178
173
|
}
|
|
179
|
-
}, [
|
|
174
|
+
}, [
|
|
175
|
+
useShowMoreButtonOnMobile,
|
|
176
|
+
getAmountOfPreviousMonthsToLoad,
|
|
177
|
+
getAmountOfNextMonthsToLoad,
|
|
178
|
+
]);
|
|
180
179
|
|
|
181
180
|
const disabledMatchers: Matcher[] = [];
|
|
182
181
|
const today = new Date();
|
|
183
182
|
if (currentMonth && !pastIsPickable) {
|
|
184
|
-
const firstDayOfMonth = new Date(
|
|
185
|
-
currentMonth.getFullYear(),
|
|
186
|
-
currentMonth.getMonth(),
|
|
187
|
-
1,
|
|
188
|
-
);
|
|
189
|
-
const yesterday = new Date(
|
|
190
|
-
today.getFullYear(),
|
|
191
|
-
today.getMonth(),
|
|
192
|
-
today.getDate(),
|
|
193
|
-
);
|
|
194
|
-
let currentDate = new Date(firstDayOfMonth);
|
|
195
|
-
while (currentDate < yesterday) {
|
|
196
|
-
disabledMatchers.push(new Date(currentDate));
|
|
197
|
-
currentDate.setDate(currentDate.getDate() + 1);
|
|
198
|
-
}
|
|
199
183
|
}
|
|
184
|
+
disabledMatchers.push({ before: new Date() });
|
|
200
185
|
|
|
201
186
|
if (props.disabled) {
|
|
202
187
|
const disabledNormalized = Array.isArray(props.disabled)
|
|
@@ -205,6 +190,13 @@ function Calendar({
|
|
|
205
190
|
disabledMatchers.push(...disabledNormalized);
|
|
206
191
|
}
|
|
207
192
|
|
|
193
|
+
const navButtonClasses = twJoin(
|
|
194
|
+
'h-11 bg-transparent p-0 opacity-50',
|
|
195
|
+
'disabled:opacity-30',
|
|
196
|
+
'hover:opacity-100',
|
|
197
|
+
'focus:outline-none focus-visible:shadow-focus-state',
|
|
198
|
+
);
|
|
199
|
+
|
|
208
200
|
return (
|
|
209
201
|
<>
|
|
210
202
|
{useShowMoreButtonOnMobile && !noMoreMonthsToAddBefore && (
|
|
@@ -217,80 +209,93 @@ function Calendar({
|
|
|
217
209
|
|
|
218
210
|
<DayPicker
|
|
219
211
|
month={currentMonth}
|
|
220
|
-
|
|
212
|
+
endMonth={toMonth}
|
|
221
213
|
numberOfMonths={currentNumberOfMonths}
|
|
222
214
|
showOutsideDays={showOutsideDays}
|
|
223
|
-
|
|
224
|
-
fromDate={fromMonth}
|
|
215
|
+
startMonth={fromMonth}
|
|
225
216
|
disabled={disabledMatchers}
|
|
226
217
|
classNames={{
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
'
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
218
|
+
[UI.Months]:
|
|
219
|
+
'flex flex-col lg:flex-row lg:flex-nowrap gap-8 lg:gap-4',
|
|
220
|
+
[UI.Month]: 'space-y-4 lg:w-1/2',
|
|
221
|
+
[UI.MonthCaption]:
|
|
222
|
+
'flex justify-center pt-1 relative items-center pointer-events-none',
|
|
223
|
+
[UI.CaptionLabel]:
|
|
224
|
+
'font-semibold text-base text-marine-high-emphasis',
|
|
225
|
+
[UI.Nav]: 'space-x-1 flex items-center',
|
|
226
|
+
[UI.MonthGrid]: 'w-full border-collapse space-y-1',
|
|
227
|
+
[UI.Weekdays]: 'flex w-full flex-row',
|
|
228
|
+
[UI.Weekday]:
|
|
229
|
+
'inline-flex items-center justify-center h-11 w-1/7 font-normal text-base rounded-sm',
|
|
230
|
+
[UI.DayButton]: twJoin(
|
|
231
|
+
'h-11 w-full p-0 font-normal aria-selected:opacity-100',
|
|
237
232
|
),
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
nav_button_next: twJoin(
|
|
243
|
-
'absolute right-0 pr-4',
|
|
244
|
-
useShowMoreButtonOnMobile ? 'hidden lg:block' : '!block',
|
|
245
|
-
),
|
|
246
|
-
table: 'w-full border-collapse space-y-1',
|
|
247
|
-
head_row: 'flex flex-row nowrap gap-x-0.5',
|
|
248
|
-
head_cell:
|
|
249
|
-
'flex justify-center items-center w-1/7 h-11 text-marine-high-emphasis font-normal text-xs rounded-sm',
|
|
250
|
-
row: 'flex flex-row nowrap gap-x-0.5 w-full mt-0.5',
|
|
251
|
-
cell: twJoin(
|
|
252
|
-
'relative w-1/7 p-0 text-center text-xs focus-within:relative focus-within:z-20' +
|
|
253
|
-
'[&:has([aria-selected].day-range-end)]:rounded-r-lg [&:has([aria-selected])]:bg-surface-secondary-7 [&:has([aria-selected].day-outside)]:bg-surface-secondary-7',
|
|
254
|
-
(props.mode as string) === 'range'
|
|
255
|
-
? '[&:has(>.day-range-end)]:rounded-r-lg [&:has(>.day-range-start)]:rounded-l-lg first:[&:has([aria-selected])]:rounded-l-lg last:[&:has([aria-selected])]:rounded-r-lg'
|
|
256
|
-
: '[&:has([aria-selected])]:rounded-sm',
|
|
257
|
-
),
|
|
258
|
-
day: twJoin(
|
|
259
|
-
'h-11 w-full rounded-sm p-0 font-normal text-marine-high-emphasis aria-selected:opacity-100',
|
|
260
|
-
'hover:border-stroke-primary-100 hover:bg-surface-primary-60 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-secondary-marine-48',
|
|
233
|
+
[UI.Week]: 'flex flex-row nowrap gap-x-0.5 w-full mt-0.5',
|
|
234
|
+
[UI.Day]: twJoin(
|
|
235
|
+
'relative w-1/7 rounded-sm p-0 text-center text-base focus-within:relative focus-within:z-20',
|
|
236
|
+
'hover:border-stroke-primary-100 hover:bg-surface-primary-60 data-[disabled]:hover:bg-transparent',
|
|
261
237
|
'active:border-stroke-primary-100 active:bg-surface-primary-60',
|
|
262
238
|
'focus:outline-none focus-visible:shadow-focus-state',
|
|
239
|
+
'disabled:text-secondary-marine-48',
|
|
263
240
|
),
|
|
264
|
-
|
|
265
|
-
'
|
|
266
|
-
day_range_end:
|
|
267
|
-
'day-range-end bg-surface-primary-100 hover:bg-surface-primary-120 active:bg-surface-primary-120 focus:bg-surface-primary-100 text-marine-high-emphasis rounded-r-lg',
|
|
268
|
-
day_range_middle:
|
|
269
|
-
'aria-selected:bg-surface-primary-60 aria-selected:text-marine-high-emphasis',
|
|
270
|
-
day_selected: twJoin(
|
|
271
|
-
'rounded-none bg-surface-primary-100 text-marine-high-emphasis',
|
|
241
|
+
[SelectionState.selected]: twJoin(
|
|
242
|
+
'bg-surface-primary-100 text-marine-high-emphasis',
|
|
272
243
|
'hover:bg-surface-primary-120 hover:text-marine-high-emphasis',
|
|
273
244
|
'active:bg-surface-primary-120 active:text-marine-high-emphasis',
|
|
274
245
|
'focus:bg-surface-primary-120 focus:text-marine-high-emphasis',
|
|
275
246
|
),
|
|
276
|
-
|
|
277
|
-
'day-
|
|
278
|
-
|
|
279
|
-
|
|
247
|
+
[SelectionState.range_start]:
|
|
248
|
+
'day-range-start bg-surface-primary-100 hover:bg-surface-primary-120 active:bg-surface-primary-120 focus:bg-surface-primary-100 text-marine-high-emphasis',
|
|
249
|
+
[SelectionState.range_end]:
|
|
250
|
+
'day-range-end bg-surface-primary-100 hover:bg-surface-primary-120 active:bg-surface-primary-120 focus:bg-surface-primary-100 text-marine-high-emphasis',
|
|
251
|
+
[SelectionState.range_middle]: 'aria-selected:bg-surface-primary-60',
|
|
252
|
+
[DayFlag.outside]:
|
|
253
|
+
'day-outside [&>button]:text-secondary-marine-48 aria-selected:bg-surface-secondary-7 relative aria-selected:text-secondary-marine-48',
|
|
254
|
+
[DayFlag.hidden]: 'invisible',
|
|
255
|
+
[DayFlag.disabled]: 'text-secondary-marine-48',
|
|
280
256
|
...classNames,
|
|
281
257
|
}}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
258
|
+
components={{
|
|
259
|
+
Root: ({ children }) => {
|
|
260
|
+
const { components, goToMonth, nextMonth, previousMonth } =
|
|
261
|
+
useDayPicker();
|
|
262
|
+
|
|
263
|
+
return (
|
|
264
|
+
<div className={twJoin('relative w-full pb-3 pt-3', className)}>
|
|
265
|
+
<div className="absolute mt-2 flex w-full items-center justify-between gap-x-1">
|
|
266
|
+
<components.PreviousMonthButton
|
|
267
|
+
onClick={() => previousMonth && goToMonth(previousMonth)}
|
|
268
|
+
disabled={!previousMonth}
|
|
269
|
+
/>
|
|
270
|
+
<components.NextMonthButton
|
|
271
|
+
onClick={() => nextMonth && goToMonth(nextMonth)}
|
|
272
|
+
disabled={!nextMonth}
|
|
273
|
+
/>
|
|
274
|
+
</div>
|
|
275
|
+
{children}
|
|
276
|
+
</div>
|
|
277
|
+
);
|
|
278
|
+
},
|
|
279
|
+
Nav: () => <></>,
|
|
280
|
+
NextMonthButton: props => (
|
|
281
|
+
<IconButton
|
|
282
|
+
iconName="nav-arrow-right"
|
|
283
|
+
variant="secondary"
|
|
284
|
+
className={twJoin('!mr-4 h-5 w-5', navButtonClasses)}
|
|
285
|
+
size="sm"
|
|
286
|
+
{...props}
|
|
287
|
+
/>
|
|
288
|
+
),
|
|
289
|
+
PreviousMonthButton: props => (
|
|
290
|
+
<IconButton
|
|
291
|
+
className={twJoin('h-5 w-5', navButtonClasses)}
|
|
292
|
+
variant="secondary"
|
|
293
|
+
iconName="nav-arrow-left"
|
|
294
|
+
size="sm"
|
|
295
|
+
{...props}
|
|
296
|
+
/>
|
|
297
|
+
),
|
|
298
|
+
}}
|
|
294
299
|
locale={usedLocale}
|
|
295
300
|
{...props}
|
|
296
301
|
/>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { ReactNode, RefObject } from 'react';
|
|
2
|
+
import { twJoin, twMerge } from 'tailwind-merge';
|
|
3
|
+
import { Slot, Slottable } from '@radix-ui/react-slot';
|
|
4
|
+
import { Pictogram, PictogramName } from '../Pictogram';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* All allowed variants for the Chip component.
|
|
8
|
+
*/
|
|
9
|
+
type Variant = 'text' | 'pictogram';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Props for the Chip component.
|
|
13
|
+
*/
|
|
14
|
+
export type ChipProps = {
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
variant?: Variant;
|
|
18
|
+
pictogram?: PictogramName;
|
|
19
|
+
on?: 'white' | 'gray';
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
active?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
ref?: RefObject<HTMLButtonElement>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A Chip component designed for basic labeling or marking destinations
|
|
28
|
+
*/
|
|
29
|
+
const Chip = ({
|
|
30
|
+
asChild,
|
|
31
|
+
className,
|
|
32
|
+
variant = 'text',
|
|
33
|
+
pictogram,
|
|
34
|
+
on = 'white',
|
|
35
|
+
active = false,
|
|
36
|
+
disabled = false,
|
|
37
|
+
children,
|
|
38
|
+
ref,
|
|
39
|
+
...args
|
|
40
|
+
}: ChipProps) => {
|
|
41
|
+
const Element = asChild ? Slot : 'button';
|
|
42
|
+
|
|
43
|
+
const borderRadius = variant === 'text' ? 'rounded-full' : 'rounded-md';
|
|
44
|
+
const padding = variant === 'text' ? 'px-4 py-3' : 'p-3 lg:p-2';
|
|
45
|
+
const variantClasses = twMerge(
|
|
46
|
+
'border-none text-center text-sm font-semibold transition-all',
|
|
47
|
+
|
|
48
|
+
// Variants
|
|
49
|
+
variant === 'text' && [
|
|
50
|
+
// Shared
|
|
51
|
+
'text-marine-high-emphasis hover:bg-surface-primary-100',
|
|
52
|
+
|
|
53
|
+
// On surfaces
|
|
54
|
+
on === 'white' && 'bg-surface-secondary-7',
|
|
55
|
+
on === 'gray' && 'bg-surface-white',
|
|
56
|
+
|
|
57
|
+
// States
|
|
58
|
+
active && 'bg-surface-primary-100',
|
|
59
|
+
disabled &&
|
|
60
|
+
'bg-surface-secondary-7 shadow-[inset_0_0_0_2px_theme(colors.stroke.secondary-20)]',
|
|
61
|
+
on === 'gray' &&
|
|
62
|
+
disabled &&
|
|
63
|
+
'bg-surface-white shadow-[inset_0_0_0_2px_theme(colors.stroke.secondary-20)]',
|
|
64
|
+
],
|
|
65
|
+
|
|
66
|
+
variant === 'pictogram' && [
|
|
67
|
+
// Shared
|
|
68
|
+
'bg-surface-white shadow-[inset_0_0_0_2px_theme(colors.stroke.primary-100)] hover:shadow-[inset_0_0_0_4px_theme(colors.stroke.primary-100)]',
|
|
69
|
+
|
|
70
|
+
// States
|
|
71
|
+
active && 'bg-surface-primary-100',
|
|
72
|
+
disabled && 'bg-surface-secondary-7 shadow-none',
|
|
73
|
+
on === 'gray' && disabled && 'bg-surface-white shadow-none',
|
|
74
|
+
],
|
|
75
|
+
|
|
76
|
+
// States
|
|
77
|
+
'focus:outline-none focus-visible:shadow-focus-state',
|
|
78
|
+
disabled && '!pointer-events-none !text-secondary-marine-48',
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<Element
|
|
83
|
+
ref={ref}
|
|
84
|
+
{...args}
|
|
85
|
+
className={twJoin(
|
|
86
|
+
'inline-flex items-center justify-center',
|
|
87
|
+
borderRadius,
|
|
88
|
+
padding,
|
|
89
|
+
variantClasses,
|
|
90
|
+
className,
|
|
91
|
+
)}
|
|
92
|
+
>
|
|
93
|
+
<Slottable>{children ?? ''}</Slottable>
|
|
94
|
+
{pictogram && <Pictogram name={pictogram} size="sm" />}
|
|
95
|
+
</Element>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
Chip.displayName = 'Chip';
|
|
100
|
+
|
|
101
|
+
export { Chip };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Chip';
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
EventClickArea,
|
|
6
|
+
formatTrackingString,
|
|
7
|
+
trackEvent,
|
|
8
|
+
} from '../../../libs/tracking';
|
|
6
9
|
import { ComponentProps, FC, PropsWithChildren, ReactNode } from 'react';
|
|
7
10
|
import { twJoin } from 'tailwind-merge';
|
|
8
11
|
import { IconButton } from '../../core/IconButton';
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LabelHTMLAttributes,
|
|
3
|
-
RefObject
|
|
4
|
-
} from 'react';
|
|
1
|
+
import { LabelHTMLAttributes, RefObject } from 'react';
|
|
5
2
|
import { twJoin } from 'tailwind-merge';
|
|
6
3
|
import { Slot, Slottable } from '@radix-ui/react-slot';
|
|
7
4
|
|
|
@@ -10,7 +7,7 @@ export type FormLabelProps = LabelHTMLAttributes<HTMLLabelElement> & {
|
|
|
10
7
|
/** Indicates if the associated field is required. */
|
|
11
8
|
required?: boolean;
|
|
12
9
|
'data-invalid'?: boolean;
|
|
13
|
-
ref?: RefObject<HTMLLabelElement
|
|
10
|
+
ref?: RefObject<HTMLLabelElement>;
|
|
14
11
|
};
|
|
15
12
|
|
|
16
13
|
const FormLabelImplementation = (props: FormLabelProps) => {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
getPhoneNumberCountry,
|
|
13
13
|
getDefaultPhoneNumberCountry,
|
|
14
14
|
guessPhoneNumberCountryFromPhoneNumber,
|
|
15
|
-
} from '
|
|
15
|
+
} from '../../../libs/phone-number/types';
|
|
16
16
|
import { CountryCode, parsePhoneNumber } from 'libphonenumber-js';
|
|
17
17
|
|
|
18
18
|
type PhoneNumberInputProps = InputHTMLAttributes<HTMLInputElement> & {
|