@trypattern/sdk 0.1.35 → 0.1.36

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.
@@ -90,7 +90,7 @@ const styles = stylex.create({
90
90
  display: 'flex',
91
91
  flexDirection: 'column',
92
92
  gap: space.xxs,
93
- width: `calc(7 * (${space.xxxl} - ${space.xs}))`
93
+ width: '100%'
94
94
  },
95
95
  header: {
96
96
  display: 'flex',
@@ -139,7 +139,7 @@ const styles = stylex.create({
139
139
  },
140
140
  row: {
141
141
  display: 'grid',
142
- gridTemplateColumns: `repeat(7, calc(${space.xxxl} - ${space.xs}))`
142
+ gridTemplateColumns: 'repeat(7, minmax(0, 1fr))'
143
143
  },
144
144
  weekday: {
145
145
  display: 'flex',
@@ -153,15 +153,15 @@ const styles = stylex.create({
153
153
  },
154
154
  cell: {
155
155
  display: 'flex',
156
- width: `calc(${space.xxxl} - ${space.xs})`,
157
- height: `calc(${space.xxxl} - ${space.xs})`
156
+ justifyContent: 'center'
158
157
  },
159
158
  day: {
160
159
  display: 'flex',
161
160
  alignItems: 'center',
162
161
  justifyContent: 'center',
163
162
  width: '100%',
164
- height: '100%',
163
+ maxWidth: `calc(${space.xxxl} - ${space.xs})`,
164
+ aspectRatio: '1',
165
165
  fontSize: fontSizes.bodyMd,
166
166
  lineHeight: lineHeights.bodySm,
167
167
  outlineOffset: 0,
@@ -15,7 +15,7 @@ export function Choice({ value, title, label, subline, isDisabled = false, child
15
15
  !state.disabled &&
16
16
  styles.faded, state.disabled && styles.disabled, isPhoto && styles.photo, focusRing.visible).className, children: [children === undefined ? null : (_jsx("span", { ...stylex.props(styles.content, isPhoto && styles.photoContent), children: children })), title === undefined ? null : (_jsx("span", { ...stylex.props(styles.title), children: title })), subline === undefined ? null : (_jsx("span", { ...stylex.props(styles.subline, isDisabled && styles.sublineDisabled), children: subline }))] }));
17
17
  }
18
- const checkedRing = `inset 0 0 0 ${borders.thin} ${colors.borderInverted}, 0 0 0 ${borders.thin} ${colors.borderInverted}`;
18
+ const checkedRing = `inset 0 0 0 ${borders.thin} ${colors.borderInverted}`;
19
19
  const styles = stylex.create({
20
20
  choice: {
21
21
  display: 'flex',
@@ -48,7 +48,7 @@ const styles = stylex.create({
48
48
  backgroundColor: colors.containerRecessed,
49
49
  borderColor: colors.borderStrong,
50
50
  borderStyle: 'dashed',
51
- borderWidth: `calc(${borders.thin} + ${borders.hairline})`,
51
+ borderWidth: borders.thin,
52
52
  borderRadius: radii.lg,
53
53
  transitionTimingFunction: motion.easeOut,
54
54
  transitionDuration: motion.fast,
@@ -6,7 +6,7 @@ export type SidebarLink = {
6
6
  to: AppPath;
7
7
  icon: IconName;
8
8
  count?: number | null;
9
- countTone?: 'quiet' | 'brand';
9
+ countTone?: 'quiet' | 'attention';
10
10
  };
11
11
  type SidebarProps = {
12
12
  workspace: string;
@@ -17,7 +17,7 @@ export function Sidebar({ workspace, workspaceMenu, links, isToggled, isAnimatin
17
17
  };
18
18
  return (_jsxs("nav", { ...stylex.props(styles.sidebar, isToggled && styles.sidebarToggled, isAnimating && styles.sidebarAnimating), children: [_jsx("div", { ...stylex.props(styles.header), children: _jsx(Menu, { trigger: _jsxs(_Fragment, { children: [_jsx("span", { ...stylex.props(styles.logo), children: _jsx(Text, { variant: "caption", children: workspace.charAt(0) }) }), _jsx(Text, { variant: "label", isTruncated: true, children: workspace }), _jsx(Icon, { name: "chevronDown" })] }), items: workspaceMenu }) }), onSearch === undefined ? null : (_jsx(Button, { variant: "secondary", icon: "search", shortcut: ['mod', 'k'], isFullWidth: true, align: "start", onClick: onSearch, children: "Search" })), _jsx("div", { ...stylex.props(styles.body), children: _jsx(ScrollArea, { children: _jsxs("div", { ...stylex.props(styles.group), children: [_jsx("span", { ...stylex.props(styles.groupLabel), children: _jsx(Text, { variant: "label", tone: "tertiary", children: "Workspace" }) }), links.map((item) => (_jsxs(NavLink, { onClick: () => followLink(item), to: item.to, end: item.to === '/' ||
19
19
  links.some((other) => String(other.to).startsWith(`${String(item.to)}/`)), className: ({ isActive }) => stylex.props(styles.item, isActive && styles.itemCurrent, focusRing.visible, focusRing.inside).className ?? '', children: [_jsx(Icon, { name: item.icon }), _jsx(Text, { variant: "label", isTruncated: true, style: styles.itemLabel, children: item.label }), typeof item.count !== 'number' ? null : item.countTone ===
20
- 'brand' ? (_jsx("span", { ...stylex.props(styles.count), children: item.count })) : (_jsx(Badge, { variant: "transparent", children: item.count }))] }, item.to)))] }) }) })] }));
20
+ 'attention' ? (_jsx("span", { ...stylex.props(styles.count), children: item.count })) : (_jsx(Badge, { variant: "transparent", children: item.count }))] }, item.to)))] }) }) })] }));
21
21
  }
22
22
  const styles = stylex.create({
23
23
  sidebar: {
@@ -138,14 +138,14 @@ const styles = stylex.create({
138
138
  flexShrink: 0,
139
139
  alignItems: 'center',
140
140
  justifyContent: 'center',
141
- minWidth: `calc(${space.lg} + ${space.xxs})`,
142
- height: `calc(${space.lg} + ${space.xxs})`,
143
- paddingInline: `calc(${space.xs} + ${space.xxs} / 2)`,
144
- fontSize: fontSizes.captionSm,
141
+ minWidth: space.lg,
142
+ height: space.lg,
143
+ paddingInline: space.xs,
144
+ fontSize: fontSizes.badge,
145
145
  fontWeight: fontWeights.medium,
146
146
  lineHeight: lineHeights.caption,
147
- color: colors.onBrandSolidForeground,
148
- backgroundColor: colors.brandSolid,
147
+ color: colors.onAttentionSolidForeground,
148
+ backgroundColor: colors.attentionSolid,
149
149
  borderRadius: radii.full
150
150
  },
151
151
  itemLabel: {
@@ -21,7 +21,7 @@ const styles = stylex.create({
21
21
  textAlign: 'start',
22
22
  backgroundColor: {
23
23
  default: 'transparent',
24
- ':hover': colors.transparentHover
24
+ ':hover': colors.componentOnContainerStrongHover
25
25
  },
26
26
  borderBottomColor: {
27
27
  default: colors.borderDefault,
@@ -34,6 +34,6 @@ const styles = stylex.create({
34
34
  height: `calc(${space.xxxl} + ${space.sm})`
35
35
  },
36
36
  current: {
37
- backgroundColor: colors.transparentHover
37
+ backgroundColor: colors.componentOnContainerStrongHover
38
38
  }
39
39
  });
@@ -374,6 +374,7 @@ const hoverUsesHighlight = styleRule((declarations) => declarations
374
374
  (SELECTED_STYLE_NAME.test(d.styleName) &&
375
375
  d.conditions.length === 0)) &&
376
376
  !isMember(d.value, 'colors', 'transparentHover') &&
377
+ !isMember(d.value, 'colors', 'componentOnContainerStrongHover') &&
377
378
  !(!SELECTED_STYLE_NAME.test(d.styleName) && isButtonStateToken(d.value)) &&
378
379
  !(d.value.type === 'Literal' && d.value['value'] === null))
379
380
  .map((d) => ({
@@ -5,7 +5,7 @@ export declare const NO_POINTER_CURSOR_MESSAGE = "cursor: pointer is not allowed
5
5
  export declare const USE_COLOR_TOKEN_MESSAGE = "Raw colors are not allowed in styles. Use a token from @trypattern/sdk/tokens.stylex (colors.*). To change what a token looks like in this app, re-value it in src/theme/theme.ts, the one file where raw colors are allowed. Keywords like transparent and currentColor are fine.";
6
6
  export declare const USE_FONT_TOKEN_MESSAGE = "Raw font sizes, families and weights are not allowed in styles. Use fontSizes.*, fonts.* or fontWeights.* from @trypattern/sdk/tokens.stylex; to change a font or a size for the whole app, re-value it in src/theme/theme.ts. Text inherits Inter 13px/20px (15px/24px on phones) from <body>, so most styles need no font properties at all.";
7
7
  export declare const NO_INTERACTIVE_TRANSITION_MESSAGE = "Hover and press transitions use the motion tokens, as Interfere does: motion.fast with motion.easeOut for buttons, motion.instant for fields, motion.base for segmented controls. Never a raw duration or easing, so every control responds at the same speed. Navigation items change instantly with no transition.";
8
- export declare const HOVER_USES_HIGHLIGHT_MESSAGE = "Hover, active and selected backgrounds must be colors.transparentHover (with radii.md), so hovering then selecting an item never flashes a second color. Styles named *Active, *Selected or *Current count as selected. Buttons and switches, which have no selected state, may instead use their own colors.*Hover and colors.*Active tokens.";
8
+ export declare const HOVER_USES_HIGHLIGHT_MESSAGE = "Hover, active and selected backgrounds must be colors.transparentHover (with radii.md), or colors.componentOnContainerStrongHover for rows on a white card, so hovering then selecting an item never flashes a second color. Styles named *Active, *Selected or *Current count as selected. Buttons and switches, which have no selected state, may instead use their own colors.*Hover and colors.*Active tokens.";
9
9
  export declare const SCROLL_VIEW_ONLY_MESSAGE = "Only ScrollArea may scroll (overflow auto/scroll). The page itself never scrolls or bounces in Pattern; wrap scrollable content in <ScrollArea> from @trypattern/sdk/react.";
10
10
  export declare const SELECTABLE_ONLY_MESSAGE = "Do not set userSelect. Text is not selectable by default in Pattern (inputs and editable fields are). For words people need to copy, write <Text isSelectable> from @trypattern/sdk/react.";
11
11
  export declare const USE_BREAKPOINTS_MESSAGE = "Media queries come from breakpoints in @trypattern/sdk/tokens.stylex, e.g. [breakpoints.compact]: value, so every screen adapts at the same sizes.";
@@ -5,7 +5,7 @@ export const NO_POINTER_CURSOR_MESSAGE = 'cursor: pointer is not allowed in Patt
5
5
  export const USE_COLOR_TOKEN_MESSAGE = 'Raw colors are not allowed in styles. Use a token from @trypattern/sdk/tokens.stylex (colors.*). To change what a token looks like in this app, re-value it in src/theme/theme.ts, the one file where raw colors are allowed. Keywords like transparent and currentColor are fine.';
6
6
  export const USE_FONT_TOKEN_MESSAGE = 'Raw font sizes, families and weights are not allowed in styles. Use fontSizes.*, fonts.* or fontWeights.* from @trypattern/sdk/tokens.stylex; to change a font or a size for the whole app, re-value it in src/theme/theme.ts. Text inherits Inter 13px/20px (15px/24px on phones) from <body>, so most styles need no font properties at all.';
7
7
  export const NO_INTERACTIVE_TRANSITION_MESSAGE = 'Hover and press transitions use the motion tokens, as Interfere does: motion.fast with motion.easeOut for buttons, motion.instant for fields, motion.base for segmented controls. Never a raw duration or easing, so every control responds at the same speed. Navigation items change instantly with no transition.';
8
- export const HOVER_USES_HIGHLIGHT_MESSAGE = 'Hover, active and selected backgrounds must be colors.transparentHover (with radii.md), so hovering then selecting an item never flashes a second color. Styles named *Active, *Selected or *Current count as selected. Buttons and switches, which have no selected state, may instead use their own colors.*Hover and colors.*Active tokens.';
8
+ export const HOVER_USES_HIGHLIGHT_MESSAGE = 'Hover, active and selected backgrounds must be colors.transparentHover (with radii.md), or colors.componentOnContainerStrongHover for rows on a white card, so hovering then selecting an item never flashes a second color. Styles named *Active, *Selected or *Current count as selected. Buttons and switches, which have no selected state, may instead use their own colors.*Hover and colors.*Active tokens.';
9
9
  export const SCROLL_VIEW_ONLY_MESSAGE = 'Only ScrollArea may scroll (overflow auto/scroll). The page itself never scrolls or bounces in Pattern; wrap scrollable content in <ScrollArea> from @trypattern/sdk/react.';
10
10
  export const SELECTABLE_ONLY_MESSAGE = 'Do not set userSelect. Text is not selectable by default in Pattern (inputs and editable fields are). For words people need to copy, write <Text isSelectable> from @trypattern/sdk/react.';
11
11
  export const USE_BREAKPOINTS_MESSAGE = 'Media queries come from breakpoints in @trypattern/sdk/tokens.stylex, e.g. [breakpoints.compact]: value, so every screen adapts at the same sizes.';
@@ -9,6 +9,7 @@ export declare const breakpoints: {
9
9
  coarsePointer: string;
10
10
  };
11
11
  export declare const colors: stylex.VarGroup<Readonly<{
12
+ attentionSolid: string;
12
13
  blackFill: string;
13
14
  blackTransparent: string;
14
15
  borderDefault: string;
@@ -56,6 +57,7 @@ export declare const colors: stylex.VarGroup<Readonly<{
56
57
  invertedSolidHover: string;
57
58
  modal: string;
58
59
  onBrandSolidForeground: string;
60
+ onAttentionSolidForeground: string;
59
61
  onBrandSubtleForeground: string;
60
62
  onDangerSolidForeground: string;
61
63
  onDangerSubtleForeground: string;
@@ -184,6 +186,7 @@ export declare const corners: stylex.VarGroup<Readonly<{
184
186
  }>, symbol>;
185
187
  export declare const fontSizes: stylex.VarGroup<Readonly<{
186
188
  captionXs: string;
189
+ badge: string;
187
190
  captionSm: string;
188
191
  captionBase: string;
189
192
  captionLg: string;
@@ -7,6 +7,7 @@ export const breakpoints = stylex.defineConsts({
7
7
  coarsePointer: '@media (pointer: coarse)'
8
8
  });
9
9
  export const colors = stylex.defineVars({
10
+ attentionSolid: '#0090ff',
10
11
  blackFill: '#000',
11
12
  blackTransparent: '#0000',
12
13
  borderDefault: 'light-dark(#0000000f, #ffffff12)',
@@ -54,6 +55,7 @@ export const colors = stylex.defineVars({
54
55
  invertedSolidHover: 'light-dark(#000c, #fffc)',
55
56
  modal: 'light-dark(oklch(100% 0 0), oklch(25.2% 0 0))',
56
57
  onBrandSolidForeground: '#fff',
58
+ onAttentionSolidForeground: '#fff',
57
59
  onBrandSubtleForeground: 'light-dark(#0090ff, #70b8ff)',
58
60
  onDangerSolidForeground: 'light-dark(#fffcfc, #fff)',
59
61
  onDangerSubtleForeground: 'light-dark(#df2600d1, #ff977d)',
@@ -182,6 +184,7 @@ export const corners = stylex.defineVars({
182
184
  });
183
185
  export const fontSizes = stylex.defineVars({
184
186
  captionXs: '8px',
187
+ badge: '9px',
185
188
  captionSm: '10px',
186
189
  captionBase: '11px',
187
190
  captionLg: '12px',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trypattern/sdk",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",