@inglorious/ui 9.9.0 → 9.10.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.
Files changed (43) hide show
  1. package/package.json +29 -3
  2. package/src/controls/checkbox/template.js +3 -1
  3. package/src/controls/chip-picker/chip-picker.stories.js +22 -0
  4. package/src/controls/chip-picker/index.js +3 -0
  5. package/src/controls/chip-picker/style.css +26 -0
  6. package/src/controls/chip-picker/template.js +53 -0
  7. package/src/controls/combobox/handlers.js +83 -20
  8. package/src/controls/combobox/template.js +3 -1
  9. package/src/controls/controls.css +3 -2
  10. package/src/controls/radio-group/template.js +3 -1
  11. package/src/controls/rating/template.js +4 -1
  12. package/src/controls/select/template.js +6 -12
  13. package/src/controls/switch/template.js +3 -1
  14. package/src/data-display/badge/style.css +1 -0
  15. package/src/data-display/data-display.css +1 -0
  16. package/src/data-display/lightbox/index.js +3 -0
  17. package/src/data-display/lightbox/lightbox.stories.js +25 -0
  18. package/src/data-display/lightbox/style.css +97 -0
  19. package/src/data-display/lightbox/template.js +153 -0
  20. package/src/feedback/confirm-dialog/confirm-dialog.stories.js +33 -0
  21. package/src/feedback/confirm-dialog/index.js +3 -0
  22. package/src/feedback/confirm-dialog/style.css +16 -0
  23. package/src/feedback/confirm-dialog/template.js +70 -0
  24. package/src/feedback/crop-dialog/index.js +3 -0
  25. package/src/feedback/crop-dialog/style.css +43 -0
  26. package/src/feedback/crop-dialog/template.js +82 -0
  27. package/src/feedback/dialog/style.css +2 -1
  28. package/src/feedback/dialog/template.js +5 -2
  29. package/src/feedback/feedback.css +3 -0
  30. package/src/feedback/load-status/index.js +3 -0
  31. package/src/feedback/load-status/load-status.stories.js +16 -0
  32. package/src/feedback/load-status/style.css +10 -0
  33. package/src/feedback/load-status/template.js +43 -0
  34. package/src/index.js +5 -0
  35. package/src/shared/icons.js +12 -0
  36. package/src/shared/live-boolean.js +17 -0
  37. package/types/controls/chip-picker.d.ts +23 -0
  38. package/types/controls/combobox.d.ts +20 -2
  39. package/types/data-display/lightbox.d.ts +35 -0
  40. package/types/feedback/confirm-dialog.d.ts +34 -0
  41. package/types/feedback/crop-dialog.d.ts +35 -0
  42. package/types/feedback/load-status.d.ts +22 -0
  43. package/types/index.d.ts +17 -0
@@ -0,0 +1,35 @@
1
+ import type { TemplateResult, nothing } from "@inglorious/web"
2
+
3
+ export interface LightboxImage {
4
+ src: string
5
+ /** Defaults to empty, for images the page describes already. */
6
+ alt?: string
7
+ }
8
+
9
+ export interface LightboxProps {
10
+ id?: string
11
+ /** URLs, or `{ src, alt }`. Renders nothing when empty. */
12
+ images?: (string | LightboxImage)[]
13
+ /** The image shown. Any integer: it wraps around. */
14
+ index?: number
15
+ isOpen?: boolean
16
+ /** The dialog's accessible name. Defaults to `"Photos"`. */
17
+ label?: string
18
+ /** Defaults to `"Close"`. */
19
+ closeLabel?: string
20
+ /** Defaults to `"Previous photo"`. */
21
+ previousLabel?: string
22
+ /** Defaults to `"Next photo"`. */
23
+ nextLabel?: string
24
+ className?: string
25
+ /** `1` for the next image, `-1` for the previous. Without it there is no navigation. */
26
+ onStep?: (step: 1 | -1) => void
27
+ /** Called by the close button, Esc and a press outside the image. */
28
+ onClose?: () => void
29
+ }
30
+
31
+ export type LightboxType = {
32
+ render(props: LightboxProps): TemplateResult | typeof nothing
33
+ }
34
+
35
+ export declare const Lightbox: LightboxType
@@ -0,0 +1,34 @@
1
+ import type { TemplateResult } from "@inglorious/web"
2
+
3
+ import type { Renderable } from "../shared/renderable"
4
+
5
+ export interface ConfirmDialogProps {
6
+ id?: string
7
+ isOpen?: boolean
8
+ /** The question, such as "Delete this event?". */
9
+ message?: TemplateResult | string | number
10
+ /** Anything more to show under the message, such as an error. */
11
+ children?: Renderable
12
+ confirmLabel: string
13
+ /** The confirm button's text while `isBusy`. Defaults to `confirmLabel`. */
14
+ busyLabel?: string
15
+ /** Defaults to `"Cancel"`. */
16
+ cancelLabel?: string
17
+ /** The close button's accessible name. Defaults to `"Close"`. */
18
+ closeLabel?: string
19
+ /** `"danger"` (default) for an action that cannot be undone, `"primary"` otherwise. */
20
+ tone?: "danger" | "primary"
21
+ /** The action is running: nothing can be pressed and the sheet stays open. */
22
+ isBusy?: boolean
23
+ isDisabled?: boolean
24
+ className?: string
25
+ onConfirm?: () => void
26
+ /** Called by the cancel button, Esc and the backdrop. */
27
+ onCancel?: () => void
28
+ }
29
+
30
+ export type ConfirmDialogType = {
31
+ render(props: ConfirmDialogProps): TemplateResult
32
+ }
33
+
34
+ export declare const ConfirmDialog: ConfirmDialogType
@@ -0,0 +1,35 @@
1
+ import type { Api, TemplateResult } from "@inglorious/web"
2
+
3
+ import type { CropRect } from "../controls/image-cropper"
4
+
5
+ export interface CropDialogProps {
6
+ id?: string
7
+ isOpen?: boolean
8
+ /** The id of the ImageCropper entity to show. */
9
+ cropperId: string
10
+ title?: TemplateResult | string
11
+ description?: TemplateResult | string
12
+ /** Defaults to `"Apply"`. */
13
+ applyLabel?: string
14
+ /** The apply button's text while `isSaving`. Defaults to `"Saving…"`. */
15
+ savingLabel?: string
16
+ /** Defaults to `"Cancel"`. */
17
+ cancelLabel?: string
18
+ /** The close button's accessible name. Defaults to `"Close"`. */
19
+ closeLabel?: string
20
+ /** Shown when the cropper cannot load its image. */
21
+ loadErrorText?: string
22
+ /** An error of the caller's, such as a failed upload. Wins over `loadErrorText`. */
23
+ error?: TemplateResult | string | null
24
+ isSaving?: boolean
25
+ className?: string
26
+ onCancel?: () => void
27
+ /** Receives the cropper's `rect`. */
28
+ onApply?: (rect: CropRect) => void
29
+ }
30
+
31
+ export type CropDialogType = {
32
+ render(props: CropDialogProps, api: Api): TemplateResult
33
+ }
34
+
35
+ export declare const CropDialog: CropDialogType
@@ -0,0 +1,22 @@
1
+ import type { Renderable } from "../shared/renderable"
2
+
3
+ export interface LoadStatusProps {
4
+ isError?: boolean
5
+ error?: Renderable
6
+ isLoading?: boolean
7
+ /** Replaces the circular progress, such as with the app's own animation. */
8
+ loader?: Renderable
9
+ /** The progress indicator's accessible name. Defaults to `"Loading…"`. */
10
+ loadingLabel?: string
11
+ isEmpty?: boolean
12
+ emptyText?: Renderable
13
+ /** What to render when there is no status to show. Runs only then, so it can read data still loading. */
14
+ content?: () => Renderable
15
+ className?: string
16
+ }
17
+
18
+ export type LoadStatusType = {
19
+ render(props: LoadStatusProps): Renderable
20
+ }
21
+
22
+ export declare const LoadStatus: LoadStatusType
package/types/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { Button } from "./controls/button"
2
2
  export { ButtonGroup } from "./controls/button-group"
3
3
  export { Checkbox } from "./controls/checkbox"
4
+ export { ChipPicker } from "./controls/chip-picker"
4
5
  export { Fab } from "./controls/fab"
5
6
  export { FileUpload } from "./controls/file-upload"
6
7
  export { IconButton } from "./controls/icon-button"
@@ -18,6 +19,7 @@ export { BeforeAfter } from "./data-display/before-after"
18
19
  export { Carousel } from "./data-display/carousel"
19
20
  export { Chat } from "./data-display/chat"
20
21
  export { Chip } from "./data-display/chip"
22
+ export { Lightbox } from "./data-display/lightbox"
21
23
  export { DataGrid } from "./data-display/data-grid"
22
24
  export { Divider } from "./data-display/divider"
23
25
  export { Icon } from "./data-display/icon"
@@ -28,7 +30,10 @@ export { Typography } from "./data-display/typography"
28
30
  export { VirtualList } from "./data-display/virtual-list"
29
31
  export { Alert } from "./feedback/alert"
30
32
  export { Backdrop } from "./feedback/backdrop"
33
+ export { ConfirmDialog } from "./feedback/confirm-dialog"
34
+ export { CropDialog } from "./feedback/crop-dialog"
31
35
  export { Dialog } from "./feedback/dialog"
36
+ export { LoadStatus } from "./feedback/load-status"
32
37
  export { Progress } from "./feedback/progress"
33
38
  export { Skeleton } from "./feedback/skeleton"
34
39
  export { Snackbar } from "./feedback/snackbar"
@@ -53,6 +58,7 @@ export { Paper } from "./surfaces/paper"
53
58
  export type { ButtonProps, ButtonType } from "./controls/button"
54
59
  export type { ButtonGroupProps, ButtonGroupType } from "./controls/button-group"
55
60
  export type { CheckboxProps, CheckboxType } from "./controls/checkbox"
61
+ export type { ChipPickerProps, ChipPickerType } from "./controls/chip-picker"
56
62
  export type {
57
63
  ComboboxProps,
58
64
  ComboboxType,
@@ -119,6 +125,11 @@ export type { PaperProps, PaperType } from "./surfaces/paper"
119
125
  export type { AvatarProps, AvatarType } from "./data-display/avatar"
120
126
  export type { BadgeProps, BadgeType } from "./data-display/badge"
121
127
  export type { ChipProps, ChipType } from "./data-display/chip"
128
+ export type {
129
+ LightboxImage,
130
+ LightboxProps,
131
+ LightboxType,
132
+ } from "./data-display/lightbox"
122
133
  export type {
123
134
  DataGridProps,
124
135
  DataGridType,
@@ -148,7 +159,13 @@ export type {
148
159
  } from "./data-display/typography"
149
160
  export type { AlertProps, AlertType } from "./feedback/alert"
150
161
  export type { BackdropProps, BackdropType } from "./feedback/backdrop"
162
+ export type {
163
+ ConfirmDialogProps,
164
+ ConfirmDialogType,
165
+ } from "./feedback/confirm-dialog"
166
+ export type { CropDialogProps, CropDialogType } from "./feedback/crop-dialog"
151
167
  export type { DialogProps, DialogType } from "./feedback/dialog"
168
+ export type { LoadStatusProps, LoadStatusType } from "./feedback/load-status"
152
169
  export type { ProgressProps, ProgressType } from "./feedback/progress"
153
170
  export type { SkeletonProps, SkeletonType } from "./feedback/skeleton"
154
171
  export type { SnackbarProps, SnackbarType } from "./feedback/snackbar"