shelving 1.260.1 → 1.260.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shelving",
3
- "version": "1.260.1",
3
+ "version": "1.260.3",
4
4
  "author": "Dave Houlbrooke <dave@shax.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -59,13 +59,13 @@
59
59
 
60
60
  /* Children */
61
61
  [data-slot="icon"] {
62
- flex: none;
63
62
  width: var(--size-icon);
64
63
  height: var(--size-icon);
65
64
  color: var(--color-gray);
66
65
  transform: rotate(180deg);
67
66
  transition: var(--details-transition, all var(--duration-fast));
68
67
  border-radius: var(--radius-xxsmall);
68
+ flex: none;
69
69
  }
70
70
  }
71
71
 
@@ -132,11 +132,6 @@
132
132
  margin: 0;
133
133
  outline: 0;
134
134
  }
135
- && > [data-slot="icon"] {
136
- inline-size: var(--input-icon-size, var(--size-icon));
137
- block-size: var(--input-icon-size, var(--size-icon));
138
- flex: none;
139
- }
140
135
 
141
136
  &.wrapper {
142
137
  position: relative;
package/ui/misc/Icon.d.ts CHANGED
@@ -1,15 +1,17 @@
1
1
  import type { ComponentType, ReactElement } from "react";
2
2
  import { type ColorVariants } from "../style/Color.js";
3
+ import type { SpaceVariants } from "../style/Space.js";
3
4
  import { type StatusVariants } from "../style/Status.js";
5
+ import type { TintVariant } from "../style/Tint.js";
4
6
  import { type SizeVariant } from "../style/Typography.js";
5
7
  /**
6
8
  * Props for `<Icon>` — the `status` to represent and optional icon `size`.
7
9
  *
8
10
  * @see https://shelving.cc/ui/IconProps
9
11
  */
10
- export interface IconProps extends ColorVariants, StatusVariants {
12
+ export interface IconProps extends ColorVariants, StatusVariants, SpaceVariants {
11
13
  /**
12
- * Set the icon to use. Defaults to appropriate icon matching for `status`
14
+ * Set the icon to use. Defaults to appropriate icon for `status`
13
15
  */
14
16
  icon?: ComponentType<{
15
17
  className?: string | undefined;
@@ -18,7 +20,12 @@ export interface IconProps extends ColorVariants, StatusVariants {
18
20
  * Size of the icon.
19
21
  * @default var(--size-icon)
20
22
  */
21
- size?: SizeVariant;
23
+ size?: SizeVariant | undefined;
24
+ /**
25
+ * Tint of the selected color.
26
+ * @default "50"
27
+ */
28
+ tint?: TintVariant | undefined;
22
29
  }
23
30
  /**
24
31
  * Render the icon for a given status, coloured to match.
@@ -4,15 +4,19 @@
4
4
 
5
5
  @layer defaults {
6
6
  .icon {
7
- font-size: var(--icon-size, var(--size-icon));
7
+ /* Box */
8
8
  width: 1em;
9
9
  height: 1em;
10
+ margin: 0;
11
+ padding: 0;
12
+
13
+ /* Style */
10
14
  color: var(--icon-color, var(--tint-50));
11
- }
12
- }
13
15
 
14
- @layer overrides {
15
- .icon {
16
+ /* Contents */
16
17
  flex: none;
18
+
19
+ /* Text */
20
+ font-size: var(--icon-size, var(--size-icon));
17
21
  }
18
22
  }
package/ui/misc/Icon.tsx CHANGED
@@ -1,7 +1,9 @@
1
1
  import { CheckCircleIcon, ExclamationTriangleIcon, InformationCircleIcon, XCircleIcon } from "@heroicons/react/24/solid";
2
2
  import type { ComponentType, ReactElement } from "react";
3
3
  import { type ColorVariants, getColorClass } from "../style/Color.js";
4
+ import type { SpaceVariants } from "../style/Space.js";
4
5
  import { getStatusClass, type Status, type StatusVariants } from "../style/Status.js";
6
+ import type { TintVariant } from "../style/Tint.js";
5
7
  import { getTypographyClass, type SizeVariant } from "../style/Typography.js";
6
8
  import { getClass, getModuleClass } from "../util/css.js";
7
9
  import ICON_CSS from "./Icon.module.css";
@@ -22,16 +24,21 @@ const STATUS_ICONS: {
22
24
  *
23
25
  * @see https://shelving.cc/ui/IconProps
24
26
  */
25
- export interface IconProps extends ColorVariants, StatusVariants {
27
+ export interface IconProps extends ColorVariants, StatusVariants, SpaceVariants {
26
28
  /**
27
- * Set the icon to use. Defaults to appropriate icon matching for `status`
29
+ * Set the icon to use. Defaults to appropriate icon for `status`
28
30
  */
29
31
  icon?: ComponentType<{ className?: string | undefined }>;
30
32
  /**
31
33
  * Size of the icon.
32
34
  * @default var(--size-icon)
33
35
  */
34
- size?: SizeVariant;
36
+ size?: SizeVariant | undefined;
37
+ /**
38
+ * Tint of the selected color.
39
+ * @default "50"
40
+ */
41
+ tint?: TintVariant | undefined;
35
42
  }
36
43
 
37
44
  /**
@@ -50,7 +57,7 @@ export function Icon(props: IconProps): ReactElement {
50
57
  getModuleClass(ICON_CSS, "icon"), //
51
58
  getColorClass(props),
52
59
  getStatusClass(props),
53
- getTypographyClass(props),
60
+ getTypographyClass(props), // Used for size and tint.
54
61
  )}
55
62
  />
56
63
  );
@@ -12,8 +12,9 @@
12
12
 
13
13
  /* Children */
14
14
  > [data-slot="icon"] {
15
- inline-size: var(--flex-icon-size, var(--size-icon));
16
- block-size: var(--flex-icon-size, var(--size-icon));
15
+ font-size: var(--size-icon);
16
+ inline-size: 1em;
17
+ block-size: 1em;
17
18
  flex: none;
18
19
  }
19
20