@leabankab/component-library 8.0.0 → 8.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 +107 -0
- package/dist/component-library.es.js +1496 -1231
- 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/data-display/card.d.ts +25 -2
- package/dist/components/form/combo-field.d.ts +9 -1
- package/dist/components/form/email-input.d.ts +9 -1
- package/dist/components/form/field-parts.d.ts +16 -2
- package/dist/components/form/input.d.ts +7 -1
- package/dist/components/form/number-input-unit.d.ts +28 -0
- package/dist/components/form/number-input.d.ts +27 -5
- package/dist/components/form/phone-number-input/phone-number-input.d.ts +20 -1
- package/dist/cookie-consent-core-fntGUdFt.cjs +2 -0
- package/dist/cookie-consent-core-fntGUdFt.cjs.map +1 -0
- package/dist/{cookie-consent-core-mwVmy5nZ.mjs → cookie-consent-core-lX0QAEAo.mjs} +2 -1
- package/dist/cookie-consent-core-lX0QAEAo.mjs.map +1 -0
- package/dist/cookie-consent-react.cjs +1 -1
- package/dist/cookie-consent-react.mjs +1 -1
- package/dist/cookie-consent.cjs +1 -1
- package/dist/cookie-consent.css +1 -1
- package/dist/cookie-consent.mjs +1 -1
- package/dist/dev-panel/dev-panel.d.ts +52 -1
- package/dist/dev-panel/parts.d.ts +1 -1
- package/dist/dev-panel/use-dev-panel-labels.d.ts +1 -1
- package/dist/dev-panel.cjs +2 -2
- package/dist/dev-panel.cjs.map +1 -1
- package/dist/dev-panel.css +1 -1
- package/dist/dev-panel.mjs +384 -283
- package/dist/dev-panel.mjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/validation/email.d.ts +18 -0
- package/dist/validation/mobile-patterns.d.ts +10 -0
- package/dist/validation/national-id.d.ts +26 -0
- package/dist/validation/phone.d.ts +30 -0
- package/package.json +4 -2
- package/dist/cookie-consent-core-C4MP7GlV.cjs +0 -2
- package/dist/cookie-consent-core-C4MP7GlV.cjs.map +0 -1
- package/dist/cookie-consent-core-mwVmy5nZ.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,112 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 8.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a09c0b3: `CookieConsentProvider` reads the stored consent under browser automation such as Playwright. Until now vanilla-cookieconsent's bot check stopped it before the cookie was read, so the dialog opened on every page even with a `cc_cookie` in place. An end-to-end test can now store a consent to keep the dialog closed; see Docs/Cookie Consent. Nothing changes for visitors.
|
|
8
|
+
|
|
9
|
+
## 8.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 8f66ff8: Validation helpers for application forms, which apps kept for themselves until now:
|
|
14
|
+
|
|
15
|
+
- `normalizeNationalId(country, value)` removes what people type around a national ID (spaces, separators, the en dash a phone makes of `-`) and keeps what the checksum needs: `"19811218–9876"` → `"198112189876"`, `"131052–308t"` → `"131052-308T"`. `NATIONAL_ID_LENGTH` is the length once cleaned up (`SE` 12, `FI` 11, `NO` 11, `ES` 9).
|
|
16
|
+
- `isSameNationalId(country, a, b)`, `isSameEmail(a, b)` and `isSamePhone(country, a, b)` tell whether the co-applicant's details are the main applicant's. Each cleans up both values first, and an empty value never matches.
|
|
17
|
+
- `validateMobileNumber(country, value)` is `validatePhoneNumber` that also rejects landlines and a number of another country. It takes `SE`, `FI`, `NO` and `ES` (`MobileCountry`; `isMobileCountry` checks a code). It adds no second set of phone data to an app.
|
|
18
|
+
|
|
19
|
+
Nothing that exists changes.
|
|
20
|
+
|
|
21
|
+
- 8f66ff8: `Card` takes `color` and `variant`.
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
<Card color="primary">…</Card>
|
|
25
|
+
<Card color="success" variant="filled">…</Card>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- `color`: `primary`, `tertiary`, `neutral`, `success`, `info`, `warning` or `error`, the same tints as `Chip`. Left out, the card is white as before.
|
|
29
|
+
- `variant`: `outlined` (the default) has a 1px border, in the colour of the tint; `filled` has none. The border stays in the box, transparent, so both take the same room and line up in a row.
|
|
30
|
+
|
|
31
|
+
A card without these props looks as before. `CardColor` and `CardVariant` are exported.
|
|
32
|
+
|
|
33
|
+
- 8f66ff8: Tailwind classes on `className` now win over a component's own styles. The styles of every component are in the cascade layer `components` (it comes after Tailwind's `base` and before its `utilities`), where before they were outside every layer and beat the utilities whatever their specificity. `<Card className="border-none" />` now has no border, and `<Button className="p-8" />` has the padding you asked for.
|
|
34
|
+
|
|
35
|
+
The same applies to `dist/dev-panel.css` and `dist/cookie-consent.css`. Each stylesheet starts with the order of the layers (`theme, base, components, utilities`, the one Tailwind v4 writes), so it makes no difference whether it is loaded before or after Tailwind's.
|
|
36
|
+
|
|
37
|
+
Check before updating:
|
|
38
|
+
|
|
39
|
+
- **Unlayered CSS in your app now beats the components.** A rule outside every layer, such as a global `a { text-decoration: none }` or `h2 { margin: 0 }`, used to compete with the component's rule on specificity and order. Now it wins. Put such resets in `@layer base`, or scope them to your own markup.
|
|
40
|
+
- **`DatePicker` is not affected.** Its styles come from Emotion at run time and stay outside a layer, so a utility on it does not win.
|
|
41
|
+
- Apps without Tailwind see no difference, except from the unlayered rules above.
|
|
42
|
+
|
|
43
|
+
- 8f66ff8: `DevPanel.Root` can be hidden completely, for when it covers the form.
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
<DevPanel.Root hideable hidden={hidden} onHiddenChange={setHidden}>
|
|
47
|
+
…
|
|
48
|
+
</DevPanel.Root>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- `hideable` adds a hide button to the header. While hidden, the panel leaves a small tab at the bottom of the right edge of the window, `DevPanel.Handle`, that brings it back. Pass `handle={<DevPanel.Handle side="left" />}` for the other edge, or `label` for other text.
|
|
52
|
+
- `shortcut` hides and shows it from anywhere on the page: `"Mod+Shift+D"` by default (⌘ on a Mac, Ctrl elsewhere), `false` for none.
|
|
53
|
+
- Focus moves to the tab when the panel is hidden and back to the panel when it returns.
|
|
54
|
+
- `hidden`, `defaultHidden` and `onHiddenChange` work as `minimised` does; store the value to keep it across reloads. Passing `hidden` or `defaultHidden` turns on `hideable`.
|
|
55
|
+
- A hideable panel on a screen narrower than 600px starts minimised, drawn as a small round button. `defaultMinimised` still decides when given.
|
|
56
|
+
|
|
57
|
+
A panel without these props is as before.
|
|
58
|
+
|
|
59
|
+
- 8f66ff8: `EmailInput` suggests a fix for a mistyped domain. When focus leaves the field with `anna@gnail.con` in it, a line below says "Mente du anna@gmail.com?" (in the language of `LeaProvider`: no, se, fi, es), and the address is a button that puts it in the field. The value never changes by itself, validation is the same as before, and an error and a suggestion can show together. It is on by default; `suggestCorrection={false}` turns it off.
|
|
60
|
+
|
|
61
|
+
The function behind it is exported: `suggestEmailCorrection(value)` returns the corrected address or `undefined`. It leaves uncommon domains alone (`anna@firma.se`) and knows real providers that look like typos (`mail.com`, `ymail.com`).
|
|
62
|
+
|
|
63
|
+
`COMMON_EMAIL_DOMAINS`, and with it the list `EmailInput` offers after `@`, also has `kolumbus.fi`, `pp.inet.fi`, `luukku.com`, `me.com`, `msn.com`, `gmx.com`, `yahoo.se` and `yahoo.no`.
|
|
64
|
+
|
|
65
|
+
- 8f66ff8: `Input`, `NumberInput`, `EmailInput` and `Autocomplete` take `warning`: a message for a value that is allowed but unusual, such as an unusually high amount.
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
<NumberInput
|
|
69
|
+
label="Inntekt per måned"
|
|
70
|
+
{...field}
|
|
71
|
+
warning={
|
|
72
|
+
field.value > 200_000 ? "Det er en uvanlig høy inntekt." : undefined
|
|
73
|
+
}
|
|
74
|
+
/>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The warning shows in amber in place of the helper text and is announced as a status. The field is not marked invalid (no red border, no `aria-invalid`), so the value still counts as valid. `error` wins when both are set. Without `warning` nothing changes.
|
|
78
|
+
|
|
79
|
+
Until now a warning had to be passed as `error`, which marked a valid value invalid.
|
|
80
|
+
|
|
81
|
+
- 8f66ff8: `NumberInput` `unit` takes two units the library writes for you, in the language of `LeaProvider`, so an app no longer translates them:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<NumberInput label="Lånebeløp" unit={{ type: "currency" }} showSteppers={false} />
|
|
85
|
+
<NumberInput label="Nedbetalingstid" unit={{ type: "years" }} min={1} max={15} />
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- `{ type: "years" }` is "år" (`no`, `se`), "vuosi" / "vuotta" (`fi`) and "año" / "años" (`es`). The plural follows the number in the field, controlled or not.
|
|
89
|
+
- `{ type: "currency" }` is the symbol of the currency of the language: "kr" for NOK and SEK, "€" for EUR. Pass `currency` for another: `{ type: "currency", currency: "EUR" }`.
|
|
90
|
+
|
|
91
|
+
Text and elements still work as before and are not translated: `unit="kr/mnd"`. `NumberInputUnit` and `NumberInputUnitSpec` are exported.
|
|
92
|
+
|
|
93
|
+
- 8f66ff8: `PhoneNumberInput` takes `countries` and `mobileOnly`, for a form that wants the mobile number of an applicant in one country.
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<PhoneNumberInput
|
|
97
|
+
label="Mobilnummer"
|
|
98
|
+
countries={["SE"]}
|
|
99
|
+
mobileOnly
|
|
100
|
+
{...field}
|
|
101
|
+
/>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- `countries={["SE"]}`: no country list; `+46` stands fixed at the start of the field. With two or more countries the list holds those alone.
|
|
105
|
+
- With `countries`, the value is the national number without the trunk `0` (`70 123 45 67`). A pasted `+46 70…`, `0046 70…` or `070…` is cleaned up to it, and a typed one when focus leaves the field. A number of another country is invalid, so a Norwegian number for a Swedish applicant is rejected. Pasting a number of another country in the list switches to it.
|
|
106
|
+
- `mobileOnly`: a landline is invalid, with its own message ("Skriv inn et mobilnummer", in the language of `LeaProvider`). It covers Sweden, Finland, Norway and Spain, through `validateMobileNumber`.
|
|
107
|
+
|
|
108
|
+
Without either prop, nothing changes. Neither adds a second set of phone metadata to the app.
|
|
109
|
+
|
|
3
110
|
## 8.0.0
|
|
4
111
|
|
|
5
112
|
### Major Changes
|