@okshaun/components 3.0.0 → 4.1.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.
Files changed (69) hide show
  1. package/dist/icon-metadata.json +359 -42
  2. package/dist/index.js +12890 -5844
  3. package/dist/index.js.map +1 -1
  4. package/dist/panda.buildinfo.json +523 -501
  5. package/dist/playroom-static.css +2 -2
  6. package/dist/{preset-BAn5LBiW.js → preset-CLoY9s9i.js} +2031 -2086
  7. package/dist/preset-CLoY9s9i.js.map +1 -0
  8. package/dist/preset.js +1 -1
  9. package/dist/specs/conditions.json +75 -51
  10. package/dist/specs/keyframes.json +22 -0
  11. package/dist/specs/recipes.json +222 -106
  12. package/dist/specs/semantic-tokens.json +194 -86
  13. package/dist/specs/tokens.json +16 -36
  14. package/dist/sprite.svg +1 -1
  15. package/dist/sprite.symbol.html +445 -44
  16. package/dist/styles.css +11441 -13424
  17. package/dist/svgs/cheese.svg +1 -0
  18. package/dist/svgs/collapse-vertical.svg +1 -0
  19. package/dist/svgs/expand-vertical.svg +1 -0
  20. package/dist/svgs/magnet.svg +1 -0
  21. package/dist/svgs/to-date-backward.svg +1 -0
  22. package/dist/svgs/to-date-forward.svg +1 -0
  23. package/dist/types/index.d.ts +2815 -288
  24. package/package.json +4 -2
  25. package/src/recipes/autocomplete.ts +266 -0
  26. package/src/recipes/badge.ts +25 -54
  27. package/src/recipes/button.ts +155 -316
  28. package/src/recipes/calendar.ts +91 -0
  29. package/src/recipes/card.ts +4 -70
  30. package/src/recipes/chip.ts +212 -266
  31. package/src/recipes/dateMenus.ts +40 -0
  32. package/src/recipes/dateTimeMenus.ts +43 -0
  33. package/src/recipes/formField.ts +1 -1
  34. package/src/recipes/kbd.ts +42 -39
  35. package/src/recipes/list.ts +11 -85
  36. package/src/recipes/listDensity.ts +66 -0
  37. package/src/recipes/listItem.ts +27 -166
  38. package/src/recipes/listItemGroup.ts +16 -16
  39. package/src/recipes/menu.ts +17 -3
  40. package/src/recipes/modal.ts +65 -65
  41. package/src/recipes/radio.ts +6 -6
  42. package/src/recipes/recipes-slot.ts +7 -2
  43. package/src/recipes/segmentedFields.ts +192 -0
  44. package/src/recipes/segmentedInputs.ts +109 -0
  45. package/src/recipes/tag.ts +218 -210
  46. package/src/recipes/text.ts +37 -19
  47. package/src/recipes/textInput.ts +103 -155
  48. package/src/recipes/themeSwitcher.ts +3 -3
  49. package/src/recipes/timeMenus.ts +110 -0
  50. package/src/recipes/toggle.ts +3 -1
  51. package/src/styles/primitives/shadows.ts +26 -60
  52. package/src/styles/primitives/zIndex.ts +1 -0
  53. package/src/styles/semantics/colors.ts +84 -37
  54. package/src/styles/semantics/shadows.ts +4 -30
  55. package/src/styles/semantics/zIndex.ts +2 -0
  56. package/src/styles/utilities/conditions.ts +61 -51
  57. package/src/styles/utilities/dropShadows.ts +51 -0
  58. package/src/styles/utilities/filters.ts +22 -7
  59. package/src/styles/utilities/globalStyle.ts +5 -2
  60. package/src/styles/utilities/index.ts +3 -0
  61. package/src/styles/utilities/keyframes.ts +27 -4
  62. package/src/styles/utilities/recipeGlobalStyles.ts +22 -0
  63. package/src/styles/utilities/shadowDefinitions.ts +112 -0
  64. package/src/utils/dsChain.ts +113 -0
  65. package/src/utils/dsComponent.ts +44 -0
  66. package/src/utils/dsPart.ts +41 -0
  67. package/dist/preset-BAn5LBiW.js.map +0 -1
  68. package/src/recipes/datePicker.ts +0 -234
  69. package/src/recipes/timePicker.ts +0 -216
@@ -1,311 +1,257 @@
1
1
  import { defineSlotRecipe } from '@pandacss/dev';
2
2
 
3
- const chipBase = {
4
- container: {
5
- position: 'relative',
6
- display: 'inline-flex',
7
- alignItems: 'center',
8
- gap: '1',
9
- width: 'fit-content',
10
- verticalAlign: 'middle',
3
+ import { globalBaseStyles } from '~/styles/utilities';
4
+
5
+ // Ported from the Cetec design system: slots, sizing scale, the
6
+ // custom-property mechanism and interaction behaviour. okshaun's semantic
7
+ // tokens carry the colours.
8
+
9
+ const buttonStyles = {
10
+ appearance: 'none',
11
+ cursor: 'pointer',
12
+ transitionDuration: 'fast',
13
+ transitionProperty: 'background, color',
14
+ transitionTimingFunction: 'default',
15
+ _icon: {
16
+ fill: 'icon.decorative',
11
17
  },
12
- body: {
13
- display: 'inline-flex',
14
- alignItems: 'center',
15
- appearance: 'none',
16
- border: 'none',
17
- borderRadius: '999',
18
- fontFamily: 'sans',
19
- lineHeight: 'default',
20
- fontWeight: 'medium',
21
- whiteSpace: 'nowrap',
22
- cursor: 'pointer',
23
- transitionDuration: 'fast',
24
- transitionProperty: 'background, color, border-color, box-shadow',
25
- transitionTimingFunction: 'default',
26
- userSelect: 'none',
27
- outlineWidth: '2',
28
- outlineStyle: 'solid',
29
- outlineColor: 'transparent',
30
- bg: 'bg.neutral',
31
- color: 'text',
32
- _hover: {
33
- bg: 'bg.neutral.hovered',
18
+ _hover: {
19
+ _icon: {
20
+ fill: 'icon',
34
21
  },
35
- _active: {
36
- bg: 'bg.neutral.pressed',
22
+ },
23
+ _active: {
24
+ _icon: {
25
+ fill: 'icon',
37
26
  },
38
- _focusVisible: {
39
- outlineColor: 'border.focused',
27
+ },
28
+ _focusVisible: {
29
+ outlineColor: 'border.focused',
30
+ },
31
+ _disabled: {
32
+ cursor: 'not-allowed',
33
+ },
34
+ '&:has([data-disabled=true])': {
35
+ cursor: 'not-allowed',
36
+ },
37
+ '&:has([data-deleted=true])': {
38
+ textDecoration: 'line-through',
39
+ opacity: '[0.6]',
40
+ },
41
+ '&:has([data-selected=true])': {
42
+ bg: 'bg.neutral.boldest',
43
+ _icon: {
44
+ fill: 'icon.decorative.inverse',
40
45
  },
41
- _loading: {
42
- cursor: 'wait',
43
- animation: 'pulse',
46
+ },
47
+ '&:has([data-selected=true]):is(:hover, [data-hover])': {
48
+ _icon: {
49
+ fill: 'icon.decorative.inverse.hovered',
44
50
  },
45
- _deleted: {
46
- textDecoration: 'line-through',
47
- cursor: 'not-allowed',
48
- opacity: '[0.6]',
51
+ },
52
+ '&:has([data-selected=true]):is(:active, [data-active])': {
53
+ _icon: {
54
+ fill: 'icon.decorative.inverse.hovered',
49
55
  },
50
- _disabled: {
51
- cursor: 'not-allowed',
52
- bg: 'bg.disabled',
53
- color: 'text.disabled',
54
- borderColor: 'border.disabled',
56
+ },
57
+ };
58
+
59
+ export const chipRecipe = defineSlotRecipe({
60
+ className: 'chip',
61
+ jsx: ['Chip'],
62
+ slots: ['container', 'body', 'mainContent', 'dismissButton', 'slot'],
63
+ base: {
64
+ container: {
65
+ ...globalBaseStyles,
66
+ '--chip-h': 'token(sizes.24)',
67
+ '--main-px': 'token(sizes.8)',
68
+ '--main-fs': 'token(sizes.14)',
69
+ '--main-slot-side-padding': 'token(sizes.4)',
70
+ '--slot-size': 'token(sizes.20)',
71
+ '--slot-px': 'token(sizes.2)',
72
+ position: 'relative',
73
+ display: 'inline-flex',
74
+ alignItems: 'center',
75
+ width: 'fit',
76
+ height: 'var(--chip-h)',
77
+ borderRadius: '999',
78
+ fontFamily: 'sans',
79
+ lineHeight: 'default',
80
+ fontWeight: 'medium',
81
+ whiteSpace: 'nowrap',
82
+ verticalAlign: 'middle',
83
+ transitionDuration: 'fast',
84
+ transitionProperty: 'all',
85
+ transitionTimingFunction: 'default',
86
+ userSelect: 'none',
87
+ bg: 'bg.neutral',
88
+ // Deviation from Cetec: hover and active live here, not on the body.
89
+ // okshaun's bg.neutral tokens are semi-transparent, so a body-painted
90
+ // hover would composite over this base rather than replace it, and it
91
+ // would leave the dismiss area of a dismissable chip unhighlighted.
92
+ // Cetec's opaque equivalents do not have this problem.
55
93
  _hover: {
94
+ bg: 'bg.neutral.hovered',
95
+ },
96
+ _active: {
97
+ bg: 'bg.neutral.pressed',
98
+ },
99
+ _loading: {
100
+ animation: 'pulse',
101
+ },
102
+ '&:has([data-selected=true])': {
103
+ bg: 'bg.neutral.boldest',
104
+ color: 'text.inverse',
105
+ _hover: {
106
+ bg: 'bg.neutral.bold.hovered',
107
+ },
108
+ _active: {
109
+ bg: 'bg.neutral.bold.pressed',
110
+ },
111
+ },
112
+ '&:has([data-disabled=true])': {
113
+ cursor: 'not-allowed',
56
114
  bg: 'bg.disabled',
57
115
  color: 'text.disabled',
58
- borderColor: 'border.disabled',
116
+ opacity: '[0.3]',
117
+ _hover: {
118
+ bg: 'bg.disabled',
119
+ },
120
+ },
121
+ },
122
+ body: {
123
+ ...globalBaseStyles,
124
+ position: 'relative',
125
+ display: 'inline-flex',
126
+ alignItems: 'center',
127
+ minW: '0',
128
+ height: 'var(--chip-h)',
129
+ flexShrink: '0',
130
+ bg: 'transparent',
131
+ border: 'none',
132
+ borderRadius: '999',
133
+ outlineWidth: '2',
134
+ outlineStyle: 'solid',
135
+ outlineColor: 'transparent',
136
+ outlineOffset: 'calc(token(sizes.2) * -1)',
137
+ 'button&': {
138
+ ...buttonStyles,
59
139
  },
60
140
  },
61
- _selected: {
62
- bg: 'bg.neutral.boldest',
63
- color: 'text.inverse',
141
+ mainContent: {
142
+ display: 'inline-flex',
143
+ alignItems: 'center',
144
+ minW: '0',
145
+ px: 'var(--main-px)',
146
+ fontSize: 'var(--main-fs)',
147
+ color: 'text',
148
+ '[data-selected=true] > &': {
149
+ color: 'text.inverse',
150
+ },
151
+ },
152
+ dismissButton: {
153
+ ...globalBaseStyles,
154
+ position: 'relative',
155
+ display: 'inline-flex',
156
+ alignItems: 'center',
157
+ justifyContent: 'center',
158
+ minW: '0',
159
+ flexShrink: '0',
160
+ bg: 'transparent',
161
+ border: 'none',
162
+ borderRadius: '999',
163
+ outlineWidth: '2',
164
+ outlineStyle: 'solid',
165
+ outlineColor: 'transparent',
166
+ outlineOffset: 'calc(token(sizes.2) * -1)',
167
+ aspectRatio: 'square',
168
+ ...buttonStyles,
169
+ // Deviation from Cetec: no hover background here. okshaun's bg.neutral
170
+ // tokens are semi-transparent, so painting hovered over the pill
171
+ // composites to roughly 26% rather than the 14% the token specifies.
64
172
  _hover: {
65
- bg: 'bg.neutral.bold.hovered',
173
+ bg: 'transparent',
174
+ _icon: { fill: 'icon' },
66
175
  },
67
176
  _active: {
68
- bg: 'bg.neutral.bold.pressed',
177
+ bg: 'transparent',
178
+ _icon: { fill: 'icon' },
179
+ },
180
+ w: 'calc(var(--slot-size) + (var(--slot-px) * 2))',
181
+ h: 'calc(var(--slot-size) + (var(--slot-px) * 2))',
182
+ _icon: {
183
+ fill: 'icon.decorative',
184
+ width: 'var(--slot-size)',
185
+ height: 'var(--slot-size)',
69
186
  },
70
187
  },
71
- },
72
- mainContent: {
73
- display: 'inline-flex',
74
- alignItems: 'center',
75
- gap: 'inherit',
76
- minW: 0,
77
- },
78
- slot: {
79
- display: 'inline-flex',
80
- alignItems: 'center',
81
- justifyContent: 'center',
82
- flexShrink: 0,
83
- },
84
- dismissButton: {
85
- display: 'inline-flex',
86
- alignItems: 'center',
87
- justifyContent: 'center',
88
- border: 'none',
89
- borderRadius: 'full',
90
- bg: 'transparent',
91
- color: 'inherit',
92
- cursor: 'pointer',
93
- transitionDuration: 'fast',
94
- transitionProperty: 'background, color',
95
- transitionTimingFunction: 'default',
96
- outlineWidth: '2',
97
- outlineStyle: 'solid',
98
- outlineColor: 'transparent',
99
- _hover: {
100
- bg: 'bg.neutral.hovered',
101
- },
102
- _active: {
103
- bg: 'bg.neutral.pressed',
104
- },
105
- _focusVisible: {
106
- outlineColor: 'border.focused',
107
- },
108
- _disabled: {
109
- cursor: 'not-allowed',
110
- color: 'text.disabled',
111
- },
112
- '[data-selected=true] &': {
113
- color: 'text.inverse',
114
- },
115
- },
116
- chipIcon: {
117
- fill: 'icon.decorative',
118
- aspectRatio: 'square',
119
- transitionDuration: 'fast',
120
- transitionProperty: 'fill',
121
- transitionTimingFunction: 'default',
122
- _groupHover: { fill: 'icon.decorative.hovered' },
123
- _groupActive: { fill: 'icon.decorative.hovered' },
124
- _groupDisabled: { fill: 'icon.decorative' },
125
- '[data-selected=true] &': {
126
- fill: 'icon.decorative.inverse',
127
- },
128
- '.group:is(:hover, [data-hover])[data-selected=true] &': {
129
- fill: 'icon.decorative.inverse.hovered',
188
+ slot: {
189
+ display: 'inline-flex',
190
+ alignItems: 'center',
191
+ px: 'var(--slot-px)',
130
192
  },
131
193
  },
132
- };
133
-
134
- export const chipRecipe = defineSlotRecipe({
135
- className: 'chip',
136
- jsx: ['Chip'],
137
- slots: [
138
- 'container',
139
- 'body',
140
- 'mainContent',
141
- 'dismissButton',
142
- 'slot',
143
- 'chipIcon',
144
- ],
145
- base: chipBase,
146
194
  variants: {
147
195
  size: {
148
196
  sm: {
149
- body: {
150
- gap: '2',
151
- h: '20',
152
- px: '6',
153
- py: '0',
154
- fontSize: '14',
155
- },
156
- mainContent: {
157
- gap: '2',
158
- },
159
- slot: {
160
- gap: '2',
161
- },
162
- chipIcon: {
163
- w: '20',
164
- h: '20',
165
- },
166
- dismissButton: {
167
- w: '20',
168
- h: '20',
197
+ container: {
198
+ '--chip-h': 'token(sizes.18)',
199
+ '--main-px': 'token(sizes.6)',
200
+ '--main-fs': 'token(sizes.12)',
201
+ '--main-slot-side-padding': 'token(sizes.4)',
202
+ '--slot-size': 'token(sizes.16)',
203
+ '--slot-px': 'token(sizes.1)',
169
204
  },
170
205
  },
171
206
  md: {
172
- body: {
173
- gap: '4',
174
- h: '24',
175
- px: '8',
176
- py: '1',
177
- fontSize: '14',
178
- },
179
- mainContent: {
180
- gap: '4',
181
- },
182
- slot: {
183
- gap: '4',
184
- },
185
- chipIcon: {
186
- w: '20',
187
- h: '20',
188
- },
189
- dismissButton: {
190
- w: '24',
191
- h: '24',
207
+ container: {
208
+ '--chip-h': 'token(sizes.24)',
209
+ '--main-px': 'token(sizes.8)',
210
+ '--main-fs': 'token(sizes.14)',
211
+ '--main-slot-side-padding': 'token(sizes.4)',
212
+ '--slot-size': 'token(sizes.20)',
213
+ '--slot-px': 'token(sizes.2)',
192
214
  },
193
215
  },
194
216
  lg: {
195
- body: {
196
- gap: '4',
197
- h: '32',
198
- px: '10',
199
- py: '4',
200
- fontSize: '16',
201
- },
202
- mainContent: {
203
- gap: '4',
204
- },
205
- slot: {
206
- gap: '4',
207
- },
208
- chipIcon: {
209
- w: '24',
210
- h: '24',
211
- },
212
- dismissButton: {
213
- w: '32',
214
- h: '32',
217
+ container: {
218
+ '--chip-h': 'token(sizes.28)',
219
+ '--main-px': 'token(sizes.10)',
220
+ '--main-fs': 'token(sizes.16)',
221
+ '--main-slot-side-padding': 'token(sizes.4)',
222
+ '--slot-size': 'token(sizes.24)',
223
+ '--slot-px': 'token(sizes.2)',
215
224
  },
216
225
  },
217
226
  xl: {
218
- body: {
219
- gap: '4',
220
- h: '40',
221
- px: '12',
222
- py: '5',
223
- fontSize: '16',
224
- },
225
- mainContent: {
226
- gap: '4',
227
- },
228
- slot: {
229
- gap: '4',
230
- },
231
- chipIcon: {
232
- w: '24',
233
- h: '24',
234
- },
235
- dismissButton: {
236
- w: '40',
237
- h: '40',
227
+ container: {
228
+ '--chip-h': 'token(sizes.32)',
229
+ '--main-px': 'token(sizes.12)',
230
+ '--main-fs': 'token(sizes.20)',
231
+ '--main-slot-side-padding': 'token(sizes.4)',
232
+ '--slot-size': 'token(sizes.28)',
233
+ '--slot-px': 'token(sizes.2)',
238
234
  },
239
235
  },
240
236
  },
241
237
  before: {
242
- true: { body: {} },
238
+ true: {
239
+ mainContent: {
240
+ ps: 'var(--main-slot-side-padding)',
241
+ },
242
+ },
243
243
  },
244
244
  after: {
245
- true: { body: {} },
245
+ true: {
246
+ mainContent: {
247
+ pe: 'var(--main-slot-side-padding)',
248
+ },
249
+ },
246
250
  },
247
251
  dismissable: {
248
- true: { body: {} },
252
+ true: {},
249
253
  },
250
254
  },
251
- compoundVariants: [
252
- {
253
- size: 'sm',
254
- before: true,
255
- css: {
256
- body: { ps: '2' },
257
- },
258
- },
259
- {
260
- size: 'sm',
261
- after: true,
262
- css: {
263
- body: { pe: '2' },
264
- },
265
- },
266
- {
267
- size: 'md',
268
- before: true,
269
- css: {
270
- body: { ps: '2' },
271
- },
272
- },
273
- {
274
- size: 'md',
275
- after: true,
276
- css: {
277
- body: { pe: '2' },
278
- },
279
- },
280
- {
281
- size: 'lg',
282
- before: true,
283
- css: {
284
- body: { ps: '4' },
285
- },
286
- },
287
- {
288
- size: 'lg',
289
- after: true,
290
- css: {
291
- body: { pe: '4' },
292
- },
293
- },
294
- {
295
- size: 'xl',
296
- before: true,
297
- css: {
298
- body: { ps: '4' },
299
- },
300
- },
301
- {
302
- size: 'xl',
303
- after: true,
304
- css: {
305
- body: { pe: '4' },
306
- },
307
- },
308
- ],
309
255
  defaultVariants: {
310
256
  size: 'md',
311
257
  },
@@ -0,0 +1,40 @@
1
+ import { defineSlotRecipe } from '@pandacss/dev';
2
+
3
+ // Content-only slots shared by DateMenu (single Calendar) and DateRangeMenu
4
+ // (two Calendars + a middle divider + a Cancel/Apply footer for the pending
5
+ // selection). The popover chrome itself (bg/radius/shadow) comes from
6
+ // `<Menu>`, not from a slot here, so it isn't duplicated.
7
+ const dateMenusBase = {
8
+ // Row wrapper for DateRangeMenu's two Calendar instances.
9
+ calendars: {
10
+ display: 'flex',
11
+ alignItems: 'stretch',
12
+ },
13
+
14
+ // Vertical rule between the two calendars.
15
+ calendarsDivider: {
16
+ width: '1',
17
+ alignSelf: 'stretch',
18
+ bg: 'border',
19
+ },
20
+
21
+ // Right-aligned Cancel/Apply pair for the pending range selection.
22
+ footer: {
23
+ display: 'flex',
24
+ justifyContent: 'flex-end',
25
+ alignItems: 'center',
26
+ gap: '8',
27
+ borderTopWidth: '1',
28
+ borderTopStyle: 'solid',
29
+ borderColor: 'border',
30
+ px: '16',
31
+ py: '8',
32
+ },
33
+ };
34
+
35
+ export const dateMenusRecipe = defineSlotRecipe({
36
+ className: 'dateMenus',
37
+ jsx: ['DateMenus', 'DateMenu', 'DateRangeMenu'],
38
+ slots: ['calendars', 'calendarsDivider', 'footer'],
39
+ base: dateMenusBase,
40
+ });
@@ -0,0 +1,43 @@
1
+ import { defineSlotRecipe } from '@pandacss/dev';
2
+
3
+ // Content-only slots for DateTimeMenu: a single Calendar + a 4px divider +
4
+ // the same scrollable time columns TimeMenu/TimeRangeMenu use (imported
5
+ // directly from `timeMenus` in the component — the column look lives in one
6
+ // place). The popover chrome itself (bg/radius/shadow) comes from `<Menu>`,
7
+ // not from a slot here. One fixed layout, not range-variant, per the Figma spec.
8
+ const dateTimeMenusBase = {
9
+ // Row holding the Calendar + divider + time columns, above the footer.
10
+ content: {
11
+ display: 'flex',
12
+ alignItems: 'stretch',
13
+ },
14
+
15
+ // 4px-wide vertical divider between the Calendar and the time columns.
16
+ divider: {
17
+ width: '4',
18
+ alignSelf: 'stretch',
19
+ bg: 'border',
20
+ },
21
+
22
+ // Right-aligned Cancel/Apply pair — always present per the Figma spec,
23
+ // even though DateTimeMenu isn't itself a range variant.
24
+ footer: {
25
+ display: 'flex',
26
+ justifyContent: 'flex-end',
27
+ alignItems: 'center',
28
+ w: 'full',
29
+ gap: '8',
30
+ borderTopWidth: '1',
31
+ borderTopStyle: 'solid',
32
+ borderColor: 'border',
33
+ px: '16',
34
+ py: '8',
35
+ },
36
+ };
37
+
38
+ export const dateTimeMenusRecipe = defineSlotRecipe({
39
+ className: 'dateTimeMenus',
40
+ jsx: ['DateTimeMenus', 'DateTimeMenu'],
41
+ slots: ['content', 'divider', 'footer'],
42
+ base: dateTimeMenusBase,
43
+ });
@@ -41,7 +41,7 @@ const formFieldVariants = {
41
41
  size: {
42
42
  sm: {
43
43
  labelWrapper: {
44
- '& [class=*-label]': {
44
+ '& [class*=-label]': {
45
45
  fontSize: '14',
46
46
  lineHeight: 'tight',
47
47
  },