@spectric/ui 0.0.17 → 0.0.19

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 (49) hide show
  1. package/dist/components/Button.d.ts +2 -1
  2. package/dist/components/Panel.d.ts +6 -3
  3. package/dist/components/ThemeProvider.d.ts +1 -0
  4. package/dist/components/calendar/calendar.d.ts +58 -0
  5. package/dist/components/calendar/index.d.ts +1 -0
  6. package/dist/components/color_picker/ColorPicker.d.ts +7 -6
  7. package/dist/components/index.d.ts +1 -0
  8. package/dist/components/input.d.ts +24 -20
  9. package/dist/components/pagination/pagination.d.ts +1 -1
  10. package/dist/components/query_bar/QueryBar.d.ts +2 -1
  11. package/dist/components/table/table.d.ts +3 -0
  12. package/dist/components/table/virtualBody.d.ts +2 -1
  13. package/dist/components/tooltip/popover.d.ts +32 -2
  14. package/dist/components/tooltip/tooltip.d.ts +1 -32
  15. package/dist/custom-elements.json +60 -15
  16. package/dist/index.d.ts +3 -0
  17. package/dist/index.es.js +2895 -2573
  18. package/dist/index.es.js.map +1 -1
  19. package/dist/index.umd.js +305 -182
  20. package/dist/index.umd.js.map +1 -1
  21. package/dist/style.css +1 -1
  22. package/package.json +1 -1
  23. package/src/components/Button.ts +14 -13
  24. package/src/components/Panel.ts +25 -18
  25. package/src/components/ThemeProvider.ts +34 -1
  26. package/src/components/button.css.ts +15 -2
  27. package/src/components/calendar/calendar.css +50 -0
  28. package/src/components/calendar/calendar.ts +281 -0
  29. package/src/components/calendar/index.ts +1 -0
  30. package/src/components/color_picker/ColorPicker.css +69 -0
  31. package/src/components/color_picker/ColorPicker.ts +72 -17
  32. package/src/components/index.ts +2 -1
  33. package/src/components/input.css +5 -34
  34. package/src/components/input.ts +207 -144
  35. package/src/components/pagination/pagination.ts +2 -2
  36. package/src/components/panel.css.ts +7 -5
  37. package/src/components/query_bar/QueryBar.css +6 -2
  38. package/src/components/query_bar/QueryBar.ts +25 -13
  39. package/src/components/table/__tests__/table.spec.ts +1 -1
  40. package/src/components/table/header.ts +0 -3
  41. package/src/components/table/table.ts +43 -35
  42. package/src/components/table/virtualBody.ts +18 -6
  43. package/src/components/tooltip/popover.ts +73 -33
  44. package/src/components/tooltip/tooltip.css +7 -2
  45. package/src/components/tooltip/tooltip.ts +4 -37
  46. package/src/stories/Calendar.stories.ts +70 -0
  47. package/src/stories/fixtures/ExampleContent.ts +2 -1
  48. package/src/stories/table.stories.ts +1 -2
  49. package/src/stories/tooltip.stories.ts +9 -2
@@ -1,4 +1,4 @@
1
- import { CSSResultGroup } from 'lit';
1
+ import { CSSResultGroup, PropertyValues } from 'lit';
2
2
  import { HTMLElementTagWithEvents, ReactElementWithPropsAndEvents } from './types';
3
3
  import { DomRenderable } from './table';
4
4
  import { TooltipPostionsTypes } from './tooltip';
@@ -45,6 +45,7 @@ export declare class SpectricButton extends DisposableElement implements ButtonP
45
45
  tooltipPosition?: TooltipPostionsTypes;
46
46
  constructor();
47
47
  private _onClick;
48
+ protected updated(_changedProperties: PropertyValues): void;
48
49
  protected render(): unknown;
49
50
  }
50
51
  export interface ButtonEventMap {
@@ -1,14 +1,17 @@
1
- import { CSSResultGroup, LitElement } from 'lit';
1
+ import { CSSResultGroup, PropertyValues } from 'lit';
2
+ import { DisposableElement } from '../classes/DisposibleElement.ts';
2
3
  /**
3
4
  * Spectric Panel visually seperates content areas and automatically adjusts the component colors that are nested inside.
4
5
  * */
5
- export declare class SpectricPanel extends LitElement {
6
+ export declare class SpectricPanel extends DisposableElement {
6
7
  static styles?: CSSResultGroup | undefined;
7
8
  /**
8
9
  * Specify the layer level and override any existing levels based on hierarchy
9
10
  */
10
11
  level: number;
11
12
  layers?: NodeListOf<SpectricPanel>;
12
- updated(): void;
13
+ constructor();
14
+ connectedCallback(): void;
15
+ update(changed: PropertyValues): void;
13
16
  render(): import('lit-html').TemplateResult<1>;
14
17
  }
@@ -58,6 +58,7 @@ export declare const ThemeSelections: { [k in keyof typeof Themes]: k; };
58
58
  type ThemeProps = {
59
59
  theme?: KnownThemes;
60
60
  };
61
+ export declare const SPECTRIC_CSS_VARIABLES: string[];
61
62
  export interface ThemeChangeEvent {
62
63
  old?: string;
63
64
  new?: string;
@@ -0,0 +1,58 @@
1
+ import { PropertyValues } from 'lit';
2
+ import { DisposableElement } from '../../classes';
3
+ import { HTMLElementTagWithEvents, ReactElementWithPropsAndEvents } from '../types';
4
+ export interface SpectricCalendarProps {
5
+ /**
6
+ * Sets the starting day for the calendar (default:Today)
7
+ */
8
+ currentDate?: Date | string | number;
9
+ /**
10
+ * Will display a button with a popup
11
+ */
12
+ popup?: boolean;
13
+ disabled?: boolean;
14
+ }
15
+ export declare class SpectricCalendar extends DisposableElement {
16
+ calendarElement: Promise<HTMLDivElement>;
17
+ constructor();
18
+ currentDate?: Date | string | number;
19
+ private date;
20
+ popup: boolean;
21
+ disabled: boolean;
22
+ protected createRenderRoot(): HTMLElement | DocumentFragment;
23
+ private getMonthDays;
24
+ private changeMonth;
25
+ private changeYear;
26
+ private handleMouseMove;
27
+ private resetMouseMove;
28
+ private selectDay;
29
+ protected update(changedProperties: PropertyValues): void;
30
+ render(): import('lit-html').TemplateResult<1>;
31
+ }
32
+ interface CalendarEvents {
33
+ select: (event: CustomEvent<Date>) => void;
34
+ }
35
+ declare global {
36
+ interface HTMLElementTagNameMap {
37
+ "spectric-calendar": HTMLElementTagWithEvents<SpectricCalendar, CalendarEvents>;
38
+ }
39
+ namespace JSX {
40
+ interface IntrinsicElements {
41
+ /**
42
+ * @see {@link SpectricCalendar}
43
+ */
44
+ "spectric-calendar": ReactElementWithPropsAndEvents<SpectricCalendar, SpectricCalendarProps, CalendarEvents>;
45
+ }
46
+ }
47
+ namespace React {
48
+ namespace JSX {
49
+ interface IntrinsicElements {
50
+ /**
51
+ * @see {@link SpectricCalendar}
52
+ */
53
+ "spectric-calendar": ReactElementWithPropsAndEvents<SpectricCalendar, SpectricCalendarProps, CalendarEvents>;
54
+ }
55
+ }
56
+ }
57
+ }
58
+ export {};
@@ -0,0 +1 @@
1
+ export * from './calendar';
@@ -19,15 +19,16 @@ export declare class SpectricColorPicker extends LitElement implements ColorPick
19
19
  /**is mouse down on saturation/light canvas? */
20
20
  private sldown;
21
21
  protected createRenderRoot(): HTMLElement | DocumentFragment;
22
+ constructor();
22
23
  protected update(changedProperties: PropertyValues): void;
23
24
  private renderHueSaturationGrid;
24
- _handleSaturationLightnessClick: (e: PointerEvent) => void;
25
- _handleHueChange: (e: DomEvent<SpectricInput>) => void;
25
+ _handleSaturationLightnessClick(e: PointerEvent): void;
26
+ _handleHueChange(e: DomEvent<SpectricInput>): void;
26
27
  private updateValue;
27
- _handleAlphaChange: (e: DomEvent<SpectricInput>) => void;
28
- _handleApply: () => void;
29
- _cancel: () => void;
30
- _openPopover: () => Promise<void>;
28
+ _handleAlphaChange(e: DomEvent<SpectricInput>): void;
29
+ _handleApply(): void;
30
+ _cancel(): void;
31
+ _openPopover(): Promise<void>;
31
32
  protected getPopover(): TemplateResult;
32
33
  protected render(): unknown;
33
34
  }
@@ -13,3 +13,4 @@ export * from './table';
13
13
  export * from './tooltip';
14
14
  export * from './types';
15
15
  export * from './color_picker';
16
+ export * from './calendar';
@@ -1,12 +1,15 @@
1
1
  import { LitElement, PropertyValues, TemplateResult } from 'lit';
2
2
  import { ReactElementWithPropsAndEvents } from './types';
3
3
  import { ButtonSizesTypes } from './Button';
4
+ import { DomEvent } from './table';
5
+ import { SpectricColorPicker } from './color_picker/ColorPicker';
4
6
  export declare enum InputVariants {
5
7
  Text = "text",
6
8
  TextArea = "text-area",
7
9
  number = "number",
8
10
  color = "color",
9
11
  date = "date",//replace default eventually with custom
12
+ datePopup = "popup-date",
10
13
  datetime = "datetime-local",//replace default eventually with custom
11
14
  email = "email",
12
15
  file = "file",//display drop area
@@ -26,8 +29,8 @@ export interface InputProps {
26
29
  disabled?: boolean;
27
30
  readonly?: boolean;
28
31
  /**
29
- * The helper text.
30
- */
32
+ * The helper text.
33
+ */
31
34
  helperText?: string;
32
35
  /**
33
36
  * Specify if the currently value is invalid.
@@ -42,16 +45,16 @@ export interface InputProps {
42
45
  */
43
46
  maxCount?: number;
44
47
  /**
45
- * Boolean property to set the required status
46
- */
48
+ * Boolean property to set the required status
49
+ */
47
50
  required?: boolean;
48
51
  /**
49
- * Shows a button to display the password
50
- */
52
+ * Shows a button to display the password
53
+ */
51
54
  showPasswordVisibilityToggle?: boolean;
52
55
  /**
53
- * Name for the input used for form data events //TODO make sure this works
54
- */
56
+ * Name for the input used for form data events //TODO make sure this works
57
+ */
55
58
  name?: string;
56
59
  /**
57
60
  * Pattern to validate the input against for HTML validity checking
@@ -60,11 +63,12 @@ export interface InputProps {
60
63
  /**
61
64
  * The sets the autocomplete for the input.
62
65
  */
63
- autocomplete?: HTMLInputElement['autocomplete'];
66
+ autocomplete?: HTMLInputElement["autocomplete"];
64
67
  }
65
68
  export declare class SpectricInput extends LitElement implements InputProps {
66
69
  checked?: boolean;
67
70
  size?: ButtonSizesTypes;
71
+ files: FileList | null;
68
72
  protected createRenderRoot(): HTMLElement | DocumentFragment;
69
73
  placeholder: string;
70
74
  readonly: boolean;
@@ -72,8 +76,8 @@ export declare class SpectricInput extends LitElement implements InputProps {
72
76
  disabled: boolean;
73
77
  label: string;
74
78
  /**
75
- * "Hide password" tooltip text on password visibility toggle
76
- */
79
+ * "Hide password" tooltip text on password visibility toggle
80
+ */
77
81
  hidePasswordLabel: string;
78
82
  /**
79
83
  * "Show password" tooltip text on password visibility toggle
@@ -109,14 +113,14 @@ export declare class SpectricInput extends LitElement implements InputProps {
109
113
  pattern: string;
110
114
  maxCount: number;
111
115
  /**
112
- * The internal value.
113
- */
116
+ * The internal value.
117
+ */
114
118
  protected _value: string | boolean | number;
115
119
  private _showPassword;
116
120
  /**
117
121
  * The sets the autocomplete for the input.
118
122
  */
119
- autocomplete: HTMLInputElement['autocomplete'];
123
+ autocomplete: HTMLInputElement["autocomplete"];
120
124
  get selectionStart(): number | null;
121
125
  /**
122
126
  * The value of the input.
@@ -127,16 +131,16 @@ export declare class SpectricInput extends LitElement implements InputProps {
127
131
  focus(options?: FocusOptions): void;
128
132
  setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void;
129
133
  /**
130
- * Handles `oninput` event on the `<input>`.
131
- */
132
- protected _handleInput: ({ target }: Event) => void;
134
+ * Handles `oninput` event on the `<input>`.
135
+ */
136
+ protected _handleInput: ({ target }: DomEvent<HTMLInputElement>) => void;
133
137
  /**
134
- * The underlying input element
135
- */
138
+ * The underlying input element
139
+ */
136
140
  protected _input?: HTMLInputElement;
137
141
  private handleTogglePasswordVisibility;
138
142
  protected updated(changedProperties: PropertyValues): void;
139
- _handleChange(e: Event): void;
143
+ _handleChange(e: DomEvent<HTMLInputElement | SpectricColorPicker>): void;
140
144
  protected render(): unknown;
141
145
  }
142
146
  declare global {
@@ -26,7 +26,7 @@ export declare class PaginationElement extends LitElement implements PaginationP
26
26
  */
27
27
  size: ButtonSizesTypes;
28
28
  protected createRenderRoot(): HTMLElement | DocumentFragment;
29
- protected updated(_changedProperties: PropertyValues): void;
29
+ protected update(_changedProperties: PropertyValues): void;
30
30
  private _handlePageUp;
31
31
  private _handlePageDown;
32
32
  private _handleSizeChange;
@@ -2,6 +2,7 @@ import { LitElement, PropertyValues } from 'lit';
2
2
  import { SpectricInput } from '../input';
3
3
  import { JsonObject } from './types';
4
4
  import { HTMLElementTagWithEvents, ReactElementWithPropsAndEvents } from '../types';
5
+ import { PopoverElement } from '../tooltip/popover';
5
6
  import * as kuery from "./querylanguage/kuery";
6
7
  export type FieldTypes = {
7
8
  name: string;
@@ -72,7 +73,7 @@ export declare class SpectricQuery extends LitElement implements IQueryProps {
72
73
  private completions;
73
74
  private completionIndex;
74
75
  fields: FieldTypes[];
75
- _autocomplete?: HTMLDivElement;
76
+ _autocomplete?: PopoverElement;
76
77
  _asyncAutocomplete: Promise<HTMLDivElement>;
77
78
  /**
78
79
  * The underlying input element
@@ -22,6 +22,7 @@ export declare enum TableSortDirection {
22
22
  }
23
23
  export type TableSortDirectionTypes = `${TableSortDirection}`;
24
24
  export type ColumnSettings<T> = {
25
+ [TABLE_CREATED_SELECTION_COLUMN]?: boolean;
25
26
  width?: number;
26
27
  /**
27
28
  * Enabled/disables resizing by dragging column header Default true
@@ -61,6 +62,8 @@ interface TableProps<T> extends TableDataOptions<T> {
61
62
  export type DomEvent<T> = Event & {
62
63
  target: T;
63
64
  };
65
+ export declare const TD_BorderAndPadding = 4;
66
+ declare const TABLE_CREATED_SELECTION_COLUMN: unique symbol;
64
67
  /**
65
68
  * React example
66
69
  * <iframe width="100%" height="400px" src="https://stackblitz.com/edit/react-ts-2ue7azag?ctl=1&embed=1&file=App.tsx&hideExplorer=1&hideNavigation=1"/>
@@ -16,8 +16,9 @@ export declare class TableVirtualBodyElement<T> extends DisposableElement implem
16
16
  rowHeight: number;
17
17
  startIndex: number;
18
18
  table: SpectricTableElement<T>;
19
+ columnsMeasured: boolean;
19
20
  constructor();
20
- protected firstUpdated(): void;
21
+ protected updated(): void;
21
22
  protected createRenderRoot(): HTMLElement | DocumentFragment;
22
23
  protected render(): unknown;
23
24
  }
@@ -1,8 +1,9 @@
1
1
  import { CSSResultGroup } from 'lit-element';
2
2
  import { DomRenderable } from '../table';
3
3
  import { DisposableElement } from '../../classes/DisposibleElement';
4
+ import { HTMLElementTagWithEvents, ReactElementWithPropsAndEvents } from '../types';
4
5
  export declare const PopoverElementTag = "spectric-popover";
5
- export type { TooltipProps, TooltipEvents };
6
+ export type { TooltipProps, PopOverEvents };
6
7
  export declare enum TooltipPostions {
7
8
  top = "top",
8
9
  bottom = "bottom",
@@ -40,6 +41,8 @@ interface TooltipProps {
40
41
  * The element that triggers the tooltip. This is used for special cases like in the shadow dom if you want to target a host element instead of the immediate parent element
41
42
  */
42
43
  triggerTarget?: HTMLElement;
44
+ mouseOffsetX?: number;
45
+ mouseOffsetY?: number;
43
46
  }
44
47
  /**
45
48
  * Spectric tooltip will add a tooltip to any container
@@ -50,6 +53,8 @@ export declare class PopoverElement extends DisposableElement implements Tooltip
50
53
  text: DomRenderable;
51
54
  position: TooltipPostionsTypes;
52
55
  maxWidth?: number;
56
+ mouseOffsetX: number;
57
+ mouseOffsetY: number;
53
58
  protected portalElement: HTMLDivElement;
54
59
  protected mouseLocation?: {
55
60
  left: number;
@@ -60,12 +65,14 @@ export declare class PopoverElement extends DisposableElement implements Tooltip
60
65
  protected timer?: number;
61
66
  protected open: boolean;
62
67
  protected mouseframe?: number;
68
+ isOpen(): boolean;
63
69
  /**
64
70
  * @default parentElement
65
71
  */
66
72
  triggerTarget: HTMLElement;
67
73
  protected get target(): HTMLElement;
68
74
  constructor();
75
+ protected createRenderRoot(): HTMLElement | DocumentFragment;
69
76
  connectedCallback(): void;
70
77
  disconnectedCallback(): void;
71
78
  protected _getMousePosition: (ev: MouseEvent) => void;
@@ -81,5 +88,28 @@ export declare class PopoverElement extends DisposableElement implements Tooltip
81
88
  protected positionTooltip: () => void;
82
89
  protected render(): import('lit-html').TemplateResult<1>;
83
90
  }
84
- interface TooltipEvents {
91
+ interface PopOverEvents {
92
+ }
93
+ declare global {
94
+ interface HTMLElementTagNameMap {
95
+ [PopoverElementTag]: HTMLElementTagWithEvents<PopoverElement, PopOverEvents>;
96
+ }
97
+ namespace JSX {
98
+ interface IntrinsicElements {
99
+ /**
100
+ * @see {@link TooltipElement}
101
+ */
102
+ [PopoverElementTag]: ReactElementWithPropsAndEvents<PopoverElement, TooltipProps, PopOverEvents>;
103
+ }
104
+ }
105
+ namespace React {
106
+ namespace JSX {
107
+ interface IntrinsicElements {
108
+ /**
109
+ * @see {@link TooltipElement}
110
+ */
111
+ [PopoverElementTag]: ReactElementWithPropsAndEvents<PopoverElement, TooltipProps, PopOverEvents>;
112
+ }
113
+ }
114
+ }
85
115
  }
@@ -1,7 +1,7 @@
1
1
  import { HTMLElementTagWithEvents, ReactElementWithPropsAndEvents } from '../types';
2
2
  import { CSSResultGroup } from 'lit-element';
3
3
  import { DomRenderable } from '../table';
4
- import { PopoverElement } from './popover';
4
+ import { PopoverElement, TooltipProps } from './popover';
5
5
  export declare const TooltipElementTag = "spectric-tooltip";
6
6
  export type { TooltipProps, TooltipEvents };
7
7
  export declare enum TooltipPostions {
@@ -12,36 +12,6 @@ export declare enum TooltipPostions {
12
12
  mouse = "mouse"
13
13
  }
14
14
  export type TooltipPostionsTypes = `${TooltipPostions}`;
15
- interface TooltipProps {
16
- /**
17
- * How long you need to hover before the tooltip displays
18
- */
19
- delay?: number;
20
- /**
21
- * How long the fade in animation should run
22
- */
23
- animationDuration?: number;
24
- /**
25
- * Tooltip contents
26
- */
27
- text: DomRenderable;
28
- /**
29
- * Where to anchor the tooltip
30
- */
31
- position?: TooltipPostionsTypes;
32
- /**
33
- * Sets a max width for the contents you can disable this by setting to 0 or -1
34
- */
35
- maxWidth?: number;
36
- /**
37
- * Container the tool tip will be attached to.
38
- */
39
- portalTarget?: HTMLElement;
40
- /**
41
- * The element that triggers the tooltip. This is used for special cases like in the shadow dom if you want to target a host element instead of the immediate parent element
42
- */
43
- triggerTarget?: HTMLElement;
44
- }
45
15
  /**
46
16
  * Spectric tooltip will add a tooltip to any container
47
17
  */
@@ -70,7 +40,6 @@ export declare class TooltipElement extends PopoverElement implements TooltipPro
70
40
  * Public method to trigger showing the tooltip programatically
71
41
  */
72
42
  showToolTip(): Promise<void>;
73
- protected render(): import('lit-html').TemplateResult<1>;
74
43
  }
75
44
  interface TooltipEvents {
76
45
  }