@dashx/react 0.0.6 → 0.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.
- package/README.md +0 -70
- package/dist/cjs/components/button.d.ts +8 -0
- package/dist/cjs/components/button.js +2 -0
- package/dist/cjs/components/button.js.map +7 -0
- package/dist/cjs/components/card.d.ts +8 -0
- package/dist/cjs/components/card.js +2 -0
- package/dist/cjs/components/card.js.map +7 -0
- package/dist/cjs/components/flex.d.ts +210 -0
- package/dist/cjs/components/flex.js +2 -0
- package/dist/cjs/components/flex.js.map +7 -0
- package/dist/cjs/components/heading.d.ts +8 -0
- package/dist/cjs/components/heading.js +2 -0
- package/dist/cjs/components/heading.js.map +7 -0
- package/dist/cjs/components/icon-button.d.ts +3 -0
- package/dist/cjs/components/icon-button.js +2 -0
- package/dist/cjs/components/icon-button.js.map +7 -0
- package/dist/cjs/components/index.d.ts +11 -0
- package/dist/cjs/components/index.js +2 -0
- package/dist/cjs/components/index.js.map +7 -0
- package/dist/cjs/components/popover.d.ts +47 -0
- package/dist/cjs/components/popover.js +2 -0
- package/dist/cjs/components/popover.js.map +7 -0
- package/dist/cjs/components/text-field.d.ts +2 -0
- package/dist/cjs/components/text-field.js +2 -0
- package/dist/cjs/components/text-field.js.map +7 -0
- package/dist/cjs/components/text.d.ts +20 -0
- package/dist/cjs/components/text.js +2 -0
- package/dist/cjs/components/text.js.map +7 -0
- package/dist/cjs/components/theme.d.ts +17 -0
- package/dist/cjs/components/theme.js +2 -0
- package/dist/cjs/components/theme.js.map +7 -0
- package/dist/cjs/components/toast.d.ts +4 -0
- package/dist/cjs/components/toast.js +2 -0
- package/dist/cjs/components/toast.js.map +7 -0
- package/dist/cjs/components/tooltip.d.ts +13 -0
- package/dist/cjs/components/tooltip.js +2 -0
- package/dist/cjs/components/tooltip.js.map +7 -0
- package/dist/cjs/hooks/index.d.ts +2 -0
- package/dist/cjs/hooks/index.js +2 -0
- package/dist/cjs/hooks/index.js.map +7 -0
- package/dist/cjs/hooks/use-dashx-provider.d.ts +3 -0
- package/dist/cjs/hooks/use-dashx-provider.js +2 -0
- package/dist/cjs/hooks/use-dashx-provider.js.map +7 -0
- package/dist/cjs/hooks/use-in-app.d.ts +9 -0
- package/dist/cjs/hooks/use-in-app.js +2 -0
- package/dist/cjs/hooks/use-in-app.js.map +7 -0
- package/dist/cjs/icons/index.d.ts +1 -0
- package/dist/cjs/icons/index.js +2 -0
- package/dist/cjs/icons/index.js.map +7 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/providers/DashXProvider.d.ts +6 -0
- package/dist/cjs/providers/DashXProvider.js +2 -0
- package/dist/cjs/providers/DashXProvider.js.map +7 -0
- package/dist/cjs/providers/index.d.ts +1 -0
- package/dist/cjs/providers/index.js +2 -0
- package/dist/cjs/providers/index.js.map +7 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/dist/cjs/utils/cn.d.ts +3 -0
- package/dist/cjs/utils/cn.js +2 -0
- package/dist/cjs/utils/cn.js.map +7 -0
- package/dist/cjs/variants/base-element.d.ts +58 -0
- package/dist/cjs/variants/base-element.js +2 -0
- package/dist/cjs/variants/base-element.js.map +7 -0
- package/dist/cjs/variants/button.d.ts +147 -0
- package/dist/cjs/variants/button.js +2 -0
- package/dist/cjs/variants/button.js.map +7 -0
- package/dist/cjs/variants/card.d.ts +117 -0
- package/dist/cjs/variants/card.js +2 -0
- package/dist/cjs/variants/card.js.map +7 -0
- package/dist/cjs/variants/heading.d.ts +377 -0
- package/dist/cjs/variants/heading.js +2 -0
- package/dist/cjs/variants/heading.js.map +7 -0
- package/dist/cjs/variants/index.d.ts +6 -0
- package/dist/cjs/variants/index.js +2 -0
- package/dist/cjs/variants/index.js.map +7 -0
- package/dist/cjs/variants/popover.d.ts +106 -0
- package/dist/cjs/variants/popover.js +2 -0
- package/dist/cjs/variants/popover.js.map +7 -0
- package/dist/cjs/variants/text-field.d.ts +93 -0
- package/dist/cjs/variants/text-field.js +2 -0
- package/dist/cjs/variants/text-field.js.map +7 -0
- package/dist/cjs/variants/text.d.ts +377 -0
- package/dist/cjs/variants/text.js +2 -0
- package/dist/cjs/variants/text.js.map +7 -0
- package/dist/cjs/variants/tooltip.d.ts +2 -0
- package/dist/cjs/variants/tooltip.js +2 -0
- package/dist/cjs/variants/tooltip.js.map +7 -0
- package/dist/cjs/variants/typography.d.ts +285 -0
- package/dist/cjs/variants/typography.js +2 -0
- package/dist/cjs/variants/typography.js.map +7 -0
- package/dist/cjs/widgets/NotificationBell.d.ts +2 -0
- package/dist/cjs/widgets/NotificationBell.js +2 -0
- package/dist/cjs/widgets/NotificationBell.js.map +7 -0
- package/dist/cjs/widgets/Preference.d.ts +15 -0
- package/dist/cjs/widgets/Preference.js +2 -0
- package/dist/cjs/widgets/Preference.js.map +7 -0
- package/dist/cjs/widgets/Preferences.d.ts +19 -0
- package/dist/cjs/widgets/Preferences.js +2 -0
- package/dist/cjs/widgets/Preferences.js.map +7 -0
- package/dist/cjs/widgets/Toast.d.ts +4 -0
- package/dist/cjs/widgets/Toast.js +2 -0
- package/dist/cjs/widgets/Toast.js.map +7 -0
- package/dist/cjs/widgets/index.d.ts +3 -0
- package/dist/cjs/widgets/index.js +2 -0
- package/dist/cjs/widgets/index.js.map +7 -0
- package/dist/esm/components/button.d.ts +8 -0
- package/dist/esm/components/button.js +2 -0
- package/dist/esm/components/button.js.map +7 -0
- package/dist/esm/components/card.d.ts +8 -0
- package/dist/esm/components/card.js +2 -0
- package/dist/esm/components/card.js.map +7 -0
- package/dist/esm/components/flex.d.ts +210 -0
- package/dist/esm/components/flex.js +2 -0
- package/dist/esm/components/flex.js.map +7 -0
- package/dist/esm/components/heading.d.ts +8 -0
- package/dist/esm/components/heading.js +2 -0
- package/dist/esm/components/heading.js.map +7 -0
- package/dist/esm/components/icon-button.d.ts +3 -0
- package/dist/esm/components/icon-button.js +2 -0
- package/dist/esm/components/icon-button.js.map +7 -0
- package/dist/esm/components/index.d.ts +11 -0
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/components/index.js.map +7 -0
- package/dist/esm/components/popover.d.ts +47 -0
- package/dist/esm/components/popover.js +2 -0
- package/dist/esm/components/popover.js.map +7 -0
- package/dist/esm/components/text-field.d.ts +2 -0
- package/dist/esm/components/text-field.js +2 -0
- package/dist/esm/components/text-field.js.map +7 -0
- package/dist/esm/components/text.d.ts +20 -0
- package/dist/esm/components/text.js +2 -0
- package/dist/esm/components/text.js.map +7 -0
- package/dist/esm/components/theme.d.ts +17 -0
- package/dist/esm/components/theme.js +2 -0
- package/dist/esm/components/theme.js.map +7 -0
- package/dist/esm/components/toast.d.ts +4 -0
- package/dist/esm/components/toast.js +2 -0
- package/dist/esm/components/toast.js.map +7 -0
- package/dist/esm/components/tooltip.d.ts +13 -0
- package/dist/esm/components/tooltip.js +2 -0
- package/dist/esm/components/tooltip.js.map +7 -0
- package/dist/esm/hooks/index.d.ts +2 -0
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/index.js.map +7 -0
- package/dist/esm/hooks/use-dashx-provider.d.ts +3 -0
- package/dist/esm/hooks/use-dashx-provider.js +2 -0
- package/dist/esm/hooks/use-dashx-provider.js.map +7 -0
- package/dist/esm/hooks/use-in-app.d.ts +9 -0
- package/dist/esm/hooks/use-in-app.js +2 -0
- package/dist/esm/hooks/use-in-app.js.map +7 -0
- package/dist/esm/icons/index.d.ts +1 -0
- package/dist/esm/icons/index.js +2 -0
- package/dist/esm/icons/index.js.map +7 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/providers/DashXProvider.d.ts +6 -0
- package/dist/esm/providers/DashXProvider.js +2 -0
- package/dist/esm/providers/DashXProvider.js.map +7 -0
- package/dist/esm/providers/index.d.ts +1 -0
- package/dist/esm/providers/index.js +2 -0
- package/dist/esm/providers/index.js.map +7 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/utils/cn.d.ts +3 -0
- package/dist/esm/utils/cn.js +2 -0
- package/dist/esm/utils/cn.js.map +7 -0
- package/dist/esm/variants/base-element.d.ts +58 -0
- package/dist/esm/variants/base-element.js +2 -0
- package/dist/esm/variants/base-element.js.map +7 -0
- package/dist/esm/variants/button.d.ts +147 -0
- package/dist/esm/variants/button.js +2 -0
- package/dist/esm/variants/button.js.map +7 -0
- package/dist/esm/variants/card.d.ts +117 -0
- package/dist/esm/variants/card.js +2 -0
- package/dist/esm/variants/card.js.map +7 -0
- package/dist/esm/variants/heading.d.ts +377 -0
- package/dist/esm/variants/heading.js +2 -0
- package/dist/esm/variants/heading.js.map +7 -0
- package/dist/esm/variants/index.d.ts +6 -0
- package/dist/esm/variants/index.js +2 -0
- package/dist/esm/variants/index.js.map +7 -0
- package/dist/esm/variants/popover.d.ts +106 -0
- package/dist/esm/variants/popover.js +2 -0
- package/dist/esm/variants/popover.js.map +7 -0
- package/dist/esm/variants/text-field.d.ts +93 -0
- package/dist/esm/variants/text-field.js +2 -0
- package/dist/esm/variants/text-field.js.map +7 -0
- package/dist/esm/variants/text.d.ts +377 -0
- package/dist/esm/variants/text.js +2 -0
- package/dist/esm/variants/text.js.map +7 -0
- package/dist/esm/variants/tooltip.d.ts +2 -0
- package/dist/esm/variants/tooltip.js +2 -0
- package/dist/esm/variants/tooltip.js.map +7 -0
- package/dist/esm/variants/typography.d.ts +285 -0
- package/dist/esm/variants/typography.js +2 -0
- package/dist/esm/variants/typography.js.map +7 -0
- package/dist/esm/widgets/NotificationBell.d.ts +2 -0
- package/dist/esm/widgets/NotificationBell.js +2 -0
- package/dist/esm/widgets/NotificationBell.js.map +7 -0
- package/dist/esm/widgets/Preference.d.ts +15 -0
- package/dist/esm/widgets/Preference.js +2 -0
- package/dist/esm/widgets/Preference.js.map +7 -0
- package/dist/esm/widgets/Preferences.d.ts +19 -0
- package/dist/esm/widgets/Preferences.js +2 -0
- package/dist/esm/widgets/Preferences.js.map +7 -0
- package/dist/esm/widgets/Toast.d.ts +4 -0
- package/dist/esm/widgets/Toast.js +2 -0
- package/dist/esm/widgets/Toast.js.map +7 -0
- package/dist/esm/widgets/index.d.ts +3 -0
- package/dist/esm/widgets/index.js +2 -0
- package/dist/esm/widgets/index.js.map +7 -0
- package/package.json +165 -34
- package/src/components/button.tsx +88 -0
- package/src/components/card.tsx +32 -0
- package/src/components/flex.tsx +61 -0
- package/src/components/heading.tsx +42 -0
- package/src/components/icon-button.tsx +24 -0
- package/src/components/index.ts +11 -0
- package/src/components/popover.tsx +145 -0
- package/src/components/text-field.tsx +7 -0
- package/src/components/text.tsx +42 -0
- package/src/components/theme.tsx +81 -0
- package/src/components/toast.tsx +19 -0
- package/src/components/tooltip.tsx +62 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-dashx-provider.ts +17 -0
- package/src/hooks/use-in-app.ts +96 -0
- package/src/icons/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/providers/DashXProvider.tsx +30 -0
- package/src/providers/index.ts +1 -0
- package/src/styles/index.css +368 -0
- package/src/utils/cn.ts +8 -0
- package/src/variants/base-element.ts +15 -0
- package/src/variants/button.ts +191 -0
- package/src/variants/card.ts +40 -0
- package/src/variants/heading.ts +28 -0
- package/src/variants/index.ts +6 -0
- package/src/variants/popover.ts +42 -0
- package/src/variants/text-field.ts +15 -0
- package/src/variants/text.ts +28 -0
- package/src/variants/tooltip.ts +7 -0
- package/src/variants/typography.ts +100 -0
- package/src/widgets/NotificationBell.tsx +101 -0
- package/src/widgets/Preference.tsx +80 -0
- package/src/widgets/Preferences.tsx +109 -0
- package/src/widgets/Toast.tsx +19 -0
- package/src/widgets/index.ts +3 -0
- package/styles.css +1255 -0
- package/dist/index.d.ts +0 -65
- package/dist/index.es.js +0 -11779
- package/dist/index.umd.js +0 -238
- package/dist/style.css +0 -1
package/src/utils/cn.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
const baseElement = tv({
|
|
4
|
+
variants: {
|
|
5
|
+
size: {
|
|
6
|
+
extrasmall: 'rounded-sm-or-full h-6',
|
|
7
|
+
small: 'rounded-sm-or-full h-8',
|
|
8
|
+
medium: 'rounded-md-or-full h-10',
|
|
9
|
+
large: 'rounded-lg-or-full h-12',
|
|
10
|
+
extralarge: 'rounded-lg-or-full h-14',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default baseElement;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
import baseElement from './base-element.js';
|
|
4
|
+
|
|
5
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
6
|
+
|
|
7
|
+
const button = tv({
|
|
8
|
+
extend: baseElement,
|
|
9
|
+
base: 'inline-flex items-center justify-center gap-2 outline-none transition-[box-shadow,background-color,color] duration-300 ease-[cubic-bezier(0.25, select-none data-[focus-visible]:outline-2 data-[focus-visible]:outline-offset-2 data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-30',
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
extrasmall: 'text-xs',
|
|
13
|
+
small: 'text-sm',
|
|
14
|
+
medium: 'text-base',
|
|
15
|
+
large: 'text-lg',
|
|
16
|
+
extralarge: 'text-xl',
|
|
17
|
+
},
|
|
18
|
+
variant: {
|
|
19
|
+
fill: 'text-white',
|
|
20
|
+
outline: 'border-2',
|
|
21
|
+
simple: 'border-1 hover:ring-1 hover:ring-inset',
|
|
22
|
+
ghost: '',
|
|
23
|
+
},
|
|
24
|
+
mode: {
|
|
25
|
+
distinct: 'data-[focus-visible]:outline-accent-300',
|
|
26
|
+
subtle: 'data-[focus-visible]:outline-accent-300',
|
|
27
|
+
negative: 'data-[focus-visible]:outline-negative-300',
|
|
28
|
+
},
|
|
29
|
+
roundness: {
|
|
30
|
+
none: '',
|
|
31
|
+
small: '',
|
|
32
|
+
medium: '',
|
|
33
|
+
large: '',
|
|
34
|
+
full: '',
|
|
35
|
+
},
|
|
36
|
+
shape: {
|
|
37
|
+
square: '',
|
|
38
|
+
rect: '',
|
|
39
|
+
},
|
|
40
|
+
inset: {
|
|
41
|
+
left: '',
|
|
42
|
+
right: '',
|
|
43
|
+
both: '',
|
|
44
|
+
},
|
|
45
|
+
// TODO: shadow
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
size: 'medium',
|
|
49
|
+
mode: 'distinct',
|
|
50
|
+
variant: 'fill',
|
|
51
|
+
shape: 'rect',
|
|
52
|
+
},
|
|
53
|
+
compoundVariants: [
|
|
54
|
+
{
|
|
55
|
+
mode: 'distinct',
|
|
56
|
+
variant: 'fill',
|
|
57
|
+
className:
|
|
58
|
+
'bg-accent-500 hover:bg-accent-600 active:bg-accent-700 shadow-accent-600/30 hover:shadow-accent-600/30 active:shadow-accent-600/30 shadow-sm hover:shadow-lg active:shadow-sm',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
mode: 'distinct',
|
|
62
|
+
variant: 'outline',
|
|
63
|
+
className: 'text-accent-500 hover:text-accent-600 active:text-accent-700',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
mode: 'distinct',
|
|
67
|
+
variant: 'simple',
|
|
68
|
+
className:
|
|
69
|
+
'text-accent-500 hover:text-accent-600 active:text-accent-700 hover:ring-accent-600 active:ring-accent-700',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
mode: 'distinct',
|
|
73
|
+
variant: 'ghost',
|
|
74
|
+
className:
|
|
75
|
+
'text-accent-500 hover:text-accent-600 active:text-accent-700 hover:bg-accent-100 active:bg-accent-200',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
mode: 'subtle',
|
|
79
|
+
variant: 'fill',
|
|
80
|
+
className:
|
|
81
|
+
'bg-gray-500 shadow-sm shadow-gray-600/30 hover:bg-gray-600 hover:shadow-lg hover:shadow-gray-600/30 active:bg-gray-700 active:shadow-sm active:shadow-gray-600/30',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
mode: 'subtle',
|
|
85
|
+
variant: 'outline',
|
|
86
|
+
className: 'text-gray-500 hover:text-gray-600 active:text-gray-700',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
mode: 'subtle',
|
|
90
|
+
variant: 'simple',
|
|
91
|
+
className:
|
|
92
|
+
'text-gray-500 hover:text-gray-600 hover:ring-gray-600 active:text-gray-700 active:ring-gray-700',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
mode: 'subtle',
|
|
96
|
+
variant: 'ghost',
|
|
97
|
+
className:
|
|
98
|
+
'text-gray-500 hover:bg-gray-100 hover:text-gray-600 active:bg-gray-200 active:text-gray-700',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
mode: 'negative',
|
|
102
|
+
variant: 'fill',
|
|
103
|
+
className:
|
|
104
|
+
'bg-negative-500 hover:bg-negative-600 active:bg-negative-700 shadow-negative-600/30 hover:shadow-negative-600/30 active:shadow-negative-600/30 shadow-sm hover:shadow-lg active:shadow-sm',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
mode: 'negative',
|
|
108
|
+
variant: 'outline',
|
|
109
|
+
className: 'text-negative-500 hover:text-negative-600 active:text-negative-700',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
mode: 'negative',
|
|
113
|
+
variant: 'simple',
|
|
114
|
+
className:
|
|
115
|
+
'text-negative-500 hover:text-negative-600 hover:ring-negative-600 active:text-negative-700 active:ring-negative-700',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
mode: 'negative',
|
|
119
|
+
variant: 'ghost',
|
|
120
|
+
className:
|
|
121
|
+
'text-negative-500 hover:bg-negative-100 hover:text-negative-600 active:bg-negative-200 active:text-negative-700',
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
{
|
|
125
|
+
shape: 'rect',
|
|
126
|
+
size: 'extrasmall',
|
|
127
|
+
className:
|
|
128
|
+
'min-w-14 px-2 data-[inset=left]:-ml-2 data-[inset=right]:-mr-2 data-[inset=both]:-mx-2',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
shape: 'rect',
|
|
132
|
+
size: 'small',
|
|
133
|
+
className:
|
|
134
|
+
'min-w-16 px-3 data-[inset=left]:-ml-3 data-[inset=right]:-mr-3 data-[inset=both]:-mx-3',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
shape: 'rect',
|
|
138
|
+
size: 'medium',
|
|
139
|
+
className:
|
|
140
|
+
'min-w-24 px-4 data-[inset=left]:-ml-4 data-[inset=right]:-mr-4 data-[inset=both]:-mx-4',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
shape: 'rect',
|
|
144
|
+
size: 'large',
|
|
145
|
+
className:
|
|
146
|
+
'min-w-28 px-6 data-[inset=left]:-ml-6 data-[inset=right]:-mr-6 data-[inset=both]:-mx-6',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
shape: 'rect',
|
|
150
|
+
size: 'extralarge',
|
|
151
|
+
className:
|
|
152
|
+
'min-w-32 px-6 data-[inset=left]:-ml-6 data-[inset=right]:-mr-6 data-[inset=both]:-mx-6',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
shape: 'square',
|
|
156
|
+
size: 'extrasmall',
|
|
157
|
+
className:
|
|
158
|
+
'size-6 p-1 data-[inset=left]:-ml-1 data-[inset=right]:-mr-1 data-[inset=both]:-mx-1',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
shape: 'square',
|
|
162
|
+
size: 'small',
|
|
163
|
+
className:
|
|
164
|
+
'size-8 p-2 data-[inset=left]:-ml-2 data-[inset=right]:-mr-2 data-[inset=both]:-mx-2',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
shape: 'square',
|
|
168
|
+
size: 'medium',
|
|
169
|
+
className:
|
|
170
|
+
'size-10 p-3 data-[inset=left]:-ml-3 data-[inset=right]:-mr-3 data-[inset=both]:-mx-3',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
shape: 'square',
|
|
174
|
+
size: 'large',
|
|
175
|
+
className:
|
|
176
|
+
'size-12 p-4 data-[inset=left]:-ml-4 data-[inset=right]:-mr-4 data-[inset=both]:-mx-4',
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
shape: 'square',
|
|
180
|
+
size: 'extralarge',
|
|
181
|
+
className:
|
|
182
|
+
'size-14 p-5 data-[inset=left]:-ml-5 data-[inset=right]:-mr-5 data-[inset=both]:-mx-5',
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
type ButtonVariantProps = VariantProps<typeof button>;
|
|
188
|
+
|
|
189
|
+
export type { ButtonVariantProps };
|
|
190
|
+
|
|
191
|
+
export { button };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
const SPACING = {
|
|
6
|
+
none: '0',
|
|
7
|
+
small: 'var(--spacing-3)',
|
|
8
|
+
medium: 'var(--spacing-4)',
|
|
9
|
+
large: 'var(--spacing-6)',
|
|
10
|
+
extralarge: 'var(--spacing-8)',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const card = tv({
|
|
14
|
+
base: 'shadow-2xs bg-white p-[var(--padding)] shadow-gray-400/10',
|
|
15
|
+
variants: {
|
|
16
|
+
roundness: {
|
|
17
|
+
none: 'rounded-none',
|
|
18
|
+
small: 'rounded-sm',
|
|
19
|
+
medium: 'rounded-md',
|
|
20
|
+
large: 'rounded-xl',
|
|
21
|
+
full: 'rounded-full',
|
|
22
|
+
},
|
|
23
|
+
spacing: {
|
|
24
|
+
none: '',
|
|
25
|
+
small: '',
|
|
26
|
+
medium: '',
|
|
27
|
+
large: '',
|
|
28
|
+
extralarge: '',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
roundness: 'medium',
|
|
33
|
+
spacing: 'medium',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
type CardVariantProps = VariantProps<typeof card>;
|
|
38
|
+
|
|
39
|
+
export type { CardVariantProps };
|
|
40
|
+
export { card, SPACING };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
import { typography } from './typography.js';
|
|
4
|
+
|
|
5
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
6
|
+
|
|
7
|
+
const heading = tv({
|
|
8
|
+
extend: typography,
|
|
9
|
+
base: 'text-gray-950',
|
|
10
|
+
variants: {
|
|
11
|
+
align: {},
|
|
12
|
+
size: {},
|
|
13
|
+
weight: {},
|
|
14
|
+
color: {},
|
|
15
|
+
variant: {},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
size: 9,
|
|
19
|
+
weight: 'bold',
|
|
20
|
+
color: 'gray',
|
|
21
|
+
variant: 'primary',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
type HeadingVariantProps = VariantProps<typeof heading>;
|
|
26
|
+
|
|
27
|
+
export type { HeadingVariantProps };
|
|
28
|
+
export { heading };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
const popover = tv({
|
|
6
|
+
base: 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 flex h-[var(--height)] max-h-[var(--max-height)] min-h-[var(--min-height)] w-[var(--width)] max-w-[var(--max-width)] min-w-[var(--min-width)] flex-col justify-start overflow-hidden bg-white shadow-md shadow-gray-400/30 outline-0',
|
|
7
|
+
variants: {
|
|
8
|
+
roundness: {
|
|
9
|
+
none: 'rounded-none',
|
|
10
|
+
small: 'rounded-sm',
|
|
11
|
+
medium: 'rounded-md',
|
|
12
|
+
large: 'rounded-xl',
|
|
13
|
+
full: 'rounded-full',
|
|
14
|
+
},
|
|
15
|
+
spacing: {
|
|
16
|
+
small: '',
|
|
17
|
+
medium: '',
|
|
18
|
+
large: '',
|
|
19
|
+
extralarge: '',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
roundness: 'medium',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
type PopoverVariantProps = VariantProps<typeof popover>;
|
|
28
|
+
|
|
29
|
+
const popoverBody = tv({
|
|
30
|
+
base: 'grow overflow-auto bg-gray-50 p-[var(--padding)]',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const popoverHeader = tv({
|
|
34
|
+
base: 'border-b border-b-gray-100 p-[var(--padding)]',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const popoverFooter = tv({
|
|
38
|
+
base: 'border-t border-t-gray-100 p-[var(--padding)]',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export type { PopoverVariantProps };
|
|
42
|
+
export { popover, popoverBody, popoverHeader, popoverFooter };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
import baseElement from './base-element.js';
|
|
4
|
+
|
|
5
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
6
|
+
|
|
7
|
+
const textField = tv({
|
|
8
|
+
extend: baseElement,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
type TextFieldVariantProps = VariantProps<typeof textField>;
|
|
12
|
+
|
|
13
|
+
export type { TextFieldVariantProps };
|
|
14
|
+
|
|
15
|
+
export { textField };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
import { typography } from './typography.js';
|
|
4
|
+
|
|
5
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
6
|
+
|
|
7
|
+
const text = tv({
|
|
8
|
+
extend: typography,
|
|
9
|
+
base: 'text-gray-950',
|
|
10
|
+
variants: {
|
|
11
|
+
align: {},
|
|
12
|
+
size: {},
|
|
13
|
+
weight: {},
|
|
14
|
+
color: {},
|
|
15
|
+
variant: {},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
size: 3,
|
|
19
|
+
weight: 'regular',
|
|
20
|
+
color: 'gray',
|
|
21
|
+
variant: 'primary',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
type TextVariantProps = VariantProps<typeof text>;
|
|
26
|
+
|
|
27
|
+
export type { TextVariantProps };
|
|
28
|
+
export { text };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
const typography = tv({
|
|
6
|
+
base: 'text-gray-950',
|
|
7
|
+
variants: {
|
|
8
|
+
align: {
|
|
9
|
+
center: 'text-center',
|
|
10
|
+
left: 'text-left',
|
|
11
|
+
right: 'text-right',
|
|
12
|
+
justify: 'text-justify',
|
|
13
|
+
balance: 'text-balance',
|
|
14
|
+
pretty: 'text-pretty',
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
1: 'text-xs',
|
|
18
|
+
2: 'text-sm',
|
|
19
|
+
3: 'text-base',
|
|
20
|
+
4: 'text-lg',
|
|
21
|
+
5: 'text-xl',
|
|
22
|
+
6: 'text-2xl',
|
|
23
|
+
7: 'text-3xl',
|
|
24
|
+
8: 'text-4xl',
|
|
25
|
+
9: 'text-5xl',
|
|
26
|
+
10: 'text-6xl',
|
|
27
|
+
11: 'text-7xl',
|
|
28
|
+
12: 'text-8xl',
|
|
29
|
+
13: 'text-9xl',
|
|
30
|
+
},
|
|
31
|
+
weight: {
|
|
32
|
+
regular: 'font-normal',
|
|
33
|
+
medium: 'font-medium',
|
|
34
|
+
semibold: 'font-semibold',
|
|
35
|
+
bold: 'font-bold',
|
|
36
|
+
},
|
|
37
|
+
color: {
|
|
38
|
+
accent: '',
|
|
39
|
+
gray: '',
|
|
40
|
+
negative: '',
|
|
41
|
+
},
|
|
42
|
+
variant: {
|
|
43
|
+
primary: '',
|
|
44
|
+
secondary: '',
|
|
45
|
+
tertiary: '',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
compoundVariants: [
|
|
49
|
+
{
|
|
50
|
+
color: 'accent',
|
|
51
|
+
variant: 'primary',
|
|
52
|
+
className: 'text-accent-950',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
color: 'accent',
|
|
56
|
+
variant: 'secondary',
|
|
57
|
+
className: 'text-accent-900',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
color: 'accent',
|
|
61
|
+
variant: 'tertiary',
|
|
62
|
+
className: 'text-accent-800',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
color: 'gray',
|
|
66
|
+
variant: 'primary',
|
|
67
|
+
className: 'text-gray-950',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
color: 'gray',
|
|
71
|
+
variant: 'secondary',
|
|
72
|
+
className: 'text-gray-900',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
color: 'gray',
|
|
76
|
+
variant: 'tertiary',
|
|
77
|
+
className: 'text-gray-800',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
color: 'negative',
|
|
81
|
+
variant: 'primary',
|
|
82
|
+
className: 'text-negative-950',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
color: 'negative',
|
|
86
|
+
variant: 'secondary',
|
|
87
|
+
className: 'text-negative-900',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
color: 'negative',
|
|
91
|
+
variant: 'tertiary',
|
|
92
|
+
className: 'text-negative-800',
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
type TypographyVariantProps = VariantProps<typeof typography>;
|
|
98
|
+
|
|
99
|
+
export type { TypographyVariantProps };
|
|
100
|
+
export { typography };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { intlFormatDistance } from 'date-fns';
|
|
2
|
+
|
|
3
|
+
import { useInApp } from '../hooks/index.js';
|
|
4
|
+
import { Button, Card, Flex, Heading, Popover, Text, Theme, Tooltip } from '../index.js';
|
|
5
|
+
import { Inbox, Mail, MailOpen, X } from '../icons/index.js';
|
|
6
|
+
|
|
7
|
+
const NotificationBell = () => {
|
|
8
|
+
let {
|
|
9
|
+
markNotificationAsRead,
|
|
10
|
+
markNotificationAsUnread,
|
|
11
|
+
notifications,
|
|
12
|
+
unreadNotificationsCount,
|
|
13
|
+
} = useInApp();
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Theme>
|
|
17
|
+
<Popover.Root>
|
|
18
|
+
<Tooltip.Root>
|
|
19
|
+
<Tooltip.Trigger>
|
|
20
|
+
<Popover.Trigger>
|
|
21
|
+
<Button
|
|
22
|
+
shape="square"
|
|
23
|
+
roundness="full"
|
|
24
|
+
variant={unreadNotificationsCount ? 'fill' : 'ghost'}
|
|
25
|
+
>
|
|
26
|
+
<Inbox />
|
|
27
|
+
</Button>
|
|
28
|
+
</Popover.Trigger>
|
|
29
|
+
</Tooltip.Trigger>
|
|
30
|
+
<Tooltip.Content content="Notification" />
|
|
31
|
+
</Tooltip.Root>
|
|
32
|
+
<Popover.Content spacing="large" width="350px" height="450px">
|
|
33
|
+
<Popover.Header asChild>
|
|
34
|
+
<Flex justify="between" align="center">
|
|
35
|
+
<Heading size={3}>Notifications</Heading>
|
|
36
|
+
<Popover.Close>
|
|
37
|
+
<Button shape="square" roundness="full" variant="ghost" mode="subtle" inset="right">
|
|
38
|
+
<X />
|
|
39
|
+
</Button>
|
|
40
|
+
</Popover.Close>
|
|
41
|
+
</Flex>
|
|
42
|
+
</Popover.Header>
|
|
43
|
+
<Popover.Body>
|
|
44
|
+
<Flex direction="column" gap={1}>
|
|
45
|
+
{notifications.length < 0 && (
|
|
46
|
+
<Flex justify="center" align="center">
|
|
47
|
+
<Text variant="tertiary" size={2}>
|
|
48
|
+
No notifications yet.
|
|
49
|
+
</Text>
|
|
50
|
+
</Flex>
|
|
51
|
+
)}
|
|
52
|
+
{notifications.map((notification) => (
|
|
53
|
+
<Card key={notification.id}>
|
|
54
|
+
<Flex align="center" gap={4} justify="between">
|
|
55
|
+
<Flex direction="column" gap={1}>
|
|
56
|
+
<Text as="p" variant="secondary" weight="semibold" size={2}>
|
|
57
|
+
{notification.renderedContent.body}
|
|
58
|
+
</Text>
|
|
59
|
+
<Text size={1} variant="tertiary">
|
|
60
|
+
{intlFormatDistance(notification.sentAt, new Date())}
|
|
61
|
+
</Text>
|
|
62
|
+
</Flex>
|
|
63
|
+
<Tooltip.Root>
|
|
64
|
+
<Tooltip.Trigger>
|
|
65
|
+
<Button
|
|
66
|
+
shape="square"
|
|
67
|
+
variant="ghost"
|
|
68
|
+
roundness="full"
|
|
69
|
+
mode={notification.readAt ? 'subtle' : 'distinct'}
|
|
70
|
+
onPress={() => {
|
|
71
|
+
if (notification.readAt) {
|
|
72
|
+
markNotificationAsUnread(notification.id);
|
|
73
|
+
} else {
|
|
74
|
+
markNotificationAsRead(notification.id);
|
|
75
|
+
}
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
{notification.readAt ? <MailOpen /> : <Mail />}
|
|
79
|
+
</Button>
|
|
80
|
+
</Tooltip.Trigger>
|
|
81
|
+
<Tooltip.Content
|
|
82
|
+
content={notification.readAt ? 'Mark as unread' : 'Mark as read'}
|
|
83
|
+
/>
|
|
84
|
+
</Tooltip.Root>
|
|
85
|
+
</Flex>
|
|
86
|
+
</Card>
|
|
87
|
+
))}
|
|
88
|
+
</Flex>
|
|
89
|
+
</Popover.Body>
|
|
90
|
+
<Popover.Footer asChild>
|
|
91
|
+
<Text as="p" align="center" color="accent" variant="tertiary" size={1}>
|
|
92
|
+
Powered by DashX
|
|
93
|
+
</Text>
|
|
94
|
+
</Popover.Footer>
|
|
95
|
+
</Popover.Content>
|
|
96
|
+
</Popover.Root>
|
|
97
|
+
</Theme>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default NotificationBell;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { ChangeEvent } from 'react';
|
|
4
|
+
import type { StoredPreference } from './Preferences.js';
|
|
5
|
+
|
|
6
|
+
type PreferenceType = [string, StoredPreference];
|
|
7
|
+
|
|
8
|
+
type RenderPreferenceFunction = (props: {
|
|
9
|
+
preference: PreferenceType;
|
|
10
|
+
onChange: UpdatePreferenceHandler;
|
|
11
|
+
}) => JSX.Element;
|
|
12
|
+
|
|
13
|
+
interface PreferenceProps {
|
|
14
|
+
preference: PreferenceType;
|
|
15
|
+
onChange: (e: ChangeEvent<HTMLInputElement>, p: PreferenceType) => void;
|
|
16
|
+
renderPreference?: RenderPreferenceFunction;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type UpdatePreferenceHandler = (
|
|
20
|
+
event: ChangeEvent<HTMLInputElement>,
|
|
21
|
+
preference: PreferenceType,
|
|
22
|
+
) => void;
|
|
23
|
+
|
|
24
|
+
const defaultRenderPreference: RenderPreferenceFunction = ({ preference, onChange }) => {
|
|
25
|
+
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
|
|
26
|
+
onChange(event, preference);
|
|
27
|
+
};
|
|
28
|
+
return (
|
|
29
|
+
<div>
|
|
30
|
+
<p>{preference[0]}</p>
|
|
31
|
+
<label>
|
|
32
|
+
Email
|
|
33
|
+
<input
|
|
34
|
+
name="email"
|
|
35
|
+
type="checkbox"
|
|
36
|
+
defaultChecked={preference[1].email}
|
|
37
|
+
onChange={handleChange}
|
|
38
|
+
/>
|
|
39
|
+
</label>
|
|
40
|
+
<label>
|
|
41
|
+
Push
|
|
42
|
+
<input
|
|
43
|
+
name="push"
|
|
44
|
+
type="checkbox"
|
|
45
|
+
defaultChecked={preference[1].push}
|
|
46
|
+
onChange={handleChange}
|
|
47
|
+
/>
|
|
48
|
+
</label>
|
|
49
|
+
<label>
|
|
50
|
+
SMS
|
|
51
|
+
<input
|
|
52
|
+
name="sms"
|
|
53
|
+
type="checkbox"
|
|
54
|
+
defaultChecked={preference[1].sms}
|
|
55
|
+
onChange={handleChange}
|
|
56
|
+
/>
|
|
57
|
+
</label>
|
|
58
|
+
<label>
|
|
59
|
+
Whatsapp
|
|
60
|
+
<input
|
|
61
|
+
name="whatsapp"
|
|
62
|
+
type="checkbox"
|
|
63
|
+
defaultChecked={preference[1].whatsapp}
|
|
64
|
+
onChange={handleChange}
|
|
65
|
+
/>
|
|
66
|
+
</label>
|
|
67
|
+
<br />
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function Preference({
|
|
73
|
+
preference,
|
|
74
|
+
onChange,
|
|
75
|
+
renderPreference = defaultRenderPreference,
|
|
76
|
+
}: PreferenceProps) {
|
|
77
|
+
return renderPreference({ preference, onChange });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default Preference;
|