@bspk/ui 1.1.16 → 1.1.18

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 (136) hide show
  1. package/dist/Avatar.d.ts +44 -10
  2. package/dist/Avatar.js +32 -13
  3. package/dist/Avatar.js.map +1 -1
  4. package/dist/AvatarGroup.d.ts +49 -0
  5. package/dist/AvatarGroup.js +18 -0
  6. package/dist/AvatarGroup.js.map +1 -0
  7. package/dist/Badge.js +1 -1
  8. package/dist/Button.d.ts +14 -4
  9. package/dist/Button.js +1 -1
  10. package/dist/Button.js.map +1 -1
  11. package/dist/Checkbox.d.ts +15 -2
  12. package/dist/Checkbox.js.map +1 -1
  13. package/dist/CheckboxGroup.d.ts +6 -3
  14. package/dist/CheckboxGroup.js.map +1 -1
  15. package/dist/CheckboxOption.d.ts +8 -1
  16. package/dist/CheckboxOption.js.map +1 -1
  17. package/dist/Chip.d.ts +3 -1
  18. package/dist/Chip.js.map +1 -1
  19. package/dist/Dialog.d.ts +3 -3
  20. package/dist/Dialog.js.map +1 -1
  21. package/dist/Divider.js +1 -1
  22. package/dist/Dropdown.d.ts +26 -6
  23. package/dist/Dropdown.js +2 -2
  24. package/dist/Dropdown.js.map +1 -1
  25. package/dist/ListItem.js +1 -1
  26. package/dist/Menu.d.ts +27 -15
  27. package/dist/Menu.js +1 -1
  28. package/dist/Menu.js.map +1 -1
  29. package/dist/NumberInput.d.ts +5 -1
  30. package/dist/NumberInput.js +7 -5
  31. package/dist/NumberInput.js.map +1 -1
  32. package/dist/Portal.d.ts +5 -1
  33. package/dist/Portal.js.map +1 -1
  34. package/dist/ProgressBar.d.ts +4 -0
  35. package/dist/ProgressBar.js.map +1 -1
  36. package/dist/ProgressionStepper.d.ts +9 -2
  37. package/dist/ProgressionStepper.js +1 -1
  38. package/dist/ProgressionStepper.js.map +1 -1
  39. package/dist/ProgressionStepperBar.d.ts +6 -0
  40. package/dist/ProgressionStepperBar.js.map +1 -1
  41. package/dist/Radio.d.ts +16 -2
  42. package/dist/Radio.js +2 -2
  43. package/dist/Radio.js.map +1 -1
  44. package/dist/RadioGroup.d.ts +26 -3
  45. package/dist/RadioGroup.js +3 -3
  46. package/dist/RadioGroup.js.map +1 -1
  47. package/dist/RadioOption.d.ts +9 -1
  48. package/dist/RadioOption.js.map +1 -1
  49. package/dist/SegmentedControl.d.ts +21 -2
  50. package/dist/SegmentedControl.js +1 -1
  51. package/dist/SegmentedControl.js.map +1 -1
  52. package/dist/Switch.d.ts +1 -1
  53. package/dist/SwitchGroup.d.ts +13 -6
  54. package/dist/SwitchGroup.js +1 -1
  55. package/dist/SwitchGroup.js.map +1 -1
  56. package/dist/TabGroup.d.ts +23 -5
  57. package/dist/TabGroup.js +1 -1
  58. package/dist/TabGroup.js.map +1 -1
  59. package/dist/Tag.d.ts +5 -2
  60. package/dist/Tag.js +1 -1
  61. package/dist/Tag.js.map +1 -1
  62. package/dist/TextInput.d.ts +15 -6
  63. package/dist/TextInput.js +11 -5
  64. package/dist/TextInput.js.map +1 -1
  65. package/dist/Textarea.d.ts +3 -3
  66. package/dist/avatar-group.css +1 -0
  67. package/dist/avatar.css +1 -1
  68. package/dist/badge.css +1 -1
  69. package/dist/button.css +1 -1
  70. package/dist/demo/ExampleModalRender.d.ts +7 -0
  71. package/dist/demo/ExampleModalRender.js +16 -0
  72. package/dist/demo/ExampleModalRender.js.map +1 -0
  73. package/dist/demo/ExamplePlaceholder.d.ts +7 -0
  74. package/dist/demo/ExamplePlaceholder.js +13 -0
  75. package/dist/demo/ExamplePlaceholder.js.map +1 -0
  76. package/dist/demo/examples.d.ts +101 -0
  77. package/dist/demo/examples.js +472 -0
  78. package/dist/demo/examples.js.map +1 -0
  79. package/dist/divider.css +1 -1
  80. package/dist/hooks/useOptionIconsInvalid.d.ts +10 -1
  81. package/dist/hooks/useOptionIconsInvalid.js.map +1 -1
  82. package/dist/index.d.ts +4 -26
  83. package/dist/index.js.map +1 -1
  84. package/dist/list-item.css +1 -1
  85. package/dist/menu.css +1 -1
  86. package/dist/segmented-control.css +1 -1
  87. package/dist/tab-group.css +1 -1
  88. package/dist/tag.css +1 -1
  89. package/dist/text-input.css +1 -1
  90. package/dist/utils/children.js.map +1 -1
  91. package/meta-types.ts +2 -0
  92. package/meta.ts +76 -42
  93. package/package.json +1 -1
  94. package/src/Avatar.tsx +80 -27
  95. package/src/AvatarGroup.tsx +71 -0
  96. package/src/Button.tsx +14 -4
  97. package/src/Checkbox.tsx +25 -11
  98. package/src/CheckboxGroup.tsx +6 -3
  99. package/src/CheckboxOption.tsx +9 -2
  100. package/src/Chip.tsx +3 -1
  101. package/src/Dialog.tsx +3 -3
  102. package/src/Dropdown.tsx +30 -10
  103. package/src/Menu.tsx +30 -18
  104. package/src/NumberInput.tsx +15 -6
  105. package/src/Portal.tsx +5 -1
  106. package/src/ProgressBar.tsx +4 -0
  107. package/src/ProgressionStepper.tsx +9 -2
  108. package/src/ProgressionStepperBar.tsx +6 -0
  109. package/src/Radio.tsx +21 -4
  110. package/src/RadioGroup.tsx +34 -6
  111. package/src/RadioOption.tsx +11 -2
  112. package/src/SegmentedControl.tsx +21 -2
  113. package/src/Switch.tsx +1 -1
  114. package/src/SwitchGroup.tsx +19 -7
  115. package/src/TabGroup.tsx +23 -5
  116. package/src/Tag.tsx +5 -2
  117. package/src/TextInput.tsx +25 -15
  118. package/src/Textarea.tsx +3 -3
  119. package/src/avatar-group.scss +17 -0
  120. package/src/avatar.scss +5 -2
  121. package/src/badge.scss +1 -0
  122. package/src/button.scss +1 -0
  123. package/src/demo/ExampleModalRender.tsx +37 -0
  124. package/src/demo/ExamplePlaceholder.tsx +40 -0
  125. package/src/demo/examples.tsx +683 -0
  126. package/src/divider.scss +2 -0
  127. package/src/dropdown.scss +1 -0
  128. package/src/hooks/useOptionIconsInvalid.ts +10 -1
  129. package/src/index.ts +5 -32
  130. package/src/list-item.scss +5 -1
  131. package/src/menu.scss +1 -1
  132. package/src/segmented-control.scss +1 -0
  133. package/src/tab-group.scss +1 -0
  134. package/src/tag.scss +1 -0
  135. package/src/text-input.scss +13 -18
  136. package/src/utils/children.ts +1 -1
@@ -1 +1 @@
1
- [data-bspk=text-input]{--border-color: var(--stroke-neutral-base);display:flex;flex-flow:row nowrap;background-color:var(--surface-neutral-t1-base);border:solid 1px var(--border-color);height:var(--field-height);border-radius:var(--radius-small);padding:0 var(--field-padding);gap:var(--spacing-sizing-01);width:100%}[data-bspk=text-input]>*{display:flex;justify-content:center;align-items:center;height:var(--field-height);font:var(--field-font);color:var(--foreground-neutral-on-surface);min-width:0}[data-bspk=text-input]:hover:not(:focus-within){background:linear-gradient(var(--interactions-hover-opacity), var(--interactions-hover-opacity)),linear-gradient(var(--surface-neutral-t1-base), var(--surface-neutral-t1-base))}[data-bspk=text-input]:active:not(:focus-within){background:linear-gradient(var(--interactions-press-opacity), var(--interactions-press-opacity)),linear-gradient(var(--surface-neutral-t1-base), var(--surface-neutral-t1-base))}[data-bspk=text-input][data-readonly]{--border-color: var(--stroke-neutral-disabled-light);background:linear-gradient(var(--interactions-disabled-opacity), var(--interactions-disabled-opacity)),linear-gradient(var(--surface-neutral-t1-base), var(--surface-neutral-t1-base))}[data-bspk=text-input][data-disabled]{--border-color: var(--stroke-neutral-disabled-light);background:linear-gradient(var(--interactions-disabled-opacity), var(--interactions-disabled-opacity)),linear-gradient(var(--surface-neutral-t1-base), var(--surface-neutral-t1-base))}[data-bspk=text-input][data-disabled]>*{color:var(--foreground-neutral-disabled-on-surface)}[data-bspk=text-input][data-invalid]{--border-color: var(--status-error)}[data-bspk=text-input][data-size=small]{--field-padding: var(--spacing-sizing-02);--field-height: var(--spacing-sizing-08);--field-font: var(--body-small);--field-icon-width: var(--spacing-sizing-04);--field-clear-width: var(--spacing-sizing-05)}[data-bspk=text-input][data-size=medium]{--field-padding: var(--spacing-sizing-03);--field-height: var(--spacing-sizing-10);--field-font: var(--body-base);--field-icon-width: var(--spacing-sizing-05);--field-clear-width: var(--spacing-sizing-05)}[data-bspk=text-input][data-size=large]{--field-padding: var(--spacing-sizing-03);--field-height: var(--spacing-sizing-12);--field-font: var(--body-large);--field-icon-width: var(--spacing-sizing-06);--field-clear-width: var(--spacing-sizing-06)}[data-bspk=text-input] [data-leading] svg,[data-bspk=text-input] [data-trailing] svg{width:var(--field-icon-width)}[data-bspk=text-input] label{font:var(--labels-small);color:var(--foreground-neutral-on-surface-variant-01)}[data-bspk=text-input] input{flex:1;background-color:rgba(0,0,0,0) !important;border:none;outline:none;padding:0;pointer-events:all;text-overflow:ellipsis}[data-bspk=text-input] input[type=number]::-webkit-inner-spin-button,[data-bspk=text-input] input[type=number]::-webkit-outer-spin-button{display:none}[data-bspk=text-input] button[data-clear]{display:none;border:none;background:none;padding:0;cursor:pointer;pointer-events:all;margin-left:var(--spacing-sizing-02);padding-right:var(--field-padding)}[data-bspk=text-input] button[data-clear] svg{pointer-events:none;width:var(--field-clear-width)}[data-bspk=text-input]:focus-within{--border-color: var(--stroke-brand-primary)}[data-bspk=text-input]:focus-within button[data-clear]{display:flex}[data-bspk=text-input]:has(button[data-clear]){padding-right:0}
1
+ [data-bspk=text-input]{--border-color: var(--stroke-neutral-base);display:flex;flex-flow:row nowrap;background-color:var(--surface-neutral-t1-base);border:solid 1px var(--border-color);height:var(--field-height);border-radius:var(--radius-small);padding:0 0 0 var(--field-padding);gap:var(--spacing-sizing-01);width:100%}[data-bspk=text-input]>*{display:flex;justify-content:center;align-items:center;height:var(--field-height);font:var(--field-font);color:var(--foreground-neutral-on-surface);min-width:0}[data-bspk=text-input]:hover:not(:focus-within){background:linear-gradient(var(--interactions-hover-opacity), var(--interactions-hover-opacity)),linear-gradient(var(--surface-neutral-t1-base), var(--surface-neutral-t1-base))}[data-bspk=text-input]:active:not(:focus-within){background:linear-gradient(var(--interactions-press-opacity), var(--interactions-press-opacity)),linear-gradient(var(--surface-neutral-t1-base), var(--surface-neutral-t1-base))}[data-bspk=text-input][data-readonly]{--border-color: var(--stroke-neutral-disabled-light);background:linear-gradient(var(--interactions-disabled-opacity), var(--interactions-disabled-opacity)),linear-gradient(var(--surface-neutral-t1-base), var(--surface-neutral-t1-base))}[data-bspk=text-input][data-disabled]{--border-color: var(--stroke-neutral-disabled-light);background:linear-gradient(var(--interactions-disabled-opacity), var(--interactions-disabled-opacity)),linear-gradient(var(--surface-neutral-t1-base), var(--surface-neutral-t1-base))}[data-bspk=text-input][data-disabled]>*{color:var(--foreground-neutral-disabled-on-surface)}[data-bspk=text-input][data-invalid]{--border-color: var(--status-error)}[data-bspk=text-input][data-size=small]{--field-padding: var(--spacing-sizing-02);--field-height: var(--spacing-sizing-08);--field-font: var(--body-small);--field-icon-width: var(--spacing-sizing-04);--field-clear-width: var(--spacing-sizing-05)}[data-bspk=text-input][data-size=medium]{--field-padding: var(--spacing-sizing-03);--field-height: var(--spacing-sizing-10);--field-font: var(--body-base);--field-icon-width: var(--spacing-sizing-05);--field-clear-width: var(--spacing-sizing-05)}[data-bspk=text-input][data-size=large]{--field-padding: var(--spacing-sizing-03);--field-height: var(--spacing-sizing-12);--field-font: var(--body-large);--field-icon-width: var(--spacing-sizing-06);--field-clear-width: var(--spacing-sizing-06)}[data-bspk=text-input] [data-leading] svg,[data-bspk=text-input] [data-trailing] svg{width:var(--field-icon-width)}[data-bspk=text-input] label{font:var(--labels-small);color:var(--foreground-neutral-on-surface-variant-01)}[data-bspk=text-input] input{flex:1;background-color:rgba(0,0,0,0) !important;border:none;outline:none;padding:0;pointer-events:all;text-overflow:ellipsis}[data-bspk=text-input] input[type=number]::-webkit-inner-spin-button,[data-bspk=text-input] input[type=number]::-webkit-outer-spin-button{display:none}[data-bspk=text-input] button[data-clear]{display:flex;border:none;background:none;padding:0;cursor:pointer;pointer-events:all;margin-left:var(--spacing-sizing-02);padding-right:var(--field-padding)}[data-bspk=text-input] button[data-clear] svg{pointer-events:none;width:var(--field-clear-width)}[data-bspk=text-input]:not(:focus-within),[data-bspk=text-input][data-empty],[data-bspk=text-input][data-readonly],[data-bspk=text-input][data-disabled]{padding-right:var(--field-padding)}[data-bspk=text-input]:not(:focus-within) button[data-clear],[data-bspk=text-input][data-empty] button[data-clear],[data-bspk=text-input][data-readonly] button[data-clear],[data-bspk=text-input][data-disabled] button[data-clear]{display:none}[data-bspk=text-input]:focus-within{--border-color: var(--stroke-brand-primary)}
@@ -1 +1 @@
1
- {"version":3,"file":"children.js","sourceRoot":"","sources":["../../src/utils/children.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvE,MAAM,UAAU,WAAW,CAAC,KAAc;IACtC,OAAO,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACvC,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;IAC/B,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IACpF,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAK,CAAC,IAA8B,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;AAChG,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC3C,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;IAE/B,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IAEpF,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KA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SAClE,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QACd,OAAO,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,CAAC;IACtF,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,sDAAsD"}
package/meta-types.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * This file is used to build the meta types for the project. It's used in the build-meta.ts file and also copied in to
3
3
  * the meta output file.
4
4
  */
5
+
5
6
  export type BaseMeta = {
6
7
  name: string;
7
8
  description?: string;
@@ -27,6 +28,7 @@ export type TypeProperty = {
27
28
  references?: string[];
28
29
  minimum?: number;
29
30
  maximum?: number;
31
+ example?: string;
30
32
  };
31
33
 
32
34
  export type ComponentMeta = BaseMeta & {
package/meta.ts CHANGED
@@ -19,6 +19,12 @@ import { ComponentMeta, TypeProperty, UtilityMeta, TypeMeta } from './meta-types
19
19
  const __filename = fileURLToPath(import.meta.url);
20
20
  const __dirname = dirname(__filename);
21
21
 
22
+ const { componentsDir, hooksDir, rootPath } = {
23
+ componentsDir: path.resolve(__dirname, 'src'),
24
+ hooksDir: path.resolve(__dirname, 'src', 'hooks'),
25
+ rootPath: path.resolve(__dirname),
26
+ } as const;
27
+
22
28
  function jsDocParse(content: string) {
23
29
  try {
24
30
  const contentTrimmed = content
@@ -43,7 +49,8 @@ function jsDocParse(content: string) {
43
49
  data[key] = value
44
50
  .replace(/\n[ ]+\*([ ]*)/g, '\n')
45
51
  .replace(/^\s+\*\s+/, '')
46
- .trim();
52
+ .trim()
53
+ .replace(/;$/, '');
47
54
 
48
55
  return;
49
56
  }
@@ -101,34 +108,34 @@ if (!metaFilePath) {
101
108
  process.exit(1);
102
109
  }
103
110
 
104
- const { componentsDir, hooksDir, rootPath } = {
105
- componentsDir: path.resolve(__dirname, 'src'),
106
- hooksDir: path.resolve(__dirname, 'src', 'hooks'),
107
- rootPath: path.resolve(__dirname),
108
- } as const;
109
-
110
111
  const componentFiles = fs
111
112
  .readdirSync(componentsDir)
112
113
  .filter((f) => f.endsWith('.tsx'))
113
114
  .map((fileName) => {
114
115
  const filePath = path.resolve(componentsDir, fileName);
116
+ const content = fs.readFileSync(filePath, 'utf-8');
115
117
  return {
116
118
  filePath,
117
119
  name: fileName.replace(/\.[^.]+$/, ''),
118
120
  fileName,
119
- content: fs.readFileSync(filePath, 'utf-8'),
121
+ content,
122
+ // eslint-disable-next-line no-useless-escape
123
+ jsDocs: content.match(/\/\*\*\s*\n([^\*]|(\*(?!\/)))*\*\//g)?.map((jsDoc) => jsDocParse(jsDoc)),
120
124
  };
121
125
  });
122
126
 
127
+ type ComponentFile = (typeof componentFiles)[0];
128
+
129
+ fs.writeFileSync(path.resolve(__dirname, 'component-files.json'), JSON.stringify(componentFiles, null, 2), {
130
+ encoding: 'utf-8',
131
+ });
132
+
123
133
  function generateComponentMeta({
124
134
  filePath: componentFile,
125
135
  content,
126
136
  name,
127
- }: {
128
- filePath: string;
129
- content: string;
130
- name: string;
131
- }): ComponentMeta | null {
137
+ jsDocs,
138
+ }: ComponentFile): ComponentMeta | null {
132
139
  const stats = fs.statSync(componentFile);
133
140
 
134
141
  const componentFunctionMatch = content.match(new RegExp(`function ${name}[(<]`));
@@ -142,18 +149,13 @@ function generateComponentMeta({
142
149
  return null;
143
150
  }
144
151
 
145
- // eslint-disable-next-line no-useless-escape
146
- const allJSDocMatches = content.match(/\/\*\*\s*\n([^\*]|(\*(?!\/)))*\*\//g);
147
-
148
- const componentDocStr = [...(allJSDocMatches || [])].find((doc) => doc.includes(`@name ${name}`));
152
+ const componentDoc = [...(jsDocs || [])].find((doc) => doc.name === name);
149
153
 
150
- if (!componentDocStr) {
154
+ if (!componentDoc) {
151
155
  console.warn(`No JSDoc found for component ${name} for ${componentFile}`);
152
156
  return null;
153
157
  }
154
158
 
155
- const componentDoc = jsDocParse(componentDocStr);
156
-
157
159
  const slug = kebabCase(componentDoc.name);
158
160
 
159
161
  const dependencies = [...content.matchAll(/import { ([^}]+) } from '\.\/([a-zA-Z]+)';/g)]
@@ -257,11 +259,9 @@ function generateTypes() {
257
259
  noExtraProps: false,
258
260
  })!;
259
261
 
260
- const symbols = generator.getSchemaForSymbols(generator.getMainFileSymbols(program), true);
262
+ const { definitions } = generator.getSchemaForSymbols(generator.getMainFileSymbols(program), true);
261
263
 
262
- const definitions = symbols.definitions as {
263
- [key: string]: TJS.Definition;
264
- };
264
+ fs.writeFileSync(path.resolve(__dirname, 'types.json'), JSON.stringify(definitions, null, 2));
265
265
 
266
266
  const nextTypes: TypeMeta[] = [];
267
267
 
@@ -283,26 +283,42 @@ function generateTypes() {
283
283
 
284
284
  const defineProperty = (
285
285
  name: string,
286
- definition: TJS.DefinitionOrBoolean,
287
- required?: string[],
286
+ definition: TJS.Definition,
287
+ required: string[],
288
+ context: {
289
+ componentFile: ComponentFile | null;
290
+ parent: string;
291
+ },
288
292
  ): TypeProperty | undefined => {
289
- if (typeof definition !== 'object') return undefined;
293
+ // the auto-generated types aren't always correct, so we need to fix them
294
+ const jsDoc = definition.description
295
+ ? context.componentFile?.jsDocs?.find(
296
+ (doc) =>
297
+ doc.description.includes(definition.description!) ||
298
+ definition.description!.includes(doc.description),
299
+ )
300
+ : undefined;
290
301
 
291
302
  const next: TypeProperty = {
292
303
  name,
293
304
  required: required?.includes(name),
294
- description: definition.description,
305
+ description: jsDoc?.description || definition.description,
295
306
  default: definition.default === 'undefined' ? undefined : definition.default,
296
- type: definition.type,
307
+ type: definition.type?.toString(),
297
308
  properties:
298
309
  definition.properties &&
299
- Object.entries(definition.properties)?.flatMap(
300
- ([name2, definition2]) => defineProperty(name2, definition2, definition.required) || [],
310
+ Object.entries(definition.properties)?.flatMap(([name2, definition2]) =>
311
+ typeof definition2 === 'boolean'
312
+ ? []
313
+ : defineProperty(name2, definition2, definition.required || [], context) || [],
301
314
  ),
302
315
  minimum: definition.minimum,
303
316
  maximum: definition.maximum,
317
+ example: jsDoc?.example,
304
318
  };
305
319
 
320
+ if (next.name.match(/^on[A-Z]/)) next.type = 'function';
321
+
306
322
  const defEnum = cleanUpDefinitionEnums(definition);
307
323
 
308
324
  if (defEnum) {
@@ -313,8 +329,8 @@ function generateTypes() {
313
329
  if (definition.$ref) {
314
330
  next.type = definition.$ref.split('/').pop() as string;
315
331
 
316
- if (definitions[next.type]) {
317
- next.options = cleanUpDefinitionEnums(definitions[next.type]);
332
+ if (definitions && definitions[next.type] && typeof definitions[next.type] !== 'boolean') {
333
+ next.options = cleanUpDefinitionEnums(definitions[next.type] as TJS.Definition);
318
334
  }
319
335
  }
320
336
 
@@ -325,6 +341,15 @@ function generateTypes() {
325
341
  Object.entries(definitions).forEach(([definitionName, definition]) => {
326
342
  if (typeof definition !== 'object') return;
327
343
 
344
+ let componentFile: ComponentFile | null = null;
345
+ // only care about ComponentProps
346
+ if (definitionName.endsWith('Props')) {
347
+ componentFile =
348
+ componentFiles.find((f) => f.fileName === `${definitionName.replace(/Props$/, '')}.tsx`) || null;
349
+ }
350
+
351
+ const context = { componentFile, parent: definitionName };
352
+
328
353
  if (!definition?.properties && !definition?.allOf) return;
329
354
 
330
355
  if (['React', 'Omit<'].some((n) => definitionName.startsWith(n))) return;
@@ -336,9 +361,10 @@ function generateTypes() {
336
361
  if (typeof ofDefinition !== 'object') return [];
337
362
 
338
363
  if (ofDefinition.properties) {
339
- return Object.entries(ofDefinition.properties).flatMap(
340
- ([refName, refDefinition]) =>
341
- defineProperty(refName, refDefinition, ofDefinition.required) || [],
364
+ return Object.entries(ofDefinition.properties).flatMap(([refName, refDefinition]) =>
365
+ typeof refDefinition !== 'object'
366
+ ? []
367
+ : defineProperty(refName, refDefinition, ofDefinition.required || [], context) || [],
342
368
  );
343
369
  }
344
370
 
@@ -348,12 +374,13 @@ function generateTypes() {
348
374
 
349
375
  const defReference = definitions[reference];
350
376
 
351
- if (!defReference) return [];
377
+ if (typeof defReference === 'boolean') return [];
352
378
 
353
- return Object.entries(defReference.properties || {}).flatMap(
354
- ([refName, refDefinition]) =>
355
- defineProperty(refName, refDefinition, defReference.required) || [],
356
- );
379
+ return Object.entries(defReference.properties || {}).flatMap(([refName, refDefinition]) => {
380
+ return typeof refDefinition !== 'object'
381
+ ? []
382
+ : defineProperty(refName, refDefinition, defReference.required || [], context) || [];
383
+ });
357
384
  });
358
385
  }
359
386
 
@@ -366,7 +393,7 @@ function generateTypes() {
366
393
  return;
367
394
  }
368
395
  properties = Object.entries(props).flatMap(
369
- ([propName, prop]) => defineProperty(propName, prop, definition.required) || [],
396
+ ([propName, prop]) => defineProperty(propName, prop, definition.required || [], context) || [],
370
397
  );
371
398
  }
372
399
 
@@ -432,11 +459,16 @@ async function createMeta() {
432
459
  const typesMeta = generateTypes();
433
460
  typesMeta.sort((a, b) => a.name.localeCompare(b.name));
434
461
 
462
+ const componentImport = (name: string) =>
463
+ `${name}: React.lazy(() => import('@bspk/ui/${name}').then((module) => ({ default: module.${name} })))`;
464
+
435
465
  fs.writeFileSync(
436
466
  metaFilePath,
437
467
  [
438
468
  `/** This file is generated by the @bspk/ui/meta.ts script with data scraped from the library. */`,
439
469
 
470
+ `import React from 'react';`,
471
+
440
472
  fs.readFileSync(path.resolve(__dirname, 'meta-types.ts'), { encoding: 'utf-8' }),
441
473
 
442
474
  `export const componentsMeta: ComponentMeta[] = ${JSON.stringify(componentsMeta, null, 2)} as const;`,
@@ -448,6 +480,8 @@ async function createMeta() {
448
480
  `export type MetaTypeName = '${typesMeta.map((t) => t.name).join("' | '")}';`,
449
481
 
450
482
  `export type MetaComponentName = '${metaComponentNames.join("' | '")}';`,
483
+
484
+ `export const components: Partial<Record<MetaComponentName, React.LazyExoticComponent<any>>> = {${metaComponentNames.map(componentImport).join(',')}\n};`,
451
485
  ].join('\n\n'),
452
486
  );
453
487
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bspk/ui",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "license": "CC-BY-4.0",
5
5
  "type": "module",
6
6
  "files": [
package/src/Avatar.tsx CHANGED
@@ -1,9 +1,15 @@
1
1
  import './avatar.scss';
2
2
  import { ReactNode, useMemo } from 'react';
3
3
 
4
+ import { Tooltip } from './Tooltip';
5
+ import { isValidIcon } from './utils/children';
4
6
  import { ColorVariant } from './utils/colorVariants';
5
7
 
6
- import { CommonProps } from '.';
8
+ const DEFAULT = {
9
+ size: 'small',
10
+ color: 'grey',
11
+ showTooltip: true,
12
+ } as const;
7
13
 
8
14
  export type SizeVariant =
9
15
  | 'large'
@@ -16,7 +22,16 @@ export type SizeVariant =
16
22
  | 'xxxx-large'
17
23
  | 'xxxxx-large';
18
24
 
19
- export type AvatarProps = CommonProps<'aria-label'> & {
25
+ export type AvatarProps = {
26
+ /**
27
+ * The name of the person or entity represented by the avatar. This is used for accessibility purposes.
28
+ *
29
+ * @example
30
+ * Jane Doe
31
+ *
32
+ * @required
33
+ */
34
+ name: string;
20
35
  /**
21
36
  * The size of the avatar.
22
37
  *
@@ -29,48 +44,86 @@ export type AvatarProps = CommonProps<'aria-label'> & {
29
44
  * @default grey
30
45
  */
31
46
  color?: ColorVariant;
32
- /** The initials to display in the avatar limited to 2 characters. */
47
+ /**
48
+ * The initials to display in the avatar limited to 2 characters.
49
+ *
50
+ * If not provided, the first two letters of the name will be used as initials.
51
+ *
52
+ * @example
53
+ * JD;
54
+ */
33
55
  initials?: string;
34
- /** The icon to display in the avatar. */
56
+ /**
57
+ * The icon to display in the avatar. This needs to be an icon from the @bspk/icons library.
58
+ *
59
+ * @example
60
+ * <SvgPerson />;
61
+ *
62
+ * @type BspkIcon
63
+ */
35
64
  icon?: ReactNode;
36
- /** The url to the image to display in the avatar. */
65
+ /**
66
+ * The url to the image to display in the avatar.
67
+ *
68
+ * @example
69
+ * /profile.jpg
70
+ */
37
71
  image?: string;
38
- /** The number of notifications not displayed in a list. */
39
- overflowCount?: number;
72
+ /**
73
+ * Whether to show the represeneetd user's name as a tooltip.
74
+ *
75
+ * @default true
76
+ */
77
+ showTooltip?: boolean;
40
78
  };
41
79
 
42
80
  /**
43
- * An avatar is a visual representation of a user or entity. It can be used to display an initials, icon, image, or an
44
- * overflowCount.
81
+ * An avatar is a visual representation of a user or entity. It can be used to display an initials, icon, image.
82
+ *
83
+ * The image if provided is displayed first, followed by the icon if provided, and finally the initials.
84
+ *
85
+ * If no initials are provided, the first two letters of the name will be used as initials.
45
86
  *
46
87
  * @name Avatar
47
88
  */
48
89
  function Avatar({
49
- initials,
50
- color = 'grey',
51
- size = 'small',
90
+ initials: initialsProp,
91
+ color = DEFAULT.color,
92
+ size = DEFAULT.size,
52
93
  icon,
53
94
  image,
54
- 'aria-label': ariaLabel,
55
- overflowCount,
95
+ name: ariaLabel,
96
+ showTooltip = DEFAULT.showTooltip,
56
97
  }: AvatarProps) {
57
98
  const children = useMemo(() => {
58
- if (initials) return <span data-initials>{initials}</span>;
59
- if (icon) return <span data-icon>{icon}</span>;
60
99
  if (image) return <img alt={ariaLabel} src={image} />;
61
- if (overflowCount) return <span data-overflow-count>+{overflowCount}</span>;
100
+
101
+ if (isValidIcon(icon)) return <span data-icon>{icon}</span>;
102
+
103
+ let initials = initialsProp;
104
+
105
+ if (ariaLabel && !initials)
106
+ initials = ariaLabel
107
+ .split(' ')
108
+ .map((word) => word.charAt(0))
109
+ .slice(0, 2)
110
+ .join('')
111
+ .toUpperCase();
112
+
113
+ if (initials) return <span data-initials>{initials.slice(0, 2)}</span>;
114
+
62
115
  return null;
63
- }, [ariaLabel, icon, image, initials, overflowCount]);
64
-
65
- return (
66
- <>
67
- {children && (
68
- <div aria-label={ariaLabel} data-bspk="avatar" data-color={color} data-size={size}>
69
- {children}
70
- </div>
71
- )}
72
- </>
116
+ }, [ariaLabel, icon, image, initialsProp]);
117
+
118
+ if (!children) return null;
119
+
120
+ const avatar = (
121
+ <div aria-label={ariaLabel} data-bspk="avatar" data-color={color} data-size={size}>
122
+ {children}
123
+ </div>
73
124
  );
125
+
126
+ return showTooltip ? <Tooltip label={ariaLabel}>{avatar}</Tooltip> : avatar;
74
127
  }
75
128
 
76
129
  Avatar.bspkName = 'Avatar';
@@ -0,0 +1,71 @@
1
+ import { Avatar, AvatarProps, SizeVariant } from './Avatar';
2
+ import './avatar-group.scss';
3
+
4
+ export type AvatarItem = Pick<AvatarProps, 'color' | 'icon' | 'image' | 'initials' | 'name'>;
5
+
6
+ export type AvatarGroupProps = {
7
+ /**
8
+ * The avatars to display in the group.
9
+ *
10
+ * @example
11
+ * [
12
+ * { name: 'Jane Doe', image: '/path/to/image.jpg' },
13
+ * { name: 'John Smith', initials: 'JS' },
14
+ * ];
15
+ *
16
+ * @type Array<AvatarItem>
17
+ * @required
18
+ */
19
+ items: AvatarItem[];
20
+ /**
21
+ * Size of the avatar group.
22
+ *
23
+ * @default small
24
+ */
25
+ size?: Extract<SizeVariant, 'large' | 'medium' | 'small' | 'x-small'>;
26
+ /**
27
+ * The maximum number of avatars to display before showing the overflowCount.
28
+ *
29
+ * This is used to limit the number of avatars displayed in the group.
30
+ *
31
+ * @minimum 3
32
+ * @maximum 5
33
+ */
34
+ max?: number;
35
+ /**
36
+ * The variant of the avatar group.
37
+ *
38
+ * @default spread
39
+ */
40
+ variant?: 'spread' | 'stacked';
41
+ };
42
+
43
+ /**
44
+ * AvatarGroup component displays a group of avatars.
45
+ *
46
+ * @name AvatarGroup
47
+ */
48
+ function AvatarGroup({ items, size = 'small', max = 5, variant }: AvatarGroupProps) {
49
+ if (!Array.isArray(items) || !items?.length) return null;
50
+
51
+ const overFlowCount = items.length - max;
52
+
53
+ return (
54
+ <div data-bspk="avatar-group" data-max={max} data-size={size} data-variant={variant}>
55
+ <div data-wrap>
56
+ {items.map((item, index) => (
57
+ <Avatar key={index} {...item} size={size} />
58
+ ))}
59
+ {overFlowCount > 0 && (
60
+ <div aria-hidden data-bspk="avatar" data-size={size}>
61
+ <span data-overflow-count>+{overFlowCount}</span>
62
+ </div>
63
+ )}
64
+ </div>
65
+ </div>
66
+ );
67
+ }
68
+
69
+ AvatarGroup.bspkName = 'AvatarGroup';
70
+
71
+ export { AvatarGroup };
package/src/Button.tsx CHANGED
@@ -9,10 +9,18 @@ import { ButtonSize, CommonProps, ElementProps } from './';
9
9
 
10
10
  export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
11
11
 
12
- export type ButtonProps<As extends ElementType = 'button'> = CommonProps<'disabled' | 'onClick'> & {
13
- /** The label of the button. */
14
- label?: string;
15
- /** The icon of the button. */
12
+ export type ButtonProps<As extends ElementType = 'button'> = CommonProps<'disabled'> & {
13
+ /**
14
+ * The label of the button.
15
+ *
16
+ * @required
17
+ */
18
+ label: string;
19
+ /**
20
+ * The icon of the button.
21
+ *
22
+ * @type BspkIcon
23
+ */
16
24
  icon?: ReactNode;
17
25
  /**
18
26
  * Shows the button label. When label isn't showing it is used in a tooltip and as the aria-label prop.
@@ -59,6 +67,8 @@ export type ButtonProps<As extends ElementType = 'button'> = CommonProps<'disabl
59
67
  children?: ReactNode;
60
68
  /** The tool tip text that appears when hovered. */
61
69
  toolTip?: string;
70
+ /** The function to call when the button is clicked. */
71
+ onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
62
72
  };
63
73
 
64
74
  /**
package/src/Checkbox.tsx CHANGED
@@ -1,17 +1,31 @@
1
1
  import './checkbox.scss';
2
- import { useEffect, useRef } from 'react';
2
+ import { ChangeEvent, useEffect, useRef } from 'react';
3
3
 
4
- import { ToggleControlProps, ElementProps } from './';
4
+ import { CommonProps, ElementProps, InvalidPropsLibrary } from './';
5
5
 
6
- export type CheckboxProps = ToggleControlProps<HTMLInputElement> & {
7
- /**
8
- * If the checkbox is partially checked or
9
- * [indeterminate](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#indeterminate_state_checkboxes).
10
- *
11
- * @default false
12
- */
13
- indeterminate?: boolean;
14
- };
6
+ export type CheckboxProps = CommonProps<'aria-label' | 'disabled' | 'name'> &
7
+ InvalidPropsLibrary &
8
+ Required<CommonProps<'value'>> & {
9
+ /**
10
+ * If the checkbox is partially checked or
11
+ * [indeterminate](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#indeterminate_state_checkboxes).
12
+ *
13
+ * @default false
14
+ */
15
+ indeterminate?: boolean;
16
+ /**
17
+ * Marks the checkbox as checked.
18
+ *
19
+ * @default false
20
+ */
21
+ checked?: boolean;
22
+ /**
23
+ * The function to call when the checkbox is checked or unchecked.
24
+ *
25
+ * @required
26
+ */
27
+ onChange: (checked: boolean, event: ChangeEvent<HTMLInputElement>) => void;
28
+ };
15
29
 
16
30
  /**
17
31
  * A control that allows users to choose one or more items from a list or turn an feature on or off. This is the base
@@ -9,9 +9,12 @@ export type CheckboxGroupProps = CommonProps<'aria-label'> & {
9
9
  /**
10
10
  * The function to call when the checkboxes are changed.
11
11
  *
12
+ * @example
13
+ * (values) => setState({ values });
14
+ *
12
15
  * @required
13
16
  */
14
- onChange: (value: string[]) => void;
17
+ onChange: (values: string[]) => void;
15
18
  /**
16
19
  * The input control name of the checkboxes.
17
20
  *
@@ -21,14 +24,14 @@ export type CheckboxGroupProps = CommonProps<'aria-label'> & {
21
24
  /**
22
25
  * The options for the checkboxes.
23
26
  *
24
- * @type CheckboxGroupOption[]
27
+ * @type Array<CheckboxGroupOption>
25
28
  * @required
26
29
  */
27
30
  options: CheckboxGroupOption[];
28
31
  /**
29
32
  * The values of the checked checkboxes.
30
33
  *
31
- * @type string[]
34
+ * @type Array<string>
32
35
  */
33
36
  values?: CheckboxGroupProps['options'][number]['value'][];
34
37
  /**
@@ -4,8 +4,15 @@ import { ToggleOptionProps, ToggleOption } from './ToggleOption';
4
4
  import { InvalidPropsLibrary } from '.';
5
5
 
6
6
  export type CheckboxOptionProps = InvalidPropsLibrary &
7
- Pick<CheckboxProps, 'checked' | 'disabled' | 'indeterminate' | 'name' | 'onChange' | 'value'> &
8
- Pick<ToggleOptionProps, 'description' | 'label'>;
7
+ Pick<CheckboxProps, 'checked' | 'disabled' | 'indeterminate' | 'name' | 'value'> &
8
+ Pick<ToggleOptionProps, 'description' | 'label'> & {
9
+ /**
10
+ * The function to call when the checkbox is checked or unchecked.
11
+ *
12
+ * @required
13
+ */
14
+ onChange: (checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
15
+ };
9
16
 
10
17
  /**
11
18
  * A control that allows users to choose one or more items from a list or turn an feature on or off.
package/src/Chip.tsx CHANGED
@@ -3,7 +3,7 @@ import { CSSProperties, ReactNode } from 'react';
3
3
 
4
4
  import { CommonProps } from '.';
5
5
 
6
- export type ChipProps = CommonProps<'disabled' | 'onClick'> & {
6
+ export type ChipProps = CommonProps<'disabled'> & {
7
7
  /**
8
8
  * The content of the chip.
9
9
  *
@@ -39,6 +39,8 @@ export type ChipProps = CommonProps<'disabled' | 'onClick'> & {
39
39
  selected?: boolean;
40
40
  /** The style of the chip. */
41
41
  style?: CSSProperties;
42
+ /** The function to call when the chip is clicked. */
43
+ onClick?: (event: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
42
44
  };
43
45
 
44
46
  /**