@leabankab/component-library 8.9.0 → 8.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/CHANGELOG.md +24 -0
- package/dist/component-library.es.js +715 -713
- package/dist/component-library.es.js.map +1 -1
- package/dist/component-library.umd.js +2 -2
- package/dist/component-library.umd.js.map +1 -1
- package/dist/components/buttons/{action-button.d.ts → action-button/action-button.d.ts} +1 -1
- package/dist/components/buttons/{button.d.ts → button/button.d.ts} +2 -2
- package/dist/components/buttons/{close-button.d.ts → close-button/close-button.d.ts} +1 -1
- package/dist/components/buttons/{download-trigger.d.ts → download-trigger/download-trigger.d.ts} +2 -2
- package/dist/components/buttons/{icon-button.d.ts → icon-button/icon-button.d.ts} +1 -1
- package/dist/components/buttons/index.d.ts +6 -6
- package/dist/components/buttons/{skip-link.d.ts → skip-link/skip-link.d.ts} +1 -1
- package/dist/components/data-display/{card.d.ts → card/card.d.ts} +1 -1
- package/dist/components/data-display/{chip.d.ts → chip/chip.d.ts} +1 -1
- package/dist/components/data-display/index.d.ts +17 -16
- package/dist/components/data-display/{link-card.d.ts → link-card/link-card.d.ts} +1 -1
- package/dist/components/data-display/{media-card.d.ts → media-card/media-card.d.ts} +1 -1
- package/dist/components/data-display/{service-card.d.ts → service-card/service-card.d.ts} +1 -1
- package/dist/components/feedback/{alert.d.ts → alert/alert.d.ts} +2 -2
- package/dist/components/feedback/{global-alert.d.ts → global-alert/global-alert.d.ts} +1 -1
- package/dist/components/feedback/index.d.ts +8 -8
- package/dist/components/feedback/{toast.d.ts → toast/toast.d.ts} +1 -1
- package/dist/components/form/{autocomplete.d.ts → autocomplete/autocomplete.d.ts} +2 -2
- package/dist/components/form/{email-input.d.ts → email-input/email-input.d.ts} +1 -1
- package/dist/components/form/index.d.ts +12 -12
- package/dist/components/form/{multi-select.d.ts → multi-select/multi-select.d.ts} +1 -1
- package/dist/components/form/{number-input-unit.d.ts → number-input/number-input-unit.d.ts} +2 -2
- package/dist/components/form/{radio.d.ts → radio/radio.d.ts} +2 -2
- package/dist/components/form/{radio-card.d.ts → radio-card/radio-card.d.ts} +3 -3
- package/dist/components/form/{select.d.ts → select/select.d.ts} +1 -1
- package/dist/components/form/{slider.d.ts → slider/slider.d.ts} +1 -1
- package/dist/components/index.d.ts +1 -2
- package/dist/components/layout/{container.d.ts → container/container.d.ts} +1 -1
- package/dist/components/layout/{grid.d.ts → grid/grid.d.ts} +2 -2
- package/dist/components/layout/index.d.ts +3 -3
- package/dist/components/layout/{stack.d.ts → stack/stack.d.ts} +2 -2
- package/dist/components/navigation/{form-stepper.d.ts → form-stepper/form-stepper.d.ts} +2 -2
- package/dist/components/navigation/index.d.ts +9 -8
- package/dist/components/navigation/{linear-form-stepper.d.ts → linear-form-stepper/linear-form-stepper.d.ts} +2 -2
- package/dist/components/navigation/{progress-circle.d.ts → progress-circle/progress-circle.d.ts} +1 -1
- package/dist/components/navigation/{tabs.d.ts → tabs/tabs.d.ts} +1 -1
- package/dist/components/surfaces/index.d.ts +3 -3
- package/dist/components/typography/index.d.ts +3 -3
- package/dist/components/typography/{link.d.ts → link/link.d.ts} +1 -1
- package/dist/components/typography/{text.d.ts → text/text.d.ts} +4 -4
- package/dist/cookie-consent/copy.d.ts +8 -2
- package/dist/cookie-consent/core.d.ts +18 -3
- package/dist/cookie-consent/react.d.ts +35 -2
- package/dist/cookie-consent-core-BYak3SKZ.cjs +2 -0
- package/dist/cookie-consent-core-BYak3SKZ.cjs.map +1 -0
- package/dist/{cookie-consent-core-lX0QAEAo.mjs → cookie-consent-core-DMnn4IZW.mjs} +25 -15
- package/dist/cookie-consent-core-DMnn4IZW.mjs.map +1 -0
- package/dist/cookie-consent-react.cjs +1 -1
- package/dist/cookie-consent-react.cjs.map +1 -1
- package/dist/cookie-consent-react.mjs +171 -154
- package/dist/cookie-consent-react.mjs.map +1 -1
- package/dist/cookie-consent.cjs +1 -1
- package/dist/cookie-consent.mjs +2 -2
- package/dist/index.css +1 -1
- package/dist/utils/{formatDecimalString.d.ts → format-decimal-string.d.ts} +1 -1
- package/dist/utils/index.d.ts +5 -5
- package/dist/website/{alert-banner.d.ts → alert-banner/alert-banner.d.ts} +21 -4
- package/dist/website/{use-carousel.d.ts → carousel/use-carousel.d.ts} +3 -1
- package/dist/website/{expanding-cards-item.d.ts → expanding-cards/expanding-cards-item.d.ts} +1 -1
- package/dist/website/index.d.ts +25 -25
- package/dist/website/{payment-feature.d.ts → payment-feature/payment-feature.d.ts} +1 -1
- package/dist/website/{section.d.ts → section/section.d.ts} +1 -1
- package/dist/website/{side-nav.d.ts → side-nav/side-nav.d.ts} +1 -1
- package/dist/website/{site-footer.d.ts → site-footer/site-footer.d.ts} +1 -1
- package/dist/website/site-header-link.d.ts +1 -1
- package/dist/website.cjs +1 -1
- package/dist/website.cjs.map +1 -1
- package/dist/website.css +1 -1
- package/dist/website.mjs +329 -283
- package/dist/website.mjs.map +1 -1
- package/package.json +2 -1
- package/dist/components/ui/index.d.ts +0 -2
- package/dist/cookie-consent-core-fntGUdFt.cjs +0 -2
- package/dist/cookie-consent-core-fntGUdFt.cjs.map +0 -1
- package/dist/cookie-consent-core-lX0QAEAo.mjs.map +0 -1
- /package/dist/components/buttons/{use-download-labels.d.ts → download-trigger/use-download-labels.d.ts} +0 -0
- /package/dist/components/data-display/{article-card.d.ts → article-card/article-card.d.ts} +0 -0
- /package/dist/components/data-display/{avatar.d.ts → avatar/avatar.d.ts} +0 -0
- /package/dist/components/{ui → data-display/brand-divider}/brand-divider.d.ts +0 -0
- /package/dist/components/data-display/{use-chip-labels.d.ts → chip/use-chip-labels.d.ts} +0 -0
- /package/dist/components/data-display/{data-field.d.ts → data-field/data-field.d.ts} +0 -0
- /package/dist/components/data-display/{featured-image.d.ts → featured-image/featured-image.d.ts} +0 -0
- /package/dist/components/data-display/{arrow-circle.d.ts → link-card/arrow-circle.d.ts} +0 -0
- /package/dist/components/data-display/{partner-row.d.ts → partner-row/partner-row.d.ts} +0 -0
- /package/dist/components/data-display/{rich-text.d.ts → rich-text/rich-text.d.ts} +0 -0
- /package/dist/components/data-display/{star-rating.d.ts → star-rating/star-rating.d.ts} +0 -0
- /package/dist/components/data-display/{use-star-rating-labels.d.ts → star-rating/use-star-rating-labels.d.ts} +0 -0
- /package/dist/components/data-display/{table.d.ts → table/table.d.ts} +0 -0
- /package/dist/components/data-display/{testimonial-card.d.ts → testimonial-card/testimonial-card.d.ts} +0 -0
- /package/dist/components/data-display/{tooltip.d.ts → tooltip/tooltip.d.ts} +0 -0
- /package/dist/components/data-display/{use-video-player-labels.d.ts → video-player/use-video-player-labels.d.ts} +0 -0
- /package/dist/components/data-display/{video-player.d.ts → video-player/video-player.d.ts} +0 -0
- /package/dist/components/feedback/{dialog.d.ts → dialog/dialog.d.ts} +0 -0
- /package/dist/components/feedback/{simple-dialog.d.ts → dialog/simple-dialog.d.ts} +0 -0
- /package/dist/components/feedback/{drawer.d.ts → drawer/drawer.d.ts} +0 -0
- /package/dist/components/feedback/{simple-drawer.d.ts → drawer/simple-drawer.d.ts} +0 -0
- /package/dist/components/feedback/{skeleton.d.ts → skeleton/skeleton.d.ts} +0 -0
- /package/dist/components/form/{amount-slider.d.ts → amount-slider/amount-slider.d.ts} +0 -0
- /package/dist/components/form/{checkbox.d.ts → checkbox/checkbox.d.ts} +0 -0
- /package/dist/components/form/{input.d.ts → input/input.d.ts} +0 -0
- /package/dist/components/form/{number-input.d.ts → number-input/number-input.d.ts} +0 -0
- /package/dist/components/form/{switch.d.ts → switch/switch.d.ts} +0 -0
- /package/dist/components/{ui → navigation/app-header}/app-header.d.ts +0 -0
- /package/dist/components/navigation/{breadcrumbs.d.ts → breadcrumbs/breadcrumbs.d.ts} +0 -0
- /package/dist/components/navigation/{use-breadcrumbs-labels.d.ts → breadcrumbs/use-breadcrumbs-labels.d.ts} +0 -0
- /package/dist/components/navigation/{step-progress.d.ts → linear-form-stepper/step-progress.d.ts} +0 -0
- /package/dist/components/navigation/{pagination.d.ts → pagination/pagination.d.ts} +0 -0
- /package/dist/components/navigation/{pagination-dots.d.ts → pagination-dots/pagination-dots.d.ts} +0 -0
- /package/dist/components/surfaces/{accordion.d.ts → accordion/accordion.d.ts} +0 -0
- /package/dist/components/surfaces/{simple-accordion.d.ts → accordion/simple-accordion.d.ts} +0 -0
- /package/dist/components/surfaces/{panel.d.ts → panel/panel.d.ts} +0 -0
- /package/dist/components/typography/{lists.d.ts → lists/lists.d.ts} +0 -0
- /package/dist/utils/{downloadFile.d.ts → download-file.d.ts} +0 -0
- /package/dist/utils/{formatDecimal.d.ts → format-decimal.d.ts} +0 -0
- /package/dist/utils/{formatPercentage.d.ts → format-percentage.d.ts} +0 -0
- /package/dist/utils/{parseExpirationDate.d.ts → parse-expiration-date.d.ts} +0 -0
- /package/dist/website/{brand-letters.d.ts → brand-letters/brand-letters.d.ts} +0 -0
- /package/dist/website/{use-brand-letters-labels.d.ts → brand-letters/use-brand-letters-labels.d.ts} +0 -0
- /package/dist/website/{calculator.d.ts → calculator/calculator.d.ts} +0 -0
- /package/dist/website/{carousel.d.ts → carousel/carousel.d.ts} +0 -0
- /package/dist/website/{use-carousel-labels.d.ts → carousel/use-carousel-labels.d.ts} +0 -0
- /package/dist/website/{cta-banner.d.ts → cta-banner/cta-banner.d.ts} +0 -0
- /package/dist/website/{expanding-cards-context.d.ts → expanding-cards/expanding-cards-context.d.ts} +0 -0
- /package/dist/website/{expanding-cards.d.ts → expanding-cards/expanding-cards.d.ts} +0 -0
- /package/dist/website/{hero.d.ts → hero/hero.d.ts} +0 -0
- /package/dist/website/{hero-service-grid.d.ts → hero-service-grid/hero-service-grid.d.ts} +0 -0
- /package/dist/website/{navigation-grid.d.ts → navigation-grid/navigation-grid.d.ts} +0 -0
- /package/dist/website/{partner-list.d.ts → partner-list/partner-list.d.ts} +0 -0
- /package/dist/website/{use-partner-list-labels.d.ts → partner-list/use-partner-list-labels.d.ts} +0 -0
- /package/dist/website/{promo-grid.d.ts → promo-grid/promo-grid.d.ts} +0 -0
- /package/dist/website/{section-header.d.ts → section-header/section-header.d.ts} +0 -0
- /package/dist/website/{service-card-grid.d.ts → service-card-grid/service-card-grid.d.ts} +0 -0
- /package/dist/website/{use-side-nav-labels.d.ts → side-nav/use-side-nav-labels.d.ts} +0 -0
- /package/dist/website/{flags.d.ts → site-footer/flags.d.ts} +0 -0
- /package/dist/website/{use-site-footer-labels.d.ts → site-footer/use-site-footer-labels.d.ts} +0 -0
- /package/dist/website/{site-header-menu.d.ts → site-header/site-header-menu.d.ts} +0 -0
- /package/dist/website/{site-header.d.ts → site-header/site-header.d.ts} +0 -0
- /package/dist/website/{split-content.d.ts → split-content/split-content.d.ts} +0 -0
- /package/dist/website/{stats.d.ts → stats/stats.d.ts} +0 -0
- /package/dist/website/{testimonials.d.ts → testimonials/testimonials.d.ts} +0 -0
- /package/dist/website/{use-testimonials-labels.d.ts → testimonials/use-testimonials-labels.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ButtonBaseProps } from '
|
|
3
|
-
export type { ButtonColor, ButtonSize, ButtonVariant, } from '
|
|
2
|
+
import { ButtonBaseProps } from '../button-base';
|
|
3
|
+
export type { ButtonColor, ButtonSize, ButtonVariant, } from '../button-base';
|
|
4
4
|
export type ButtonProps = ButtonBaseProps & {
|
|
5
5
|
/** Icon before the label. Replaced by the spinner while `loading`. */
|
|
6
6
|
startIcon?: ReactNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonBaseProps } from '
|
|
1
|
+
import { ButtonBaseProps } from '../button-base';
|
|
2
2
|
export type CloseButtonProps = Omit<ButtonBaseProps, "children" | "aria-label" | "aria-labelledby"> & {
|
|
3
3
|
/** Accessible name. Defaults to a translated "Close". */
|
|
4
4
|
label?: string;
|
package/dist/components/buttons/{download-trigger.d.ts → download-trigger/download-trigger.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DownloadDataSource } from '
|
|
2
|
-
import { ButtonProps } from '
|
|
1
|
+
import { DownloadDataSource } from '../../../utils/download-file';
|
|
2
|
+
import { ButtonProps } from '../button/button';
|
|
3
3
|
type DownloadTriggerProps = Omit<ButtonProps, "onClick"> & {
|
|
4
4
|
/** File contents, or a function/promise that resolves to them. */
|
|
5
5
|
data: DownloadDataSource;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ButtonBaseProps, ButtonVariant } from '
|
|
2
|
+
import { ButtonBaseProps, ButtonVariant } from '../button-base';
|
|
3
3
|
/**
|
|
4
4
|
* The variants of `Button`, plus `"elevated"`: a white disc with the website's
|
|
5
5
|
* soft shadow, for controls that float over a picture or a coloured section
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './action-button';
|
|
2
|
-
export * from './button';
|
|
3
|
-
export * from './close-button';
|
|
4
|
-
export * from './download-trigger';
|
|
5
|
-
export * from './icon-button';
|
|
6
|
-
export * from './skip-link';
|
|
1
|
+
export * from './action-button/action-button';
|
|
2
|
+
export * from './button/button';
|
|
3
|
+
export * from './close-button/close-button';
|
|
4
|
+
export * from './download-trigger/download-trigger';
|
|
5
|
+
export * from './icon-button/icon-button';
|
|
6
|
+
export * from './skip-link/skip-link';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ButtonBaseProps } from '
|
|
2
|
+
import { ButtonBaseProps } from '../button-base';
|
|
3
3
|
export type SkipLinkProps = Pick<ButtonBaseProps, "className" | "style"> & {
|
|
4
4
|
/** The id of the main content, as a fragment: `#main`. */
|
|
5
5
|
href: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
2
|
import { Ref } from 'react';
|
|
3
|
-
import { ColorRoles } from '
|
|
3
|
+
import { ColorRoles } from '../../color-roles';
|
|
4
4
|
export type CardColor = ColorRoles<"primary" | "tertiary" | "neutral" | "success" | "info" | "warning" | "error">;
|
|
5
5
|
export type CardVariant = "outlined" | "filled";
|
|
6
6
|
export type CardProps = Omit<useRender.ComponentProps<"div">, "ref" | "color"> & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps, MouseEvent, ReactNode } from 'react';
|
|
2
|
-
import { ColorRoles } from '
|
|
2
|
+
import { ColorRoles } from '../../color-roles';
|
|
3
3
|
export type ChipColor = ColorRoles<"primary" | "tertiary" | "neutral" | "muted" | "success" | "info" | "warning" | "error">;
|
|
4
4
|
export type ChipVariant = "filled" | "outlined";
|
|
5
5
|
export type ChipSize = "sm" | "md" | "lg";
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export * from './data-field';
|
|
2
|
-
export * from './card';
|
|
3
|
-
export * from './chip';
|
|
4
|
-
export * from './tooltip';
|
|
5
|
-
export * from './avatar';
|
|
6
|
-
export * from './star-rating';
|
|
7
|
-
export * from './table';
|
|
8
|
-
export * from './rich-text';
|
|
9
|
-
export * from './featured-image';
|
|
10
|
-
export * from './video-player';
|
|
11
|
-
export * from './link-card';
|
|
12
|
-
export * from './media-card';
|
|
13
|
-
export * from './service-card';
|
|
14
|
-
export * from './testimonial-card';
|
|
15
|
-
export * from './article-card';
|
|
16
|
-
export * from './partner-row';
|
|
1
|
+
export * from './data-field/data-field';
|
|
2
|
+
export * from './card/card';
|
|
3
|
+
export * from './chip/chip';
|
|
4
|
+
export * from './tooltip/tooltip';
|
|
5
|
+
export * from './avatar/avatar';
|
|
6
|
+
export * from './star-rating/star-rating';
|
|
7
|
+
export * from './table/table';
|
|
8
|
+
export * from './rich-text/rich-text';
|
|
9
|
+
export * from './featured-image/featured-image';
|
|
10
|
+
export * from './video-player/video-player';
|
|
11
|
+
export * from './link-card/link-card';
|
|
12
|
+
export * from './media-card/media-card';
|
|
13
|
+
export * from './service-card/service-card';
|
|
14
|
+
export * from './testimonial-card/testimonial-card';
|
|
15
|
+
export * from './article-card/article-card';
|
|
16
|
+
export * from './partner-row/partner-row';
|
|
17
|
+
export * from './brand-divider/brand-divider';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
2
|
import { ReactElement, ReactNode, Ref } from 'react';
|
|
3
|
-
import { SurfaceRoles } from '
|
|
3
|
+
import { SurfaceRoles } from '../../color-roles';
|
|
4
4
|
export type LinkCardSurface = SurfaceRoles<"base" | "subtle" | "muted" | "contrast" | "contrast-accent">;
|
|
5
5
|
/** A link card always leads somewhere: an `href`, or a router link. */
|
|
6
6
|
type LinkCardTarget = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
2
|
import { ReactElement, ReactNode, Ref } from 'react';
|
|
3
|
-
import { SurfaceRoles } from '
|
|
3
|
+
import { SurfaceRoles } from '../../color-roles';
|
|
4
4
|
export type MediaCardSurface = SurfaceRoles<"base" | "subtle" | "muted" | "contrast" | "contrast-accent">;
|
|
5
5
|
export type MediaCardOrientation = "horizontal" | "vertical";
|
|
6
6
|
export type MediaCardImagePosition = "start" | "end";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
2
|
import { ReactElement, ReactNode, Ref } from 'react';
|
|
3
|
-
import { SurfaceRoles } from '
|
|
3
|
+
import { SurfaceRoles } from '../../color-roles';
|
|
4
4
|
export type ServiceCardSurface = SurfaceRoles<"base" | "subtle" | "muted" | "contrast" | "contrast-accent">;
|
|
5
5
|
export type ServiceCardLayout = "stacked" | "row";
|
|
6
6
|
/** `alt` is required with a photo, `""` when it is decoration. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
import { AlertProps } from '
|
|
3
|
-
export type { AlertColor, AlertProps, AlertSeverity, AlertSize, AlertVariant, } from '
|
|
2
|
+
import { AlertProps } from '../alert-parts';
|
|
3
|
+
export type { AlertColor, AlertProps, AlertSeverity, AlertSize, AlertVariant, } from '../alert-parts';
|
|
4
4
|
/**
|
|
5
5
|
* A message with Lea Bank's status colours. The ARIA `role` is derived from
|
|
6
6
|
* `severity`: `error` / `warning` announce assertively (`role="alert"`) while
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './alert';
|
|
2
|
-
export * as Dialog from './dialog';
|
|
3
|
-
export * as Drawer from './drawer';
|
|
4
|
-
export * from './global-alert';
|
|
5
|
-
export * from './simple-dialog';
|
|
6
|
-
export * from './simple-drawer';
|
|
7
|
-
export * from './toast';
|
|
8
|
-
export * from './skeleton';
|
|
1
|
+
export * from './alert/alert';
|
|
2
|
+
export * as Dialog from './dialog/dialog';
|
|
3
|
+
export * as Drawer from './drawer/drawer';
|
|
4
|
+
export * from './global-alert/global-alert';
|
|
5
|
+
export * from './dialog/simple-dialog';
|
|
6
|
+
export * from './drawer/simple-drawer';
|
|
7
|
+
export * from './toast/toast';
|
|
8
|
+
export * from './skeleton/skeleton';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MouseEvent, ReactNode } from 'react';
|
|
2
|
-
import { AlertColor, AlertSeverity } from '
|
|
2
|
+
import { AlertColor, AlertSeverity } from '../alert-parts';
|
|
3
3
|
export type ToastSeverity = AlertSeverity;
|
|
4
4
|
export type ToastColor = AlertColor;
|
|
5
5
|
export type ToastOptions = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ComboFieldBaseProps } from '
|
|
3
|
-
import { SelectOption } from '
|
|
2
|
+
import { ComboFieldBaseProps } from '../combo-field';
|
|
3
|
+
import { SelectOption } from '../select-field';
|
|
4
4
|
type AutocompleteBaseProps<Value extends string> = ComboFieldBaseProps & {
|
|
5
5
|
/** The choices. Typing filters them by their label. */
|
|
6
6
|
options: readonly SelectOption<Value>[];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export * from './amount-slider';
|
|
2
|
-
export * from './autocomplete';
|
|
3
|
-
export * from './checkbox';
|
|
4
|
-
export * from './email-input';
|
|
5
|
-
export * from './input';
|
|
6
|
-
export * from './multi-select';
|
|
7
|
-
export * from './number-input';
|
|
1
|
+
export * from './amount-slider/amount-slider';
|
|
2
|
+
export * from './autocomplete/autocomplete';
|
|
3
|
+
export * from './checkbox/checkbox';
|
|
4
|
+
export * from './email-input/email-input';
|
|
5
|
+
export * from './input/input';
|
|
6
|
+
export * from './multi-select/multi-select';
|
|
7
|
+
export * from './number-input/number-input';
|
|
8
8
|
export * from './phone-number-input';
|
|
9
|
-
export * as RadioGroup from './radio';
|
|
10
|
-
export * as RadioCard from './radio-card';
|
|
11
|
-
export * from './select';
|
|
12
|
-
export * from './slider';
|
|
13
|
-
export * from './switch';
|
|
9
|
+
export * as RadioGroup from './radio/radio';
|
|
10
|
+
export * as RadioCard from './radio-card/radio-card';
|
|
11
|
+
export * from './select/select';
|
|
12
|
+
export * from './slider/slider';
|
|
13
|
+
export * from './switch/switch';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SelectFieldBaseProps, SelectOption } from '
|
|
2
|
+
import { SelectFieldBaseProps, SelectOption } from '../select-field';
|
|
3
3
|
export type MultiSelectProps<Value extends string = string> = SelectFieldBaseProps & {
|
|
4
4
|
/** The choices, shown with a checkbox each. */
|
|
5
5
|
options: readonly SelectOption<Value>[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Currency } from '
|
|
3
|
-
import { Language } from '
|
|
2
|
+
import { Currency } from '../../../hooks/country/countries';
|
|
3
|
+
import { Language } from '../../../i18n';
|
|
4
4
|
/**
|
|
5
5
|
* A unit the library writes for you, in the language of `LeaProvider`:
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode, Ref } from 'react';
|
|
2
|
-
import { RadioSize } from '
|
|
3
|
-
import { RadioGroupBaseProps, RadioValue } from '
|
|
2
|
+
import { RadioSize } from '../radio-circle';
|
|
3
|
+
import { RadioGroupBaseProps, RadioValue } from '../radio-group-root';
|
|
4
4
|
export type { RadioSize as Size, RadioValue as Value };
|
|
5
5
|
/**
|
|
6
6
|
* One choice in the `options` list of a `RadioGroup.Root` or `RadioCard.Group`.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LucideIcon } from 'lucide-react';
|
|
2
2
|
import { CSSProperties, ReactNode, Ref } from 'react';
|
|
3
|
-
import { Option } from '
|
|
4
|
-
import { RadioSize } from '
|
|
5
|
-
import { RadioCardSize, RadioGroupBaseProps, RadioValue } from '
|
|
3
|
+
import { Option } from '../radio/radio';
|
|
4
|
+
import { RadioSize } from '../radio-circle';
|
|
5
|
+
import { RadioCardSize, RadioGroupBaseProps, RadioValue } from '../radio-group-root';
|
|
6
6
|
export type RootProps<T extends RadioValue = RadioValue> = {
|
|
7
7
|
/** What `onValueChange` on the group is called with when this card is picked. */
|
|
8
8
|
value: T;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SelectFieldBaseProps, SelectOption, SelectSize } from '
|
|
1
|
+
import { SelectFieldBaseProps, SelectOption, SelectSize } from '../select-field';
|
|
2
2
|
export type { SelectOption, SelectSize };
|
|
3
3
|
export type SelectProps<Value extends string = string> = SelectFieldBaseProps & {
|
|
4
4
|
/** The choices. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Slider as BaseSlider } from '@base-ui/react/slider';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { ColorRoles } from '
|
|
3
|
+
import { ColorRoles } from '../../color-roles';
|
|
4
4
|
/**
|
|
5
5
|
* Requires an accessible name so the slider is never nameless. Provide a
|
|
6
6
|
* visible `label`, or an `aria-label` when the design has none.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
-
import { Breakpoint } from '
|
|
2
|
+
import { Breakpoint } from '../../../theme/tokens/breakpoints';
|
|
3
3
|
export type ContainerSize = Exclude<Breakpoint, "xs">;
|
|
4
4
|
export type ContainerProps = Omit<useRender.ComponentProps<"div">, "ref"> & {
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
-
import { SpacingFactor } from '
|
|
3
|
-
import { Responsive } from '
|
|
2
|
+
import { SpacingFactor } from '../../../theme/token-types';
|
|
3
|
+
import { Responsive } from '../responsive';
|
|
4
4
|
export type GridProps = Omit<useRender.ComponentProps<"div">, "ref"> & {
|
|
5
5
|
/**
|
|
6
6
|
* Number of equal-width columns.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './container';
|
|
2
|
-
export * from './grid';
|
|
1
|
+
export * from './container/container';
|
|
2
|
+
export * from './grid/grid';
|
|
3
3
|
export type { Responsive, ResponsiveKey } from './responsive';
|
|
4
|
-
export * from './stack';
|
|
4
|
+
export * from './stack/stack';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
-
import { SpacingFactor } from '
|
|
3
|
-
import { Responsive } from '
|
|
2
|
+
import { SpacingFactor } from '../../../theme/token-types';
|
|
3
|
+
import { Responsive } from '../responsive';
|
|
4
4
|
export type StackDirection = "column" | "row";
|
|
5
5
|
export type StackAlign = "start" | "center" | "end" | "stretch" | "baseline";
|
|
6
6
|
export type StackJustify = "start" | "center" | "end" | "between" | "around" | "evenly";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ProgressCircleColor } from '
|
|
3
|
-
import { StepperLabels } from '
|
|
2
|
+
import { ProgressCircleColor } from '../progress-circle/progress-circle';
|
|
3
|
+
import { StepperLabels } from '../use-stepper-labels';
|
|
4
4
|
export type FormStepperProps = {
|
|
5
5
|
/** Active step (1-based). */
|
|
6
6
|
currentStep: number;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export * from './form-stepper';
|
|
2
|
-
export * from './linear-form-stepper';
|
|
3
|
-
export * from './progress-circle';
|
|
4
|
-
export * from './step-progress';
|
|
5
|
-
export * as Tabs from './tabs';
|
|
1
|
+
export * from './form-stepper/form-stepper';
|
|
2
|
+
export * from './linear-form-stepper/linear-form-stepper';
|
|
3
|
+
export * from './progress-circle/progress-circle';
|
|
4
|
+
export * from './linear-form-stepper/step-progress';
|
|
5
|
+
export * as Tabs from './tabs/tabs';
|
|
6
6
|
export * from './use-stepper-labels';
|
|
7
|
-
export * from './breadcrumbs';
|
|
8
|
-
export * from './pagination';
|
|
9
|
-
export * from './pagination-dots';
|
|
7
|
+
export * from './breadcrumbs/breadcrumbs';
|
|
8
|
+
export * from './pagination/pagination';
|
|
9
|
+
export * from './pagination-dots/pagination-dots';
|
|
10
|
+
export * from './app-header/app-header';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ProgressCircleColor } from '
|
|
3
|
-
import { StepperLabels } from '
|
|
2
|
+
import { ProgressCircleColor } from '../progress-circle/progress-circle';
|
|
3
|
+
import { StepperLabels } from '../use-stepper-labels';
|
|
4
4
|
export type LinearFormStepperProps = {
|
|
5
5
|
/** Active step (1-based). */
|
|
6
6
|
currentStep: number;
|
package/dist/components/navigation/{progress-circle.d.ts → progress-circle/progress-circle.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColorRoles } from '
|
|
1
|
+
import { ColorRoles } from '../../color-roles';
|
|
2
2
|
export type ProgressCircleColor = ColorRoles<"primary" | "tertiary">;
|
|
3
3
|
export type ProgressCircleProps = {
|
|
4
4
|
/** Current value, e.g. the active step (1-based). Clamped to `0..max`. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tabs as BaseTabs } from '@base-ui/react/tabs';
|
|
2
|
-
import { ColorRoles } from '
|
|
2
|
+
import { ColorRoles } from '../../color-roles';
|
|
3
3
|
/** The colours of the active "pill". */
|
|
4
4
|
export type Color = ColorRoles<"primary" | "secondary">;
|
|
5
5
|
export type RootProps = Omit<BaseTabs.Root.Props, "color"> & {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * as Accordion from './accordion';
|
|
2
|
-
export * from './simple-accordion';
|
|
3
|
-
export * from './panel';
|
|
1
|
+
export * as Accordion from './accordion/accordion';
|
|
2
|
+
export * from './accordion/simple-accordion';
|
|
3
|
+
export * from './panel/panel';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './link';
|
|
2
|
-
export * as List from './lists';
|
|
3
|
-
export * from './text';
|
|
1
|
+
export * from './link/link';
|
|
2
|
+
export * as List from './lists/lists';
|
|
3
|
+
export * from './text/text';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
2
|
import { Ref } from 'react';
|
|
3
|
-
import { ColorRoles } from '
|
|
3
|
+
import { ColorRoles } from '../../color-roles';
|
|
4
4
|
export type LinkColor = ColorRoles<"secondary" | "primary" | "tertiary" | "contrast">;
|
|
5
5
|
export type LinkProps = Omit<useRender.ComponentProps<"a">, "ref" | "color"> & {
|
|
6
6
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
2
|
import { Ref } from 'react';
|
|
3
|
-
import { ColorPath } from '
|
|
4
|
-
import { fontSizes } from '
|
|
5
|
-
import { fontWeights } from '
|
|
6
|
-
import { TextStyleToken } from '
|
|
3
|
+
import { ColorPath } from '../../../theme/token-types';
|
|
4
|
+
import { fontSizes } from '../../../theme/tokens/font-sizes';
|
|
5
|
+
import { fontWeights } from '../../../theme/tokens/font-weights';
|
|
6
|
+
import { TextStyleToken } from '../../../theme/tokens/text-styles';
|
|
7
7
|
type FontSizeToken = keyof typeof fontSizes;
|
|
8
8
|
type FontWeightToken = keyof typeof fontWeights;
|
|
9
9
|
/** A palette token such as `text.subtle`, or `inherit` for the parent's colour. */
|
|
@@ -3,9 +3,15 @@ import { StrapiBlocksNode } from './strapi-blocks';
|
|
|
3
3
|
/** Consent copy as resolved by the app from Strapi, fallbacks applied. */
|
|
4
4
|
export interface CookieConsentCopy {
|
|
5
5
|
modalTitle: string;
|
|
6
|
+
/**
|
|
7
|
+
* Rich text above the categories. End it with the link to the cookie policy:
|
|
8
|
+
* the dialog has no link of its own.
|
|
9
|
+
*/
|
|
6
10
|
intro: StrapiBlocksNode[];
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
/** Unused: the dialog has no separate policy link. Put it in `intro`. */
|
|
12
|
+
policyLinkLabel?: string;
|
|
13
|
+
/** Unused, as `policyLinkLabel`. */
|
|
14
|
+
policyLinkUrl?: string;
|
|
9
15
|
btnAcceptAll: string;
|
|
10
16
|
btnAcceptNecessary: string;
|
|
11
17
|
btnSaveSettings: string;
|
|
@@ -3,17 +3,29 @@ export interface InitCookieConsentOptions {
|
|
|
3
3
|
market: Market;
|
|
4
4
|
/**
|
|
5
5
|
* Called with the visitor's choice once the library has loaded, when there
|
|
6
|
-
* is a valid consent, and again whenever the choice changes.
|
|
6
|
+
* is a valid consent, and again whenever the choice changes. Only the first
|
|
7
|
+
* call's function is kept: in React, pass `onConsentChange` to
|
|
8
|
+
* `CookieConsentProvider` instead.
|
|
7
9
|
*/
|
|
8
10
|
onConsentChange?: (state: ConsentState) => void;
|
|
9
11
|
}
|
|
10
12
|
export interface ConsentSnapshot {
|
|
11
13
|
consent: ConsentState | null;
|
|
12
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Whether the settings were asked for with `openCookieSettings`. The
|
|
16
|
+
* provider also opens them by itself while `consent` is `null`.
|
|
17
|
+
*/
|
|
13
18
|
settingsOpen: boolean;
|
|
14
19
|
/** The stored consent has been read and the choice can be changed. */
|
|
15
20
|
ready: boolean;
|
|
16
21
|
}
|
|
22
|
+
/** Whether two choices accept the same categories. */
|
|
23
|
+
export declare function sameConsent(a: ConsentState | null, b: ConsentState | null): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the user agent is a known crawler or audit tool, such as Googlebot
|
|
26
|
+
* or Lighthouse. Browser automation such as Playwright is not one.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isCrawler(userAgent: string): boolean;
|
|
17
29
|
/** `null` on the server, before the visitor has chosen, or after a revision bump. */
|
|
18
30
|
export declare function getConsentState(): ConsentState | null;
|
|
19
31
|
/**
|
|
@@ -27,7 +39,10 @@ export declare function initCookieConsent({ market, onConsentChange, }: InitCook
|
|
|
27
39
|
* `initCookieConsent` has read the stored consent.
|
|
28
40
|
*/
|
|
29
41
|
export declare function setConsent(categories: readonly CookieConsentCategory[] | "all"): void;
|
|
30
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Opens the settings dialog of the mounted `CookieConsentProvider`, also
|
|
44
|
+
* where its `autoOpen` is `false`.
|
|
45
|
+
*/
|
|
31
46
|
export declare function openCookieSettings(): void;
|
|
32
47
|
/** Closes the settings dialog, unless the visitor has yet to choose. */
|
|
33
48
|
export declare function closeCookieSettings(): void;
|
|
@@ -12,11 +12,44 @@ export interface CookieConsentProviderProps {
|
|
|
12
12
|
copy: CookieConsentCopy;
|
|
13
13
|
/** Rewrites link URLs in the copy, e.g. to make CMS-relative paths absolute. */
|
|
14
14
|
resolveHref?: ResolveHref;
|
|
15
|
+
/**
|
|
16
|
+
* Called with the visitor's choice, for example to update Google Consent
|
|
17
|
+
* Mode or to start analytics. Called once after load when there is a valid
|
|
18
|
+
* stored consent, then whenever the choice changes: the first choice, a
|
|
19
|
+
* change, or a step back to necessary only.
|
|
20
|
+
*
|
|
21
|
+
* Never called with `null`, nor when the visitor saves the same choice
|
|
22
|
+
* again. Called once per change, also under React StrictMode, and also when
|
|
23
|
+
* `initCookieConsent` was called elsewhere first. The latest function is
|
|
24
|
+
* always the one called, so an inline arrow function is fine. An error
|
|
25
|
+
* thrown in it is passed to `reportError`, and the choice is still saved.
|
|
26
|
+
*
|
|
27
|
+
* A function can't be passed from a server component: render the provider
|
|
28
|
+
* through a client component of your own.
|
|
29
|
+
*/
|
|
30
|
+
onConsentChange?: (state: ConsentState) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the dialog opens by itself while the visitor has yet to choose.
|
|
33
|
+
* Default `true`. Pass `false` on pages the dialog shouldn't cover, such as
|
|
34
|
+
* the cookie policy, which the intro's link opens in a new tab.
|
|
35
|
+
*
|
|
36
|
+
* While it is `false` and there is no consent, the dialog stays closed and
|
|
37
|
+
* only necessary cookies are used. `openSettings` and `openCookieSettings`
|
|
38
|
+
* still open it, and it still can't be dismissed without a choice. It is
|
|
39
|
+
* read on every render: when it turns `true` with no consent yet, the
|
|
40
|
+
* dialog opens.
|
|
41
|
+
*
|
|
42
|
+
* The dialog never opens by itself for crawlers and audit tools (a user
|
|
43
|
+
* agent with `bot`, `crawl`, `spider`, `slurp`, `teoma` or `lighthouse`).
|
|
44
|
+
* Browser automation such as Playwright gets it as visitors do.
|
|
45
|
+
*/
|
|
46
|
+
autoOpen?: boolean;
|
|
15
47
|
children?: ReactNode;
|
|
16
48
|
}
|
|
17
49
|
/**
|
|
18
50
|
* Reads the shared consent after mount and renders the settings dialog, which
|
|
19
|
-
* opens by itself until the visitor has chosen
|
|
51
|
+
* opens by itself until the visitor has chosen, unless `autoOpen` is `false`.
|
|
52
|
+
* `market` is read once.
|
|
20
53
|
*/
|
|
21
|
-
export declare function CookieConsentProvider({ market, copy, resolveHref, children, }: CookieConsentProviderProps): import("react").JSX.Element;
|
|
54
|
+
export declare function CookieConsentProvider({ market, copy, resolveHref, onConsentChange, autoOpen, children, }: CookieConsentProviderProps): import("react").JSX.Element;
|
|
22
55
|
export declare function useCookieConsent(): CookieConsentContextValue;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("vanilla-cookieconsent");c=s(c);var l=3,u=[`necessary`,`preferences`,`analytics`,`marketing`],d={se:`leabank.se`,fi:`leabank.fi`,no:`leabank.no`,es:`leabank.es`},f=`cc_cookie`;function p(e,t){let n=d[t],r=e.toLowerCase();return r===n||r.endsWith(`.${n}`)?n:void 0}function m(){document.cookie=`${f}=; path=/; max-age=0`}var h={consent:null,settingsOpen:!1,ready:!1},g=!1,_=h,v=new Set;function y(e){_={..._,...e},v.forEach(e=>e())}function b(e,t){return e===null||t===null?e===t:u.every(n=>e[n]===t[n])}function x(){let e=w();return b(e,_.consent)?_.consent:e}var S=/bot|crawl|spider|slurp|teoma|lighthouse/i;function C(e){return S.test(e)}function w(){if(typeof window>`u`||!c.validConsent())return null;let e=new Set(c.getUserPreferences().acceptedCategories);return Object.fromEntries(u.map(t=>[t,e.has(t)]))}function T({market:e,onConsentChange:t}){if(typeof window>`u`||g)return;g=!0;let n=p(window.location.hostname,e);n&&m();let r=()=>{let e=x();y({consent:e}),e&&t?.(e)};c.run({root:document.createElement(`div`),autoShow:!1,hideFromBots:!1,language:{default:`en`,translations:{en:{consentModal:{},preferencesModal:{sections:[]}}}},revision:3,cookie:{name:f,sameSite:`Lax`,secure:!0,...n&&{domain:n}},categories:{necessary:{enabled:!0,readOnly:!0},preferences:{enabled:!1,readOnly:!1},analytics:{enabled:!1,readOnly:!1,autoClear:{cookies:[{name:/^(_ga|_gid|_gat)/}]}},marketing:{enabled:!1,readOnly:!1,autoClear:{cookies:[{name:/^(_fbp|_fbc)/},{name:/^(_gcl_)/}]}}},onFirstConsent:r,onChange:r}).then(()=>{let e=x();y({consent:e,ready:!0}),e&&t?.(e)})}function E(e){_.ready&&(c.acceptCategory(e===`all`?`all`:[`necessary`,...e.filter(e=>e!==`necessary`)]),y({consent:x(),settingsOpen:!1}))}function D(){typeof window>`u`||y({settingsOpen:!0})}function O(){_.consent!==null&&y({settingsOpen:!1})}function k(e){return v.add(e),()=>{v.delete(e)}}function A(){return _}function j(){return h}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return k}});
|
|
2
|
+
//# sourceMappingURL=cookie-consent-core-BYak3SKZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-consent-core-BYak3SKZ.cjs","names":[],"sources":["../src/cookie-consent/constants.ts","../src/cookie-consent/domain.ts","../src/cookie-consent/core.ts"],"sourcesContent":["/**\n * Bumping the revision invalidates every visitor's consent on every Lea Bank\n * app at once. Only change it here, then release all apps together.\n */\nexport const COOKIE_CONSENT_REVISION = 3;\n\nexport const COOKIE_CONSENT_CATEGORIES = [\n \"necessary\",\n \"preferences\",\n \"analytics\",\n \"marketing\",\n] as const;\n\nexport type CookieConsentCategory = (typeof COOKIE_CONSENT_CATEGORIES)[number];\n\nexport type ConsentState = Record<CookieConsentCategory, boolean>;\n\nexport type Market = \"se\" | \"fi\" | \"no\" | \"es\";\n\nexport const MARKET_DOMAINS: Record<Market, string> = {\n se: \"leabank.se\",\n fi: \"leabank.fi\",\n no: \"leabank.no\",\n es: \"leabank.es\",\n};\n\nexport const COOKIE_NAME = \"cc_cookie\";\n","import { COOKIE_NAME, MARKET_DOMAINS, type Market } from \"./constants\";\n\n/**\n * Returns the market's registrable domain when the page is served from it or\n * one of its subdomains. Anywhere else (localhost, `*.azurewebsites.net`,\n * which is on the Public Suffix List) the browser would reject the cookie, so\n * it stays host-only.\n */\nexport function resolveCookieDomain(\n hostname: string,\n market: Market,\n): string | undefined {\n const domain = MARKET_DOMAINS[market];\n const host = hostname.toLowerCase();\n\n return host === domain || host.endsWith(`.${domain}`) ? domain : undefined;\n}\n\n/**\n * Erases a host-only consent cookie left by an earlier, domain-less setup.\n * Without this it coexists with the domain cookie under the same name and a\n * stale value can win. A cookie written without `domain` only matches the\n * host-only one, so the shared cookie is kept.\n */\nexport function clearHostOnlyCookie(): void {\n document.cookie = `${COOKIE_NAME}=; path=/; max-age=0`;\n}\n","import * as CookieConsent from \"vanilla-cookieconsent\";\n\nimport {\n COOKIE_CONSENT_CATEGORIES,\n COOKIE_CONSENT_REVISION,\n COOKIE_NAME,\n type ConsentState,\n type CookieConsentCategory,\n type Market,\n} from \"./constants\";\nimport { clearHostOnlyCookie, resolveCookieDomain } from \"./domain\";\n\nexport interface InitCookieConsentOptions {\n market: Market;\n /**\n * Called with the visitor's choice once the library has loaded, when there\n * is a valid consent, and again whenever the choice changes. Only the first\n * call's function is kept: in React, pass `onConsentChange` to\n * `CookieConsentProvider` instead.\n */\n onConsentChange?: (state: ConsentState) => void;\n}\n\nexport interface ConsentSnapshot {\n consent: ConsentState | null;\n /**\n * Whether the settings were asked for with `openCookieSettings`. The\n * provider also opens them by itself while `consent` is `null`.\n */\n settingsOpen: boolean;\n /** The stored consent has been read and the choice can be changed. */\n ready: boolean;\n}\n\nconst serverSnapshot: ConsentSnapshot = {\n consent: null,\n settingsOpen: false,\n ready: false,\n};\n\nlet started = false;\nlet snapshot = serverSnapshot;\nconst listeners = new Set<() => void>();\n\nfunction update(patch: Partial<ConsentSnapshot>) {\n snapshot = { ...snapshot, ...patch };\n listeners.forEach((listener) => listener());\n}\n\n/** Whether two choices accept the same categories. */\nexport function sameConsent(\n a: ConsentState | null,\n b: ConsentState | null,\n): boolean {\n if (a === null || b === null) return a === b;\n return COOKIE_CONSENT_CATEGORIES.every((category) => a[category] === b[category]);\n}\n\n/**\n * The stored consent, as the current object when the choice is the same, so\n * that saving it again doesn't look like a change to `useCookieConsent`.\n */\nfunction readConsent(): ConsentState | null {\n const consent = getConsentState();\n return sameConsent(consent, snapshot.consent) ? snapshot.consent : consent;\n}\n\n/**\n * vanilla-cookieconsent's own bot check, with Lighthouse added and without its\n * `navigator.webdriver` test, so that end-to-end tests still get the dialog.\n */\nconst CRAWLER_USER_AGENT = /bot|crawl|spider|slurp|teoma|lighthouse/i;\n\n/**\n * Whether the user agent is a known crawler or audit tool, such as Googlebot\n * or Lighthouse. Browser automation such as Playwright is not one.\n */\nexport function isCrawler(userAgent: string): boolean {\n return CRAWLER_USER_AGENT.test(userAgent);\n}\n\n/** `null` on the server, before the visitor has chosen, or after a revision bump. */\nexport function getConsentState(): ConsentState | null {\n if (typeof window === \"undefined\" || !CookieConsent.validConsent()) {\n return null;\n }\n\n const accepted = new Set(CookieConsent.getUserPreferences().acceptedCategories);\n return Object.fromEntries(\n COOKIE_CONSENT_CATEGORIES.map((category) => [category, accepted.has(category)]),\n ) as ConsentState;\n}\n\n/**\n * Reads the shared consent and keeps it up to date. Only the first call has an\n * effect, and it is a no-op on the server. It shows nothing by itself: the\n * settings dialog is rendered by `CookieConsentProvider`.\n */\nexport function initCookieConsent({\n market,\n onConsentChange,\n}: InitCookieConsentOptions): void {\n if (typeof window === \"undefined\" || started) return;\n started = true;\n\n const domain = resolveCookieDomain(window.location.hostname, market);\n if (domain) clearHostOnlyCookie();\n\n const applyConsent = () => {\n const consent = readConsent();\n update({ consent });\n if (consent) onConsentChange?.(consent);\n };\n\n // The full build with its UI unused: `run` still builds an empty consent\n // modal when consent is missing, so it goes into a detached `root` that never\n // reaches the page. The UI-less core build of 3.1.0 can't be used, because\n // its `run` throws. `hideFromBots` is off because its check stops `run`\n // before the stored cookie is read, so browser automation such as Playwright\n // could never see a stored consent. With the UI unused, it hides nothing:\n // the provider keeps the dialog from crawlers with `isCrawler` instead.\n void CookieConsent.run({\n root: document.createElement(\"div\"),\n autoShow: false,\n hideFromBots: false,\n language: {\n default: \"en\",\n translations: { en: { consentModal: {}, preferencesModal: { sections: [] } } },\n },\n revision: COOKIE_CONSENT_REVISION,\n cookie: {\n name: COOKIE_NAME,\n sameSite: \"Lax\",\n secure: true,\n ...(domain && { domain }),\n },\n categories: {\n necessary: { enabled: true, readOnly: true },\n preferences: { enabled: false, readOnly: false },\n analytics: {\n enabled: false,\n readOnly: false,\n autoClear: { cookies: [{ name: /^(_ga|_gid|_gat)/ }] },\n },\n marketing: {\n enabled: false,\n readOnly: false,\n autoClear: {\n cookies: [{ name: /^(_fbp|_fbc)/ }, { name: /^(_gcl_)/ }],\n },\n },\n },\n onFirstConsent: applyConsent,\n onChange: applyConsent,\n }).then(() => {\n const consent = readConsent();\n update({ consent, ready: true });\n if (consent) onConsentChange?.(consent);\n });\n}\n\n/**\n * Stores the visitor's choice. `necessary` is always kept. Does nothing until\n * `initCookieConsent` has read the stored consent.\n */\nexport function setConsent(\n categories: readonly CookieConsentCategory[] | \"all\",\n): void {\n if (!snapshot.ready) return;\n\n CookieConsent.acceptCategory(\n categories === \"all\"\n ? \"all\"\n : [\"necessary\", ...categories.filter((category) => category !== \"necessary\")],\n );\n update({ consent: readConsent(), settingsOpen: false });\n}\n\n/**\n * Opens the settings dialog of the mounted `CookieConsentProvider`, also\n * where its `autoOpen` is `false`.\n */\nexport function openCookieSettings(): void {\n if (typeof window === \"undefined\") return;\n update({ settingsOpen: true });\n}\n\n/** Closes the settings dialog, unless the visitor has yet to choose. */\nexport function closeCookieSettings(): void {\n if (snapshot.consent === null) return;\n update({ settingsOpen: false });\n}\n\nexport function subscribe(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nexport function getSnapshot(): ConsentSnapshot {\n return snapshot;\n}\n\nexport function getServerSnapshot(): ConsentSnapshot {\n return serverSnapshot;\n}\n"],"mappings":"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"}
|