@propellerads/empty-state 5.0.0 → 5.0.1
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.
- package/README.md +2 -2
- package/dist/index.d.ts +7 -8
- package/dist/index.js +39 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ not.
|
|
|
72
72
|
|--------------------|-------------------------------------------------------------------------------------|
|
|
73
73
|
| `Empty` | The block. Centred, `--space-24` between header and actions, `--space-24` padding (`--space-40` from 769px). `variant`: `plain`, `outline` (dashed `--color-rich`), `muted` (`--color-quiet-bg`) |
|
|
74
74
|
| `EmptyHeader` | Picture, title and description, `--space-8` apart, at most 384px wide |
|
|
75
|
-
| `EmptyMedia` | The picture. `default` shows
|
|
75
|
+
| `EmptyMedia` | The picture. `default` shows an icon as given, at its own size. `variant="icon"` puts an icon on a 40px quiet square and sizes it to 24px. `variant="illustration"` is a 144px square an `<img>` or an `<svg>` fills, keeping its proportions |
|
|
76
76
|
| `EmptyTitle` | `--font-h3`. `render={<h2 />}` makes it a heading of the page |
|
|
77
77
|
| `EmptyDescription` | `--font-paragraph`, `--color-quiet-text`. A link inside is underlined and turns `--color-action` under the pointer |
|
|
78
78
|
| `EmptyContent` | The actions, stacked and centred, `--space-16` apart. Put a pair that belongs side by side in a row of its own |
|
|
@@ -96,7 +96,7 @@ So is the size of the illustration:
|
|
|
96
96
|
## Screenshots
|
|
97
97
|
|
|
98
98
|
The Storybook story at 2×: the playground, then Default, Outline, Muted,
|
|
99
|
-
|
|
99
|
+
Illustration and Heading.
|
|
100
100
|
|
|
101
101
|
| Light | Dark |
|
|
102
102
|
|---|---|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
3
|
import { useRender } from '@base-ui-components/react/use-render';
|
|
5
4
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
5
|
|
|
@@ -16,7 +15,7 @@ declare const EmptyVariant: {
|
|
|
16
15
|
type EmptyVariant = (typeof EmptyVariant)[keyof typeof EmptyVariant];
|
|
17
16
|
/** How the picture above the title is drawn. */
|
|
18
17
|
declare const EmptyMediaVariant: {
|
|
19
|
-
/** As given: an
|
|
18
|
+
/** As given: an icon at its own size. */
|
|
20
19
|
readonly Default: "default";
|
|
21
20
|
/** An icon on a 40px quiet square, sized to 24px. */
|
|
22
21
|
readonly Icon: "icon";
|
|
@@ -50,17 +49,17 @@ declare const emptyMediaVariants: (props?: ({
|
|
|
50
49
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
51
50
|
|
|
52
51
|
/** The block. Centres what is inside it. */
|
|
53
|
-
declare const Empty:
|
|
52
|
+
declare const Empty: react.ForwardRefExoticComponent<Omit<EmptyProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
54
53
|
/** The picture, the title and the description, held together at a readable width. */
|
|
55
|
-
declare const EmptyHeader:
|
|
54
|
+
declare const EmptyHeader: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
56
55
|
/** The picture above the title. */
|
|
57
|
-
declare const EmptyMedia:
|
|
56
|
+
declare const EmptyMedia: react.ForwardRefExoticComponent<Omit<EmptyMediaProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
58
57
|
/** The line that says what is missing. */
|
|
59
|
-
declare const EmptyTitle:
|
|
58
|
+
declare const EmptyTitle: react.ForwardRefExoticComponent<Omit<EmptyTitleProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
60
59
|
/** What happens next, in a sentence. A link inside it is underlined. */
|
|
61
|
-
declare const EmptyDescription:
|
|
60
|
+
declare const EmptyDescription: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
62
61
|
/** What to do about it: a button, a pair of them, a field. */
|
|
63
|
-
declare const EmptyContent:
|
|
62
|
+
declare const EmptyContent: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
64
63
|
|
|
65
64
|
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyMediaVariant, EmptyTitle, EmptyVariant, Empty as default, emptyMediaVariants, emptyVariants };
|
|
66
65
|
export type { EmptyContentProps, EmptyDescriptionProps, EmptyHeaderProps, EmptyMediaProps, EmptyProps, EmptyTitleProps };
|
package/dist/index.js
CHANGED
|
@@ -1,58 +1,75 @@
|
|
|
1
1
|
import { mergeProps as e } from "@base-ui-components/react/merge-props";
|
|
2
2
|
import { useRender as t } from "@base-ui-components/react/use-render";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import { clsx as r } from "clsx";
|
|
5
|
+
import { cva as i } from "class-variance-authority";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
7
|
import './index.css';//#region src/cn.ts
|
|
7
|
-
var
|
|
8
|
+
var o = (...e) => r(e), s = {
|
|
8
9
|
Plain: "plain",
|
|
9
10
|
Outline: "outline",
|
|
10
11
|
Muted: "muted"
|
|
11
|
-
},
|
|
12
|
+
}, c = {
|
|
12
13
|
Default: "default",
|
|
13
14
|
Icon: "icon",
|
|
14
15
|
Illustration: "illustration"
|
|
15
|
-
},
|
|
16
|
+
}, l = i("empty", {
|
|
16
17
|
variants: { variant: {
|
|
17
18
|
plain: "",
|
|
18
19
|
outline: "empty--outline",
|
|
19
20
|
muted: "empty--muted"
|
|
20
21
|
} },
|
|
21
22
|
defaultVariants: { variant: "plain" }
|
|
22
|
-
}),
|
|
23
|
+
}), u = i("empty__media", {
|
|
23
24
|
variants: { variant: {
|
|
24
25
|
default: "",
|
|
25
26
|
icon: "empty__media--icon",
|
|
26
27
|
illustration: "empty__media--illustration"
|
|
27
28
|
} },
|
|
28
29
|
defaultVariants: { variant: "default" }
|
|
29
|
-
}),
|
|
30
|
+
}), d = n(({ variant: e = s.Plain, className: t, ...n }, r) => /* @__PURE__ */ a("div", {
|
|
30
31
|
...n,
|
|
32
|
+
ref: r,
|
|
31
33
|
"data-variant": e,
|
|
32
|
-
className:
|
|
33
|
-
})
|
|
34
|
+
className: o(l({ variant: e }), t)
|
|
35
|
+
}));
|
|
36
|
+
d.displayName = "Empty";
|
|
37
|
+
var f = n(({ className: e, ...t }, n) => /* @__PURE__ */ a("div", {
|
|
34
38
|
...t,
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
ref: n,
|
|
40
|
+
className: o("empty__header", e)
|
|
41
|
+
}));
|
|
42
|
+
f.displayName = "EmptyHeader";
|
|
43
|
+
var p = n(({ variant: e = c.Default, className: t, ...n }, r) => /* @__PURE__ */ a("div", {
|
|
37
44
|
...n,
|
|
45
|
+
ref: r,
|
|
38
46
|
"data-variant": e,
|
|
39
|
-
className:
|
|
40
|
-
})
|
|
47
|
+
className: o(u({ variant: e }), t)
|
|
48
|
+
}));
|
|
49
|
+
p.displayName = "EmptyMedia";
|
|
50
|
+
var m = n(({ className: n, render: r, ...i }, a) => t({
|
|
41
51
|
defaultTagName: "div",
|
|
42
52
|
render: r,
|
|
43
|
-
ref:
|
|
53
|
+
ref: a,
|
|
44
54
|
props: e({ className: "empty__title" }, {
|
|
45
|
-
...
|
|
55
|
+
...i,
|
|
46
56
|
className: n
|
|
47
57
|
})
|
|
48
|
-
})
|
|
58
|
+
}));
|
|
59
|
+
m.displayName = "EmptyTitle";
|
|
60
|
+
var h = n(({ className: e, ...t }, n) => /* @__PURE__ */ a("div", {
|
|
49
61
|
...t,
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
ref: n,
|
|
63
|
+
className: o("empty__description", e)
|
|
64
|
+
}));
|
|
65
|
+
h.displayName = "EmptyDescription";
|
|
66
|
+
var g = n(({ className: e, ...t }, n) => /* @__PURE__ */ a("div", {
|
|
52
67
|
...t,
|
|
53
|
-
|
|
54
|
-
|
|
68
|
+
ref: n,
|
|
69
|
+
className: o("empty__content", e)
|
|
70
|
+
}));
|
|
71
|
+
g.displayName = "EmptyContent";
|
|
55
72
|
//#endregion
|
|
56
|
-
export {
|
|
73
|
+
export { d as Empty, d as default, g as EmptyContent, h as EmptyDescription, f as EmptyHeader, p as EmptyMedia, c as EmptyMediaVariant, m as EmptyTitle, s as EmptyVariant, u as emptyMediaVariants, l as emptyVariants };
|
|
57
74
|
|
|
58
75
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/cn.ts","../src/types.ts","../src/variants.ts","../src/index.tsx"],"sourcesContent":["import {type ClassValue, clsx} from 'clsx';\n\n/**\n * Joins class names. There is no tailwind-merge here on purpose: the empty state\n * ships its own stylesheet instead of utility classes, so there is nothing to\n * deduplicate.\n */\nconst cn = (...inputs: ClassValue[]): string => clsx(inputs);\n\nexport {cn};\n","import type {useRender} from '@base-ui-components/react/use-render';\nimport type {ComponentPropsWithRef} from 'react';\n\n/** How the block is set off from the page. */\nexport const EmptyVariant = {\n /** Nothing around it: the block stands on whatever is behind it. */\n Plain: 'plain',\n /** A dashed contour: a place that is waiting to be filled — a list, a drop zone. */\n Outline: 'outline',\n /** A quiet pad: an empty panel inside a page that is otherwise full. */\n Muted: 'muted',\n} as const;\nexport type EmptyVariant = (typeof EmptyVariant)[keyof typeof EmptyVariant];\n\n/** How the picture above the title is drawn. */\nexport const EmptyMediaVariant = {\n /** As given: an
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/cn.ts","../src/types.ts","../src/variants.ts","../src/index.tsx"],"sourcesContent":["import {type ClassValue, clsx} from 'clsx';\n\n/**\n * Joins class names. There is no tailwind-merge here on purpose: the empty state\n * ships its own stylesheet instead of utility classes, so there is nothing to\n * deduplicate.\n */\nconst cn = (...inputs: ClassValue[]): string => clsx(inputs);\n\nexport {cn};\n","import type {useRender} from '@base-ui-components/react/use-render';\nimport type {ComponentPropsWithRef} from 'react';\n\n/** How the block is set off from the page. */\nexport const EmptyVariant = {\n /** Nothing around it: the block stands on whatever is behind it. */\n Plain: 'plain',\n /** A dashed contour: a place that is waiting to be filled — a list, a drop zone. */\n Outline: 'outline',\n /** A quiet pad: an empty panel inside a page that is otherwise full. */\n Muted: 'muted',\n} as const;\nexport type EmptyVariant = (typeof EmptyVariant)[keyof typeof EmptyVariant];\n\n/** How the picture above the title is drawn. */\nexport const EmptyMediaVariant = {\n /** As given: an icon at its own size. */\n Default: 'default',\n /** An icon on a 40px quiet square, sized to 24px. */\n Icon: 'icon',\n /** A 144px picture — an image or an SVG — fitted to the square. */\n Illustration: 'illustration',\n} as const;\nexport type EmptyMediaVariant = (typeof EmptyMediaVariant)[keyof typeof EmptyMediaVariant];\n\nexport type EmptyProps = ComponentPropsWithRef<'div'> & {\n /** @default 'plain' */\n variant?: EmptyVariant;\n};\n\nexport type EmptyHeaderProps = ComponentPropsWithRef<'div'>;\n\nexport type EmptyMediaProps = ComponentPropsWithRef<'div'> & {\n /** @default 'default' */\n variant?: EmptyMediaVariant;\n};\n\n/** `render` swaps the element: `render={<h2 />}` makes the title a heading of the page. */\nexport type EmptyTitleProps = useRender.ComponentProps<'div'>;\n\nexport type EmptyDescriptionProps = ComponentPropsWithRef<'div'>;\n\nexport type EmptyContentProps = ComponentPropsWithRef<'div'>;\n","import {cva} from 'class-variance-authority';\n\n/**\n * The class names the stylesheet defines. Exported so that a page can give its\n * own markup the look without rendering the component.\n */\nconst emptyVariants = cva('empty', {\n variants: {\n variant: {\n plain: '',\n outline: 'empty--outline',\n muted: 'empty--muted',\n },\n },\n defaultVariants: {\n variant: 'plain',\n },\n});\n\nconst emptyMediaVariants = cva('empty__media', {\n variants: {\n variant: {\n default: '',\n icon: 'empty__media--icon',\n illustration: 'empty__media--illustration',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\nexport {emptyMediaVariants, emptyVariants};\n","import {mergeProps} from '@base-ui-components/react/merge-props';\nimport {useRender} from '@base-ui-components/react/use-render';\nimport {forwardRef, type PropsWithoutRef} from 'react';\nimport './empty-state.css';\nimport {cn} from './cn';\nimport {\n type EmptyContentProps,\n type EmptyDescriptionProps,\n type EmptyHeaderProps,\n type EmptyMediaProps,\n EmptyMediaVariant,\n type EmptyProps,\n type EmptyTitleProps,\n EmptyVariant,\n} from './types';\nimport {emptyMediaVariants, emptyVariants} from './variants';\n\n/*\n * The parts follow shadcn's Empty: the block, the header holding the picture,\n * the title and the description, and the actions under it.\n */\n\n/** The block. Centres what is inside it. */\nconst Empty = forwardRef<HTMLDivElement, PropsWithoutRef<EmptyProps>>(\n ({variant = EmptyVariant.Plain, className, ...props}, ref) => (\n <div {...props} ref={ref} data-variant={variant} className={cn(emptyVariants({variant}), className)} />\n ),\n);\nEmpty.displayName = 'Empty';\n\n/** The picture, the title and the description, held together at a readable width. */\nconst EmptyHeader = forwardRef<HTMLDivElement, PropsWithoutRef<EmptyHeaderProps>>(({className, ...props}, ref) => (\n <div {...props} ref={ref} className={cn('empty__header', className)} />\n));\nEmptyHeader.displayName = 'EmptyHeader';\n\n/** The picture above the title. */\nconst EmptyMedia = forwardRef<HTMLDivElement, PropsWithoutRef<EmptyMediaProps>>(\n ({variant = EmptyMediaVariant.Default, className, ...props}, ref) => (\n <div {...props} ref={ref} data-variant={variant} className={cn(emptyMediaVariants({variant}), className)} />\n ),\n);\nEmptyMedia.displayName = 'EmptyMedia';\n\n/** The line that says what is missing. */\nconst EmptyTitle = forwardRef<HTMLDivElement, PropsWithoutRef<EmptyTitleProps>>(({className, render, ...props}, ref) =>\n useRender({\n defaultTagName: 'div',\n render,\n ref,\n props: mergeProps<'div'>({className: 'empty__title'}, {...props, className}),\n }),\n);\nEmptyTitle.displayName = 'EmptyTitle';\n\n/** What happens next, in a sentence. A link inside it is underlined. */\nconst EmptyDescription = forwardRef<HTMLDivElement, PropsWithoutRef<EmptyDescriptionProps>>(\n ({className, ...props}, ref) => <div {...props} ref={ref} className={cn('empty__description', className)} />,\n);\nEmptyDescription.displayName = 'EmptyDescription';\n\n/** What to do about it: a button, a pair of them, a field. */\nconst EmptyContent = forwardRef<HTMLDivElement, PropsWithoutRef<EmptyContentProps>>(({className, ...props}, ref) => (\n <div {...props} ref={ref} className={cn('empty__content', className)} />\n));\nEmptyContent.displayName = 'EmptyContent';\n\nexport default Empty;\n\nexport type {EmptyContentProps, EmptyDescriptionProps, EmptyHeaderProps, EmptyMediaProps, EmptyProps, EmptyTitleProps};\nexport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyMediaVariant,\n EmptyTitle,\n EmptyVariant,\n emptyMediaVariants,\n emptyVariants,\n};\n"],"mappings":";;;;;;;AAOA,IAAM,KAAM,GAAG,MAAiC,EAAK,EAAO,ECH/C,IAAe;CAE1B,OAAO;CAEP,SAAS;CAET,OAAO;CACR,EAIY,IAAoB;CAE/B,SAAS;CAET,MAAM;CAEN,cAAc;CACf,EChBK,IAAgB,EAAI,SAAS;CACjC,UAAU,EACR,SAAS;EACP,OAAO;EACP,SAAS;EACT,OAAO;EACR,EACF;CACD,iBAAiB,EACf,SAAS,SACV;CACF,CAAC,EAEI,IAAqB,EAAI,gBAAgB;CAC7C,UAAU,EACR,SAAS;EACP,SAAS;EACT,MAAM;EACN,cAAc;EACf,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CAAC,ECPI,IAAQ,GACX,EAAC,aAAU,EAAa,OAAO,cAAW,GAAG,KAAQ,MACpD,kBAAC,OAAD;CAAK,GAAI;CAAY;CAAK,gBAAc;CAAS,WAAW,EAAG,EAAc,EAAC,YAAQ,CAAC,EAAE,EAAU;CAAI,CAAA,CAE1G;AACD,EAAM,cAAc;AAGpB,IAAM,IAAc,GAA+D,EAAC,cAAW,GAAG,KAAQ,MACxG,kBAAC,OAAD;CAAK,GAAI;CAAY;CAAK,WAAW,EAAG,iBAAiB,EAAU;CAAI,CAAA,CACvE;AACF,EAAY,cAAc;AAG1B,IAAM,IAAa,GAChB,EAAC,aAAU,EAAkB,SAAS,cAAW,GAAG,KAAQ,MAC3D,kBAAC,OAAD;CAAK,GAAI;CAAY;CAAK,gBAAc;CAAS,WAAW,EAAG,EAAmB,EAAC,YAAQ,CAAC,EAAE,EAAU;CAAI,CAAA,CAE/G;AACD,EAAW,cAAc;AAGzB,IAAM,IAAa,GAA8D,EAAC,cAAW,WAAQ,GAAG,KAAQ,MAC9G,EAAU;CACR,gBAAgB;CAChB;CACA;CACA,OAAO,EAAkB,EAAC,WAAW,gBAAe,EAAE;EAAC,GAAG;EAAO;EAAU,CAAC;CAC7E,CAAC,CACH;AACD,EAAW,cAAc;AAGzB,IAAM,IAAmB,GACtB,EAAC,cAAW,GAAG,KAAQ,MAAQ,kBAAC,OAAD;CAAK,GAAI;CAAY;CAAK,WAAW,EAAG,sBAAsB,EAAU;CAAI,CAAA,CAC7G;AACD,EAAiB,cAAc;AAG/B,IAAM,IAAe,GAAgE,EAAC,cAAW,GAAG,KAAQ,MAC1G,kBAAC,OAAD;CAAK,GAAI;CAAY;CAAK,WAAW,EAAG,kBAAkB,EAAU;CAAI,CAAA,CACxE;AACF,EAAa,cAAc"}
|