@okshaun/components 4.2.0 → 5.0.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 (58) hide show
  1. package/README.md +1 -1
  2. package/dist/icon-metadata.json +134 -0
  3. package/dist/index.js +15087 -9901
  4. package/dist/index.js.map +1 -1
  5. package/dist/panda.buildinfo.json +738 -531
  6. package/dist/{preset-CsYXL2Bm.js → preset-B6fsdoKY.js} +2141 -214
  7. package/dist/preset-B6fsdoKY.js.map +1 -0
  8. package/dist/preset.js +1 -1
  9. package/dist/specs/keyframes.json +66 -0
  10. package/dist/specs/recipes.json +383 -26
  11. package/dist/specs/tokens.json +15 -0
  12. package/dist/sprite.svg +1 -1
  13. package/dist/sprite.symbol.html +248 -2
  14. package/dist/styles.css +3862 -803
  15. package/dist/svgs/barcode-reader-off.svg +1 -0
  16. package/dist/svgs/circle-dashed.svg +1 -0
  17. package/dist/svgs/drawer-left-hide.svg +1 -0
  18. package/dist/svgs/drawer-left-show.svg +1 -0
  19. package/dist/svgs/drawer-right-hide.svg +1 -0
  20. package/dist/svgs/drawer-right-show.svg +1 -0
  21. package/dist/svgs/not-equal.svg +1 -0
  22. package/dist/svgs/square-dashed.svg +1 -0
  23. package/dist/types/index.d.ts +2725 -117
  24. package/package.json +9 -12
  25. package/src/recipes/alert.ts +80 -0
  26. package/src/recipes/autocomplete.ts +2 -2
  27. package/src/recipes/avatar.ts +13 -6
  28. package/src/recipes/button.ts +41 -30
  29. package/src/recipes/checkbox.ts +3 -0
  30. package/src/recipes/chip.ts +16 -0
  31. package/src/recipes/code.ts +40 -23
  32. package/src/recipes/codeBlock.ts +277 -0
  33. package/src/recipes/drawer.ts +150 -0
  34. package/src/recipes/filterField.ts +138 -0
  35. package/src/recipes/filterMenu.ts +71 -0
  36. package/src/recipes/filterToken.ts +189 -0
  37. package/src/recipes/inlineNote.ts +49 -0
  38. package/src/recipes/keyFact.ts +111 -0
  39. package/src/recipes/listItem.ts +25 -0
  40. package/src/recipes/menu.ts +41 -2
  41. package/src/recipes/pageBanner.ts +110 -0
  42. package/src/recipes/peekBar.ts +35 -0
  43. package/src/recipes/popover.ts +206 -0
  44. package/src/recipes/recipes-regular.ts +1 -1
  45. package/src/recipes/recipes-slot.ts +13 -0
  46. package/src/recipes/segmentedFields.ts +11 -5
  47. package/src/recipes/select.ts +204 -63
  48. package/src/recipes/spinner.ts +1 -1
  49. package/src/recipes/tabs.ts +161 -0
  50. package/src/recipes/tag.ts +13 -2
  51. package/src/recipes/timeMenus.ts +1 -1
  52. package/src/recipes/toast.ts +116 -0
  53. package/src/recipes/toggle.ts +3 -3
  54. package/src/styles/primitives/fontSizes.ts +1 -0
  55. package/src/styles/primitives/radii.ts +2 -0
  56. package/src/styles/utilities/keyframes.ts +38 -0
  57. package/src/utils/compoundComponent.ts +29 -0
  58. package/dist/preset-CsYXL2Bm.js.map +0 -1
@@ -0,0 +1,161 @@
1
+ import { defineSlotRecipe } from '@pandacss/dev';
2
+
3
+ import { globalBaseStyles } from '~/styles/utilities';
4
+
5
+ export const tabsRecipe = defineSlotRecipe({
6
+ className: 'tabs',
7
+ jsx: ['Tabs'],
8
+ slots: ['root', 'strip', 'list', 'tab', 'badge', 'overflow', 'menu', 'panel'],
9
+ base: {
10
+ root: {
11
+ ...globalBaseStyles,
12
+ display: 'flex',
13
+ flexDirection: 'column',
14
+ minWidth: '0',
15
+ width: 'full',
16
+ },
17
+ strip: {
18
+ ...globalBaseStyles,
19
+ position: 'relative',
20
+ minWidth: '0',
21
+ width: 'full',
22
+ },
23
+ list: {
24
+ ...globalBaseStyles,
25
+ position: 'relative',
26
+ display: 'flex',
27
+ alignItems: 'stretch',
28
+ flexWrap: 'nowrap',
29
+ // Figma `Tabs` tablist: 8px between tabs, with each tab carrying 6px of
30
+ // its own inline padding so the underline hugs the label.
31
+ gap: '8',
32
+ minWidth: '0',
33
+ width: 'full',
34
+ // The 1px rule the strip sits on. Each tab's 2px underline overlaps it.
35
+ borderBottomWidth: '1',
36
+ borderBottomStyle: 'solid',
37
+ borderBottomColor: 'border',
38
+ },
39
+ tab: {
40
+ ...globalBaseStyles,
41
+ position: 'relative',
42
+ display: 'inline-flex',
43
+ alignItems: 'center',
44
+ justifyContent: 'center',
45
+ gap: '6',
46
+ flexShrink: '0',
47
+ whiteSpace: 'nowrap',
48
+ appearance: 'none',
49
+ bg: 'transparent',
50
+ cursor: 'pointer',
51
+ px: '6',
52
+ // 8px above and below the 22px line box, plus the 2px underline, makes
53
+ // the 40px tab in Figma `_TabsTab`. The 20px badge sits inside the line
54
+ // box, so showing it never changes the tab's height.
55
+ py: '8',
56
+ fontSize: '14',
57
+ lineHeight: 'default',
58
+ color: 'text.subtlest',
59
+ borderWidth: '0',
60
+ borderBottomWidth: '2',
61
+ borderBottomStyle: 'solid',
62
+ borderBottomColor: 'transparent',
63
+ // Pull the 2px underline on top of the list's 1px rule.
64
+ marginBottom: '-1',
65
+ transitionProperty: 'color, border-color',
66
+ transitionDuration: 'fast',
67
+ transitionTimingFunction: 'default',
68
+ _hover: {
69
+ color: 'text',
70
+ borderBottomColor: 'border',
71
+ },
72
+ _selected: {
73
+ color: 'text',
74
+ borderBottomColor: 'border.bold',
75
+ // The selected underline does not react to hover.
76
+ _hover: {
77
+ borderBottomColor: 'border.bold',
78
+ },
79
+ },
80
+ _focusVisible: {
81
+ outlineWidth: '2',
82
+ outlineStyle: 'solid',
83
+ outlineColor: 'border.focused',
84
+ outlineOffset: '-2',
85
+ },
86
+ _disabled: {
87
+ color: 'text.disabled',
88
+ cursor: 'not-allowed',
89
+ _hover: {
90
+ color: 'text.disabled',
91
+ borderBottomColor: 'transparent',
92
+ },
93
+ },
94
+ _motionReduce: {
95
+ transitionDuration: 'fastest',
96
+ },
97
+ },
98
+ badge: {
99
+ display: 'inline-flex',
100
+ alignItems: 'center',
101
+ flexShrink: '0',
102
+ // Keep the badge from adding a line box of its own to the tab.
103
+ lineHeight: 'none',
104
+ },
105
+ overflow: {
106
+ position: 'absolute',
107
+ insetInlineEnd: '0',
108
+ top: '0',
109
+ bottom: '0',
110
+ display: 'inline-flex',
111
+ alignItems: 'center',
112
+ flexShrink: '0',
113
+ },
114
+ menu: {
115
+ minWidth: '160',
116
+ },
117
+ panel: {
118
+ ...globalBaseStyles,
119
+ color: 'text',
120
+ fontSize: '14',
121
+ minWidth: '0',
122
+ _focusVisible: {
123
+ outlineWidth: '2',
124
+ outlineStyle: 'solid',
125
+ outlineColor: 'border.focused',
126
+ outlineOffset: '2',
127
+ },
128
+ },
129
+ },
130
+ variants: {
131
+ hasOverflow: {
132
+ false: {
133
+ overflow: {
134
+ visibility: 'hidden',
135
+ pointerEvents: 'none',
136
+ },
137
+ },
138
+ true: {
139
+ overflow: {
140
+ visibility: 'visible',
141
+ pointerEvents: 'auto',
142
+ },
143
+ },
144
+ },
145
+ /** Keeps an overflowed tab measurable while removing it from the strip. */
146
+ overflowed: {
147
+ true: {
148
+ tab: {
149
+ position: 'absolute',
150
+ visibility: 'hidden',
151
+ pointerEvents: 'none',
152
+ insetInlineStart: '0',
153
+ top: '0',
154
+ },
155
+ },
156
+ },
157
+ },
158
+ defaultVariants: {
159
+ hasOverflow: false,
160
+ },
161
+ });
@@ -12,13 +12,23 @@ export const tagRecipe = defineRecipe({
12
12
  gap: '1',
13
13
  px: '4',
14
14
  w: 'fit',
15
- h: '20',
16
- fontSize: '14',
17
15
  fontWeight: 'medium',
18
16
  lineHeight: 'tight',
19
17
  whiteSpace: 'nowrap',
20
18
  },
21
19
  variants: {
20
+ // Both sizes set every property they change, so a conditional value such
21
+ // as { base: 'sm', md: 'md' } switches back at the breakpoint.
22
+ size: {
23
+ sm: {
24
+ h: '16',
25
+ fontSize: '12',
26
+ },
27
+ md: {
28
+ h: '20',
29
+ fontSize: '14',
30
+ },
31
+ },
22
32
  // Each hue publishes both colour pairs; `variant` picks one. This replaces
23
33
  // 24 compoundVariants, which Panda emitted no CSS for at all: the variant
24
34
  // bodies were empty, so every Tag rendered as the uncoloured base. Doing it
@@ -261,6 +271,7 @@ export const tagRecipe = defineRecipe({
261
271
  },
262
272
  },
263
273
  defaultVariants: {
274
+ size: 'md',
264
275
  variant: 'default',
265
276
  hue: 'gray',
266
277
  },
@@ -60,7 +60,7 @@ const timeMenusBase = {
60
60
  top: '0',
61
61
  textAlign: 'center',
62
62
  fontSize: '12',
63
- fontWeight: 'semibold',
63
+ fontWeight: 'medium',
64
64
  color: 'text.subtlest',
65
65
  bg: 'surface',
66
66
  py: '4',
@@ -0,0 +1,116 @@
1
+ import { defineSlotRecipe } from '@pandacss/dev';
2
+
3
+ import { globalBaseStyles } from '~/styles/utilities';
4
+
5
+ const toastBase = {
6
+ /**
7
+ * Fixed, bottom-right stack rendered once by `ToastViewport`. The viewport
8
+ * itself is click-through so it never covers the page; each toast re-enables
9
+ * pointer events for its own box.
10
+ */
11
+ viewport: {
12
+ position: 'fixed',
13
+ left: { base: '24', xs: 'auto' },
14
+ right: '24',
15
+ bottom: '24',
16
+ display: 'flex',
17
+ flexDirection: 'column',
18
+ alignItems: 'flex-end',
19
+ gap: '12',
20
+ maxW: 'full',
21
+ pointerEvents: 'none',
22
+ zIndex: 'tooltip',
23
+ },
24
+ root: {
25
+ ...globalBaseStyles,
26
+ display: 'flex',
27
+ alignItems: 'flex-start',
28
+ gap: '8',
29
+ w: 'full',
30
+ minW: { base: '0', xs: 'xs' },
31
+ maxW: 'sm',
32
+ p: '12',
33
+ borderRadius: '8',
34
+ bg: 'surface.overlay',
35
+ boxShadow: 'overlay',
36
+ border: 'default',
37
+ pointerEvents: 'auto',
38
+ animationName: 'toastSlideIn',
39
+ animationDuration: 'fast',
40
+ animationTimingFunction: 'out',
41
+ animationFillMode: 'forwards',
42
+ '&[data-state="closing"]': {
43
+ animationName: 'toastSlideOut',
44
+ },
45
+ _motionReduce: {
46
+ animationName: 'none',
47
+ opacity: '1',
48
+ },
49
+ },
50
+ icon: {
51
+ display: 'flex',
52
+ alignItems: 'center',
53
+ flex: 'none',
54
+ minH: '18',
55
+ },
56
+ content: {
57
+ display: 'flex',
58
+ flexDirection: 'column',
59
+ gap: '4',
60
+ flex: '1',
61
+ minW: '0',
62
+ },
63
+ message: {
64
+ maxW: 'full',
65
+ },
66
+ actions: {
67
+ display: 'flex',
68
+ flexWrap: 'wrap',
69
+ alignItems: 'center',
70
+ gap: '8',
71
+ mt: '4',
72
+ },
73
+ dismiss: {
74
+ flex: 'none',
75
+ },
76
+ };
77
+
78
+ const toastVariants = {
79
+ /** Semantic tone. Drives the leading border accent and the tone icon. */
80
+ tone: {
81
+ info: {
82
+ root: { borderLeft: 'info', borderLeftWidth: '4' },
83
+ },
84
+ success: {
85
+ root: { borderLeft: 'success', borderLeftWidth: '4' },
86
+ },
87
+ warning: {
88
+ root: { borderLeft: 'warning', borderLeftWidth: '4' },
89
+ },
90
+ danger: {
91
+ root: { borderLeft: 'danger', borderLeftWidth: '4' },
92
+ },
93
+ neutral: {
94
+ root: { borderLeft: 'default', borderLeftWidth: '4' },
95
+ },
96
+ },
97
+ };
98
+
99
+ export const toastRecipe = defineSlotRecipe({
100
+ className: 'toast',
101
+ jsx: ['Toast', 'ToastViewport'],
102
+ slots: [
103
+ 'viewport',
104
+ 'root',
105
+ 'icon',
106
+ 'content',
107
+ 'message',
108
+ 'actions',
109
+ 'dismiss',
110
+ ],
111
+ base: toastBase,
112
+ variants: toastVariants,
113
+ defaultVariants: {
114
+ tone: 'neutral',
115
+ },
116
+ });
@@ -10,11 +10,11 @@ export const toggleRecipe = defineSlotRecipe({
10
10
  w: '32',
11
11
  h: '20',
12
12
  my: '2',
13
- rounded: '20',
13
+ rounded: '999',
14
14
  bg: 'surface',
15
15
  cursor: 'pointer',
16
16
  transitionProperty: 'border-color, background-color',
17
- transitionDuration: 'default',
17
+ transitionDuration: 'normal',
18
18
  transitionTimingFunction: 'ease-in-out',
19
19
  borderWidth: '2',
20
20
  borderStyle: 'solid',
@@ -33,7 +33,7 @@ export const toggleRecipe = defineSlotRecipe({
33
33
  outlineOffset: '1',
34
34
  outlineWidth: '2',
35
35
  outlineStyle: 'solid',
36
- rounded: '20',
36
+ rounded: '999',
37
37
  w: '32',
38
38
  h: '20',
39
39
  },
@@ -10,6 +10,7 @@ export const fontSizes = defineTokens.fontSizes({
10
10
  '32': { value: '{sizes.32}' },
11
11
  '40': { value: '{sizes.40}' },
12
12
  '48': { value: '{sizes.48}' },
13
+ '56': { value: '{sizes.56}' },
13
14
  '64': { value: '{sizes.64}' },
14
15
  '72': { value: '{sizes.72}' },
15
16
  '80': { value: '{sizes.80}' },
@@ -7,7 +7,9 @@ export const radii = defineTokens.radii({
7
7
  '2': { value: '{sizes.2}' },
8
8
  '3': { value: '{sizes.3}' },
9
9
  '4': { value: '{sizes.4}' },
10
+ '6': { value: '{sizes.6}' },
10
11
  '8': { value: '{sizes.8}' },
12
+ '12': { value: '{sizes.12}' },
11
13
  '16': { value: '{sizes.16}' },
12
14
  '100': { value: utilitySizes.full.value },
13
15
  '999': { value: '999px' },
@@ -113,4 +113,42 @@ export const keyframes = defineKeyframes({
113
113
  transform: 'scale(0.97) translateY(-40px)',
114
114
  },
115
115
  },
116
+ // Drawer animations
117
+ drawerSlideInRight: {
118
+ '0%': { transform: 'translateX(100%)' },
119
+ '100%': { transform: 'translateX(0)' },
120
+ },
121
+ drawerSlideOutRight: {
122
+ '0%': { transform: 'translateX(0)' },
123
+ '100%': { transform: 'translateX(100%)' },
124
+ },
125
+ drawerSlideInLeft: {
126
+ '0%': { transform: 'translateX(-100%)' },
127
+ '100%': { transform: 'translateX(0)' },
128
+ },
129
+ drawerSlideOutLeft: {
130
+ '0%': { transform: 'translateX(0)' },
131
+ '100%': { transform: 'translateX(-100%)' },
132
+ },
133
+ // Toast animations
134
+ toastSlideIn: {
135
+ '0%': {
136
+ opacity: '0',
137
+ transform: 'translateX(16px)',
138
+ },
139
+ '100%': {
140
+ opacity: '1',
141
+ transform: 'translateX(0)',
142
+ },
143
+ },
144
+ toastSlideOut: {
145
+ '0%': {
146
+ opacity: '1',
147
+ transform: 'translateX(0)',
148
+ },
149
+ '100%': {
150
+ opacity: '0',
151
+ transform: 'translateX(16px)',
152
+ },
153
+ },
116
154
  });
@@ -0,0 +1,29 @@
1
+ /** Reads a string marker from a React element's component type. */
2
+ export const getCompoundComponentType = (
3
+ node: unknown,
4
+ markerKey: string,
5
+ ): string | null => {
6
+ if (!node || typeof node !== 'object' || !('type' in node)) {
7
+ return null;
8
+ }
9
+
10
+ const component = (node as { type?: unknown }).type;
11
+ if (
12
+ (typeof component !== 'function' && typeof component !== 'object') ||
13
+ component === null
14
+ ) {
15
+ return null;
16
+ }
17
+
18
+ const marker = (component as Record<string, unknown>)[markerKey];
19
+ return typeof marker === 'string' ? marker : null;
20
+ };
21
+
22
+ /** Marks a component so a compound parent can recognize its child elements. */
23
+ export const setCompoundComponentType = (
24
+ component: object,
25
+ markerKey: string,
26
+ componentType: string,
27
+ ) => {
28
+ Object.assign(component, { [markerKey]: componentType });
29
+ };