@hubspot/ui-extensions 0.11.4 → 0.11.6

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 (155) hide show
  1. package/dist/__tests__/crm/hooks/useAssociations.spec.js +96 -0
  2. package/dist/__tests__/crm/hooks/useCrmProperties.spec.js +170 -1
  3. package/dist/crm/hooks/useAssociations.d.ts +2 -0
  4. package/dist/crm/hooks/useAssociations.js +87 -0
  5. package/dist/crm/hooks/useCrmProperties.d.ts +5 -1
  6. package/dist/crm/hooks/useCrmProperties.js +81 -2
  7. package/dist/hooks/useExtensionActions.d.ts +4 -0
  8. package/dist/hooks/useExtensionActions.js +6 -0
  9. package/dist/hooks/useExtensionContext.d.ts +4 -0
  10. package/dist/hooks/useExtensionContext.js +6 -0
  11. package/dist/index.d.ts +2 -0
  12. package/dist/index.js +2 -0
  13. package/dist/internal/global-utils.js +4 -0
  14. package/dist/internal/hook-utils.d.ts +10 -3
  15. package/dist/internal/hook-utils.js +10 -1
  16. package/dist/shared/types/components/accordion.d.ts +5 -5
  17. package/dist/shared/types/components/alert.d.ts +2 -2
  18. package/dist/shared/types/components/button-row.d.ts +5 -2
  19. package/dist/shared/types/components/button.d.ts +16 -10
  20. package/dist/shared/types/components/chart.d.ts +3 -3
  21. package/dist/shared/types/components/description-list.d.ts +2 -2
  22. package/dist/shared/types/components/dropdown.d.ts +8 -8
  23. package/dist/shared/types/components/empty-state.d.ts +5 -7
  24. package/dist/shared/types/components/error-state.d.ts +2 -2
  25. package/dist/shared/types/components/form.d.ts +2 -2
  26. package/dist/shared/types/components/heading.d.ts +1 -1
  27. package/dist/shared/types/components/icon.d.ts +4 -5
  28. package/dist/shared/types/components/illustration.d.ts +12 -0
  29. package/dist/shared/types/components/image.d.ts +9 -4
  30. package/dist/shared/types/components/inputs.d.ts +51 -64
  31. package/dist/shared/types/components/layouts.d.ts +17 -24
  32. package/dist/shared/types/components/link.d.ts +8 -5
  33. package/dist/shared/types/components/loading-spinner.d.ts +3 -3
  34. package/dist/shared/types/components/modal.d.ts +5 -5
  35. package/dist/shared/types/components/panel.d.ts +7 -7
  36. package/dist/shared/types/components/progress-bar.d.ts +4 -4
  37. package/dist/shared/types/components/selects.d.ts +11 -20
  38. package/dist/shared/types/components/statistics.d.ts +2 -2
  39. package/dist/shared/types/components/status-tag.d.ts +5 -5
  40. package/dist/shared/types/components/step-indicator.d.ts +5 -7
  41. package/dist/shared/types/components/table.d.ts +22 -12
  42. package/dist/shared/types/components/tabs.d.ts +10 -10
  43. package/dist/shared/types/components/tag.d.ts +2 -2
  44. package/dist/shared/types/components/text.d.ts +15 -21
  45. package/dist/shared/types/components/tile.d.ts +2 -2
  46. package/dist/shared/types/components/toggle.d.ts +12 -14
  47. package/dist/shared/types/components/toggleInputs.d.ts +26 -19
  48. package/dist/shared/types/components/tooltip.d.ts +1 -1
  49. package/dist/shared/types/crm.d.ts +52 -0
  50. package/dist/shared/types/http-requests.d.ts +2 -2
  51. package/dist/shared/types/shared.d.ts +123 -78
  52. package/dist/shared/types/shared.js +123 -78
  53. package/dist/shared/types/worker-globals.d.ts +15 -0
  54. package/dist/{experimental/testing → testing}/__tests__/debug.spec.js +1 -1
  55. package/dist/{experimental/testing → testing}/__tests__/find.spec.js +1 -1
  56. package/dist/{experimental/testing → testing}/__tests__/findAll.spec.js +1 -1
  57. package/dist/{experimental/testing → testing}/__tests__/findAllChildren.spec.js +1 -1
  58. package/dist/{experimental/testing → testing}/__tests__/findByTestId.spec.js +1 -1
  59. package/dist/{experimental/testing → testing}/__tests__/findChild.spec.js +1 -1
  60. package/dist/{experimental/testing → testing}/__tests__/fragments.spec.js +1 -1
  61. package/dist/{experimental/testing → testing}/__tests__/invalid-components.spec.js +1 -1
  62. package/dist/{experimental/testing → testing}/__tests__/isMatch.spec.js +1 -1
  63. package/dist/{experimental/testing → testing}/__tests__/logger.spec.js +1 -1
  64. package/dist/{experimental/testing → testing}/__tests__/maybeFind.spec.js +1 -1
  65. package/dist/{experimental/testing → testing}/__tests__/maybeFindByTestId.spec.js +1 -1
  66. package/dist/{experimental/testing → testing}/__tests__/maybeFindChild.spec.js +1 -1
  67. package/dist/{experimental/testing → testing}/__tests__/mocks.runServerlessFunction.spec.js +1 -1
  68. package/dist/testing/__tests__/mocks.useAssociations.spec.js +135 -0
  69. package/dist/testing/__tests__/mocks.useCrmProperties.spec.js +106 -0
  70. package/dist/testing/__tests__/mocks.useExtensionActions.spec.js +32 -0
  71. package/dist/testing/__tests__/mocks.useExtensionContext.spec.js +46 -0
  72. package/dist/{experimental/testing → testing}/__tests__/props.spec.js +1 -1
  73. package/dist/{experimental/testing → testing}/__tests__/testId.spec.js +1 -1
  74. package/dist/{experimental/testing → testing}/__tests__/trigger.spec.js +1 -1
  75. package/dist/{experimental/testing → testing}/__tests__/type-utils.spec.js +1 -1
  76. package/dist/testing/__tests__/waitFor.spec.d.ts +1 -0
  77. package/dist/{experimental/testing → testing}/__tests__/waitFor.spec.js +1 -1
  78. package/dist/{experimental/testing → testing}/internal/convert.js +1 -1
  79. package/dist/{experimental/testing → testing}/internal/element.d.ts +1 -1
  80. package/dist/{experimental/testing → testing}/internal/errors.js +1 -1
  81. package/dist/{experimental/testing → testing}/internal/match.d.ts +1 -1
  82. package/dist/{experimental/testing → testing}/internal/mocks/index.d.ts +1 -1
  83. package/dist/{experimental/testing → testing}/internal/mocks/mock-extension-point-api.d.ts +1 -1
  84. package/dist/{experimental/testing → testing}/internal/mocks/mock-extension-point-api.js +1 -1
  85. package/dist/testing/internal/mocks/mock-hooks.d.ts +3 -0
  86. package/dist/{experimental/testing → testing}/internal/mocks/mock-hooks.js +14 -0
  87. package/dist/{experimental/testing → testing}/internal/print.js +1 -1
  88. package/dist/{experimental/testing → testing}/internal/query.d.ts +1 -1
  89. package/dist/{experimental/testing → testing}/internal/query.js +1 -1
  90. package/dist/{experimental/testing → testing}/internal/types-internal.d.ts +7 -3
  91. package/dist/testing/internal/types-internal.js +1 -0
  92. package/dist/{experimental/testing → testing}/render.d.ts +1 -1
  93. package/dist/{experimental/testing → testing}/render.js +7 -7
  94. package/dist/{experimental/testing → testing}/types.d.ts +25 -5
  95. package/dist/{experimental/testing → testing}/utils.d.ts +1 -1
  96. package/dist/{experimental/testing → testing}/utils.js +1 -1
  97. package/package.json +3 -3
  98. package/dist/experimental/testing/__tests__/mocks.useAssociations.spec.js +0 -47
  99. package/dist/experimental/testing/__tests__/mocks.useCrmProperties.spec.js +0 -58
  100. package/dist/experimental/testing/internal/mocks/mock-hooks.d.ts +0 -2
  101. /package/dist/{experimental/testing → testing}/__tests__/createRenderer.spec.d.ts +0 -0
  102. /package/dist/{experimental/testing → testing}/__tests__/createRenderer.spec.js +0 -0
  103. /package/dist/{experimental/testing → testing}/__tests__/debug.spec.d.ts +0 -0
  104. /package/dist/{experimental/testing → testing}/__tests__/find.spec.d.ts +0 -0
  105. /package/dist/{experimental/testing → testing}/__tests__/findAll.spec.d.ts +0 -0
  106. /package/dist/{experimental/testing → testing}/__tests__/findAllChildren.spec.d.ts +0 -0
  107. /package/dist/{experimental/testing → testing}/__tests__/findByTestId.spec.d.ts +0 -0
  108. /package/dist/{experimental/testing → testing}/__tests__/findChild.spec.d.ts +0 -0
  109. /package/dist/{experimental/testing → testing}/__tests__/fragments.spec.d.ts +0 -0
  110. /package/dist/{experimental/testing → testing}/__tests__/invalid-components.spec.d.ts +0 -0
  111. /package/dist/{experimental/testing → testing}/__tests__/isMatch.spec.d.ts +0 -0
  112. /package/dist/{experimental/testing → testing}/__tests__/logger.spec.d.ts +0 -0
  113. /package/dist/{experimental/testing → testing}/__tests__/maybeFind.spec.d.ts +0 -0
  114. /package/dist/{experimental/testing → testing}/__tests__/maybeFindByTestId.spec.d.ts +0 -0
  115. /package/dist/{experimental/testing → testing}/__tests__/maybeFindChild.spec.d.ts +0 -0
  116. /package/dist/{experimental/testing → testing}/__tests__/mocks.actions.spec.d.ts +0 -0
  117. /package/dist/{experimental/testing → testing}/__tests__/mocks.actions.spec.js +0 -0
  118. /package/dist/{experimental/testing → testing}/__tests__/mocks.context.spec.d.ts +0 -0
  119. /package/dist/{experimental/testing → testing}/__tests__/mocks.context.spec.js +0 -0
  120. /package/dist/{experimental/testing → testing}/__tests__/mocks.runServerlessFunction.spec.d.ts +0 -0
  121. /package/dist/{experimental/testing → testing}/__tests__/mocks.useAssociations.spec.d.ts +0 -0
  122. /package/dist/{experimental/testing → testing}/__tests__/mocks.useCrmProperties.spec.d.ts +0 -0
  123. /package/dist/{experimental/testing/__tests__/props.spec.d.ts → testing/__tests__/mocks.useExtensionActions.spec.d.ts} +0 -0
  124. /package/dist/{experimental/testing/__tests__/testId.spec.d.ts → testing/__tests__/mocks.useExtensionContext.spec.d.ts} +0 -0
  125. /package/dist/{experimental/testing/__tests__/trigger.spec.d.ts → testing/__tests__/props.spec.d.ts} +0 -0
  126. /package/dist/{experimental/testing/__tests__/type-utils.spec.d.ts → testing/__tests__/testId.spec.d.ts} +0 -0
  127. /package/dist/{experimental/testing/__tests__/waitFor.spec.d.ts → testing/__tests__/trigger.spec.d.ts} +0 -0
  128. /package/dist/{experimental/testing/internal/types-internal.js → testing/__tests__/type-utils.spec.d.ts} +0 -0
  129. /package/dist/{experimental/testing → testing}/index.d.ts +0 -0
  130. /package/dist/{experimental/testing → testing}/index.js +0 -0
  131. /package/dist/{experimental/testing → testing}/internal/constants.d.ts +0 -0
  132. /package/dist/{experimental/testing → testing}/internal/constants.js +0 -0
  133. /package/dist/{experimental/testing → testing}/internal/convert.d.ts +0 -0
  134. /package/dist/{experimental/testing → testing}/internal/debug.d.ts +0 -0
  135. /package/dist/{experimental/testing → testing}/internal/debug.js +0 -0
  136. /package/dist/{experimental/testing → testing}/internal/document.d.ts +0 -0
  137. /package/dist/{experimental/testing → testing}/internal/document.js +0 -0
  138. /package/dist/{experimental/testing → testing}/internal/element.js +0 -0
  139. /package/dist/{experimental/testing → testing}/internal/errors.d.ts +0 -0
  140. /package/dist/{experimental/testing → testing}/internal/fragment.d.ts +0 -0
  141. /package/dist/{experimental/testing → testing}/internal/fragment.js +0 -0
  142. /package/dist/{experimental/testing → testing}/internal/match.js +0 -0
  143. /package/dist/{experimental/testing → testing}/internal/mocks/index.js +0 -0
  144. /package/dist/{experimental/testing → testing}/internal/print.d.ts +0 -0
  145. /package/dist/{experimental/testing → testing}/internal/root.d.ts +0 -0
  146. /package/dist/{experimental/testing → testing}/internal/root.js +0 -0
  147. /package/dist/{experimental/testing → testing}/internal/text.d.ts +0 -0
  148. /package/dist/{experimental/testing → testing}/internal/text.js +0 -0
  149. /package/dist/{experimental/testing → testing}/internal/type-utils-internal.d.ts +0 -0
  150. /package/dist/{experimental/testing → testing}/internal/type-utils-internal.js +0 -0
  151. /package/dist/{experimental/testing → testing}/internal/utils/promise-utils.d.ts +0 -0
  152. /package/dist/{experimental/testing → testing}/internal/utils/promise-utils.js +0 -0
  153. /package/dist/{experimental/testing → testing}/type-utils.d.ts +0 -0
  154. /package/dist/{experimental/testing → testing}/type-utils.js +0 -0
  155. /package/dist/{experimental/testing → testing}/types.js +0 -0
@@ -5,13 +5,11 @@ import { BaseComponentProps } from '../shared.ts';
5
5
  * */
6
6
  export interface BaseSelectProps extends BaseComponentProps {
7
7
  /**
8
- * The text that displays above to the dropdown menu.
9
- *
8
+ * The text that displays above the input.
10
9
  */
11
10
  label?: string;
12
11
  /**
13
- * The unique identifier for the select element.
14
- *
12
+ * The input's unique identifier.
15
13
  */
16
14
  name?: string;
17
15
  /**
@@ -21,19 +19,17 @@ export interface BaseSelectProps extends BaseComponentProps {
21
19
  */
22
20
  required?: boolean;
23
21
  /**
24
- * When set to `true`, sets the field as read-only on the CRM record, and users will not be able to fill the input field.
22
+ * When set to `true`, users will not be able to fill the input field.
25
23
  *
26
24
  * @defaultValue `false`
27
25
  */
28
26
  readOnly?: boolean;
29
27
  /**
30
- * Displayed text that describes the field's purpose.
31
- *
28
+ * Text that describes the field's purpose.
32
29
  */
33
30
  description?: string;
34
31
  /**
35
32
  * The text that displays in a tooltip next to the label.
36
- *
37
33
  */
38
34
  tooltip?: string;
39
35
  /**
@@ -50,12 +46,11 @@ export interface BaseSelectProps extends BaseComponentProps {
50
46
  */
51
47
  error?: boolean;
52
48
  /**
53
- * The text to show if the input has an error.
54
- *
49
+ * The text to display if the input has an error.
55
50
  */
56
51
  validationMessage?: string;
57
52
  /**
58
- * The variant type for the select.
53
+ * The visual style of the button
59
54
  *
60
55
  * @defaultValue `"input"`
61
56
  */
@@ -68,8 +63,7 @@ export interface BaseSelectProps extends BaseComponentProps {
68
63
  */
69
64
  export interface SelectProps extends BaseSelectProps {
70
65
  /**
71
- * The value of the select input.
72
- *
66
+ * The value of the input.
73
67
  */
74
68
  value?: string | number | boolean;
75
69
  /**
@@ -79,21 +73,19 @@ export interface SelectProps extends BaseSelectProps {
79
73
  */
80
74
  onChange?: (value: NonNullable<SelectProps['value']>) => void;
81
75
  /**
82
- * The variant type for the select.
76
+ * The visual style of the button
83
77
  *
84
78
  * @defaultValue `"input"`
85
79
  */
86
80
  variant?: 'transparent' | 'input';
87
81
  /**
88
- * A function that is called and passed the value every time the search field is
89
- * edited by the user. Prefer updating state in onChange as it fires less
90
- * frequently, and if you need to update state here, consider debouncing your function.
82
+ * A callback function that is called and passed the value every time the search field is edited by the user. Prefer updating state in `onChange` as it fires less frequently, and if you need to update state here, consider debouncing your function.
91
83
  *
92
84
  * @event
93
85
  */
94
86
  onInput?: (value: string) => void;
95
87
  /**
96
- * The options to display in the dropdown menu.
88
+ * The options to display in the dropdown menu. `label` will be used as the display text, and `value` should be the option's unique identifier, which is submitted with the form.
97
89
  */
98
90
  options: {
99
91
  /** Will be used as the display text. **/
@@ -109,8 +101,7 @@ export interface SelectProps extends BaseSelectProps {
109
101
  */
110
102
  export interface MultiSelectProps extends BaseSelectProps {
111
103
  /**
112
- * The value of the select input.
113
- *
104
+ * The value of the input.
114
105
  */
115
106
  value?: (string | number | boolean)[];
116
107
  /**
@@ -28,11 +28,11 @@ export interface StatisticsTrendProps extends BaseComponentProps {
28
28
  */
29
29
  export interface StatisticsItemProps extends BaseComponentProps {
30
30
  /**
31
- * The unique identifier.
31
+ * The statistic item's unique identifier.
32
32
  */
33
33
  id?: string;
34
34
  /**
35
- * The item's label text.
35
+ * The item's label.
36
36
  */
37
37
  label: string;
38
38
  /**
@@ -7,15 +7,15 @@ import { BaseComponentProps } from '../shared.ts';
7
7
  */
8
8
  export interface StatusTagProps extends BaseComponentProps {
9
9
  /**
10
- * The status tag's indicator color.
10
+ * The color of the dot indicator.
11
11
  *
12
12
  * @defaultValue `"default"`
13
13
  */
14
14
  variant?: 'danger' | 'warning' | 'info' | 'success' | 'default';
15
15
  /**
16
- * When set to true, the status tag's dot will be a ring instead.
16
+ * When set to `true`, the status tag's dot will be a ring instead of a filled-in circle.
17
17
  *
18
- * @defaultValue `false `
18
+ * @defaultValue `false`
19
19
  */
20
20
  hollow?: boolean;
21
21
  /**
@@ -25,13 +25,13 @@ export interface StatusTagProps extends BaseComponentProps {
25
25
  */
26
26
  onClick?: () => void;
27
27
  /**
28
- * When set to true, the status tag will show a small clickable 'x' icon.
28
+ * When set to `true`, the status tag will include a small, clickable x icon to remove it.
29
29
  *
30
30
  * @defaultValue `false`
31
31
  */
32
32
  showRemoveIcon?: boolean;
33
33
  /**
34
- * A function that will be invoked when the 'x' icon is clicked. It receives no arguments and its return value is ignored.
34
+ * A function that will be invoked when the remove icon is clicked.
35
35
  *
36
36
  * @event
37
37
  */
@@ -22,21 +22,19 @@ export interface StepIndicatorProps extends BaseComponentProps {
22
22
  */
23
23
  circleSize?: AllSizes;
24
24
  /**
25
- * The currently active step. Steps are 0-based.
25
+ * The currently active step. Steps are zero-based, meaning the first step is assigned `0`.
26
26
  */
27
27
  currentStep?: number;
28
28
  /**
29
- * The visual style of the component.
30
- *
31
- * - default: default spacing.
32
- * - compact: only shows the title of the currently active step.
33
- * - flush: only shows the title of the currently active step and removes left and right margins.
29
+ * Sets component spacing.
30
+ * - `compact`: only shows the title of the currently active step.
31
+ * - `flush`: only shows the title of the currently active step and removes left and right margin.
34
32
  *
35
33
  * @defaultValue `"default"`
36
34
  */
37
35
  variant?: 'default' | 'compact' | 'flush';
38
36
  /**
39
- * A function that will be invoked when a step in the indicator is clicked. The function receives the current step index as an argument (zero-based). Use this to update the currently active step.
37
+ * A function that is invoked when a step in the indicator is clicked. The function receives the current step index as an argument (zero-based). Use this to update the currently active step.
40
38
  *
41
39
  * @event
42
40
  */
@@ -1,9 +1,18 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { BaseComponentProps } from '../shared.ts';
3
3
  export interface AlignmentProps {
4
+ /**
5
+ * Sets the alignment of the table element.
6
+ */
4
7
  align?: 'left' | 'center' | 'right';
5
8
  }
6
9
  export interface WidthProps {
10
+ /**
11
+ * Sets the width of the table element.
12
+ * - `min`: the content will only be as wide as required, overflowing if the content is wider than the table. A horizontal scrollbar will appear when there is overflow.
13
+ * - `max`: the content will expand to occupy the maximum available width without overflowing.
14
+ * - `auto`: the content will adjust its width based on the available space without overflowing.
15
+ */
7
16
  width?: 'min' | 'max' | 'auto' | number;
8
17
  }
9
18
  export interface TableElementProps extends BaseComponentProps {
@@ -17,6 +26,9 @@ export interface TableElementProps extends BaseComponentProps {
17
26
  */
18
27
  export type BaseTableHeaderProps = TableElementProps & AlignmentProps & WidthProps & BaseComponentProps;
19
28
  export type TableCellProps = TableElementProps & AlignmentProps & WidthProps & {
29
+ /**
30
+ * Sets the number of columns a cell should span.
31
+ */
20
32
  colSpan?: number;
21
33
  } & BaseComponentProps;
22
34
  /**
@@ -34,21 +46,19 @@ export interface UnSortedTableHeaderProps extends BaseTableHeaderProps {
34
46
  */
35
47
  export interface SortedTableHeaderProps extends BaseTableHeaderProps {
36
48
  /**
37
- * Sets the current direction in which the column is sorted (if any). It's a visual indicator, it doesn't modify the data.
49
+ * Visually indicates with an arrow which way the rows are sorted.
38
50
  *
39
51
  * @defaultValue `"none"`
40
52
  */
41
53
  sortDirection: 'ascending' | 'descending' | 'none';
42
54
  /**
43
- * A callback function that is invoked when the header is clicked. It recieves the new `sortDirection` as an argument.
44
- * It's required when sort = `ascending`, `descending` or `none`.
55
+ * A function that will be invoked when the header is clicked. It receives a `sortDirection` as an argument (cannot be none or a null value).
45
56
  *
46
57
  * @event
47
- * @defaultValue `"none"`
48
58
  */
49
59
  onSortChange: (value: NonNullable<SortedTableHeaderProps['sortDirection']>) => void;
50
60
  /**
51
- * If `true`, users cannot change the sort ordering. It has no effect if sort=`never` or `undefined`.
61
+ * When set to `true`, users cannot change the sort ordering. It has no effect if `sortDirection` is set to `never` or undefined.
52
62
  *
53
63
  * @defaultValue `false`
54
64
  */
@@ -62,13 +72,13 @@ export interface SortedTableHeaderProps extends BaseTableHeaderProps {
62
72
  export type TableHeaderProps = SortedTableHeaderProps | UnSortedTableHeaderProps;
63
73
  interface BaseTableProps extends BaseComponentProps {
64
74
  /**
65
- * When set to false, the table will not have borders.
75
+ * When set to `false`, the table will not include borders.
66
76
  *
67
77
  * @defaultValue `true`
68
78
  */
69
79
  bordered?: boolean;
70
80
  /**
71
- * When set to `true`, the table will not have bottom margin.
81
+ * When set to `true`, the table will not include bottom margin.
72
82
  *
73
83
  * @defaultValue `false`
74
84
  */
@@ -104,27 +114,27 @@ export interface TablePaginatedProps extends BaseTableProps {
104
114
  */
105
115
  pageCount: number;
106
116
  /**
107
- * When set to `false`, hides the text labels for the First/Prev/Next buttons. The button labels will still be accessible to screen readers.
117
+ * When set to `false`, hides the text labels for First/Prev/Next buttons. The button labels will still be accessible to screen readers.
108
118
  *
109
119
  * @defaultValue `true`
110
120
  */
111
121
  showButtonLabels?: boolean;
112
122
  /**
113
- * When set to `true`, displays the **First/Last** page buttons.
123
+ * When set to `true`, displays the First/Last page buttons.
114
124
  *
115
125
  * @defaultValue `false`
116
126
  */
117
127
  showFirstLastButtons?: boolean;
118
128
  /**
119
- * Sets how many page buttons are displayed.
129
+ * The maximum number of page buttons to display.
120
130
  */
121
131
  maxVisiblePageButtons?: number;
122
132
  /**
123
- * Denotes the current page.
133
+ * Denotes the current page number.
124
134
  */
125
135
  page?: number;
126
136
  /**
127
- * A function that will be invoked when the pagination button is clicked. It receives the new page number as argument.
137
+ * A function that is invoked when the page pagination button is clicked. It receives the new page number as an argument.
128
138
  *
129
139
  * @event
130
140
  */
@@ -6,38 +6,38 @@ export interface TabsProps extends BaseComponentProps {
6
6
  */
7
7
  children?: ReactNode;
8
8
  /**
9
- * Callback when the selected tab changes.
9
+ * A function that gets invoked when the selected tab changes.
10
10
  */
11
11
  onSelectedChange?: ((selectedId: string) => void) | ((selectedId: number) => void) | ((selectedId: number | string) => void);
12
12
  /**
13
- * The initially selected tab ID.
13
+ * The ID of the tab to display by default (as set by the `Tab`'s `tabId` prop).
14
14
  */
15
15
  defaultSelected?: string | number;
16
16
  /**
17
- * The currently selected tab ID (controlled component).
17
+ * The currently selected tab ID, for controlling the component via React state.
18
18
  */
19
19
  selected?: string | number;
20
20
  /**
21
- * Visual style variant of the tabs.
21
+ * Visual style of the tabs.
22
22
  * @defaultValue 'default'
23
23
  */
24
24
  variant?: 'default' | 'enclosed';
25
25
  /**
26
- * Whether the tab should fill available space.
26
+ * Whether the tabs should fill the available space.
27
27
  */
28
28
  fill?: boolean;
29
29
  }
30
30
  export interface TabProps extends BaseComponentProps {
31
31
  /**
32
- * Whether the tab is disabled.
32
+ * Whether the tab should be disabled. When set to `false`, tab will be greyed out and not clickable.
33
33
  */
34
34
  disabled?: boolean;
35
35
  /**
36
- * Unique identifier for the tab.
36
+ * The tab's unique identifier.
37
37
  */
38
38
  tabId?: string | number;
39
39
  /**
40
- * The title text of the tab.
40
+ * The tab's title text.
41
41
  */
42
42
  title?: string;
43
43
  /**
@@ -45,11 +45,11 @@ export interface TabProps extends BaseComponentProps {
45
45
  */
46
46
  children?: ReactNode;
47
47
  /**
48
- * The tooltip text of the tab.
48
+ * The text that appears in a tooltip on hover.
49
49
  */
50
50
  tooltip?: string;
51
51
  /**
52
- * The tab's tooltip placement
52
+ * Where the tooltip should appear, relative to the tab.
53
53
  * @defaultValue 'top'
54
54
  */
55
55
  tooltipPlacement?: 'top' | 'bottom' | 'left' | 'right';
@@ -12,13 +12,13 @@ export interface TagProps extends OverlayComponentProps, BaseComponentProps {
12
12
  */
13
13
  children: ReactNode;
14
14
  /**
15
- * The tag's color. The following variants are available.
15
+ * The color of the alert.
16
16
  *
17
17
  * @defaultValue `"default"`
18
18
  */
19
19
  variant?: 'default' | 'warning' | 'success' | 'error' | 'info';
20
20
  /**
21
- * A function that will be invoked when the tag is clicked.
21
+ * A function that will be invoked when the tag is clicked. The function receives no arguments and its return value is ignored.
22
22
  *
23
23
  * @event
24
24
  */
@@ -48,16 +48,13 @@ export interface TruncateOptions {
48
48
  */
49
49
  export type TextProps = {
50
50
  /**
51
- * The style of text to display. Can be either of:
52
- *
53
- * - bodytext: the default value which renders the standard text size.
54
- * - microcopy: smaller text used for adding context.
51
+ * The style of text to display.
55
52
  *
56
53
  * @defaultValue `"bodytext"`
57
54
  */
58
55
  variant?: 'bodytext' | 'microcopy';
59
56
  /**
60
- * When set to `true`, inserts a line break.
57
+ * When set to `true`, will insert text without breaking the line.
61
58
  *
62
59
  * @defaultValue `false`
63
60
  */
@@ -67,26 +64,23 @@ export type TextProps = {
67
64
  */
68
65
  children: ReactNode;
69
66
  /**
70
- * @interface
71
- * The style of text to display. Can be any of:
72
- *
73
- * - { fontWeight: 'bold' }
74
- * - { fontWeight: 'demibold' }
75
- * - { italic: true }
76
- * - { lineDecoration: 'strikethrough' }
77
- * - { lineDecoration: 'underline' }
78
- * - <Text inline={true}>
67
+ * Text formatting options, which include:
68
+ * - `{ fontWeight: 'bold' }`
69
+ * - `{ fontWeight: 'demibold' }`
70
+ * - `{ italic: true }`
71
+ * - `{ lineDecoration: 'strikethrough' }`
72
+ * - `{ lineDecoration: 'underline' }`
73
+ * - `{ textTransform: '...' }` - Controls text capitalization
79
74
  */
80
75
  format?: TextFormatOptions;
81
76
  /**
82
- * @interface
83
- * truncates long strings to a single line. If the full string doesn't fit in one line,
84
- * it's shown in a tooltip on hover.
77
+ * Truncates long strings to a single line. If the full string doesn't fit on one line, the excess text will display in a tooltip on hover.
78
+ * - `false` (default): text is not truncated.
79
+ * - `true`: truncates text to a single line. Full text will display in a tooltip on hover.
85
80
  *
86
- * - `false` => no truncation(default).
87
- * - `true` => truncates the string to a single line. Full-text will show inside the tooltip.
88
- * - { tooltipText: 'some text' } => truncates the string and lets you control the contents of the tooltip.
89
- * - { maxWidth: 150 } => sets the width(in pixel) of the line.
81
+ * Alternatively, set this prop to one of the following objects to specify truncate options:
82
+ * - `{tooltipText: 'string'}`: truncates the string and sets the contents of the tooltip.
83
+ * - `{maxWidth: number}`: sets the width of the line in pixels.
90
84
  *
91
85
  * @defaultValue `false`
92
86
  */
@@ -11,13 +11,13 @@ export interface TileProps extends BaseComponentProps {
11
11
  */
12
12
  children: ReactNode;
13
13
  /**
14
- * When set to `true`, reduces the default amount of padding around the contents of the Tile.
14
+ * When set to `true`, reduces the amount of padding in the tile.
15
15
  *
16
16
  * @defaultValue `false`
17
17
  */
18
18
  compact?: boolean;
19
19
  /**
20
- * When set to `true`, removes left and right padding from tile contents.
20
+ * When set to `true`, removes left and right padding from the tile contents.
21
21
  *
22
22
  * @defaultValue `false`
23
23
  */
@@ -6,55 +6,53 @@ import { TShirtSizes, BaseComponentProps } from '../shared.ts';
6
6
  */
7
7
  export interface ToggleProps extends BaseComponentProps {
8
8
  /**
9
- * The current status of the input.
9
+ * Whether the toggle is selected.
10
10
  */
11
11
  checked?: boolean;
12
12
  /**
13
- * When set to `true`, the option cannot be selected.
13
+ * When set to `true`, users will not be able to select the toggle.
14
14
  */
15
15
  readonly?: boolean;
16
16
  /**
17
- * The unique identifier for the toggle element.
17
+ * The input's unique identifier.
18
18
  */
19
19
  name?: string;
20
20
  /**
21
- * The size variation of the toggle.
21
+ * The size of the toggle. Only `'md'` sized toggles can display text on the toggle (ON, OFF). All other sizes will hide checked/unchecked text.
22
22
  *
23
- * @defaultValue `"medium"`
23
+ * @defaultValue `"md"`
24
24
  */
25
25
  size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'] | 'default';
26
26
  /**
27
- * A function that is called when the `checked` input status changes.
27
+ * A function that is invoked when the toggle is clicked.
28
28
  *
29
29
  * @event
30
30
  */
31
31
  onChange?: (checked: boolean) => void;
32
32
  /**
33
- * When set to `true`, the option will be selected by default. Use it to
34
- * set the default `checked` state when the component is **uncontrolled**.
33
+ * When set to `true`, the toggle will be selected by default. Sets the default `checked` state when the component is uncontrolled.
35
34
  */
36
35
  initialIsChecked?: boolean;
37
36
  /**
38
- * The companion text of for Toggle. It can be displayed on top,
39
- * inline, or hidden. When hidden, it will remain usable for screen readers.
37
+ * The text that displays above the input.
40
38
  */
41
39
  label: string;
42
40
  /**
43
- * Controls the display setting of the label prop.
41
+ * The display option for the toggle label.
44
42
  *
45
43
  * @defaultValue `"inline"`
46
44
  */
47
45
  labelDisplay?: 'inline' | 'top' | 'hidden';
48
46
  /**
49
- * The text that appears on the Toggle when `checked={true}`.
47
+ * The text that displays on the toggle when checked. Extra small and small toggles will not display any text.
50
48
  *
51
49
  * @defaultValue `"ON"`
52
50
  */
53
51
  textChecked?: string;
54
52
  /**
55
- * The text that appears on the Toggle when `checked={false}`.
53
+ * The text that displays on the toggle when not checked. Extra small and small toggles will not display any text.
56
54
  *
57
- * @defaultValue `"ON"`
55
+ * @defaultValue `"OFF"`
58
56
  */
59
57
  textUnchecked?: string;
60
58
  }
@@ -6,53 +6,57 @@ import { BaseComponentProps } from '../shared.ts';
6
6
  */
7
7
  export interface CheckboxProps extends BaseComponentProps {
8
8
  /**
9
- * A string representing the value of the input. This is not displayed on the client-side,
10
- * but on the server this is the value given to the data submitted with the checkbox's name.
9
+ * The checkbox value. This value is not displayed on the card, but is passed on the server side when submitted, along with the checkbox name.
11
10
  */
12
11
  value?: string;
13
12
  /**
14
- * The current status of the input.
13
+ * When set to `true`, the checkbox is selected.
14
+ *
15
+ * @defaultValue `false`
15
16
  */
16
17
  checked?: boolean;
17
18
  /** @deprecated use readOnly instead */
18
19
  readonly?: boolean;
19
20
  /**
20
- * When set to `true`, the option cannot be selected.
21
+ * When set to `true`, the checkbox cannot be selected.
21
22
  */
22
23
  readOnly?: boolean;
23
24
  /**
24
- * The string that displays below the toggle.
25
+ * Text that describes the field's purpose.
25
26
  */
26
27
  description?: string;
27
28
  /**
28
- * The unique identifier for the checkbox element.
29
+ * The checkbox's unique identifier.
29
30
  */
30
31
  name?: string;
31
32
  /**
32
- * The size variation of the checkbox.
33
+ * The size of the checkbox.
33
34
  *
34
35
  * @defaultValue `"default"`
35
36
  */
36
37
  variant?: 'default' | 'small';
37
38
  /**
38
- * A function that is called when the `checked` input status changes.
39
+ * A callback function that is called when the checkbox is selected or cleared. Passes the new value.
39
40
  *
40
41
  * @event
41
42
  */
42
43
  onChange?: (checked: boolean, value: string) => void;
43
- /** The text that displays in the dropdown menu. */
44
+ /** The text that displays next to the checkbox. */
44
45
  children?: React.ReactNode;
45
46
  /**
46
- * Use the inline prop to arrange checkboxes side-by-side.
47
+ * When set to `true`, arranges checkboxes side by side.
48
+ *
49
+ * @defaultValue `false`
47
50
  */
48
51
  inline?: boolean;
49
52
  /**
50
- * When set to `true`, the option will be selected by default. Use it to
51
- * set the default `checked` state when the component is **uncontrolled**.
53
+ * When set to `true`, the checkbox is selected by default.
54
+ *
55
+ * @defaultValue `false`
52
56
  */
53
57
  initialIsChecked?: boolean;
54
58
  /**
55
- * Accessibility label. It should be present when the checkbox has no label(children).
59
+ * The checkbox's accessibility label.
56
60
  */
57
61
  'aria-label'?: string;
58
62
  }
@@ -91,15 +95,15 @@ export interface RadioButtonListProps extends ToggleGroupListBaseProps {
91
95
  type ToggleType = 'checkboxList' | 'radioButtonList';
92
96
  export interface CommonGroupProps extends BaseComponentProps {
93
97
  /**
94
- * Denotes the type of list to render.
98
+ * The type of toggle, whether checkboxes or radio buttons. Radio buttons only allow one option to be selected.
95
99
  */
96
100
  toggleType?: ToggleType;
97
101
  /**
98
- * The unique identifier for the toggle group element.
102
+ * The input's unique identifier.
99
103
  */
100
104
  name: string;
101
105
  /**
102
- * The label that displays above the toggle group.
106
+ * The text that displays above the toggles.
103
107
  */
104
108
  label: string;
105
109
  /**
@@ -117,13 +121,13 @@ export interface CommonGroupProps extends BaseComponentProps {
117
121
  */
118
122
  tooltip?: string;
119
123
  /**
120
- * When set to `true`, `validationMessage` is displayed as an error message if provided. The input will also render its error state to let the user know there is an error. If left false, `validationMessage` is displayed as a success message.
124
+ * When set to `true`, `validationMessage` is displayed as an error message if provided. The input will also render its error state to let the user know there is an error. If left `false`, `validationMessage` is displayed as a success message.
121
125
  *
122
126
  * @defaultValue `false`
123
127
  */
124
128
  error?: boolean;
125
129
  /**
126
- * An array of options to display in the dropdown menu.
130
+ * An array of options to display in the group.
127
131
  *
128
132
  * @defaultValue `[]`
129
133
  */
@@ -135,11 +139,14 @@ export interface CommonGroupProps extends BaseComponentProps {
135
139
  */
136
140
  inline?: boolean;
137
141
  /**
138
- * The size variation of the individual options.
142
+ * The size of the toggle.
139
143
  *
140
144
  * @defaultValue `"default"`
141
145
  */
142
146
  variant?: 'default' | 'small';
147
+ /**
148
+ * The value of the toggle group.
149
+ */
143
150
  value?: string[] | string;
144
151
  }
145
152
  type CheckboxGroupProps = {
@@ -6,7 +6,7 @@ export interface TooltipProps extends BaseComponentProps {
6
6
  */
7
7
  children: ReactNode;
8
8
  /**
9
- * Sets the position of the tooltip relative to its trigger element.
9
+ * The position where the tooltip will be displayed, relative to the parent UI component.
10
10
  * @default 'top'
11
11
  */
12
12
  placement?: 'top' | 'bottom' | 'left' | 'right';