@saasbase-io/core-elements 1.4.0 → 1.5.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.
@@ -1,4 +1,5 @@
1
1
  export * from './form';
2
+ export * from './passkey-button';
2
3
  export * from './provider';
3
4
  export * from './sb-error';
4
5
  export * from './sb-gap';
@@ -0,0 +1,112 @@
1
+ import { LitElement } from '../../../../../node_modules/lit';
2
+ import { PasskeyButtonProps, PasskeyButtonSize, PasskeyButtonSpinnerAlign, PasskeyButtonVariant } from './passkey-button.types';
3
+ /**
4
+ * A button for passkey authentication.
5
+ * @element sb-passkey-button
6
+ *
7
+ * @part passkey-button (rtg-button)
8
+ * @part passkey-button-spinner (rtg-spinner): loading indicator
9
+ *
10
+ * @fires sb-passkey-button:click { id, event }
11
+ */
12
+ export declare class SbPasskeyButton extends LitElement implements PasskeyButtonProps {
13
+ private static readonly _ROOT;
14
+ private static readonly _SPINNER;
15
+ /**
16
+ * The stable CSS part names exposed for external targeting.
17
+ */
18
+ static get parts(): {
19
+ root: string;
20
+ spinner: string;
21
+ };
22
+ /**
23
+ * The name of the custom event fired on click.
24
+ */
25
+ static get clickEventName(): string;
26
+ /**
27
+ * A unique value used as a substring in the generated part/child IDs, when
28
+ * the `child-id` prop is not provided.
29
+ */
30
+ seed: string;
31
+ /**
32
+ * The `id` value given to the root child/part and used as the base of other
33
+ * child/part IDs.
34
+ */
35
+ childId?: string;
36
+ /**
37
+ * The visual variant of the button.
38
+ */
39
+ variant: PasskeyButtonVariant;
40
+ /**
41
+ * The size of the button.
42
+ */
43
+ size: PasskeyButtonSize;
44
+ /**
45
+ * The text used as the button label.
46
+ */
47
+ label: string;
48
+ /**
49
+ * Whether the loading spinner should be rendered before or after the label.
50
+ */
51
+ spinnerAlign: PasskeyButtonSpinnerAlign;
52
+ /**
53
+ * When provided, the button reflects a disabled state.
54
+ */
55
+ disabled?: boolean;
56
+ /**
57
+ * When provided, a loading state is applied.
58
+ */
59
+ loading?: boolean;
60
+ /**
61
+ * The event identifier/name as defined in auth service.
62
+ */
63
+ event?: string;
64
+ /**
65
+ * Whether the button is in a loading state.
66
+ */
67
+ private _loading;
68
+ /**
69
+ * Overrides default behavior to render into light DOM.
70
+ */
71
+ protected createRenderRoot(): this;
72
+ /**
73
+ * The `id` of the root element. Equal to `childId` when provided, otherwise
74
+ * derived from the component's part name and `seed`.
75
+ */
76
+ get rootId(): string;
77
+ /**
78
+ * The `id` of the spinner element, derived from `rootId` with the spinner
79
+ * part name appended.
80
+ */
81
+ get spinnerId(): string;
82
+ /**
83
+ * The loading state, derived from the private `_loading` and `loading` prop.
84
+ */
85
+ get isLoading(): boolean | undefined;
86
+ /**
87
+ * Adds the click event listener.
88
+ */
89
+ connectedCallback(): void;
90
+ /**
91
+ * Removes the click event listener.
92
+ */
93
+ disconnectedCallback(): void;
94
+ /**
95
+ * Defines and dispatches the click event.
96
+ */
97
+ private _dispatchClick;
98
+ /**
99
+ * Emits the provided `event` to the auth service to process.
100
+ */
101
+ private _emitClickEvent;
102
+ /**
103
+ * Handles the click event, preventing execution when disabled/loading, firing
104
+ * the click event, and emitting to auth service.
105
+ */
106
+ private _handleClick;
107
+ /**
108
+ * Returns the loading spinner template.
109
+ */
110
+ private _renderSpinner;
111
+ render(): import('../../../../../node_modules/lit-html').TemplateResult<1>;
112
+ }
@@ -0,0 +1,7 @@
1
+ import { SbPasskeyButton } from './_passkey-button';
2
+ export { SbPasskeyButton };
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ "sb-passkey-button": SbPasskeyButton;
6
+ }
7
+ }
@@ -0,0 +1,11 @@
1
+ import { Meta, StoryObj } from '@storybook/web-components-vite';
2
+ declare const meta: Meta;
3
+ export default meta;
4
+ type Story = StoryObj;
5
+ export declare const Basic: Story;
6
+ export declare const Variant: Story;
7
+ export declare const Size: Story;
8
+ export declare const Label: Story;
9
+ export declare const Disabled: Story;
10
+ export declare const Loading: Story;
11
+ export declare const SpinnerAlign: Story;
@@ -0,0 +1,15 @@
1
+ import { IconAlign, RtgButtonBasicSize, RtgButtonBasicVariant } from '../../../../types';
2
+ export type PasskeyButtonVariant = RtgButtonBasicVariant;
3
+ export type PasskeyButtonSize = RtgButtonBasicSize;
4
+ export type PasskeyButtonSpinnerAlign = IconAlign;
5
+ export type PasskeyButtonProps = {
6
+ seed: string;
7
+ childId?: string;
8
+ variant: PasskeyButtonVariant;
9
+ size: PasskeyButtonSize;
10
+ label: string;
11
+ spinnerAlign: PasskeyButtonSpinnerAlign;
12
+ disabled?: boolean;
13
+ loading?: boolean;
14
+ event?: string;
15
+ };