@tempoxyz/ds 3.2.20261201001603 → 3.3.20261201015246

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@tempoxyz/ds",
3
3
  "type": "module",
4
- "version": "3.2.20261201001603",
4
+ "version": "3.3.20261201015246",
5
5
  "license": "MIT",
6
6
  "files": [
7
7
  "DESIGN.md",
@@ -1513,5 +1513,5 @@
1513
1513
  "main": "./dist/web/index.js",
1514
1514
  "module": "./dist/web/index.js",
1515
1515
  "types": "./dist/web/index.d.ts",
1516
- "gitHead": "0c28a00a1689db3102492146fe9981261a140fe1"
1516
+ "gitHead": "dbdbc88e2cb66028e83dfbcfa2933920705368ef"
1517
1517
  }
@@ -1,36 +1,49 @@
1
- /** Renders a partner's mark on a square tile in its brand color. @module */
1
+ /** Renders a glyph, icon, or mark on a square decorative tile in a surface tone or an accent color. @module */
2
2
  import type { ComponentPropsWithRef } from 'react'
3
3
  import type * as zyzz from 'zyzz'
4
4
  import { variants } from '../zyzz.config.js'
5
5
 
6
6
  /**
7
- * A partner's own mark on a square tile in its brand color: 40px on cards and rows, or 64px beside
8
- * a profile's title. The mark, an `img` or an inline SVG, fills the whole tile, so it sits where
9
- * its drawing puts it. A tile without a `color` keeps the 4% grey. It is decorative and always
10
- * hidden from assistive technology, so the partner's name follows it as text. Forced colors leave
11
- * the tile and its mark as they are, as they leave an image. It has no states or motion.
7
+ * A glyph, icon, or mark on a square tile: 40px in cards and rows, or 64px beside a title. The tile
8
+ * is decorative. It is always hidden from assistive technology and never takes focus, so a label
9
+ * beside it carries its meaning. It has no states or motion, and forced colors leave it as they
10
+ * leave an image.
12
11
  *
13
- * - Set `color` to the partner's brand color, and `mark` to `light` when the tile is dark, so an
14
- * inline SVG drawn in `currentColor` turns white.
15
- * - Use the partner's own vector mark, never a traced picture.
12
+ * - Set `tone` to one of the surfaces, the 4% `grey` by default. Set `color` to an accent, such as
13
+ * `accent.blue`, or to any CSS color. A `color` replaces the tone.
14
+ * - Set `mark` to `light` on a dark `color`, so content drawn in `currentColor` turns white. An
15
+ * `inverse` tile turns it white without it.
16
+ * - A child without its own `width`, such as an `img` or an inline SVG, fills the whole tile. A child
17
+ * with one, such as a Tempo icon at its `size`, sits at that size in the tile's center.
16
18
  * - Use `Logo` or `Mark` for Tempo's own marks.
17
19
  *
18
20
  * @example
19
- * <SymbolTile color="#363ff9" mark="light">
20
- * <img alt="" src="/partners/alchemy.svg" />
21
+ * <SymbolTile color="accent.blue" mark="light">
22
+ * <GlobeIcon size={20} />
21
23
  * </SymbolTile>
22
24
  */
23
25
  export function SymbolTile(props: SymbolTile.Props) {
24
- const { className, color, mark, size, vars, ...attributes } = props
26
+ const { className, color, mark, size, tone, vars, ...attributes } = props
27
+
28
+ // A color replaces the tone, so an outline's hairline never frames an accent. An accent compiles
29
+ // ahead of time to its variable, and any other color paints inline.
30
+ const fill = color === undefined ? tone : undefined
31
+ const accent = color?.startsWith('accent.') ? (color.slice(7) as SymbolTile.Hue) : undefined
32
+ const style =
33
+ color === undefined || accent !== undefined
34
+ ? props.style
35
+ : { backgroundColor: color, ...props.style }
25
36
 
26
37
  return (
27
38
  <span
28
39
  {...attributes}
29
40
  {...styles.root({
41
+ accent,
30
42
  className,
31
- mark,
43
+ mark: mark ?? (fill === 'inverse' ? 'light' : 'dark'),
32
44
  size,
33
- style: color === undefined ? props.style : { backgroundColor: color, ...props.style },
45
+ style,
46
+ tone: fill,
34
47
  vars,
35
48
  })}
36
49
  aria-hidden="true"
@@ -39,10 +52,16 @@ export function SymbolTile(props: SymbolTile.Props) {
39
52
  }
40
53
 
41
54
  export namespace SymbolTile {
55
+ /** A Marketing accent hue, such as `blue`. */
56
+ export type Hue = NonNullable<zyzz.Props.Variants<typeof styles.root>['accent']>
57
+
42
58
  export type Props = Omit<ComponentPropsWithRef<'span'>, 'aria-hidden' | 'color'> &
43
- zyzz.Props.Variants<typeof styles.root> & {
44
- /** The partner's brand color, such as `#363ff9`. Without it, the tile keeps the 4% grey. */
45
- color?: string | undefined
59
+ Omit<zyzz.Props.Variants<typeof styles.root>, 'accent'> & {
60
+ /**
61
+ * The tile's color in place of its `tone`: a Marketing accent, such as `accent.blue`, or any
62
+ * CSS color, such as `#363ff9`. Absent by default, so the tile takes its `tone`.
63
+ */
64
+ color?: `accent.${Hue}` | (string & {}) | undefined
46
65
  }
47
66
  }
48
67
 
@@ -50,31 +69,47 @@ namespace styles {
50
69
  export const root = variants(
51
70
  {
52
71
  base: {
72
+ alignItems: 'center',
53
73
  backgroundColor: 'container.control',
54
- display: 'block',
74
+ boxSizing: 'border-box',
75
+ display: 'grid',
55
76
  flexShrink: 0,
56
77
  forcedColorAdjust: 'none',
78
+ justifyItems: 'center',
57
79
  overflow: 'hidden',
58
- // The mark is drawn across the whole tile.
59
80
  selectors: {
60
- '& > *': { display: 'block', height: 'full', width: 'full' },
81
+ '& > *': { display: 'block' },
82
+ // Content without its own width, such as a mark drawn on its own frame, fills the tile.
83
+ '& > :not([width])': { height: 'full', width: 'full' },
61
84
  },
62
85
  },
63
- defaultVariants: { mark: 'dark', size: 'small' },
86
+ defaultVariants: { mark: 'dark', size: 'small', tone: 'grey' },
64
87
  variants: {
88
+ // The accents a `color` names, painted ahead of time from their variables.
89
+ accent: {
90
+ blue: { backgroundColor: 'accent.blue' },
91
+ cyan: { backgroundColor: 'accent.cyan' },
92
+ green: { backgroundColor: 'accent.green' },
93
+ magenta: { backgroundColor: 'accent.magenta' },
94
+ olive: { backgroundColor: 'accent.olive' },
95
+ orange: { backgroundColor: 'accent.orange' },
96
+ purple: { backgroundColor: 'accent.purple' },
97
+ red: { backgroundColor: 'accent.red' },
98
+ violet: { backgroundColor: 'accent.violet' },
99
+ },
65
100
  /**
66
- * The color a one-color mark drawn in `currentColor` takes: black on a light tile, or white
67
- * on a dark one. A mark in its own colors keeps them.
101
+ * The color content drawn in `currentColor` takes: black on a light tile, or white on a dark
102
+ * one. Content in its own colors keeps them.
68
103
  *
69
- * @default 'dark'
104
+ * @default 'dark', or 'light' on an `inverse` tone
70
105
  */
71
106
  mark: {
72
107
  dark: { color: 'neutral.100' },
73
108
  light: { color: 'neutral.000' },
74
109
  },
75
110
  /**
76
- * The tile's size: `small` is 40px with 8px corners on cards and rows, and `large` 64px with
77
- * 12px corners beside a profile's title.
111
+ * The tile's size: `small` is 40px with 8px corners in cards and rows, and `large` is 64px
112
+ * with 12px corners beside a title.
78
113
  *
79
114
  * @default 'small'
80
115
  */
@@ -82,6 +117,23 @@ namespace styles {
82
117
  large: { borderRadius: 'md', height: '64', width: '64' },
83
118
  small: { borderRadius: 'sm', height: '40', width: '40' },
84
119
  },
120
+ /**
121
+ * The tile's surface: the 4% `grey`, `white`, an `outline` hairline on no fill, or black for
122
+ * `inverse`. A `color` replaces it.
123
+ *
124
+ * @default 'grey'
125
+ */
126
+ tone: {
127
+ grey: {},
128
+ inverse: { backgroundColor: 'inverse.background.primary' },
129
+ outline: {
130
+ backgroundColor: 'transparent',
131
+ borderColor: 'line.primary',
132
+ borderStyle: 'solid',
133
+ borderWidth: 'regular',
134
+ },
135
+ white: { backgroundColor: 'background.secondary' },
136
+ },
85
137
  },
86
138
  },
87
139
  { id: 'tds/marketing/symbol-tile' },