@popgrids/ui 0.0.1 → 0.0.4

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/index.d.cts CHANGED
@@ -1,659 +1,22 @@
1
- import * as lit_html from 'lit-html';
2
- import { LitElement, CSSResultGroup, TemplateResult } from 'lit';
3
-
4
- /**
5
- * @summary A base element for all components.
6
- * @description This is the base class for all components in the library.
7
- * It provides common functionality and styles.
8
- *
9
- * @status experimental
10
- * @since 0.0.1
11
- */
12
- declare class PopElement extends LitElement {
13
- static styles: CSSResultGroup;
14
- /**
15
- * Emits a custom event with optional detail.
16
- * @param name - The name of the event.
17
- * @param detail - Optional data to include in the event.
18
- * @param options - Additional event options (bubbles, composed, cancelable).
19
- * @returns The emitted event.
20
- */
21
- protected emit<T = unknown>(name: string, detail?: T, options?: EventInit): CustomEvent<T>;
22
- constructor();
23
- }
24
-
25
- /**
26
- * @summary A button that looks like a link, used for navigation or action triggering.
27
- * @status experimental
28
- * @since 0.0.1
29
- *
30
- * @slot - The default slot for the button text.
31
- * @slot icon - Slot for an optional icon.
32
- *
33
- * @csspart base - The component's base wrapper.
34
- * @csspart content - The text content wrapper.
35
- * @csspart icon - The icon wrapper.
36
- *
37
- * @cssproperty --button-link-gap - The gap between text and icon.
38
- */
39
- declare class PopButtonLink extends PopElement {
40
- static styles: CSSResultGroup;
41
- /** The size of the button link (sm, md, lg). */
42
- size: "sm" | "md" | "lg";
43
- /** Whether the button should use primary styling. */
44
- primary: boolean;
45
- /** The theme of the button. */
46
- theme: "default" | "white" | "black";
47
- /** Whether the button is disabled. */
48
- disabled: boolean;
49
- /** The URL the button should navigate to when clicked. */
50
- href: string;
51
- /** The target attribute for the link (if href is provided). */
52
- target: string;
53
- /** The rel attribute for the link (if href is provided). */
54
- rel: string;
55
- /** The type attribute for the link (if href is provided). */
56
- type: "button" | "submit" | "reset";
57
- /** The id attribute for the link. */
58
- id: string;
59
- private handleClick;
60
- private handleKeyDown;
61
- render(): lit_html.TemplateResult<1>;
62
- }
63
-
64
- declare global {
65
- interface HTMLElementTagNameMap {
66
- "pop-button-link": PopButtonLink;
67
- }
68
- }
69
-
70
- type ButtonTheme = "brand" | "error" | "glass";
71
- type ButtonVariant = "primary" | "secondary" | "tertiary";
72
- type ButtonSize = "sm" | "md" | "lg";
73
- type ButtonAlign = "left" | "center";
74
- type LoaderTheme = "default" | "reversed" | "black" | "white";
75
- type LoaderVariant = "loader" | "spinner";
76
- type ButtonType = "button" | "submit" | "reset" | "menu";
77
- /**
78
- * @summary A versatile button component with multiple themes, variants, and states.
79
- * @status stable
80
- * @since 1.0.0
81
- *
82
- * @slot - The default slot for button content
83
- * @slot leading - Slot for content before the label
84
- * @slot trailing - Slot for content after the label
85
- *
86
- * @csspart base - The component's base wrapper
87
- * @csspart label - The button's label wrapper
88
- * @csspart leading - The leading content wrapper
89
- * @csspart trailing - The trailing content wrapper
90
- * @csspart loader - The loader wrapper
91
- *
92
- * @cssproperty --bg-resting - Background color in resting state
93
- * @cssproperty --bg-hover - Background color in hover state
94
- * @cssproperty --bg-active - Background color in active state
95
- * @cssproperty --bg-focused - Background color in focused state
96
- * @cssproperty --color-resting - Text color in resting state
97
- * @cssproperty --color-hover - Text color in hover state
98
- * @cssproperty --color-active - Text color in active state
99
- * @cssproperty --color-focused - Text color in focused state
100
- */
101
- declare class PopButton extends PopElement {
102
- static styles: CSSResultGroup;
103
- /** The button's theme */
104
- theme: ButtonTheme;
105
- /** The button's variant */
106
- variant: ButtonVariant;
107
- /** The button's size */
108
- size: ButtonSize;
109
- /** The button's content alignment */
110
- align: ButtonAlign;
111
- /** Whether the button is in a loading state */
112
- loading: boolean;
113
- /** Whether the button is disabled */
114
- disabled: boolean;
115
- /** Whether the button is in a current/active state */
116
- current: boolean;
117
- /** Whether the button has an outline style */
118
- outline: boolean;
119
- /** Whether the button is collapsed (icon only) */
120
- collapsed: boolean;
121
- /** Whether the button is highlighted */
122
- highlight: boolean;
123
- /** Whether the button has rounded corners */
124
- rounded: boolean;
125
- /** Whether the button uses white theme (glass variant) */
126
- white: boolean;
127
- /** Whether the button uses black theme (glass variant) */
128
- black: boolean;
129
- /** The loader theme to use when loading */
130
- loaderTheme: LoaderTheme;
131
- /** The loader variant to use when loading */
132
- loaderVariant: LoaderVariant;
133
- /** The button's type attribute */
134
- type: ButtonType;
135
- /** The button's href attribute for link buttons */
136
- href?: string;
137
- private get buttonClasses();
138
- render(): lit_html.TemplateResult<1>;
139
- }
140
- declare global {
141
- interface HTMLElementTagNameMap {
142
- "pop-button": PopButton;
143
- }
144
- }
145
-
146
- type ButtonVerticalVariant = "avatar" | "icon";
147
- /**
148
- * @summary A vertical button component with icon and notification support.
149
- * @status stable
150
- * @since 1.0.0
151
- *
152
- * @slot - The default slot for button content
153
- * @slot leading - Slot for content before the label (usually an icon)
154
- * @slot trailing - Slot for notification count or indicator
155
- *
156
- * @csspart base - The component's base wrapper
157
- * @csspart label - The button's label wrapper
158
- * @csspart leading - The leading content wrapper
159
- * @csspart trailing - The trailing content wrapper
160
- * @csspart loader - The loader wrapper
161
- */
162
- declare class PopButtonVertical extends PopElement {
163
- static styles: CSSResultGroup;
164
- /** Whether the button is in a loading state */
165
- loading: boolean;
166
- /** Whether the button is displayed in mini format */
167
- mini: boolean;
168
- /** Whether the button is in a current/active state */
169
- current: boolean;
170
- /** The button's variant */
171
- variant: ButtonVerticalVariant;
172
- /** Whether the button is disabled */
173
- disabled: boolean;
174
- /** The loader theme to use when loading */
175
- loaderTheme: LoaderTheme;
176
- /** The loader variant to use when loading */
177
- loaderVariant: LoaderVariant;
178
- /** The button's type attribute */
179
- type: ButtonType;
180
- /** The button's href attribute for link buttons */
181
- href?: string;
182
- private get buttonClasses();
183
- render(): lit_html.TemplateResult<1>;
184
- }
185
- declare global {
186
- interface HTMLElementTagNameMap {
187
- "pop-button-vertical": PopButtonVertical;
188
- }
189
- }
190
-
191
- declare global {
192
- interface HTMLElementTagNameMap {
193
- "pop-button": PopButton;
194
- "pop-button-vertical": PopButtonVertical;
195
- }
196
- }
197
-
198
- /**
199
- * @summary A specialized input field designed for code or monospaced text entry.
200
- * @description The PopCodeInputField component provides a text input styled specifically for code entry,
201
- * typically using monospaced fonts and appropriate styling for displaying code or technical input.
202
- * @status experimental
203
- * @since 0.0.1
204
- *
205
- * @csspart base - The component's base wrapper.
206
- *
207
- * @property {boolean} disabled - When true, the input field will be disabled and not accept user input.
208
- * @property {string} name - The name of the input field, used for form submissions.
209
- * @property {string} value - The current value of the input field.
210
- */
211
- declare class PopCodeInputField extends PopElement {
212
- static styles: CSSResultGroup;
213
- disabled: boolean;
214
- name: string;
215
- value: string;
216
- private input;
217
- render(): lit_html.TemplateResult<1>;
218
- private onInput;
219
- focus(): void;
220
- select(): void;
221
- }
222
-
223
- declare global {
224
- interface HTMLElementTagNameMap {
225
- "pop-code-input-field": PopCodeInputField;
226
- }
227
- }
228
-
229
- /**
230
- * @summary A component for displaying a comment's avatar with a customizable size.
231
- * @status experimental
232
- * @since 0.0.1
233
- *
234
- * @slot - The default slot.
235
- *
236
- * @csspart base - The component's base wrapper.
237
- * @csspart background - The background element.
238
- * @csspart content - The content element.
239
- *
240
- * @cssproperty --comment-avatar-border-size
241
- * @cssproperty --comment-avatar-border-color
242
- */
243
- declare class PopCommentAvatar extends PopElement {
244
- static styles: CSSResultGroup;
245
- size: "xs" | "sm" | "md" | "lg" | "xl";
246
- backgroundColor: string;
247
- render(): lit_html.TemplateResult<1>;
248
- }
249
-
250
- declare global {
251
- interface HTMLElementTagNameMap {
252
- 'pop-comment-avatar': PopCommentAvatar;
253
- }
254
- }
255
-
256
- /**
257
- * @summary A component for displaying a comment-related icon button.
258
- * @status experimental
259
- * @since 0.0.1
260
- *
261
- * @event pop-click - Emitted when the button is clicked.
262
- *
263
- * @slot - The default slot.
264
- * @slot example - An example slot.
265
- *
266
- * @csspart base - The component's base wrapper.
267
- *
268
- * @csspart base - The component's base element.
269
- * @csspart icon - The container that wraps the icon element.
270
- *
271
- * @cssproperty --icon-scale - The beginning scale of the element.
272
- * @cssproperty --icon-scale-hover - The scale of the element when hovered.
273
- * @cssproperty --icon-scale-active - The scale of the element when pressed.
274
- * @cssproperty --icon-size - The size of the icon element
275
- * @cssproperty --icon-color - The color of the icon element.
276
- * @cssproperty --icon-color-hover - The color of the icon element when hovered.
277
- * @cssproperty --icon-color-active - The color of the icon element when pressed.
278
- * @cssproperty --icon-color-focused - The color of the icon element when focused.
279
- * @cssproperty --icon-background - The background color of the icon element.
280
- * @cssproperty --icon-background-hover - The background color of the icon element when hovered.
281
- * @cssproperty --icon-background-active - The background color of the icon element when pressed.
282
- * @cssproperty --icon-background-focused - The background color of the icon element when focused.
283
- */
284
- declare class PopCommentIcon extends PopElement {
285
- static styles: CSSResultGroup;
286
- counter: number;
287
- iconUrl: string | undefined;
288
- size: string;
289
- theme: "brand" | "neutral";
290
- variant: "add" | "close" | "filter" | "more" | "send" | "cancel";
291
- type: "button" | "submit" | "reset" | "menu";
292
- disabled: boolean;
293
- handleClick(event: Event): void;
294
- get icon(): TemplateResult<1>;
295
- render(): TemplateResult<1>;
296
- }
297
-
298
- declare global {
299
- interface HTMLElementTagNameMap {
300
- "pop-comment-icon": PopCommentIcon;
301
- }
302
- }
303
-
304
- declare global {
305
- interface HTMLElementTagNameMap {
306
- "pop-element": PopElement;
307
- }
308
- }
309
-
310
- /**
311
- * @summary A component for displaying a focus indicator.
312
- * @status experimental
313
- * @since 0.0.1
314
- *
315
- * @csspart base - The component's base wrapper.
316
- */
317
- declare class PopFocusIndicator extends PopElement {
318
- static styles: CSSResultGroup;
319
- render(): lit_html.TemplateResult<1>;
320
- }
321
-
322
- declare global {
323
- interface HTMLElementTagNameMap {
324
- "pop-focus-indicator": PopFocusIndicator;
325
- }
326
- }
327
-
328
- /**
329
- * Input types supported by the form input component.
330
- * Focused on text-based inputs that make sense for this component.
331
- */
332
- type InputType = "text" | "password" | "email" | "search" | "tel" | "url" | "number";
333
- /**
334
- * @summary A simple input component with different states and validation.
335
- * @status stable
336
- * @since 0.0.1
337
- *
338
- * @slot hint - Optional hint/error text to display below the input
339
- * @slot prefix - Optional content to display before the input
340
- * @slot suffix - Optional content to display after the input
341
- *
342
- * @csspart base - The component's base wrapper
343
- * @csspart error - The validation error text element
344
- * @csspart input - The native input element
345
- * @csspart hint - The hint/error text element
346
- *
347
- * @cssproperty --form-input-border-radius - Border radius of the input
348
- * @cssproperty --form-input-padding - Padding inside the input
349
- * @cssproperty --form-input-font-size - Input text size
350
- * @cssproperty --form-input-color - Input text color
351
- * @cssproperty --form-input-placeholder-color - Placeholder text color
352
- * @cssproperty --form-input-bg-color - Input background color
353
- * @cssproperty --form-input-border-color - Input border color
354
- * @cssproperty --form-input-border-color-focus - Input border color when focused
355
- * @cssproperty --form-input-border-color-error - Input border color when in error state
356
- * @cssproperty --form-input-bg-color-error - Input background color when in error state
357
- * @cssproperty --form-input-hint-font-size - Hint text size
358
- * @cssproperty --form-input-hint-line-height - Hint line height
359
- * @cssproperty --form-input-hint-color - Hint text color
360
- * @cssproperty --form-input-error-font-size - Error text size
361
- * @cssproperty --form-input-error-line-height - Error line height
362
- * @cssproperty --form-input-error-color - Error text color
363
- */
364
- declare class PopFormInputSimple extends PopElement {
365
- static styles: CSSResultGroup;
366
- /**
367
- * The input's current value
368
- */
369
- value: string;
370
- /**
371
- * The input's placeholder text
372
- */
373
- placeholder?: string;
374
- /**
375
- * The input's type
376
- */
377
- type: InputType;
378
- /**
379
- * The input's name
380
- */
381
- name?: string;
382
- /**
383
- * The input's autocomplete attribute
384
- */
385
- autocomplete?: string;
386
- /**
387
- * The input's disabled state
388
- */
389
- disabled: boolean;
390
- /**
391
- * The input's error state
392
- */
393
- error: boolean;
394
- /**
395
- * The input's error message
396
- */
397
- errorMessage?: string;
398
- /**
399
- * Whether the input is required
400
- */
401
- required: boolean;
402
- /**
403
- * The input's readonly state
404
- */
405
- readonly: boolean;
406
- /**
407
- * The input's minimum length
408
- */
409
- minlength?: number;
410
- /**
411
- * The input's maximum length
412
- */
413
- maxlength?: number;
414
- /**
415
- * The input's pattern for validation
416
- */
417
- pattern?: string;
418
- /**
419
- * The input's minimum value (for number type)
420
- */
421
- min?: number;
422
- /**
423
- * The input's maximum value (for number type)
424
- */
425
- max?: number;
426
- /**
427
- * The input's step value (for number type)
428
- */
429
- step?: number;
430
- /**
431
- * The input's inputmode attribute
432
- */
433
- inputmode?: "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
434
- private _hasFocus;
435
- private _hasBlurred;
436
- private _hasBeenValidated;
437
- private _showValidationMessage;
438
- private _validationMessage;
439
- /**
440
- * Reference to the native input element
441
- */
442
- private input;
443
- /**
444
- * Checks the validity of the input and updates the error state
445
- * @returns True if the input is valid, false otherwise
446
- */
447
- private checkValidity;
448
- private handleInput;
449
- private handleFocus;
450
- private handleBlur;
451
- render(): lit_html.TemplateResult<1>;
452
- }
453
-
454
- declare global {
455
- interface HTMLElementTagNameMap {
456
- 'pop-form-input-simple': PopFormInputSimple;
457
- }
458
- }
459
-
460
- /**
461
- * @summary A reusable icon component that renders SVG icons from a registered library
462
- * @status stable
463
- * @since 0.0.1
464
- *
465
- * @csspart base - The component's base wrapper
466
- * @csspart icon - The icon element
467
- *
468
- * @cssproperty --icon-color - Color of the icon
469
- */
470
- declare class PopIcon extends PopElement {
471
- static styles: CSSResultGroup;
472
- /**
473
- * The name of the icon to display (e.g., "check", "activity-heart")
474
- */
475
- name: string;
476
- /**
477
- * The library to draw the icon from
478
- */
479
- library: string;
480
- /**
481
- * The size of the icon in pixels
482
- */
483
- size: number;
484
- /**
485
- * Optional CSS color value to apply to the icon
486
- */
487
- color: string;
488
- render(): lit_html.TemplateResult<1>;
489
- }
490
-
491
- declare global {
492
- interface HTMLElementTagNameMap {
493
- "pop-icon": PopIcon;
494
- }
495
- }
496
-
497
- /**
498
- * @summary A loading indicator component that displays a spinner or animation.
499
- * @status stable
500
- * @since 0.0.1
501
- *
502
- * @dependency pop-loader
503
- *
504
- * @property {string} theme - Controls the color scheme. Options: 'default', 'reversed', 'black', 'white'.
505
- * @property {string} variant - Determines the loading animation style. Options: 'spinner', 'loader'.
506
- *
507
- * @csspart base - The component's base wrapper.
508
- *
509
- * @cssproperty --foreground - Controls stroke color in loader variant.
510
- */
511
- declare class PopLoader extends PopElement {
512
- static styles: CSSResultGroup;
513
- theme: "default" | "reversed" | "black" | "white";
514
- variant: "spinner" | "loader";
515
- render(): lit_html.TemplateResult<1>;
516
- }
517
-
518
- declare global {
519
- interface HTMLElementTagNameMap {
520
- 'pop-loader': PopLoader;
521
- }
522
- }
523
-
524
- /**
525
- * @summary PopLogo renders the PopGrids logo with different variants and themes.
526
- * @status experimental
527
- * @since 0.0.1
528
- *
529
- * @slot - The default slot.
530
- *
531
- * @csspart base - The component's base wrapper.
532
- *
533
- * @cssproperty --logo-color - Controls the color of the logo. Defaults to var(--color-text-text-default).
534
- */
535
- declare class PopLogo extends PopElement {
536
- static styles: CSSResultGroup;
537
- /** The logo variant. */
538
- variant: "logo" | "icon";
539
- /** The logo theme. */
540
- theme: "default" | "reversed" | "black" | "white";
541
- /** Whether to display the logo with an outline. */
542
- outline: boolean;
543
- /** Whether to display the logo in a mini size. */
544
- mini: boolean;
545
- render(): lit_html.TemplateResult<1> | undefined;
546
- }
547
-
548
- declare global {
549
- interface HTMLElementTagNameMap {
550
- 'pop-logo': PopLogo;
551
- }
552
- }
553
-
554
- /**
555
- * @summary A component for displaying a sum or total value.
556
- * @status experimental
557
- * @since 0.0.1
558
- *
559
- * @slot - The default slot.
560
- *
561
- * @csspart base - The component's base wrapper.
562
- *
563
- * @cssproperty --sum-background - The background color.
564
- * @cssproperty --sum-border-color - The border color.
565
- * @cssproperty --sum-color - The text color.
566
- */
567
- declare class PopSum extends PopElement {
568
- static styles: CSSResultGroup;
569
- /** An example attribute. */
570
- id: string;
571
- render(): lit_html.TemplateResult<1>;
572
- }
573
-
574
- declare global {
575
- interface HTMLElementTagNameMap {
576
- 'pop-sum': PopSum;
577
- }
578
- }
579
-
580
- /**
581
- * @summary Displays a countdown timer to a specified future timestamp.
582
- * @status experimental
583
- * @since 0.0.1
584
- *
585
- * @event pop-expired - Emitted when the countdown reaches zero.
586
- *
587
- * @property {string} expires - ISO8601 datetime string of when countdown expires
588
- *
589
- * @csspart base - The component's base wrapper.
590
- */
591
- declare class PopTimestampCountdown extends PopElement {
592
- static styles: CSSResultGroup;
593
- /**
594
- * ISO8601 datetime string of when countdown expires
595
- * @attr expires-at
596
- */
597
- expires: string;
598
- /**
599
- * The ISO8601 datetime string from the element content
600
- */
601
- get datetimeContent(): string;
602
- private interval?;
603
- private displayText;
604
- connectedCallback(): void;
605
- disconnectedCallback(): void;
606
- /**
607
- * Formats time in milliseconds to MM:SS format
608
- */
609
- private formatTime;
610
- /**
611
- * Get the timestamp to use, with priority for the attribute value
612
- */
613
- private getTargetTimestamp;
614
- /**
615
- * Updates the countdown on each tick
616
- */
617
- private tick;
618
- render(): lit_html.TemplateResult<1>;
619
- }
620
-
621
- declare global {
622
- interface HTMLElementTagNameMap {
623
- 'pop-timestamp-countdown': PopTimestampCountdown;
624
- }
625
- }
626
-
627
- /**
628
- * @summary A toast notification component that displays brief messages to users.
629
- * @status experimental
630
- * @since 0.0.1
631
- *
632
- * @dependency pop-element
633
- *
634
- * @event pop-close - Emitted when the close button is clicked.
635
- *
636
- * @slot - The default slot for the toast content/message.
637
- * @slot icon - Optional slot for an icon to display before the content.
638
- *
639
- * @csspart base - The component's base wrapper.
640
- * @csspart close - The close button.
641
- */
642
- declare class PopToast extends PopElement {
643
- static styles: CSSResultGroup;
644
- /** The toast theme variant: 'default', 'transparent', or 'reversed'. */
645
- theme: "transparent" | "default" | "reversed";
646
- private close;
647
- render(): lit_html.TemplateResult<1>;
648
- }
649
-
650
- declare global {
651
- interface HTMLElementTagNameMap {
652
- 'pop-toast': PopToast;
653
- }
654
- }
655
-
656
- declare const colors: string[];
657
- declare const sampleColor: () => string;
658
-
659
- export { type ButtonAlign, type ButtonSize, type ButtonTheme, type ButtonType, type ButtonVariant, type ButtonVerticalVariant, type InputType, type LoaderTheme, type LoaderVariant, PopButton, PopButtonLink, PopButtonVertical, PopCodeInputField, PopCommentAvatar, PopCommentIcon, PopElement, PopFocusIndicator, PopFormInputSimple, PopIcon, PopLoader, PopLogo, PopSum, PopTimestampCountdown, PopToast, colors, sampleColor };
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
3
+ import { Button as Button$1 } from '@base-ui/react/button';
4
+ import { VariantProps } from 'class-variance-authority';
5
+
6
+ declare const buttonVariants: (props?: ({
7
+ align?: "left" | "center" | "right" | null | undefined;
8
+ collapsed?: boolean | null | undefined;
9
+ outline?: boolean | null | undefined;
10
+ leading?: boolean | null | undefined;
11
+ theme?: "base" | "brand" | "error" | null | undefined;
12
+ trailing?: boolean | null | undefined;
13
+ variant?: "default" | "outline" | "primary" | "secondary" | "tertiary" | null | undefined;
14
+ pill?: boolean | null | undefined;
15
+ size?: "default" | "lg" | null | undefined;
16
+ } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
17
+ declare function Button({ className, children, collapsed, variant, size, align, outline, pill, theme, leadingElement, trailingElement, ...props }: Button$1.Props & VariantProps<typeof buttonVariants> & {
18
+ leadingElement?: React.ReactNode;
19
+ trailingElement?: React.ReactNode;
20
+ }): react_jsx_runtime.JSX.Element;
21
+
22
+ export { Button, buttonVariants };