@speles7172/controls 0.2.1 → 0.3.0
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/dist/.tsbuildinfo +1 -1
- package/dist/Badge.d.ts +45 -0
- package/dist/Badge.d.ts.map +1 -0
- package/dist/Badge.js +51 -0
- package/dist/Badge.js.map +1 -0
- package/dist/Card.d.ts +52 -0
- package/dist/Card.d.ts.map +1 -0
- package/dist/Card.js +25 -0
- package/dist/Card.js.map +1 -0
- package/dist/DataTable.d.ts +99 -0
- package/dist/DataTable.d.ts.map +1 -0
- package/dist/DataTable.js +93 -0
- package/dist/DataTable.js.map +1 -0
- package/dist/KeyValueList.d.ts.map +1 -1
- package/dist/KeyValueList.js +2 -1
- package/dist/KeyValueList.js.map +1 -1
- package/dist/PageHeader.d.ts +36 -0
- package/dist/PageHeader.d.ts.map +1 -0
- package/dist/PageHeader.js +24 -0
- package/dist/PageHeader.js.map +1 -0
- package/dist/ProgressBar.d.ts +36 -0
- package/dist/ProgressBar.d.ts.map +1 -0
- package/dist/ProgressBar.js +34 -0
- package/dist/ProgressBar.js.map +1 -0
- package/dist/SearchableMultiSelect.d.ts.map +1 -1
- package/dist/SearchableMultiSelect.js +3 -2
- package/dist/SearchableMultiSelect.js.map +1 -1
- package/dist/Section.d.ts +34 -0
- package/dist/Section.d.ts.map +1 -0
- package/dist/Section.js +21 -0
- package/dist/Section.js.map +1 -0
- package/dist/Tabs.d.ts +37 -0
- package/dist/Tabs.d.ts.map +1 -0
- package/dist/Tabs.js +55 -0
- package/dist/Tabs.js.map +1 -0
- package/dist/icons.d.ts +37 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +45 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +28 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -5
- package/dist/index.js.map +1 -1
- package/dist/states.d.ts +65 -0
- package/dist/states.d.ts.map +1 -0
- package/dist/states.js +38 -0
- package/dist/states.js.map +1 -0
- package/dist/styles.css +747 -22
- package/package.json +4 -3
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The icon set, for every package here.
|
|
3
|
+
*
|
|
4
|
+
* The icons are `lucide-react`, which is the set the reference dashboard uses
|
|
5
|
+
* and the reason its screens read as a product rather than as a test fixture.
|
|
6
|
+
* The first versions of these controls rendered `▾`, `☐`, `☑`, `↑` and `✕`
|
|
7
|
+
* instead, on the grounds that a control package should take no runtime
|
|
8
|
+
* dependency. That was a shortcut mistaken for a principle — the package
|
|
9
|
+
* already depends on React and on `controls-client` — and it costs more than it
|
|
10
|
+
* saves: a unicode glyph renders at a different weight in every font on every
|
|
11
|
+
* platform, sits off the text baseline, cannot be given a stroke width, and is
|
|
12
|
+
* announced by a screen reader as "black down-pointing small triangle".
|
|
13
|
+
*
|
|
14
|
+
* They are re-exported through this one module, and every console imports them
|
|
15
|
+
* from `@speles7172/controls` rather than from `lucide-react`, so that what a
|
|
16
|
+
* caret or a delete button looks like is decided in a single file — and so
|
|
17
|
+
* swapping the set, or letting a consumer swap it, is one edit rather than one
|
|
18
|
+
* per package. `@speles7172/file-console` keeps a module of its own on top of
|
|
19
|
+
* this, because the colour a folder icon is drawn in *is* information there.
|
|
20
|
+
*
|
|
21
|
+
* Lucide is tree-shakeable, and these are re-exports: a console that names four
|
|
22
|
+
* icons ships four, not the fourteen hundred in the package and not the fifty
|
|
23
|
+
* below.
|
|
24
|
+
*
|
|
25
|
+
* Names are what the icon *means* here, not what lucide calls it, because the
|
|
26
|
+
* meaning is what a caller is choosing between — and because two meanings
|
|
27
|
+
* sometimes want the same drawing.
|
|
28
|
+
*/
|
|
29
|
+
export { ArrowDown as MoveDownIcon, ArrowDown as SortDescendingIcon, ArrowUp as MoveUpIcon, ArrowUp as SortAscendingIcon, ArrowUpDown as SortableIcon, Check as CheckIcon, ChevronDown as ChevronDownIcon, ChevronLeft as PreviousIcon, ChevronRight as ChevronRightIcon, ChevronRight as NextIcon, Inbox as EmptyIcon, Loader2 as SpinnerIcon, Search as SearchIcon, Square as UncheckedIcon, SquareCheck as CheckedIcon, X as CloseIcon, CircleAlert as ErrorIcon, CircleCheck as SuccessIcon, Info as InfoIcon, TriangleAlert as AlertIcon, Copy as CopyIcon, Download as DownloadIcon, ExternalLink as OpenIcon, Eye as ViewIcon, ListFilter as FilterIcon, Pencil as EditIcon, Play as RunIcon, Plus as AddIcon, RefreshCw as RefreshIcon, RotateCcw as RestoreIcon, Save as SaveIcon, Send as SendIcon, Trash2 as DeleteIcon, Upload as UploadIcon, AtSign as MentionIcon, Bell as NotificationIcon, CalendarClock as ScheduleIcon, ChartColumn as StatisticsIcon, Clock as TimeIcon, Database as DatabaseIcon, HardDriveDownload as BackupIcon, History as HistoryIcon, KeyRound as KeyIcon, Languages as TranslateIcon, Mail as MailIcon, MapPin as LocationIcon, MessageSquare as ThreadIcon, Monitor as DeviceIcon, Route as RoutingIcon, ScrollText as LogIcon, SlidersHorizontal as SettingsIcon, Sparkles as SparklesIcon, SpellCheck as GrammarIcon, Table as TableIcon, User as UserIcon, WandSparkles as AssistIcon, } from 'lucide-react';
|
|
30
|
+
/**
|
|
31
|
+
* The default icon size, in pixels.
|
|
32
|
+
*
|
|
33
|
+
* 16 next to 14px text: an icon that matches its label's cap height reads as
|
|
34
|
+
* part of the label, and one that competes with it is decoration.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ICON_SIZE = 16;
|
|
37
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAEL,SAAS,IAAI,YAAY,EACzB,SAAS,IAAI,kBAAkB,EAC/B,OAAO,IAAI,UAAU,EACrB,OAAO,IAAI,iBAAiB,EAC5B,WAAW,IAAI,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I,IAAI,QAAQ,EAChB,YAAY,IAAI,UAAU,GAC3B,MAAM,cAAc,CAAC;AAEtB;;;;;GAKG;AACH,eAAO,MAAM,SAAS,KAAK,CAAC"}
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The icon set, for every package here.
|
|
3
|
+
*
|
|
4
|
+
* The icons are `lucide-react`, which is the set the reference dashboard uses
|
|
5
|
+
* and the reason its screens read as a product rather than as a test fixture.
|
|
6
|
+
* The first versions of these controls rendered `▾`, `☐`, `☑`, `↑` and `✕`
|
|
7
|
+
* instead, on the grounds that a control package should take no runtime
|
|
8
|
+
* dependency. That was a shortcut mistaken for a principle — the package
|
|
9
|
+
* already depends on React and on `controls-client` — and it costs more than it
|
|
10
|
+
* saves: a unicode glyph renders at a different weight in every font on every
|
|
11
|
+
* platform, sits off the text baseline, cannot be given a stroke width, and is
|
|
12
|
+
* announced by a screen reader as "black down-pointing small triangle".
|
|
13
|
+
*
|
|
14
|
+
* They are re-exported through this one module, and every console imports them
|
|
15
|
+
* from `@speles7172/controls` rather than from `lucide-react`, so that what a
|
|
16
|
+
* caret or a delete button looks like is decided in a single file — and so
|
|
17
|
+
* swapping the set, or letting a consumer swap it, is one edit rather than one
|
|
18
|
+
* per package. `@speles7172/file-console` keeps a module of its own on top of
|
|
19
|
+
* this, because the colour a folder icon is drawn in *is* information there.
|
|
20
|
+
*
|
|
21
|
+
* Lucide is tree-shakeable, and these are re-exports: a console that names four
|
|
22
|
+
* icons ships four, not the fourteen hundred in the package and not the fifty
|
|
23
|
+
* below.
|
|
24
|
+
*
|
|
25
|
+
* Names are what the icon *means* here, not what lucide calls it, because the
|
|
26
|
+
* meaning is what a caller is choosing between — and because two meanings
|
|
27
|
+
* sometimes want the same drawing.
|
|
28
|
+
*/
|
|
29
|
+
export {
|
|
30
|
+
/* The controls' own affordances. */
|
|
31
|
+
ArrowDown as MoveDownIcon, ArrowDown as SortDescendingIcon, ArrowUp as MoveUpIcon, ArrowUp as SortAscendingIcon, ArrowUpDown as SortableIcon, Check as CheckIcon, ChevronDown as ChevronDownIcon, ChevronLeft as PreviousIcon, ChevronRight as ChevronRightIcon, ChevronRight as NextIcon, Inbox as EmptyIcon, Loader2 as SpinnerIcon, Search as SearchIcon, Square as UncheckedIcon, SquareCheck as CheckedIcon, X as CloseIcon,
|
|
32
|
+
/* Saying how something went. */
|
|
33
|
+
CircleAlert as ErrorIcon, CircleCheck as SuccessIcon, Info as InfoIcon, TriangleAlert as AlertIcon,
|
|
34
|
+
/* The verbs. */
|
|
35
|
+
Copy as CopyIcon, Download as DownloadIcon, ExternalLink as OpenIcon, Eye as ViewIcon, ListFilter as FilterIcon, Pencil as EditIcon, Play as RunIcon, Plus as AddIcon, RefreshCw as RefreshIcon, RotateCcw as RestoreIcon, Save as SaveIcon, Send as SendIcon, Trash2 as DeleteIcon, Upload as UploadIcon,
|
|
36
|
+
/* The nouns each console is about. */
|
|
37
|
+
AtSign as MentionIcon, Bell as NotificationIcon, CalendarClock as ScheduleIcon, ChartColumn as StatisticsIcon, Clock as TimeIcon, Database as DatabaseIcon, HardDriveDownload as BackupIcon, History as HistoryIcon, KeyRound as KeyIcon, Languages as TranslateIcon, Mail as MailIcon, MapPin as LocationIcon, MessageSquare as ThreadIcon, Monitor as DeviceIcon, Route as RoutingIcon, ScrollText as LogIcon, SlidersHorizontal as SettingsIcon, Sparkles as SparklesIcon, SpellCheck as GrammarIcon, Table as TableIcon, User as UserIcon, WandSparkles as AssistIcon, } from 'lucide-react';
|
|
38
|
+
/**
|
|
39
|
+
* The default icon size, in pixels.
|
|
40
|
+
*
|
|
41
|
+
* 16 next to 14px text: an icon that matches its label's cap height reads as
|
|
42
|
+
* part of the label, and one that competes with it is decoration.
|
|
43
|
+
*/
|
|
44
|
+
export const ICON_SIZE = 16;
|
|
45
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sourceR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,IAAI,aAAa,EAC1B,IAAI,IAAI,QAAQ,EAChB,MAAM,IAAI,YAAY,EACtB,aAAa,IAAI,UAAU,EAC3B,OAAO,IAAI,UAAU,EACrB,KAAK,IAAI,WAAW,EACpB,UAAU,IAAI,OAAO,EACrB,iBAAiB,IAAI,YAAY,EACjC,QAAQ,IAAI,YAAY,EACxB,UAAU,IAAI,WAAW,EACzB,KAAK,IAAI,SAAS,EAClB,IAAI,IAAI,QAAQ,EAChB,YAAY,IAAI,UAAU,GAC3B,MAAM,cAAc,CAAC;AAEtB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,22 @@
|
|
|
2
2
|
* `@speles7172/controls` — the form controls every Peles.us frontend was
|
|
3
3
|
* re-implementing.
|
|
4
4
|
*
|
|
5
|
-
* One package that grows:
|
|
6
|
-
*
|
|
5
|
+
* One package that grows: anything needed in two places belongs here rather
|
|
6
|
+
* than being copied into the second one. That is the form controls — a
|
|
7
7
|
* searchable multi-select and its single-select sibling, the typed field
|
|
8
|
-
* `<ValueInput>`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* `<ValueInput>`, `<KeyValueList>` for a setting that is really several — and
|
|
9
|
+
* the furniture every screen is built out of: `<DataTable>`, `<PageHeader>`,
|
|
10
|
+
* `<Section>`, `<Tabs>`, `<Card>`, `<Badge>`, `<ProgressBar>`, the `<Modal>`
|
|
11
|
+
* shell, and the states that are not the happy one (`<Loading>`,
|
|
12
|
+
* `<TableSkeleton>`, `<EmptyState>`).
|
|
13
|
+
*
|
|
14
|
+
* The design language those render — the palette, the 4px space scale, the
|
|
15
|
+
* radius and elevation rules, what a colour is allowed to mean — is defined in
|
|
16
|
+
* `styles.css` as custom properties and written up in `docs/UI.md`. A console
|
|
17
|
+
* re-declares the same token values under its own prefix rather than importing
|
|
18
|
+
* them, which is the same parallel-implementation trade the backend packages
|
|
19
|
+
* make, and bridges `--ctl-*` onto its own so a dark console never gets light
|
|
20
|
+
* popovers.
|
|
11
21
|
*
|
|
12
22
|
* Each control takes either a fixed array of options or an
|
|
13
23
|
* {@link OptionTransport}, and behaves the same either way — the difference
|
|
@@ -37,6 +47,19 @@
|
|
|
37
47
|
export { SearchableMultiSelect, type SearchableMultiSelectProps, } from './SearchableMultiSelect.js';
|
|
38
48
|
export { SearchableSelect, type SearchableSelectProps } from './SearchableSelect.js';
|
|
39
49
|
export { Modal, type ModalProps } from './Modal.js';
|
|
50
|
+
export { DataTable, SortableColumn, type ColumnDef, type DataTableProps, type SortDirection, } from './DataTable.js';
|
|
51
|
+
export { PageHeader, type PageHeaderProps } from './PageHeader.js';
|
|
52
|
+
export { Section, type SectionProps } from './Section.js';
|
|
53
|
+
export { Tabs, type TabDef, type TabsProps } from './Tabs.js';
|
|
54
|
+
export { Card, type CardProps } from './Card.js';
|
|
55
|
+
export { Badge, StatusBadge, statusTone, type BadgeProps, type BadgeTone, type StatusBadgeProps } from './Badge.js';
|
|
56
|
+
export { ProgressBar, type ProgressBarProps } from './ProgressBar.js';
|
|
57
|
+
export { EmptyState, Loading, Skeleton, Spinner, TableSkeleton, type EmptyStateProps, type LoadingProps, type SkeletonProps, type SpinnerProps, type TableSkeletonProps, } from './states.js';
|
|
58
|
+
/**
|
|
59
|
+
* The icon set, re-exported so a console renders the same marks as the controls
|
|
60
|
+
* inside it — and so swapping the set is one edit rather than one per package.
|
|
61
|
+
*/
|
|
62
|
+
export * from './icons.js';
|
|
40
63
|
export { ValueInput, type ValueInputProps, type ValueInputType } from './ValueInput.js';
|
|
41
64
|
export { KeyValueList, type KeyValueItem, type KeyValueItemType, type KeyValueListProps, } from './KeyValueList.js';
|
|
42
65
|
export { useOptionSelect, type OptionSelectState, type UseOptionSelectOptions, } from './useOptionSelect.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],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eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAExF,OAAO,EACL,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EACV,YAAY,EACZ,MAAM,EACN,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,22 @@
|
|
|
2
2
|
* `@speles7172/controls` — the form controls every Peles.us frontend was
|
|
3
3
|
* re-implementing.
|
|
4
4
|
*
|
|
5
|
-
* One package that grows:
|
|
6
|
-
*
|
|
5
|
+
* One package that grows: anything needed in two places belongs here rather
|
|
6
|
+
* than being copied into the second one. That is the form controls — a
|
|
7
7
|
* searchable multi-select and its single-select sibling, the typed field
|
|
8
|
-
* `<ValueInput>`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* `<ValueInput>`, `<KeyValueList>` for a setting that is really several — and
|
|
9
|
+
* the furniture every screen is built out of: `<DataTable>`, `<PageHeader>`,
|
|
10
|
+
* `<Section>`, `<Tabs>`, `<Card>`, `<Badge>`, `<ProgressBar>`, the `<Modal>`
|
|
11
|
+
* shell, and the states that are not the happy one (`<Loading>`,
|
|
12
|
+
* `<TableSkeleton>`, `<EmptyState>`).
|
|
13
|
+
*
|
|
14
|
+
* The design language those render — the palette, the 4px space scale, the
|
|
15
|
+
* radius and elevation rules, what a colour is allowed to mean — is defined in
|
|
16
|
+
* `styles.css` as custom properties and written up in `docs/UI.md`. A console
|
|
17
|
+
* re-declares the same token values under its own prefix rather than importing
|
|
18
|
+
* them, which is the same parallel-implementation trade the backend packages
|
|
19
|
+
* make, and bridges `--ctl-*` onto its own so a dark console never gets light
|
|
20
|
+
* popovers.
|
|
11
21
|
*
|
|
12
22
|
* Each control takes either a fixed array of options or an
|
|
13
23
|
* {@link OptionTransport}, and behaves the same either way — the difference
|
|
@@ -37,6 +47,19 @@
|
|
|
37
47
|
export { SearchableMultiSelect, } from './SearchableMultiSelect.js';
|
|
38
48
|
export { SearchableSelect } from './SearchableSelect.js';
|
|
39
49
|
export { Modal } from './Modal.js';
|
|
50
|
+
export { DataTable, SortableColumn, } from './DataTable.js';
|
|
51
|
+
export { PageHeader } from './PageHeader.js';
|
|
52
|
+
export { Section } from './Section.js';
|
|
53
|
+
export { Tabs } from './Tabs.js';
|
|
54
|
+
export { Card } from './Card.js';
|
|
55
|
+
export { Badge, StatusBadge, statusTone } from './Badge.js';
|
|
56
|
+
export { ProgressBar } from './ProgressBar.js';
|
|
57
|
+
export { EmptyState, Loading, Skeleton, Spinner, TableSkeleton, } from './states.js';
|
|
58
|
+
/**
|
|
59
|
+
* The icon set, re-exported so a console renders the same marks as the controls
|
|
60
|
+
* inside it — and so swapping the set is one edit rather than one per package.
|
|
61
|
+
*/
|
|
62
|
+
export * from './icons.js';
|
|
40
63
|
export { ValueInput } from './ValueInput.js';
|
|
41
64
|
export { KeyValueList, } from './KeyValueList.js';
|
|
42
65
|
export { useOptionSelect, } from './useOptionSelect.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EACL,qBAAqB,GAEtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAA8B,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,KAAK,EAAmB,MAAM,YAAY,CAAC;AAEpD,OAAO,EACL,SAAS,EACT,cAAc,GAIf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,IAAI,EAA+B,MAAM,WAAW,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAkB,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAA0D,MAAM,YAAY,CAAC;AAEpH,OAAO,EAAE,WAAW,EAAyB,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EACL,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAO,EACP,aAAa,GAMd,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,UAAU,EAA6C,MAAM,iBAAiB,CAAC;AAExF,OAAO,EACL,YAAY,GAIb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,GAGhB,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,kCAAkC,CAAC"}
|
package/dist/states.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { ControlTheme } from './types.js';
|
|
3
|
+
export interface SpinnerProps {
|
|
4
|
+
size?: number;
|
|
5
|
+
/** What is being waited for. Announced; not drawn. */
|
|
6
|
+
label?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/** A spinner. Sized in pixels, coloured with the accent. */
|
|
10
|
+
export declare function Spinner({ size, label, className }: SpinnerProps): import("react").JSX.Element;
|
|
11
|
+
export interface LoadingProps {
|
|
12
|
+
/** The line beside the spinner. Say what is loading, not "Loading…". */
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
theme?: ControlTheme;
|
|
16
|
+
}
|
|
17
|
+
/** A centred spinner and a line, for a panel that has nothing to show yet. */
|
|
18
|
+
export declare function Loading({ children, className, theme }: LoadingProps): import("react").JSX.Element;
|
|
19
|
+
export interface SkeletonProps {
|
|
20
|
+
/** CSS width. A row of identical-width blocks reads as a loading bar, not as
|
|
21
|
+
* the shape of the content that is coming. */
|
|
22
|
+
width?: string;
|
|
23
|
+
height?: string;
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
/** One shimmering block, the shape of the thing that is coming. */
|
|
27
|
+
export declare function Skeleton({ width, height, className }: SkeletonProps): import("react").JSX.Element;
|
|
28
|
+
export interface TableSkeletonProps {
|
|
29
|
+
rows?: number;
|
|
30
|
+
columns?: number;
|
|
31
|
+
className?: string;
|
|
32
|
+
theme?: ControlTheme;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A table's worth of skeleton rows.
|
|
36
|
+
*
|
|
37
|
+
* Sized like the table it replaces so the page does not jump when the rows
|
|
38
|
+
* arrive — which is the entire argument for a skeleton over a spinner, and the
|
|
39
|
+
* reason the header row is drawn too.
|
|
40
|
+
*/
|
|
41
|
+
export declare function TableSkeleton({ rows, columns, className, theme }: TableSkeletonProps): import("react").JSX.Element;
|
|
42
|
+
export interface EmptyStateProps {
|
|
43
|
+
/** What is not here. */
|
|
44
|
+
title: ReactNode;
|
|
45
|
+
/** What this place is *for*, or why the filter matched nothing. */
|
|
46
|
+
lead?: ReactNode;
|
|
47
|
+
/** The action that fills it. */
|
|
48
|
+
action?: ReactNode;
|
|
49
|
+
/** A lucide icon component. Defaults to an empty tray. */
|
|
50
|
+
icon?: ComponentType<{
|
|
51
|
+
size?: number;
|
|
52
|
+
}>;
|
|
53
|
+
className?: string;
|
|
54
|
+
theme?: ControlTheme;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The empty state.
|
|
58
|
+
*
|
|
59
|
+
* An empty list rendering as blank space is a bug: it leaves somebody unable to
|
|
60
|
+
* tell a screen that is working from one that is broken. Say what this place is
|
|
61
|
+
* for and offer the action that fills it — and where the emptiness is a filter
|
|
62
|
+
* rather than an absence, say *that*, because the way out is different.
|
|
63
|
+
*/
|
|
64
|
+
export declare function EmptyState({ title, lead, action, icon: Icon, className, theme, }: EmptyStateProps): import("react").JSX.Element;
|
|
65
|
+
//# sourceMappingURL=states.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"states.d.ts","sourceRoot":"","sources":["../src/states.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAc/C,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4DAA4D;AAC5D,wBAAgB,OAAO,CAAC,EAAE,IAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,YAAY,+BAU3E;AAED,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,8EAA8E;AAC9E,wBAAgB,OAAO,CAAC,EAAE,QAAqB,EAAE,SAAS,EAAE,KAAe,EAAE,EAAE,YAAY,+BAW1F;AAED,MAAM,WAAW,aAAa;IAC5B;mDAC+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mEAAmE;AACnE,wBAAgB,QAAQ,CAAC,EAAE,KAAc,EAAE,MAAe,EAAE,SAAS,EAAE,EAAE,aAAa,+BAQrF;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAAE,IAAQ,EAAE,OAAW,EAAE,SAAS,EAAE,KAAe,EAAE,EAAE,kBAAkB,+BAsBtG;AAED,MAAM,WAAW,eAAe;IAC9B,wBAAwB;IACxB,KAAK,EAAE,SAAS,CAAC;IACjB,mEAAmE;IACnE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,gCAAgC;IAChC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,aAAa,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EAAE,IAAgB,EACtB,SAAS,EACT,KAAe,GAChB,EAAE,eAAe,+BAcjB"}
|
package/dist/states.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { EmptyIcon, SpinnerIcon, ICON_SIZE } from './icons.js';
|
|
3
|
+
/** A spinner. Sized in pixels, coloured with the accent. */
|
|
4
|
+
export function Spinner({ size = ICON_SIZE, label, className }) {
|
|
5
|
+
return (_jsx("span", { className: `ctl-spinner${className === undefined ? '' : ` ${className}`}`, role: label === undefined ? 'presentation' : 'status', "aria-label": label, children: _jsx(SpinnerIcon, { size: size }) }));
|
|
6
|
+
}
|
|
7
|
+
/** A centred spinner and a line, for a panel that has nothing to show yet. */
|
|
8
|
+
export function Loading({ children = 'Loading…', className, theme = 'light' }) {
|
|
9
|
+
return (_jsxs("div", { className: `ctl ctl-loading${className === undefined ? '' : ` ${className}`}`, "data-ctl-theme": theme, role: "status", children: [_jsx(Spinner, {}), children] }));
|
|
10
|
+
}
|
|
11
|
+
/** One shimmering block, the shape of the thing that is coming. */
|
|
12
|
+
export function Skeleton({ width = '100%', height = '12px', className }) {
|
|
13
|
+
return (_jsx("span", { className: `ctl-skeleton${className === undefined ? '' : ` ${className}`}`, style: { display: 'block', width, height }, "aria-hidden": "true" }));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A table's worth of skeleton rows.
|
|
17
|
+
*
|
|
18
|
+
* Sized like the table it replaces so the page does not jump when the rows
|
|
19
|
+
* arrive — which is the entire argument for a skeleton over a spinner, and the
|
|
20
|
+
* reason the header row is drawn too.
|
|
21
|
+
*/
|
|
22
|
+
export function TableSkeleton({ rows = 5, columns = 4, className, theme = 'light' }) {
|
|
23
|
+
return (_jsx("div", { className: `ctl ctl-skeleton-table${className === undefined ? '' : ` ${className}`}`, "data-ctl-theme": theme, role: "status", "aria-label": "Loading", children: Array.from({ length: rows + 1 }, (_, row) => (_jsx("div", { className: "ctl-skeleton-row", children: Array.from({ length: columns }, (_, column) => (_jsx(Skeleton, { className: "ctl-skeleton-cell",
|
|
24
|
+
// Ragged on purpose: equal blocks read as a progress bar.
|
|
25
|
+
width: column === 0 ? '60%' : column === columns - 1 ? '40%' : '80%' }, column))) }, row))) }));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The empty state.
|
|
29
|
+
*
|
|
30
|
+
* An empty list rendering as blank space is a bug: it leaves somebody unable to
|
|
31
|
+
* tell a screen that is working from one that is broken. Say what this place is
|
|
32
|
+
* for and offer the action that fills it — and where the emptiness is a filter
|
|
33
|
+
* rather than an absence, say *that*, because the way out is different.
|
|
34
|
+
*/
|
|
35
|
+
export function EmptyState({ title, lead, action, icon: Icon = EmptyIcon, className, theme = 'light', }) {
|
|
36
|
+
return (_jsxs("div", { className: `ctl ctl-empty${className === undefined ? '' : ` ${className}`}`, "data-ctl-theme": theme, children: [_jsx("span", { className: "ctl-empty-icon", "aria-hidden": "true", children: _jsx(Icon, { size: 20 }) }), _jsx("p", { className: "ctl-empty-title", children: title }), lead !== undefined && _jsx("p", { className: "ctl-empty-lead", children: lead }), action !== undefined && _jsx("div", { className: "ctl-empty-action", children: action })] }));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=states.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"states.js","sourceRoot":"","sources":["../src/states.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAsB/D,4DAA4D;AAC5D,MAAM,UAAU,OAAO,CAAC,EAAE,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS,EAAgB;IAC1E,OAAO,CACL,eACE,SAAS,EAAE,cAAc,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,EAAE,EACzE,IAAI,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,gBACzC,KAAK,YAEjB,KAAC,WAAW,IAAC,IAAI,EAAE,IAAI,GAAI,GACtB,CACR,CAAC;AACJ,CAAC;AASD,8EAA8E;AAC9E,MAAM,UAAU,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,EAAE,SAAS,EAAE,KAAK,GAAG,OAAO,EAAgB;IACzF,OAAO,CACL,eACE,SAAS,EAAE,kBAAkB,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,E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