@bspk/ui 1.1.12 → 1.1.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.
@@ -2,13 +2,13 @@ import './skeleton.scss';
2
2
  import { TxtVariant } from './utils/txtVariants';
3
3
  export type SkeletonProps = {
4
4
  /**
5
- * The text variant of the skeleton.
5
+ * The variant of the skeleton that best hints the content being loaded.
6
6
  *
7
7
  * @default text
8
8
  */
9
9
  variant?: 'circular' | 'photo' | 'profile' | 'rectangular' | 'text' | 'thumbnail';
10
10
  /**
11
- * The size of the text. This is only used when variant is 'text'.
11
+ * The variant of the text being loaded. This is only used when variant is 'text'.
12
12
  *
13
13
  * @default body-base
14
14
  */
@@ -35,6 +35,28 @@ export type SkeletonProps = {
35
35
  /**
36
36
  * A visual placeholder for an element while it is in a loading state.
37
37
  *
38
+ * The data for your components might not be immediately available. You can improve the perceived responsiveness of the
39
+ * page by using skeletons. It feels like things are happening immediately, then the information is incrementally
40
+ * displayed on the screen.
41
+ *
42
+ * @example
43
+ * function Example() {
44
+ * return item ? (
45
+ * <img
46
+ * style={{
47
+ * width: 210,
48
+ * height: 118,
49
+ * }}
50
+ * alt={item.title}
51
+ * src={item.src}
52
+ * />
53
+ * ) : (
54
+ * <Skeleton variant="photo" width={210} height={118} />
55
+ * );
56
+ * }
57
+ *
58
+ * @exampleDescription This example shows a skeleton loading state for an image but can be used for any element.
59
+ *
38
60
  * @name Skeleton
39
61
  */
40
62
  declare function Skeleton({ width, height, textLines, textVariant: textSize, variant, }: SkeletonProps): import("react/jsx-runtime").JSX.Element;
package/dist/Skeleton.js CHANGED
@@ -9,6 +9,28 @@ styleAdd(`[data-bspk=skeleton]{/*!
9
9
  /**
10
10
  * A visual placeholder for an element while it is in a loading state.
11
11
  *
12
+ * The data for your components might not be immediately available. You can improve the perceived responsiveness of the
13
+ * page by using skeletons. It feels like things are happening immediately, then the information is incrementally
14
+ * displayed on the screen.
15
+ *
16
+ * @example
17
+ * function Example() {
18
+ * return item ? (
19
+ * <img
20
+ * style={{
21
+ * width: 210,
22
+ * height: 118,
23
+ * }}
24
+ * alt={item.title}
25
+ * src={item.src}
26
+ * />
27
+ * ) : (
28
+ * <Skeleton variant="photo" width={210} height={118} />
29
+ * );
30
+ * }
31
+ *
32
+ * @exampleDescription This example shows a skeleton loading state for an image but can be used for any element.
33
+ *
12
34
  * @name Skeleton
13
35
  */
14
36
  function Skeleton({ width = 100, height = 100, textLines, textVariant: textSize, variant = 'rectangular', }) {
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../src/Skeleton.tsx"],"names":[],"mappings":";AAAA,OAAO,iBAAiB,CAAC;AAsCzB;;;;GAIG;AACH,SAAS,QAAQ,CAAC,EACd,KAAK,GAAG,GAAG,EACX,MAAM,GAAG,GAAG,EACZ,SAAS,EACT,WAAW,EAAE,QAAQ,EACrB,OAAO,GAAG,aAAa,GACX;IACZ,OAAO,CACH,2BACc,UAAU,kBACN,OAAO,EACrB,KAAK,EACD;YACI,UAAU,EAAE,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,MAAM;YAC/D,eAAe,EAAE,SAAS,QAAQ,QAAQ;YAC1C,eAAe,EAAE,cAAc,QAAQ,yBAAyB,QAAQ,SAAS;YACjF,SAAS,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK;SAC7C,YAGrB,OAAO,KAAK,MAAM;YACf,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,mCAAoB,KAAK,CAAI,CAAC,GAC1F,CACT,CAAC;AACN,CAAC;AAED,QAAQ,CAAC,QAAQ,GAAG,UAAU,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../src/Skeleton.tsx"],"names":[],"mappings":";AAAA,OAAO,iBAAiB,CAAC;AAsCzB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAS,QAAQ,CAAC,EACd,KAAK,GAAG,GAAG,EACX,MAAM,GAAG,GAAG,EACZ,SAAS,EACT,WAAW,EAAE,QAAQ,EACrB,OAAO,GAAG,aAAa,GACX;IACZ,OAAO,CACH,2BACc,UAAU,kBACN,OAAO,EACrB,KAAK,EACD;YACI,UAAU,EAAE,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,MAAM;YAC/D,eAAe,EAAE,SAAS,QAAQ,QAAQ;YAC1C,eAAe,EAAE,cAAc,QAAQ,yBAAyB,QAAQ,SAAS;YACjF,SAAS,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK;SAC7C,YAGrB,OAAO,KAAK,MAAM;YACf,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,mCAAoB,KAAK,CAAI,CAAC,GAC1F,CACT,CAAC;AACN,CAAC;AAED,QAAQ,CAAC,QAAQ,GAAG,UAAU,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,CAAC"}
package/meta-types.ts CHANGED
@@ -6,11 +6,11 @@ export type BaseMeta = {
6
6
  name: string;
7
7
  description?: string;
8
8
  file?: string;
9
+ example?: string;
9
10
  };
10
11
 
11
12
  export type TypeMeta = BaseMeta & {
12
13
  id: string;
13
- example?: string;
14
14
  references?: string[];
15
15
  properties?: TypeProperty[];
16
16
  };
@@ -35,12 +35,15 @@ export type ComponentMeta = BaseMeta & {
35
35
  modified: string;
36
36
  css: string;
37
37
  hasTouchTarget: boolean;
38
+ usage?: {
39
+ code: string;
40
+ description?: string;
41
+ };
38
42
  };
39
43
 
40
44
  export type UtilityMeta = BaseMeta & {
41
45
  param?: string;
42
46
  returns?: string;
43
- example?: string;
44
47
  };
45
48
 
46
49
  /** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
package/meta.ts CHANGED
@@ -169,6 +169,13 @@ function generateComponentMeta({
169
169
 
170
170
  const css = fs.existsSync(cssPath) ? fs.readFileSync(cssPath, { encoding: 'utf-8' }) : '';
171
171
 
172
+ const usage = componentDoc.example
173
+ ? {
174
+ code: componentDoc.example,
175
+ description: componentDoc.exampleDescription,
176
+ }
177
+ : undefined;
178
+
172
179
  return {
173
180
  description: componentDoc.description,
174
181
  file: componentFile.split(componentsDir)[1],
@@ -176,6 +183,7 @@ function generateComponentMeta({
176
183
  slug,
177
184
  dependencies,
178
185
  modified: stats.mtime.toISOString(),
186
+ usage,
179
187
  css,
180
188
  hasTouchTarget: css.includes('data-touch-target'),
181
189
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bspk/ui",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "license": "CC-BY-4.0",
5
5
  "type": "module",
6
6
  "files": [
package/src/Skeleton.tsx CHANGED
@@ -5,13 +5,13 @@ import { TxtVariant } from './utils/txtVariants';
5
5
 
6
6
  export type SkeletonProps = {
7
7
  /**
8
- * The text variant of the skeleton.
8
+ * The variant of the skeleton that best hints the content being loaded.
9
9
  *
10
10
  * @default text
11
11
  */
12
12
  variant?: 'circular' | 'photo' | 'profile' | 'rectangular' | 'text' | 'thumbnail';
13
13
  /**
14
- * The size of the text. This is only used when variant is 'text'.
14
+ * The variant of the text being loaded. This is only used when variant is 'text'.
15
15
  *
16
16
  * @default body-base
17
17
  */
@@ -39,6 +39,28 @@ export type SkeletonProps = {
39
39
  /**
40
40
  * A visual placeholder for an element while it is in a loading state.
41
41
  *
42
+ * The data for your components might not be immediately available. You can improve the perceived responsiveness of the
43
+ * page by using skeletons. It feels like things are happening immediately, then the information is incrementally
44
+ * displayed on the screen.
45
+ *
46
+ * @example
47
+ * function Example() {
48
+ * return item ? (
49
+ * <img
50
+ * style={{
51
+ * width: 210,
52
+ * height: 118,
53
+ * }}
54
+ * alt={item.title}
55
+ * src={item.src}
56
+ * />
57
+ * ) : (
58
+ * <Skeleton variant="photo" width={210} height={118} />
59
+ * );
60
+ * }
61
+ *
62
+ * @exampleDescription This example shows a skeleton loading state for an image but can be used for any element.
63
+ *
42
64
  * @name Skeleton
43
65
  */
44
66
  function Skeleton({