@pontive/pontkit-core 1.12.0 → 1.14.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.
Files changed (29) hide show
  1. package/README.md +1 -1
  2. package/catalog.json +1 -1
  3. package/custom-elements.json +1 -1
  4. package/dist/index.js +640 -602
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +4392 -4346
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/primitives/components/ui/calendar/calendar.style.d.ts +0 -2
  9. package/dist/primitives/components/ui/date-picker/date-picker.styles.d.ts +0 -1
  10. package/dist/primitives/components/ui/pagination/pagination-link.d.ts +1 -1
  11. package/dist/primitives/components/ui/pagination/pagination.styles.d.ts +0 -4
  12. package/dist/primitives/components/ui/switch/_switch.d.ts +146 -0
  13. package/dist/primitives/components/ui/switch/switch.d.ts +6 -9
  14. package/dist/primitives/components/ui/switch/switch.defs.d.ts +13 -0
  15. package/dist/primitives/components/ui/switch/switch.stories.d.ts +12 -4
  16. package/dist/styles.css +3309 -1193
  17. package/dist/tokens/tailwind/border-radius.d.ts +0 -3
  18. package/dist/tokens/tailwind/border-width.d.ts +0 -4
  19. package/dist/tokens/tailwind/color.d.ts +0 -32
  20. package/dist/tokens/tailwind/font-size.d.ts +0 -1
  21. package/dist/tokens/tailwind/font-weight.d.ts +0 -1
  22. package/dist/tokens/tailwind/index.d.ts +0 -66
  23. package/dist/tokens/tailwind/opacity.d.ts +0 -2
  24. package/dist/tokens/tailwind/ring-width.d.ts +0 -3
  25. package/dist/tokens/tailwind/spacing.d.ts +0 -20
  26. package/package.json +1 -1
  27. package/dist/primitives/components/ui/button/button.style.d.ts +0 -4
  28. package/dist/primitives/components/ui/switch/switch.style.d.ts +0 -4
  29. package/dist/primitives/components/ui/switch/switch.type.d.ts +0 -4
@@ -4,8 +4,6 @@ export declare const calendarStyles: {
4
4
  months: string[];
5
5
  nav: string[];
6
6
  month: string[];
7
- buttonPrevious: string[];
8
- buttonNext: string[];
9
7
  chevron: string[];
10
8
  monthCaption: string[];
11
9
  captionLabel: string[];
@@ -1,6 +1,5 @@
1
1
  export declare const datePickerStyles: {
2
2
  root: string[];
3
3
  trigger: string[];
4
- triggerButton: string[];
5
4
  content: string[];
6
5
  };
@@ -6,7 +6,7 @@ export declare class PaginationLink extends BaseElement {
6
6
  isActive: boolean;
7
7
  size: Exclude<ButtonSize, 'xs' | 'icon-xs'>;
8
8
  href: string;
9
- get _containerElement(): HTMLAnchorElement | null;
9
+ get _containerElement(): HTMLElement | null;
10
10
  protected createRenderRoot(): HTMLElement | DocumentFragment;
11
11
  protected firstUpdated(_changedProperties: PropertyValues): void;
12
12
  updated(changedProps: PropertyValues): void;
@@ -2,10 +2,6 @@ export declare const paginationStyles: {
2
2
  root: string[];
3
3
  content: string[];
4
4
  item: string[];
5
- link: (props?: ({
6
- variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
7
- size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
8
- } & import('class-variance-authority/types').ClassProp) | undefined) => string;
9
5
  previous: {
10
6
  base: string[];
11
7
  span: string[];
@@ -0,0 +1,146 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import { SwitchProps, SwitchState } from './switch.defs';
3
+ /**
4
+ * The `<pont-switch>` component is a control that indicates whether a setting
5
+ * is on or off.
6
+ *
7
+ * The host element itself is the switch: it carries `role="switch"` and its
8
+ * ARIA state (via `ElementInternals`), takes focus, and toggles on click,
9
+ * `Enter` and `Space`. It is form-associated, so it is labelable by
10
+ * `<label for>`, submits its value with its owning form when `name` is set,
11
+ * restores its default state on form reset, and is disabled by a disabled
12
+ * `<fieldset>`.
13
+ *
14
+ * @element pont-switch
15
+ * @slot switch
16
+ * @slot switch-thumb
17
+ *
18
+ * @event pont-switch:checked-change - Fired when the user toggles the switch.
19
+ * Detail: `{ checked: boolean }`
20
+ */
21
+ export declare class PontSwitch extends LitElement implements SwitchProps {
22
+ static readonly formAssociated = true;
23
+ static readonly CHECKED_CHANGE_EVENT = "pont-switch:checked-change";
24
+ /**
25
+ * The checked state of the switch when it is initially rendered. Use when
26
+ * you do not need to control its checked state. Resetting the owning form
27
+ * restores this state.
28
+ */
29
+ defaultChecked?: boolean;
30
+ /**
31
+ * The controlled checked state of the switch. Must be used in conjunction
32
+ * with `onCheckedChange` (or the `pont-switch:checked-change` event).
33
+ */
34
+ checked?: boolean;
35
+ /**
36
+ * Event handler called when the checked state of the switch changes.
37
+ */
38
+ onCheckedChange?: (checked: boolean) => void;
39
+ /**
40
+ * When `true`, prevents the user from interacting with the switch.
41
+ */
42
+ disabled?: boolean;
43
+ /**
44
+ * When `true`, the switch remains focusable but its state cannot be changed
45
+ * by the user.
46
+ */
47
+ readonly?: boolean;
48
+ /**
49
+ * When `true`, indicates that the user must turn the switch on before the
50
+ * owning form can be submitted.
51
+ */
52
+ required?: boolean;
53
+ /**
54
+ * When `true`, sets `aria-invalid` on the switch and styles it accordingly.
55
+ */
56
+ invalid?: boolean;
57
+ /**
58
+ * The name of the switch. Submitted with its owning form as part of a
59
+ * name/value pair.
60
+ */
61
+ name?: string;
62
+ /**
63
+ * The value submitted with the owning form when the switch is on.
64
+ */
65
+ value: string;
66
+ /**
67
+ * The value submitted with the owning form when the switch is off. When
68
+ * omitted, nothing is submitted for an unchecked switch.
69
+ */
70
+ uncheckedValue?: string;
71
+ /**
72
+ * The internal checked state, used when the switch is uncontrolled.
73
+ */
74
+ private _checked;
75
+ /**
76
+ * Whether the switch is disabled by an ancestor (e.g. `<fieldset disabled>`).
77
+ */
78
+ private _formDisabled;
79
+ /**
80
+ * Gates whether `defaultChecked` or `_checked` is authoritative while
81
+ * uncontrolled. True once the user has toggled the switch.
82
+ */
83
+ private _dirty;
84
+ private readonly _internals;
85
+ protected createRenderRoot(): this;
86
+ /**
87
+ * Returns `true` if the switch is in controlled mode, determined by whether
88
+ * the `checked` prop was explicitly provided.
89
+ */
90
+ get isControlled(): boolean;
91
+ /**
92
+ * The current checked state, from `checked` if controlled, otherwise from
93
+ * internal state.
94
+ */
95
+ get isChecked(): boolean;
96
+ get isDisabled(): boolean;
97
+ get isInvalid(): boolean;
98
+ get state(): SwitchState;
99
+ /**
100
+ * The owning form, if any.
101
+ */
102
+ get form(): HTMLFormElement | null;
103
+ /**
104
+ * The validity state of the switch within its owning form.
105
+ */
106
+ get validity(): ValidityState;
107
+ connectedCallback(): void;
108
+ disconnectedCallback(): void;
109
+ protected willUpdate(changed: PropertyValues): void;
110
+ protected updated(): void;
111
+ formResetCallback(): void;
112
+ formDisabledCallback(disabled: boolean): void;
113
+ formStateRestoreCallback(state: string | null): void;
114
+ /**
115
+ * Returns `true` if the switch satisfies its constraints (i.e. it is not
116
+ * `required` and unchecked), otherwise fires `invalid` and returns `false`.
117
+ */
118
+ checkValidity(): boolean;
119
+ /**
120
+ * Like `checkValidity()`, but also reports the problem to the user.
121
+ */
122
+ reportValidity(): boolean;
123
+ /**
124
+ * Writes the ARIA state and tab stop of the host, which is the element
125
+ * exposed as the switch.
126
+ */
127
+ private _syncHostState;
128
+ /**
129
+ * Writes the submitted value and validity of the switch to its owning form.
130
+ */
131
+ private _syncFormState;
132
+ /**
133
+ * Handles clicks on the host, including clicks forwarded from an associated
134
+ * `<label>` and those synthesised by the keyboard handlers. In uncontrolled
135
+ * mode, toggles internal state directly. In controlled mode, leaves state to
136
+ * the parent, which must write back to `checked`.
137
+ */
138
+ private _handleClick;
139
+ /**
140
+ * Mirrors native button behaviour: `Enter` toggles on keydown, while `Space`
141
+ * only suppresses page scroll here and toggles on keyup.
142
+ */
143
+ private _handleKeydown;
144
+ private _handleKeyup;
145
+ render(): import('lit-html').TemplateResult<1>;
146
+ }
@@ -1,13 +1,10 @@
1
- import { LitElement } from 'lit';
2
- export declare class Switch extends LitElement {
3
- disabled: 'true' | 'false';
4
- state: 'checked' | 'unchecked';
5
- private _toggleChecked;
6
- protected createRenderRoot(): HTMLElement | DocumentFragment;
7
- render(): import('lit-html').TemplateResult<1>;
8
- }
1
+ import { PontSwitch } from './_switch';
2
+ export { PontSwitch };
3
+ /**
4
+ * A control that indicates whether a setting is on or off.
5
+ */
9
6
  declare global {
10
7
  interface HTMLElementTagNameMap {
11
- 'pont-switch': Switch;
8
+ "pont-switch": PontSwitch;
12
9
  }
13
10
  }
@@ -0,0 +1,13 @@
1
+ export type SwitchState = "checked" | "unchecked";
2
+ export interface SwitchProps {
3
+ defaultChecked?: boolean;
4
+ checked?: boolean;
5
+ onCheckedChange?: (checked: boolean) => void;
6
+ disabled?: boolean;
7
+ readonly?: boolean;
8
+ required?: boolean;
9
+ invalid?: boolean;
10
+ name?: string;
11
+ value: string;
12
+ uncheckedValue?: string;
13
+ }
@@ -1,4 +1,12 @@
1
- import { Meta, StoryFn } from '@storybook/web-components-vite';
2
- declare const _default: Meta;
3
- export default _default;
4
- export declare const Switch: StoryFn;
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 Demo: Story;
6
+ export declare const Description: Story;
7
+ export declare const ChoiceCard: Story;
8
+ export declare const Disabled: Story;
9
+ export declare const Invalid: Story;
10
+ export declare const States: Story;
11
+ export declare const Controlled: Story;
12
+ export declare const Form: Story;