@govtechsg/sgds-web-component 0.0.12 → 0.0.13

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 (41) hide show
  1. package/base/dropdown-element.d.ts +24 -0
  2. package/base/link-element.d.ts +6 -0
  3. package/components/Accordion/sgds-accordion-item.d.ts +8 -4
  4. package/components/Accordion/sgds-accordion.d.ts +4 -2
  5. package/components/Button/sgds-button.d.ts +16 -10
  6. package/components/Checkbox/sgds-checkbox.d.ts +25 -6
  7. package/components/Footer/sgds-footer.d.ts +35 -1
  8. package/components/Input/sgds-input.d.ts +45 -12
  9. package/components/Mainnav/sgds-mainnav-item.d.ts +5 -1
  10. package/components/Mainnav/sgds-mainnav.d.ts +20 -4
  11. package/components/Masthead/sgds-masthead.d.ts +17 -0
  12. package/components/Radio/sgds-radio-group.d.ts +27 -12
  13. package/components/Radio/sgds-radio.d.ts +10 -2
  14. package/components/Sidenav/sgds-sidenav-item.d.ts +25 -4
  15. package/components/Sidenav/sgds-sidenav-link.d.ts +5 -0
  16. package/components/Sidenav/sgds-sidenav.d.ts +4 -0
  17. package/components/Spinner/index.d.ts +1 -0
  18. package/components/Spinner/sgds-spinner.d.ts +11 -0
  19. package/components/Table/sgds-table.d.ts +54 -3
  20. package/components/Textarea/sgds-textarea.d.ts +43 -14
  21. package/index.d.ts +1 -0
  22. package/index.js +581 -336
  23. package/index.js.map +1 -1
  24. package/main.d.ts +1 -0
  25. package/package.json +1 -1
  26. package/react/checkbox/index.d.ts +3 -1
  27. package/react/cjs/index.js +715 -434
  28. package/react/cjs/index.js.map +1 -1
  29. package/react/dropdown/index.d.ts +6 -1
  30. package/react/index.d.ts +2 -1
  31. package/react/index.js +688 -408
  32. package/react/index.js.map +1 -1
  33. package/react/input/index.d.ts +6 -1
  34. package/react/mainnav-dropdown/index.d.ts +6 -1
  35. package/react/radio/index.d.ts +4 -1
  36. package/react/radio-group/index.d.ts +3 -1
  37. package/react/spinner/index.d.ts +3 -0
  38. package/react/textarea/index.d.ts +6 -1
  39. package/umd/index.js +580 -335
  40. package/umd/index.js.map +1 -1
  41. package/utils/form.d.ts +16 -0
@@ -1,22 +1,73 @@
1
1
  import SgdsElement from "../../base/sgds-element";
2
+ /**
3
+ * @summary The use of a table is to organise a collections of data into readable rows
4
+ *
5
+ * @cssproperty --sgds-table-bg - Table's background color
6
+ * @cssproperty --sgds-table-accent-bg - Table's accent background color
7
+ * @cssproperty --sgds-table-striped-color - Text color for striped table
8
+ * @cssproperty --sgds-table-striped-bg - Background color for striped table
9
+ * @cssproperty --sgds-table-active-color - Active text color for hovered row
10
+ * @cssproperty --sgds-table-active-bg - Active background color for hovered row
11
+ * @cssproperty --sgds-table-hover-color - Hovered text color for hover table
12
+ * @cssproperty --sgds-table-hover-bg - Hovered background color for hover table
13
+ */
2
14
  export declare class SgdsTable extends SgdsElement {
3
15
  static styles: import("lit").CSSResultGroup[];
16
+ /**
17
+ * Adds zebra-striping using striped to table row within the <tbody>
18
+ */
4
19
  striped: boolean;
20
+ /**
21
+ * Add borders to all sides of table and cells
22
+ */
5
23
  bordered: boolean;
24
+ /**
25
+ * Remove all borders to table and cells
26
+ */
6
27
  borderless: boolean;
28
+ /**
29
+ * Add hoverable state on table rows
30
+ */
7
31
  hover: boolean;
8
- size?: string;
9
- variant?: string;
32
+ /**
33
+ * Add <code>.table-sm</code> to make table more compact
34
+ */
35
+ size: string;
36
+ /**
37
+ * Use contextual classes to add colors to table
38
+ */
39
+ variant: string;
40
+ /**
41
+ * Sorting on a column is enabled by adding the sort property. The sorting algorithm is based on javascript array.sort() method. In ascending order from bottom, alphabets come first, followed by numbers, and then symbols. Similarly, in descending order from bottom, symbols come first, followed by numbers, and then alphabets.
42
+ */
10
43
  sort: boolean;
44
+ /**
45
+ * When removableSort is present, the third click removes the sorting from the column.
46
+ */
11
47
  removableSort: boolean;
12
- responsive?: "sm" | "md" | "lg" | "xl";
48
+ /**
49
+ * Use responsive="sm", responsive="md" , responsive="lg", or responsive="xl" as needed to create responsive tables up to a particular breakpoint. From that breakpoint and up, the table will behave normally and not scroll horizontally. Use reponsive="always" to let table be always responsive
50
+ */
51
+ responsive: "sm" | "md" | "lg" | "xl" | "always";
52
+ /**
53
+ * Populate header cells using Arrays
54
+ */
13
55
  tableHeaders: any[];
56
+ /**
57
+ * Populate data cells using Arrays
58
+ */
14
59
  tableData: any[];
60
+ /** @internal */
15
61
  sortColumn: number | null;
62
+ /** @internal */
16
63
  sortAsc: boolean;
64
+ /** @internal */
17
65
  activeColumn: number | null;
66
+ /** @internal */
18
67
  sortClickCount: number;
68
+ /** @internal */
19
69
  clickCount: number;
70
+ /** @internal */
20
71
  originalTableData: Array<string[]>;
21
72
  connectedCallback(): void;
22
73
  handleHeaderClick(columnIndex: number): void;
@@ -1,48 +1,77 @@
1
1
  import SgdsElement from "../../base/sgds-element";
2
- export declare class SgdsTextArea extends SgdsElement {
2
+ import { SgdsFormControl } from "../../utils/form";
3
+ /**
4
+ * @summary Text areas allow for the collection of input longer than a single line.
5
+ *
6
+ * @event sgds-change - Emitted when an alteration to the control's value is committed by the user.
7
+ * @event sgds-input - Emitted when the control receives input and its value changes.
8
+ * @event sgds-focus - Emitted when textarea is in focus.
9
+ * @event sgds-blur - Emitted when textarea loses focus.
10
+ */
11
+ export declare class SgdsTextarea extends SgdsElement implements SgdsFormControl {
3
12
  static styles: import("lit").CSSResultGroup[];
13
+ /**@internal */
4
14
  textarea: HTMLTextAreaElement;
5
- private hasFocus;
15
+ /**@internal */
6
16
  private readonly formSubmitController;
17
+ /**@internal */
7
18
  private resizeObserver;
19
+ /**The textarea's label */
8
20
  label: string;
21
+ /**The textarea's unique id */
9
22
  textareaId: string;
10
- name: any;
11
- textareaClasses?: any;
23
+ /**The textarea's name attribute */
24
+ name: string;
25
+ /**Forwarded to the HTML native textarea element. Can be used to insert any bootstrap classes such as mt-2 */
26
+ textareaClasses?: string;
27
+ /**The textarea's value attribute. */
12
28
  value: string;
13
- minlength: any;
14
- maxlength: any;
29
+ /**Sets the minimum length of the textarea */
30
+ minlength: number;
31
+ /**Sets the maximum length of the textarea */
32
+ maxlength: number;
33
+ /**Enables spell checking on the textarea */
15
34
  spellcheck: boolean;
16
35
  /** The number of rows to display by default. */
17
36
  rows: number;
37
+ /**The textarea's placeholder text. */
18
38
  placeholder: string;
39
+ /**Feedback text for error state when validated */
19
40
  invalidFeedback: string;
41
+ /**Autofocus the textarea */
20
42
  autofocus: boolean;
43
+ /**Disables the textarea. */
21
44
  disabled: boolean;
45
+ /**Makes the textarea a required field. */
22
46
  required: boolean;
23
- /** Makes the input readonly. */
47
+ /** Makes the textarea readonly. */
24
48
  readonly: boolean;
25
- invalid: boolean;
26
- valid: boolean;
27
49
  /** Controls how the textarea can be resized. */
28
50
  resize: "none" | "vertical" | "auto";
29
- /** The textarea's inputmode attribute. */
51
+ /** The native textarea's inputmode attribute. It hints at the type of data that might be entered by the user while editing the element or its contents. This allows a browser to display an appropriate virtual keyboard. */
30
52
  inputmode: "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
53
+ /** The native textarea's autocorrect attribute. */
31
54
  autocorrect: string;
32
55
  /** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
33
56
  defaultValue: string;
57
+ /** Allows invalidFeedback, invalid and valid styles to be visible with the input */
58
+ hasFeedback: boolean;
59
+ /**@internal */
60
+ invalid: boolean;
61
+ /**@internal */
62
+ valid: boolean;
34
63
  connectedCallback(): void;
35
64
  disconnectedCallback(): void;
36
65
  /** Sets focus on the textarea. */
37
66
  focus(options?: FocusOptions): void;
38
67
  /** Checks for validity and shows the browser's validation message if the control is invalid. */
39
68
  reportValidity(): boolean;
40
- handleInvalid(): void;
69
+ /** Selects all the text in the textarea. */
70
+ select(): void;
71
+ handleInvalid(e: Event): void;
41
72
  handleChange(event: string): void;
42
73
  handleFocus(): void;
43
74
  handleBlur(): void;
44
- /** Selects all the text in the textarea. */
45
- select(): void;
46
75
  handleKeyDown(event: KeyboardEvent): void;
47
76
  handleRowsChange(): void;
48
77
  setTextareaHeight(): void;
@@ -50,4 +79,4 @@ export declare class SgdsTextArea extends SgdsElement {
50
79
  handleValueChange(): void;
51
80
  render(): import("lit").TemplateResult;
52
81
  }
53
- export default SgdsTextArea;
82
+ export default SgdsTextarea;
package/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export * from "./components/Toast";
21
21
  export * from "./components/FileUpload";
22
22
  export * from "./components/Accordion";
23
23
  export * from "./components/Tooltip";
24
+ export * from "./components/Spinner";