@juspay/svelte-ui-components 4.18.0 → 4.19.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.
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { AttrsEscapeHatch, LegacyAttrs } from '../types';
|
|
2
3
|
export type CardProperties = OptionalCardProperties;
|
|
4
|
+
/**
|
|
5
|
+
* The attributes Card writes on its own root, named so each carries the prop to
|
|
6
|
+
* use instead. Card spreads `attrs` first and these after, so an entry for one
|
|
7
|
+
* of these keys has never reached the DOM — declaring them optional and
|
|
8
|
+
* `string`-valued keeps that code compiling, and the `@deprecated` tag is what
|
|
9
|
+
* makes the discard visible at the point it is written.
|
|
10
|
+
*/
|
|
11
|
+
type CardManagedAttrs = {
|
|
12
|
+
/** @deprecated Card writes its own `class`. Use `classes`; this entry is discarded. */
|
|
13
|
+
class?: string;
|
|
14
|
+
/** @deprecated Card writes its own `style`. Use `cssVars`; this entry is discarded. */
|
|
15
|
+
style?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Card derives `role` from `onclick`/`href` and writes it (or removes
|
|
18
|
+
* it) itself. There is no prop for it; this entry is discarded.
|
|
19
|
+
*/
|
|
20
|
+
role?: string;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Card derives `tabindex` from `onclick`/`href` and writes it (or
|
|
23
|
+
* removes it) itself. There is no prop for it; this entry is discarded.
|
|
24
|
+
*/
|
|
25
|
+
tabindex?: string;
|
|
26
|
+
/** @deprecated Card writes its own `href`. Use `href`; this entry is discarded. */
|
|
27
|
+
href?: string;
|
|
28
|
+
/** @deprecated Card writes its own `target`. Use `target`; this entry is discarded. */
|
|
29
|
+
target?: string;
|
|
30
|
+
/** @deprecated Card writes its own `rel`. Use `rel`; this entry is discarded. */
|
|
31
|
+
rel?: string;
|
|
32
|
+
/** @deprecated Card writes its own `onclick`. Use `onclick`; this entry is discarded. */
|
|
33
|
+
onclick?: string;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Card binds its own `onkeydown` on an interactive card, to make
|
|
36
|
+
* Enter and Space activate it. There is no prop for it; this entry is discarded.
|
|
37
|
+
*/
|
|
38
|
+
onkeydown?: string;
|
|
39
|
+
/** @deprecated Card writes its own `data-pw`. Use `testId`; this entry is discarded. */
|
|
40
|
+
'data-pw'?: string;
|
|
41
|
+
/** @deprecated Card writes its own `testID`. Use `testId`; this entry is discarded. */
|
|
42
|
+
testID?: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* `attrs` with Card's managed attributes rejected instead of deprecated — the
|
|
46
|
+
* shape the prop takes in the next major (#576). Annotate an object with it to
|
|
47
|
+
* get the compile error today.
|
|
48
|
+
*/
|
|
49
|
+
export type CardStrictAttrs = AttrsEscapeHatch<Extract<keyof CardManagedAttrs, string>>;
|
|
3
50
|
export type MandatoryCardProperties = Record<string, never>;
|
|
4
51
|
export type OptionalCardProperties = {
|
|
5
52
|
/**
|
|
@@ -90,11 +137,13 @@ export type OptionalCardProperties = {
|
|
|
90
137
|
* second `classes` modifier for the same state. Applied before Card's own
|
|
91
138
|
* `class`/`style`/`data-pw`/`testID`/`role`/`tabindex`/`href`/`target`/`rel`/
|
|
92
139
|
* `onclick`/`onkeydown` attributes, so an entry here can never override one
|
|
93
|
-
* of those
|
|
94
|
-
*
|
|
95
|
-
*
|
|
140
|
+
* of those. Those keys are deprecated rather than rejected, so code that
|
|
141
|
+
* passes one keeps compiling exactly as before while saying, where it is
|
|
142
|
+
* written, that it has no effect. `CardStrictAttrs` rejects them outright
|
|
143
|
+
* for consumers who want that today. Omitted by default, so existing
|
|
144
|
+
* consumers render exactly the same attributes as before.
|
|
96
145
|
*/
|
|
97
|
-
attrs?:
|
|
146
|
+
attrs?: LegacyAttrs<CardManagedAttrs>;
|
|
98
147
|
/**
|
|
99
148
|
* Overrides the tag `svelte:element` renders for the card root — e.g.
|
|
100
149
|
* `'figure'` for a card whose root needs real `<figure>` sectioning-content
|
|
@@ -123,3 +172,4 @@ export type OptionalCardProperties = {
|
|
|
123
172
|
*/
|
|
124
173
|
as?: 'div' | 'a' | 'figure';
|
|
125
174
|
};
|
|
175
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { MediaPlayerProperties } from './properties';
|
|
2
|
-
declare const MediaPlayer: import("svelte").Component<MediaPlayerProperties, {}, "
|
|
2
|
+
declare const MediaPlayer: import("svelte").Component<MediaPlayerProperties, {}, "muted" | "duration" | "playing" | "currentTime">;
|
|
3
3
|
type MediaPlayer = ReturnType<typeof MediaPlayer>;
|
|
4
4
|
export default MediaPlayer;
|
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { AttrsEscapeHatch, LegacyAttrs } from '../types';
|
|
2
3
|
export type PillProperties = MandatoryPillProperties & OptionalPillProperties & PillEventProperties;
|
|
4
|
+
/**
|
|
5
|
+
* The attributes Pill writes on its own root, named so each carries the prop to
|
|
6
|
+
* use instead. Pill spreads `attrs` first and these after, so an entry for one
|
|
7
|
+
* of these keys has never reached the DOM — declaring them optional and
|
|
8
|
+
* `string`-valued keeps that code compiling, and the `@deprecated` tag is what
|
|
9
|
+
* makes the discard visible at the point it is written.
|
|
10
|
+
*/
|
|
11
|
+
type PillManagedAttrs = {
|
|
12
|
+
/** @deprecated Pill writes its own `class`. Use `classes`; this entry is discarded. */
|
|
13
|
+
class?: string;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Pill always supplies `type="button"` on a `<button>` root, so a
|
|
16
|
+
* pill never submits a form by accident. There is no prop for it; this entry
|
|
17
|
+
* is discarded.
|
|
18
|
+
*/
|
|
19
|
+
type?: string;
|
|
20
|
+
/** @deprecated Pill writes its own `data-pw`. Use `testId`; this entry is discarded. */
|
|
21
|
+
'data-pw'?: string;
|
|
22
|
+
/** @deprecated Pill writes its own `testID`. Use `testId`; this entry is discarded. */
|
|
23
|
+
testID?: string;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Pill derives `role` from whether it is interactive on a
|
|
26
|
+
* non-button root. There is no prop for it; this entry is discarded.
|
|
27
|
+
*/
|
|
28
|
+
role?: string;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Pill derives `tabindex` from whether it is interactive on a
|
|
31
|
+
* non-button root. There is no prop for it; this entry is discarded.
|
|
32
|
+
*/
|
|
33
|
+
tabindex?: string;
|
|
34
|
+
/** @deprecated Pill writes its own `title`. Use `title`; this entry is discarded. */
|
|
35
|
+
title?: string;
|
|
36
|
+
/** @deprecated Pill derives `aria-disabled` from `disabled`; this entry is discarded. */
|
|
37
|
+
'aria-disabled'?: string;
|
|
38
|
+
/** @deprecated Pill derives `aria-expanded` from `ariaExpanded`; this entry is discarded. */
|
|
39
|
+
'aria-expanded'?: string;
|
|
40
|
+
/** @deprecated Pill derives `aria-pressed` from `ariaPressed`; this entry is discarded. */
|
|
41
|
+
'aria-pressed'?: string;
|
|
42
|
+
/** @deprecated Pill writes its own `onclick`. Use `onclick`; this entry is discarded. */
|
|
43
|
+
onclick?: string;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Pill binds its own `onkeydown` on an interactive non-button
|
|
46
|
+
* root, to make Enter and Space activate it. There is no prop for it; this
|
|
47
|
+
* entry is discarded.
|
|
48
|
+
*/
|
|
49
|
+
onkeydown?: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* `attrs` with Pill's managed attributes rejected instead of deprecated — the
|
|
53
|
+
* shape the prop takes in the next major (#576). Annotate an object with it to
|
|
54
|
+
* get the compile error today.
|
|
55
|
+
*/
|
|
56
|
+
export type PillStrictAttrs = AttrsEscapeHatch<Extract<keyof PillManagedAttrs, string>>;
|
|
3
57
|
export type MandatoryPillProperties = {
|
|
4
58
|
text: string;
|
|
5
59
|
};
|
|
@@ -77,13 +131,17 @@ export type OptionalPillProperties = {
|
|
|
77
131
|
* just to hold the attribute, or adding a second `classes` modifier for the
|
|
78
132
|
* same state. Applied before Pill's own `class`/`onclick`/`onkeydown`/
|
|
79
133
|
* `role`/`tabindex`/`aria-disabled`/`data-pw`/`title`/`testID` attributes, so
|
|
80
|
-
* an entry here can never override one of those
|
|
81
|
-
*
|
|
82
|
-
*
|
|
134
|
+
* an entry here can never override one of those. Those keys are deprecated
|
|
135
|
+
* rather than rejected, so code that passes one keeps compiling exactly as
|
|
136
|
+
* before while saying, where it is written, that it has no effect.
|
|
137
|
+
* `PillStrictAttrs` rejects them outright for consumers who want that today.
|
|
138
|
+
* Omitted by default, so existing consumers render exactly the same
|
|
139
|
+
* attributes as before.
|
|
83
140
|
*/
|
|
84
|
-
attrs?:
|
|
141
|
+
attrs?: LegacyAttrs<PillManagedAttrs>;
|
|
85
142
|
};
|
|
86
143
|
export type PillEventProperties = {
|
|
87
144
|
onclick?: (event: MouseEvent) => void;
|
|
88
145
|
ondismiss?: () => void;
|
|
89
146
|
};
|
|
147
|
+
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FlyParams } from 'svelte/transition';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
3
|
/**
|
|
3
4
|
* @name InputDataType
|
|
4
5
|
* @description Different types of input data which can be passed to the Input Component.
|
|
@@ -36,6 +37,39 @@ export type FlyAnimationConfig = {
|
|
|
36
37
|
in: FlyParams;
|
|
37
38
|
out: FlyParams;
|
|
38
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* The strict form of the escape-hatch `attrs` prop: every HTML attribute the
|
|
42
|
+
* component does not manage, and a compile error naming any it does.
|
|
43
|
+
*
|
|
44
|
+
* `attrs` itself is NOT typed this way. It stays `Record<string, string>`,
|
|
45
|
+
* which is what it has always been, so nothing that compiles today stops
|
|
46
|
+
* compiling. Each component instead names its managed keys as `@deprecated`
|
|
47
|
+
* members, which an editor strikes through and
|
|
48
|
+
* `@typescript-eslint/no-deprecated` reports, so the entry is called out where
|
|
49
|
+
* it is written rather than vanishing silently at spread time.
|
|
50
|
+
*
|
|
51
|
+
* Annotate an object with a component's `*StrictAttrs` alias to opt into the
|
|
52
|
+
* compile error today:
|
|
53
|
+
*
|
|
54
|
+
* const attrs: CardStrictAttrs = { class: 'mine' }; // error: class is managed
|
|
55
|
+
*
|
|
56
|
+
* Optional `never` properties reject managed keys through predeclared objects,
|
|
57
|
+
* not just excess-property checks, and override the broader `data-*` index.
|
|
58
|
+
* Other HTML attributes retain Svelte's native value and event types. `attrs`
|
|
59
|
+
* adopts this shape in the next major — see #576, which specifies the
|
|
60
|
+
* narrowing as a major precisely because rejecting `class` is a break.
|
|
61
|
+
*/
|
|
62
|
+
export type AttrsEscapeHatch<TManagedKeys extends string> = Omit<HTMLAttributes<HTMLElement>, TManagedKeys> & {
|
|
63
|
+
[Key in TManagedKeys]?: never;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The wide `attrs` value type, unchanged from before #576: any attribute name
|
|
67
|
+
* mapped to a string. Intersected with a component's managed-key map so those
|
|
68
|
+
* keys carry a deprecation, which constrains nothing — every managed key is
|
|
69
|
+
* declared optional and `string`-valued, exactly what the index signature
|
|
70
|
+
* already allowed.
|
|
71
|
+
*/
|
|
72
|
+
export type LegacyAttrs<TManagedAttrs> = Record<string, string> & TManagedAttrs;
|
|
39
73
|
export type Rgb = {
|
|
40
74
|
r: number;
|
|
41
75
|
g: number;
|