@42-central/ui-react 0.28.0 → 0.29.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/{chunk-I53TMAV2.js → chunk-2RQLPN4U.js} +3 -3
- package/dist/{chunk-I53TMAV2.js.map → chunk-2RQLPN4U.js.map} +1 -1
- package/dist/{chunk-SOUDKESO.js → chunk-37HYN7PC.js} +3 -3
- package/dist/{chunk-SOUDKESO.js.map → chunk-37HYN7PC.js.map} +1 -1
- package/dist/{chunk-TGGNSSOJ.js → chunk-5EOMSWNO.js} +4 -4
- package/dist/{chunk-TGGNSSOJ.js.map → chunk-5EOMSWNO.js.map} +1 -1
- package/dist/{chunk-K3FZHYJL.js → chunk-7FPSQBWB.js} +3 -3
- package/dist/{chunk-K3FZHYJL.js.map → chunk-7FPSQBWB.js.map} +1 -1
- package/dist/{chunk-WERJ44ZN.js → chunk-DTFSCR3U.js} +3 -3
- package/dist/{chunk-WERJ44ZN.js.map → chunk-DTFSCR3U.js.map} +1 -1
- package/dist/{chunk-PFZMB3US.js → chunk-FQJNQW3G.js} +3 -3
- package/dist/{chunk-PFZMB3US.js.map → chunk-FQJNQW3G.js.map} +1 -1
- package/dist/{chunk-ASKQ6N5V.js → chunk-FSPS7TVD.js} +4 -4
- package/dist/{chunk-ASKQ6N5V.js.map → chunk-FSPS7TVD.js.map} +1 -1
- package/dist/{chunk-GJFCIG34.js → chunk-GEZYGBXY.js} +5 -5
- package/dist/{chunk-GJFCIG34.js.map → chunk-GEZYGBXY.js.map} +1 -1
- package/dist/{chunk-ULF5LOBS.js → chunk-HMNXNKDA.js} +3 -3
- package/dist/{chunk-ULF5LOBS.js.map → chunk-HMNXNKDA.js.map} +1 -1
- package/dist/{chunk-NF2PBGD3.js → chunk-IANYMDKH.js} +3 -3
- package/dist/{chunk-NF2PBGD3.js.map → chunk-IANYMDKH.js.map} +1 -1
- package/dist/{chunk-QEMXXQQO.js → chunk-JKFPRQB2.js} +3 -3
- package/dist/{chunk-QEMXXQQO.js.map → chunk-JKFPRQB2.js.map} +1 -1
- package/dist/{chunk-P7SH3XWY.js → chunk-MQHD3EJE.js} +3 -3
- package/dist/{chunk-P7SH3XWY.js.map → chunk-MQHD3EJE.js.map} +1 -1
- package/dist/{chunk-IUK7OJXZ.js → chunk-OBSZ4NE2.js} +5 -4
- package/dist/chunk-OBSZ4NE2.js.map +1 -0
- package/dist/{chunk-DJ72KP32.js → chunk-OXR7BXZA.js} +3 -3
- package/dist/{chunk-DJ72KP32.js.map → chunk-OXR7BXZA.js.map} +1 -1
- package/dist/{chunk-LIZWCWED.js → chunk-PQZSTI3R.js} +3 -3
- package/dist/{chunk-LIZWCWED.js.map → chunk-PQZSTI3R.js.map} +1 -1
- package/dist/{chunk-7BY5I2RB.js → chunk-S5CQRCTF.js} +4 -4
- package/dist/{chunk-7BY5I2RB.js.map → chunk-S5CQRCTF.js.map} +1 -1
- package/dist/{chunk-BGDVUC3B.js → chunk-TUP7WXQE.js} +3 -3
- package/dist/{chunk-BGDVUC3B.js.map → chunk-TUP7WXQE.js.map} +1 -1
- package/dist/{chunk-KYVXPSNW.js → chunk-V2QZG4IT.js} +3 -3
- package/dist/{chunk-KYVXPSNW.js.map → chunk-V2QZG4IT.js.map} +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/ambient-background/index.js +1 -1
- package/dist/components/app-shell/index.js +3 -3
- package/dist/components/avatar/index.js +2 -2
- package/dist/components/calendar/index.js +3 -3
- package/dist/components/calendar-heatmap/index.js +2 -2
- package/dist/components/camera/index.js +3 -3
- package/dist/components/carousel/index.js +2 -2
- package/dist/components/code-block/index.js +1 -1
- package/dist/components/code-block/static.js.map +1 -1
- package/dist/components/compare/index.js +2 -2
- package/dist/components/data-table/index.js +10 -10
- package/dist/components/date-picker/index.js +7 -7
- package/dist/components/drawer/index.js +3 -3
- package/dist/components/file-item/index.js +4 -4
- package/dist/components/file-preview/index.js +3 -3
- package/dist/components/file-upload/index.js +4 -4
- package/dist/components/gallery/index.js +2 -2
- package/dist/components/image-cropper/index.js +4 -4
- package/dist/components/indicator/index.js +1 -1
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/lightbox/index.js +4 -4
- package/dist/components/menu/index.js +2 -2
- package/dist/components/modal/index.js +3 -3
- package/dist/components/multi-select/index.js +3 -3
- package/dist/components/overlays/index.js +4 -4
- package/dist/components/password-input/index.js +1 -1
- package/dist/components/phone-input/flag.d.ts +9 -0
- package/dist/components/phone-input/flag.d.ts.map +1 -0
- package/dist/components/phone-input/index.d.ts +4 -0
- package/dist/components/phone-input/index.d.ts.map +1 -0
- package/dist/components/phone-input/index.js +503 -0
- package/dist/components/phone-input/index.js.map +1 -0
- package/dist/components/phone-input/phone-input.d.ts +125 -0
- package/dist/components/phone-input/phone-input.d.ts.map +1 -0
- package/dist/components/phone-input/phone.d.ts +117 -0
- package/dist/components/phone-input/phone.d.ts.map +1 -0
- package/dist/components/photo-capture/index.js +5 -5
- package/dist/components/pills-input/index.js +3 -3
- package/dist/components/schedule/index.js +3 -3
- package/dist/components/segment-group/index.js +3 -3
- package/dist/components/spotlight/index.js +5 -5
- package/dist/components/tabs/index.js +3 -3
- package/dist/components/tags-input/index.js +3 -3
- package/dist/components/time-input/index.js +4 -4
- package/dist/components/timeline/index.d.ts +1 -1
- package/dist/components/timeline/index.d.ts.map +1 -1
- package/dist/components/timeline/index.js +40 -11
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/timeline/timeline.d.ts +8 -3
- package/dist/components/timeline/timeline.d.ts.map +1 -1
- package/dist/components/tree-multi-select/index.js +3 -3
- package/dist/index.js +4 -4
- package/dist/lib/dev-warn.d.ts +1 -0
- package/dist/lib/dev-warn.d.ts.map +1 -1
- package/dist/lib/intl.d.ts +5 -0
- package/dist/lib/intl.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/as-child.contract.test.tsx +2 -0
- package/src/components/phone-input/flag.tsx +86 -0
- package/src/components/phone-input/index.ts +14 -0
- package/src/components/phone-input/phone-input.test.tsx +285 -0
- package/src/components/phone-input/phone-input.tsx +527 -0
- package/src/components/phone-input/phone.test.ts +187 -0
- package/src/components/phone-input/phone.ts +298 -0
- package/src/components/timeline/index.ts +1 -0
- package/src/components/timeline/timeline.test.tsx +105 -4
- package/src/components/timeline/timeline.tsx +46 -11
- package/src/lib/dev-warn.ts +1 -1
- package/src/lib/intl-direction.test.tsx +23 -0
- package/src/lib/intl.tsx +8 -2
- package/dist/chunk-IUK7OJXZ.js.map +0 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type FocusEvent, type ReactNode, type Ref } from "react";
|
|
2
|
+
import { type IconMap } from "../../lib/icons";
|
|
3
|
+
import type { WithTestId } from "../../lib/test-id";
|
|
4
|
+
import { type FieldProps } from "../field/field";
|
|
5
|
+
import { type InputSize, type InputVariant } from "../input/input";
|
|
6
|
+
import { type CountryCode } from "./phone";
|
|
7
|
+
/**
|
|
8
|
+
* PhoneInput — a phone number field with a country picker. It formats as the
|
|
9
|
+
* user types (`06 12 34 56 78` for France, `(201) 555-0123` for the US) and
|
|
10
|
+
* hands back one canonical value, the E.164 string (`"+33612345678"`), which
|
|
11
|
+
* is what a backend or an SMS provider wants.
|
|
12
|
+
*
|
|
13
|
+
* - The country picker at the inline-start is a searchable list (by name or
|
|
14
|
+
* dial code: "33" finds France), with each country's flag. Typing or
|
|
15
|
+
* pasting a dial code (`+44 20 …`) moves it into the trigger, and
|
|
16
|
+
* Backspace at the start of the number pulls it back out for editing.
|
|
17
|
+
* - `onChange(value, { country, isValid })` reports `null` while there is no
|
|
18
|
+
* number. The field never turns red on its own while the user is still
|
|
19
|
+
* typing: read `isValid` (or use the exported `isValidPhoneNumber` in your
|
|
20
|
+
* schema) and pass `error`.
|
|
21
|
+
* - The country defaults to the locale's region (`fr-FR` gives France).
|
|
22
|
+
* Pass `defaultCountry` to pin it, which also keeps SSR and the first
|
|
23
|
+
* client render identical when the locale is `"auto"`.
|
|
24
|
+
*
|
|
25
|
+
* Formatting and validation come from libphonenumber-js (its `min` metadata),
|
|
26
|
+
* flags from country-flag-icons, loaded lazily on first use.
|
|
27
|
+
*/
|
|
28
|
+
export type { CountryCode };
|
|
29
|
+
type PhoneInputClassNames = {
|
|
30
|
+
/** The field wrapper (label / description / error). */
|
|
31
|
+
field?: string;
|
|
32
|
+
/** The label element itself. */
|
|
33
|
+
label?: string;
|
|
34
|
+
/** The shell `<div>` (also targeted by `className`). */
|
|
35
|
+
root?: string;
|
|
36
|
+
/** The country trigger button. */
|
|
37
|
+
country?: string;
|
|
38
|
+
/** The inner `<input>`. */
|
|
39
|
+
input?: string;
|
|
40
|
+
/** The country list panel. */
|
|
41
|
+
list?: string;
|
|
42
|
+
};
|
|
43
|
+
export type PhoneInputTranslations = {
|
|
44
|
+
/** The country trigger's accessible name, given the selected country's name (`null` when
|
|
45
|
+
* none is selected). */
|
|
46
|
+
triggerLabel?: (country: string | null) => string;
|
|
47
|
+
/** The country search's placeholder. */
|
|
48
|
+
searchPlaceholder?: string;
|
|
49
|
+
/** Shown when no country matches the search. */
|
|
50
|
+
empty?: string;
|
|
51
|
+
/** Group heading over `preferredCountries`. */
|
|
52
|
+
preferredLabel?: string;
|
|
53
|
+
/** Group heading over the rest of the list, when `preferredCountries` is set. */
|
|
54
|
+
allLabel?: string;
|
|
55
|
+
};
|
|
56
|
+
export declare const PHONE_INPUT_DEFAULT_TRANSLATIONS: {
|
|
57
|
+
readonly triggerLabel: (country: string | null) => string;
|
|
58
|
+
readonly searchPlaceholder: "Search country";
|
|
59
|
+
readonly empty: "No country found";
|
|
60
|
+
readonly preferredLabel: "Suggested";
|
|
61
|
+
readonly allLabel: "All countries";
|
|
62
|
+
};
|
|
63
|
+
export type PhoneInputIconSlot = "chevron" | "international";
|
|
64
|
+
export type PhoneInputIcons = IconMap<PhoneInputIconSlot>;
|
|
65
|
+
/** The default icons: the trigger's chevron, and the globe shown while no country is set. */
|
|
66
|
+
export declare const DEFAULT_ICONS: Record<PhoneInputIconSlot, ReactNode>;
|
|
67
|
+
/** What `onChange` reports alongside the value. */
|
|
68
|
+
export type PhoneInputChangeDetails = {
|
|
69
|
+
/** The country the number belongs to, or `null` when it can't be told yet. */
|
|
70
|
+
country: CountryCode | null;
|
|
71
|
+
/** A complete, valid number for that country, and the country is in `countries`. */
|
|
72
|
+
isValid: boolean;
|
|
73
|
+
};
|
|
74
|
+
export type PhoneInputProps = Pick<FieldProps, "label" | "description" | "error" | "required"> & WithTestId & {
|
|
75
|
+
/** Controlled value, E.164 (`"+33612345678"`); `null` for empty. */
|
|
76
|
+
value?: string | null;
|
|
77
|
+
/** Uncontrolled initial value, E.164. */
|
|
78
|
+
defaultValue?: string | null;
|
|
79
|
+
/** Fires with the E.164 value (`null` while there's no number) on every change. */
|
|
80
|
+
onChange?: (value: string | null, details: PhoneInputChangeDetails) => void;
|
|
81
|
+
/** Controlled country. */
|
|
82
|
+
country?: CountryCode | null;
|
|
83
|
+
/** Uncontrolled initial country. Defaults to the locale's region, when it's in `countries`. */
|
|
84
|
+
defaultCountry?: CountryCode | null;
|
|
85
|
+
/** Fires when the country changes, picked from the list or detected from a `+…` number. */
|
|
86
|
+
onCountryChange?: (country: CountryCode | null) => void;
|
|
87
|
+
/** Only offer these countries. A number from elsewhere still formats, but isn't valid. */
|
|
88
|
+
countries?: readonly CountryCode[];
|
|
89
|
+
/** Pinned at the top of the list, under their own heading. */
|
|
90
|
+
preferredCountries?: readonly CountryCode[];
|
|
91
|
+
/** Draw each country's flag yourself (an emoji, your own sprite). Defaults to the kit's
|
|
92
|
+
* SVG flags. */
|
|
93
|
+
renderFlag?: (country: CountryCode) => ReactNode;
|
|
94
|
+
/** Locale for the country names and the default country; defaults to the `IntlProvider`'s. */
|
|
95
|
+
locale?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Placeholder shown while the field is empty. Defaults to an example number of the selected
|
|
98
|
+
* country (`06 12 34 56 78` for France) and none while no country is selected. The field's
|
|
99
|
+
* meaning changes with the country, so a fixed string can contradict it (`+33 …` next to a
|
|
100
|
+
* selected France). Pass a function of the country to word it yourself, or `""` for none.
|
|
101
|
+
*/
|
|
102
|
+
placeholder?: string | ((country: CountryCode | null) => string | undefined);
|
|
103
|
+
/** Field name for native form submission; submits the E.164 value. */
|
|
104
|
+
name?: string;
|
|
105
|
+
/** Red invalid state; OR'd with `error`. */
|
|
106
|
+
invalid?: boolean;
|
|
107
|
+
/** Dims the shell and disables the input and the country picker. */
|
|
108
|
+
disabled?: boolean;
|
|
109
|
+
/** Keeps full contrast but blocks edits and the country picker. */
|
|
110
|
+
readOnly?: boolean;
|
|
111
|
+
variant?: InputVariant;
|
|
112
|
+
size?: InputSize;
|
|
113
|
+
/** Lands on the `<input>` for focus-on-error. */
|
|
114
|
+
ref?: Ref<HTMLInputElement>;
|
|
115
|
+
/** Forwarded to the `<input>`; drives touched/blurred validation. */
|
|
116
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
117
|
+
className?: string;
|
|
118
|
+
classNames?: PhoneInputClassNames;
|
|
119
|
+
/** Overrides the country picker's wording. A partial override keeps the other defaults. */
|
|
120
|
+
translations?: PhoneInputTranslations;
|
|
121
|
+
/** Replaces the default icons: `chevron`, `international`. */
|
|
122
|
+
icons?: PhoneInputIcons;
|
|
123
|
+
};
|
|
124
|
+
export declare const PhoneInput: ({ value, defaultValue, onChange, country: countryProp, defaultCountry, onCountryChange, countries, preferredCountries, renderFlag, locale: localeProp, placeholder, name, invalid, disabled, readOnly, required, label, description, error, variant, size, ref, onBlur, className, classNames, testId, translations, icons: iconsProp, }: PhoneInputProps) => import("react").JSX.Element;
|
|
125
|
+
//# sourceMappingURL=phone-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-input.d.ts","sourceRoot":"","sources":["../../../src/components/phone-input/phone-input.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,UAAU,EAEf,KAAK,SAAS,EACd,KAAK,GAAG,EAIT,M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AAM,GAAG,CAAC,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,MAAM,GAAG,SAAS,CAAC,CAAA;IAC5E,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,iDAAiD;IACjD,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAA;IAC3B,qEAAqE;IACrE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,oBAAoB,CAAA;IACjC,2FAA2F;IAC3F,YAAY,CAAC,EAAE,sBAAsB,CAAA;IACrC,8DAA8D;IAC9D,KAAK,CAAC,EAAE,eAAe,CAAA;CACxB,CAAA;AAuDH,eAAO,MAAM,UAAU,6UA6BpB,eAAe,gCA0QjB,CAAA"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type CountryCode } from "libphonenumber-js/min";
|
|
2
|
+
/**
|
|
3
|
+
* PhoneInput's engine, with nothing visual in it: libphonenumber-js formats
|
|
4
|
+
* as you type and produces the E.164 value, and the caret helpers below keep
|
|
5
|
+
* the cursor where the user left it while the formatting moves characters
|
|
6
|
+
* around it.
|
|
7
|
+
*
|
|
8
|
+
* The dial code behaves like a token in front of the number. Typing a complete
|
|
9
|
+
* code (`+33`) moves it out of the text and into the country trigger. Backspace
|
|
10
|
+
* at the very start of the text pulls it back out as editable characters
|
|
11
|
+
* (`releaseCountry`). Whenever a country is selected, the text is national.
|
|
12
|
+
*/
|
|
13
|
+
export type { CountryCode };
|
|
14
|
+
/** Every country libphonenumber-js has metadata for. */
|
|
15
|
+
export declare const PHONE_COUNTRIES: readonly CountryCode[];
|
|
16
|
+
/** `"33"` for `"FR"`. */
|
|
17
|
+
export declare const callingCodeOf: (country: CountryCode) => string;
|
|
18
|
+
/**
|
|
19
|
+
* A real-looking mobile number for `country`, as its people write it (`06 12 34 56 78`,
|
|
20
|
+
* `07400 123456`, `(201) 555-0123`), for the placeholder. libphonenumber's example numbers
|
|
21
|
+
* weigh ~1.4 KB gzipped for every country.
|
|
22
|
+
*/
|
|
23
|
+
export declare const exampleOf: (country: CountryCode) => string | undefined;
|
|
24
|
+
/** What the field holds after a keystroke. */
|
|
25
|
+
export type PhoneState = {
|
|
26
|
+
/** The formatted text shown in the `<input>`. National whenever a country is selected. */
|
|
27
|
+
text: string;
|
|
28
|
+
/** The selected country — resolved from a typed `+…` code, else the one the user picked. */
|
|
29
|
+
country: CountryCode | null;
|
|
30
|
+
/** E.164 (`"+33612345678"`), or `null` while there's no number to speak of. */
|
|
31
|
+
value: string | null;
|
|
32
|
+
/** Whether the number is a complete, valid number for its country. */
|
|
33
|
+
isValid: boolean;
|
|
34
|
+
};
|
|
35
|
+
/** A keystroke's result, plus how many caret-relevant characters (the `+` and the code's
|
|
36
|
+
* digits) moved out of the text and into the trigger, so the caret can follow. */
|
|
37
|
+
export type FormattedPhone = PhoneState & {
|
|
38
|
+
consumed: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Format `raw` as typed under `country`. Only digits and a leading `+` survive,
|
|
42
|
+
* so pasted spaces, dashes, dots and parentheses all fold into the country's
|
|
43
|
+
* own grouping.
|
|
44
|
+
*
|
|
45
|
+
* A national number keeps the selected country. With `refine`, the digits move it
|
|
46
|
+
* within its calling code (`204 …` under the US becomes Canada): that's for a
|
|
47
|
+
* country resolved from a typed code, which the user never chose. A country they
|
|
48
|
+
* picked stays put; the E.164 value is the same either way. An international one
|
|
49
|
+
* collapses its code
|
|
50
|
+
* into the country as soon as the code is complete. Calling codes are
|
|
51
|
+
* prefix-free, so `+33` can't be the start of a longer one. A shared code
|
|
52
|
+
* resolves to the current country if it shares it, else to the code's main
|
|
53
|
+
* country, and the national digits refine it.
|
|
54
|
+
*
|
|
55
|
+
* `caret` is the number of caret-relevant characters before the caret. The code
|
|
56
|
+
* only collapses when the caret is at or past its end. With the caret inside the
|
|
57
|
+
* code, the user is editing it: `+3|6 12` after deleting a `3` is a complete
|
|
58
|
+
* Hungarian code, and collapsing it would jump to a country they never typed.
|
|
59
|
+
* It stays international text until they finish the code. Omit `caret` (a
|
|
60
|
+
* paste, a value) to collapse unconditionally.
|
|
61
|
+
*/
|
|
62
|
+
export declare const formatPhone: (raw: string, country: CountryCode | null, caret?: number, refine?: boolean) => FormattedPhone;
|
|
63
|
+
/**
|
|
64
|
+
* Backspace at the very start of the text, with a country selected: the dial code comes back
|
|
65
|
+
* out of the trigger as editable text, and the country is unselected.
|
|
66
|
+
*
|
|
67
|
+
* - With no number yet, it's the exact inverse of the keystroke that created the token: `+33`
|
|
68
|
+
* collapsed to France, so Backspace leaves `+3`.
|
|
69
|
+
* - With a number after it, the code comes back whole (`+33| 6 12`, caret after the code)
|
|
70
|
+
* without deleting anything. Deleting its last digit would leave `+36 12`, a Hungarian number
|
|
71
|
+
* the user never typed.
|
|
72
|
+
*
|
|
73
|
+
* Returns the new state and the caret position, in caret-relevant characters.
|
|
74
|
+
*/
|
|
75
|
+
export declare const releaseCountry: (text: string, country: CountryCode) => {
|
|
76
|
+
next: PhoneState;
|
|
77
|
+
caret: number;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* The display state for an E.164 `value` handed in from outside (initial or
|
|
81
|
+
* controlled): national formatting once the number is possible for a known
|
|
82
|
+
* country, the collapsed code and national digits otherwise. A `null` value
|
|
83
|
+
* keeps `fallback`.
|
|
84
|
+
*/
|
|
85
|
+
export declare const parsePhone: (value: string | null, fallback: CountryCode | null) => PhoneState;
|
|
86
|
+
/**
|
|
87
|
+
* Re-home the current text under a newly picked country: international text
|
|
88
|
+
* (a code still being typed) drops its calling code and keeps its national
|
|
89
|
+
* digits, a national one keeps its digits as they are.
|
|
90
|
+
*/
|
|
91
|
+
export declare const switchCountry: (text: string, country: CountryCode | null) => PhoneState;
|
|
92
|
+
/** How many caret-relevant characters (digits, and a leading `+`) sit before `end`. */
|
|
93
|
+
export declare const significantBefore: (text: string, end: number) => number;
|
|
94
|
+
/**
|
|
95
|
+
* The caret position in `text` right after its `count`-th significant
|
|
96
|
+
* character — where a caret that had `count` digits before it belongs once
|
|
97
|
+
* the text is reformatted.
|
|
98
|
+
*/
|
|
99
|
+
export declare const caretAfter: (text: string, count: number) => number;
|
|
100
|
+
/**
|
|
101
|
+
* Backspace / Delete on a formatting character (a space, a parenthesis, a
|
|
102
|
+
* dash) would be undone by the next format and look like a dead key. Instead
|
|
103
|
+
* it removes the nearest digit in that direction, the way every phone field
|
|
104
|
+
* that formats as you type behaves. Returns `null` when the native edit is
|
|
105
|
+
* fine as it is: a selection, or a digit next to the caret.
|
|
106
|
+
*/
|
|
107
|
+
export declare const deleteAcrossSeparator: (text: string, caret: number, direction: "backward" | "forward") => {
|
|
108
|
+
raw: string;
|
|
109
|
+
count: number;
|
|
110
|
+
} | null;
|
|
111
|
+
/**
|
|
112
|
+
* The country a locale implies (`"fr"` → `FR`, `"en-GB"` → `GB`), when
|
|
113
|
+
* libphonenumber knows it. `Intl.Locale#maximize` fills in the likely region
|
|
114
|
+
* of a bare language tag.
|
|
115
|
+
*/
|
|
116
|
+
export declare const countryOfLocale: (locale: string) => CountryCode | null;
|
|
117
|
+
//# sourceMappingURL=phone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone.d.ts","sourceRoot":"","sources":["../../../src/components/phone-input/phone.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAKjB,MAAM,uBAAuB,CAAA;AAI9B;;;;;;;;;;GAUG;AAEH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,MAAM,KAAG,MAIxD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,SAC1B,MAAM,SACL,MAAM,aACF,UAAU,GAAG,SAAS,KAChC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAanC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAAY,MAAM,KAAG,WAAW,GAAG,IAO9D,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useImageCropperContext, ImageCropper } from '../../chunk-
|
|
2
|
+
import { useImageCropperContext, ImageCropper } from '../../chunk-5EOMSWNO.js';
|
|
3
3
|
import '../../chunk-AKXALCUN.js';
|
|
4
4
|
import { FileTrigger } from '../../chunk-3KARNPW4.js';
|
|
5
|
-
import { Camera, useCamera, imageFile } from '../../chunk-
|
|
5
|
+
import { Camera, useCamera, imageFile } from '../../chunk-2RQLPN4U.js';
|
|
6
6
|
import '../../chunk-HX3LNK26.js';
|
|
7
7
|
import '../../chunk-K6YASO4L.js';
|
|
8
8
|
import '../../chunk-IA6DCC3N.js';
|
|
@@ -16,21 +16,21 @@ import '../../chunk-X6DESK37.js';
|
|
|
16
16
|
import '../../chunk-KNGSO7A3.js';
|
|
17
17
|
import '../../chunk-SKPM2FRX.js';
|
|
18
18
|
import { Button } from '../../chunk-SP6LCCTZ.js';
|
|
19
|
-
import { useObjectUrl } from '../../chunk-
|
|
19
|
+
import { useObjectUrl } from '../../chunk-DTFSCR3U.js';
|
|
20
20
|
import '../../chunk-EIBDLRAR.js';
|
|
21
21
|
import '../../chunk-WG3BCIU4.js';
|
|
22
22
|
import '../../chunk-CQ4M4BSF.js';
|
|
23
23
|
import { useMediaQuery } from '../../chunk-HDYORQZN.js';
|
|
24
24
|
import { useMergedRefs } from '../../chunk-HBWV5EPU.js';
|
|
25
25
|
import '../../chunk-AHM6SGEU.js';
|
|
26
|
-
import { useDirectionCheck } from '../../chunk-
|
|
26
|
+
import { useDirectionCheck } from '../../chunk-OBSZ4NE2.js';
|
|
27
27
|
import '../../chunk-RKCUXOU2.js';
|
|
28
28
|
import '../../chunk-HWBFRDX7.js';
|
|
29
29
|
import '../../chunk-V6PY7C6S.js';
|
|
30
30
|
import '../../chunk-SLUOF7XW.js';
|
|
31
31
|
import '../../chunk-B5YHYI7E.js';
|
|
32
32
|
import '../../chunk-6B2GNPJP.js';
|
|
33
|
-
import '../../chunk-
|
|
33
|
+
import '../../chunk-PQZSTI3R.js';
|
|
34
34
|
import '../../chunk-PMUCGFY5.js';
|
|
35
35
|
import { useIsomorphicLayoutEffect } from '../../chunk-BUIHQJGE.js';
|
|
36
36
|
import '../../chunk-6YNLRQ25.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { PillOverflowCounter, PillsInput, pillsContent, pillsShell, usePillOverflow } from '../../chunk-
|
|
2
|
+
export { PillOverflowCounter, PillsInput, pillsContent, pillsShell, usePillOverflow } from '../../chunk-FQJNQW3G.js';
|
|
3
3
|
import '../../chunk-6M6YZ3PQ.js';
|
|
4
4
|
import '../../chunk-I4B3N3UX.js';
|
|
5
5
|
import '../../chunk-X6DESK37.js';
|
|
6
6
|
import '../../chunk-2LI3VPDP.js';
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
7
|
+
import '../../chunk-OBSZ4NE2.js';
|
|
8
|
+
import '../../chunk-PQZSTI3R.js';
|
|
9
9
|
import '../../chunk-BUIHQJGE.js';
|
|
10
10
|
import '../../chunk-XXOR34T4.js';
|
|
11
11
|
import '../../chunk-R5LYFTHA.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Tabs } from '../../chunk-
|
|
2
|
+
import { Tabs } from '../../chunk-37HYN7PC.js';
|
|
3
3
|
import { Text } from '../../chunk-XKDL4QS6.js';
|
|
4
4
|
import { Divider } from '../../chunk-RLOWPCGG.js';
|
|
5
5
|
import { calendarValueToDate, dateToCalendarValue } from '../../chunk-ZB5VMGKB.js';
|
|
@@ -8,14 +8,14 @@ import { useNow, isNowPending } from '../../chunk-JQJ23YQX.js';
|
|
|
8
8
|
import { prefersReducedMotion } from '../../chunk-CQ4M4BSF.js';
|
|
9
9
|
import '../../chunk-HDYORQZN.js';
|
|
10
10
|
import { useMergedRefs } from '../../chunk-HBWV5EPU.js';
|
|
11
|
-
import { useLocale, useTimeZone, DEFAULT_LOCALE } from '../../chunk-
|
|
11
|
+
import { useLocale, useTimeZone, DEFAULT_LOCALE } from '../../chunk-OBSZ4NE2.js';
|
|
12
12
|
import { Popover } from '../../chunk-RKCUXOU2.js';
|
|
13
13
|
import '../../chunk-HWBFRDX7.js';
|
|
14
14
|
import { resolveLogicalPlacement } from '../../chunk-V6PY7C6S.js';
|
|
15
15
|
import { OverlayContainerProvider } from '../../chunk-SLUOF7XW.js';
|
|
16
16
|
import { ActionIcon } from '../../chunk-B5YHYI7E.js';
|
|
17
17
|
import '../../chunk-6B2GNPJP.js';
|
|
18
|
-
import { devWarn, warnRenamedProp } from '../../chunk-
|
|
18
|
+
import { devWarn, warnRenamedProp } from '../../chunk-PQZSTI3R.js';
|
|
19
19
|
import { useUncontrolled } from '../../chunk-PMUCGFY5.js';
|
|
20
20
|
import '../../chunk-BUIHQJGE.js';
|
|
21
21
|
import { iconStroke, mergeIcons } from '../../chunk-XXOR34T4.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { SegmentGroup } from '../../chunk-
|
|
2
|
+
export { SegmentGroup } from '../../chunk-IANYMDKH.js';
|
|
3
3
|
import '../../chunk-X6DESK37.js';
|
|
4
4
|
import '../../chunk-HBWV5EPU.js';
|
|
5
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-OBSZ4NE2.js';
|
|
6
|
+
import '../../chunk-PQZSTI3R.js';
|
|
7
7
|
import '../../chunk-PMUCGFY5.js';
|
|
8
8
|
import '../../chunk-BUIHQJGE.js';
|
|
9
9
|
import '../../chunk-WYCMIIRR.js';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Kbd } from '../../chunk-
|
|
3
|
-
import { Modal } from '../../chunk-
|
|
2
|
+
import { Kbd } from '../../chunk-OXR7BXZA.js';
|
|
3
|
+
import { Modal } from '../../chunk-7FPSQBWB.js';
|
|
4
4
|
import { Pill } from '../../chunk-6M6YZ3PQ.js';
|
|
5
5
|
import { Mark } from '../../chunk-NS6RGPWR.js';
|
|
6
6
|
import { Skeleton } from '../../chunk-TWNIAF7K.js';
|
|
7
|
-
import '../../chunk-
|
|
7
|
+
import '../../chunk-V2QZG4IT.js';
|
|
8
8
|
import { Combobox } from '../../chunk-QRNQQIQM.js';
|
|
9
9
|
import '../../chunk-I4B3N3UX.js';
|
|
10
10
|
import '../../chunk-X6DESK37.js';
|
|
11
11
|
import { useLocalStorage, useInView } from '../../chunk-HC4XVBP2.js';
|
|
12
|
-
import { useHotkey, KBD_DEFAULT_TRANSLATIONS } from '../../chunk-
|
|
12
|
+
import { useHotkey, KBD_DEFAULT_TRANSLATIONS } from '../../chunk-JKFPRQB2.js';
|
|
13
13
|
import { observeResize } from '../../chunk-2LI3VPDP.js';
|
|
14
14
|
import { useLinkComponent } from '../../chunk-GTKKRV5N.js';
|
|
15
15
|
import { popoverOption, popoverGroupLabel, popoverEmpty } from '../../chunk-RKCUXOU2.js';
|
|
@@ -18,7 +18,7 @@ import '../../chunk-V6PY7C6S.js';
|
|
|
18
18
|
import '../../chunk-SLUOF7XW.js';
|
|
19
19
|
import '../../chunk-B5YHYI7E.js';
|
|
20
20
|
import '../../chunk-6B2GNPJP.js';
|
|
21
|
-
import { devWarn } from '../../chunk-
|
|
21
|
+
import { devWarn } from '../../chunk-PQZSTI3R.js';
|
|
22
22
|
import '../../chunk-PMUCGFY5.js';
|
|
23
23
|
import { useIsomorphicLayoutEffect } from '../../chunk-BUIHQJGE.js';
|
|
24
24
|
import '../../chunk-6YNLRQ25.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { Tabs } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
2
|
+
export { Tabs } from '../../chunk-37HYN7PC.js';
|
|
3
|
+
import '../../chunk-OBSZ4NE2.js';
|
|
4
|
+
import '../../chunk-PQZSTI3R.js';
|
|
5
5
|
import '../../chunk-WYCMIIRR.js';
|
|
6
6
|
import '../../chunk-C6NVU4F7.js';
|
|
7
7
|
import '../../chunk-GIPQUKCN.js';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { usePillOverflow, PillOverflowCounter, pillsContent, pillsShell } from '../../chunk-
|
|
2
|
+
import { usePillOverflow, PillOverflowCounter, pillsContent, pillsShell } from '../../chunk-FQJNQW3G.js';
|
|
3
3
|
import { pillRemove, pill } from '../../chunk-6M6YZ3PQ.js';
|
|
4
4
|
import { inputSlot, inputControlClasses, inputShell } from '../../chunk-I4B3N3UX.js';
|
|
5
5
|
import { FieldShell, fieldA11yProps } from '../../chunk-X6DESK37.js';
|
|
6
6
|
import '../../chunk-2LI3VPDP.js';
|
|
7
|
-
import '../../chunk-
|
|
7
|
+
import '../../chunk-OBSZ4NE2.js';
|
|
8
8
|
import { popoverClearTrigger } from '../../chunk-RKCUXOU2.js';
|
|
9
9
|
import '../../chunk-HWBFRDX7.js';
|
|
10
10
|
import '../../chunk-V6PY7C6S.js';
|
|
11
11
|
import '../../chunk-SLUOF7XW.js';
|
|
12
|
-
import '../../chunk-
|
|
12
|
+
import '../../chunk-PQZSTI3R.js';
|
|
13
13
|
import '../../chunk-PMUCGFY5.js';
|
|
14
14
|
import '../../chunk-BUIHQJGE.js';
|
|
15
15
|
import { CloseIcon } from '../../chunk-6YNLRQ25.js';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { resolveHourCycle, toDisplayHour, TimeRow, fromDisplayHour } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
2
|
+
import { resolveHourCycle, toDisplayHour, TimeRow, fromDisplayHour } from '../../chunk-HMNXNKDA.js';
|
|
3
|
+
import '../../chunk-IANYMDKH.js';
|
|
4
4
|
import '../../chunk-SBZJGFZ6.js';
|
|
5
5
|
import '../../chunk-I4B3N3UX.js';
|
|
6
6
|
import { FieldShell, fieldA11yProps } from '../../chunk-X6DESK37.js';
|
|
7
7
|
import '../../chunk-HBWV5EPU.js';
|
|
8
|
-
import '../../chunk-
|
|
8
|
+
import '../../chunk-OBSZ4NE2.js';
|
|
9
9
|
import '../../chunk-RKCUXOU2.js';
|
|
10
10
|
import '../../chunk-HWBFRDX7.js';
|
|
11
11
|
import '../../chunk-V6PY7C6S.js';
|
|
12
12
|
import '../../chunk-SLUOF7XW.js';
|
|
13
|
-
import '../../chunk-
|
|
13
|
+
import '../../chunk-PQZSTI3R.js';
|
|
14
14
|
import { useUncontrolled } from '../../chunk-PMUCGFY5.js';
|
|
15
15
|
import '../../chunk-BUIHQJGE.js';
|
|
16
16
|
import '../../chunk-6YNLRQ25.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Timeline, type TimelineBulletVariant, type TimelineContentProps, type TimelineItemProps, type TimelineLabelProps, type TimelineLineVariant, type TimelineProps, type TimelineSize, type TimelineTitleProps, type TimelineTranslations, } from "./timeline";
|
|
1
|
+
export { Timeline, type TimelineBulletRadius, type TimelineBulletVariant, type TimelineContentProps, type TimelineItemProps, type TimelineLabelProps, type TimelineLineVariant, type TimelineProps, type TimelineSize, type TimelineTitleProps, type TimelineTranslations, } from "./timeline";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/timeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/timeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,YAAY,CAAA"}
|
|
@@ -77,14 +77,25 @@ var timelineVariants = cva(
|
|
|
77
77
|
}
|
|
78
78
|
);
|
|
79
79
|
var RING_CUTOUT = "ring-2 ring-offset-2 ring-offset-brand-50 dark:ring-offset-brand-950 ring-transparent ring-inset";
|
|
80
|
-
var timelineBulletVariants = cva(["
|
|
80
|
+
var timelineBulletVariants = cva(["shrink-0"], {
|
|
81
81
|
variants: {
|
|
82
82
|
variant: {
|
|
83
|
-
// `
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
|
|
83
|
+
// `filled` paints the palette's solid, so its icon takes the palette's
|
|
84
|
+
// own on-solid colour, like any text in it (navy on the bright dark-mode
|
|
85
|
+
// solids: white there fell under 3:1 on yellow, green, pink).
|
|
86
|
+
// `outline`/`dashed` have no fill: their icon sits on the page, so
|
|
87
|
+
// `dark:[&_svg]:text-white` keeps it readable on the dark ground.
|
|
88
|
+
// `default`/`gradient` invert to a *light* dark-mode surface and keep
|
|
89
|
+
// their own text colour.
|
|
90
|
+
filled: "bg-(--c-solid) text-(--c-on-solid)",
|
|
91
|
+
// A tile, as Badge's `light`: the palette's soft surface (opaque, so the
|
|
92
|
+
// line stops under it), a soft ring of its solid, the icon in its text
|
|
93
|
+
// colour. Quieter than `filled` for a feed of many events.
|
|
94
|
+
light: "bg-(--c-soft) border border-(--c-solid)/40 text-(--c-text)",
|
|
95
|
+
// No surface and no ring: the custom `bullet` is drawn as it is (a
|
|
96
|
+
// geodesic badge, an avatar). `color` still tints the line and the
|
|
97
|
+
// icon, so the item keeps its place in the line's colours.
|
|
98
|
+
subtle: "text-(--c-text)",
|
|
88
99
|
outline: "border-(--c-solid) border dark:[&_svg]:text-white",
|
|
89
100
|
dashed: "border-dashed border-(--c-solid) border dark:[&_svg]:text-white",
|
|
90
101
|
default: "bg-brand-950 text-white dark:bg-white dark:text-brand-950 border",
|
|
@@ -108,7 +119,21 @@ var timelineBulletVariants = cva(["rounded-full shrink-0"], {
|
|
|
108
119
|
none: "",
|
|
109
120
|
complete: "",
|
|
110
121
|
active: "",
|
|
111
|
-
pending:
|
|
122
|
+
pending: [
|
|
123
|
+
"[--c-solid:var(--c-solid-disabled)] [--c-on-solid:var(--c-on-solid-disabled)]",
|
|
124
|
+
// `light` and `subtle` read the soft surface and the text colour too.
|
|
125
|
+
"[--c-soft:var(--c-soft-disabled)] [--c-text:var(--c-text-disabled)]"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
/** The bullet's corners, the scale ActionIcon uses: `full` is the dot, a
|
|
129
|
+
* smaller radius a rounded tile. */
|
|
130
|
+
radius: {
|
|
131
|
+
xs: "rounded-xs",
|
|
132
|
+
sm: "rounded-sm",
|
|
133
|
+
md: "rounded-md",
|
|
134
|
+
lg: "rounded-lg",
|
|
135
|
+
xl: "rounded-xl",
|
|
136
|
+
full: "rounded-full"
|
|
112
137
|
}
|
|
113
138
|
},
|
|
114
139
|
compoundVariants: [
|
|
@@ -141,7 +166,7 @@ var timelineBulletVariants = cva(["rounded-full shrink-0"], {
|
|
|
141
166
|
class: "bg-none bg-(--c-solid-disabled) text-(--c-on-solid-disabled)"
|
|
142
167
|
}
|
|
143
168
|
],
|
|
144
|
-
defaultVariants: { variant: "default", ringed: true, state: "none" }
|
|
169
|
+
defaultVariants: { variant: "default", ringed: true, state: "none", radius: "full" }
|
|
145
170
|
});
|
|
146
171
|
var LINE_MASK = {
|
|
147
172
|
solid: "none",
|
|
@@ -222,6 +247,7 @@ var TimelineItem = ({
|
|
|
222
247
|
className,
|
|
223
248
|
color,
|
|
224
249
|
variant,
|
|
250
|
+
radius,
|
|
225
251
|
bullet,
|
|
226
252
|
size,
|
|
227
253
|
lineVariant,
|
|
@@ -325,10 +351,13 @@ var TimelineItem = ({
|
|
|
325
351
|
// A pending `default` step is a bare outer ring: no inset gap
|
|
326
352
|
// and center to draw.
|
|
327
353
|
ringed: !bullet && !(pending && (variant ?? "default") === "default"),
|
|
328
|
-
state
|
|
354
|
+
state,
|
|
355
|
+
radius
|
|
329
356
|
}),
|
|
330
357
|
"size-(--tl-bullet-size) grid place-items-center overflow-hidden",
|
|
331
|
-
|
|
358
|
+
// Zero specificity (`:where`), as in ActionIcon: a size class on
|
|
359
|
+
// the icon itself wins over the bullet's default fill.
|
|
360
|
+
"[:where(&)_svg]:size-full [:where(&)_svg]:p-0.5",
|
|
332
361
|
isGradient && !pending && gradient?.dir && GRADIENT_DIR_CLASS[gradient.dir]
|
|
333
362
|
),
|
|
334
363
|
children: bullet
|
|
@@ -348,7 +377,7 @@ var TimelineLabel = ({ className, color, testId, ...rest }) => /* @__PURE__ */ j
|
|
|
348
377
|
"data-part": "label",
|
|
349
378
|
"data-color": color,
|
|
350
379
|
className: cn(
|
|
351
|
-
"col-start-1 inline-flex items-center gap-1.5 self-start pt-px [&_svg]:size-3.5 [&_svg]:shrink-0",
|
|
380
|
+
"col-start-1 inline-flex items-center gap-1.5 self-start pt-px [:where(&)_svg]:size-3.5 [:where(&)_svg]:shrink-0",
|
|
352
381
|
color ? "text-(--c-text)" : TEXT_COLOR_CLASSES.muted,
|
|
353
382
|
className
|
|
354
383
|
),
|