@xjur-ui/react 1.0.2 → 1.0.4
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/.turbo/turbo-build.log +26 -16
- package/CHANGELOG.md +20 -0
- package/dist/components/avatar-group.d.ts +34 -0
- package/dist/components/avatar-group.js +179 -0
- package/dist/components/avatar.js +1 -0
- package/dist/components/chip.js +1 -0
- package/dist/components/date-picker.js +1 -1
- package/dist/components/divider.js +2 -1
- package/dist/components/dropdown-menu.js +3 -2
- package/dist/components/icon.d.ts +1 -1
- package/dist/components/icon.js +5 -1
- package/dist/components/input.js +1 -1
- package/dist/components/otp-input.js +1 -1
- package/dist/components/rich-editor.d.ts +25 -0
- package/dist/components/rich-editor.js +723 -0
- package/dist/components/search-input.js +1 -1
- package/dist/components/select.js +2 -2
- package/dist/components/skeleton.d.ts +6 -0
- package/dist/components/skeleton.js +16 -0
- package/dist/components/table.d.ts +17 -0
- package/dist/components/table.js +196 -0
- package/dist/components/tooltip.d.ts +11 -0
- package/dist/components/tooltip.js +58 -0
- package/dist/components/typography.d.ts +1 -1
- package/dist/index.css +401 -23
- package/package.json +14 -2
- package/src/components/avatar-group.tsx +76 -0
- package/src/components/avatar.tsx +1 -0
- package/src/components/date-picker.tsx +1 -1
- package/src/components/divider.tsx +2 -1
- package/src/components/dropdown-menu.tsx +1 -1
- package/src/components/input.tsx +1 -1
- package/src/components/otp-input.tsx +1 -1
- package/src/components/rich-editor.tsx +371 -0
- package/src/components/search-input.tsx +1 -2
- package/src/components/select.tsx +1 -1
- package/src/components/skeleton.tsx +12 -0
- package/src/components/table.tsx +160 -0
- package/src/components/tooltip.tsx +63 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-os.ts +32 -0
- package/src/resources/icons.ts +5 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip'
|
|
2
|
+
import { cx } from '@xjur-ui/util'
|
|
3
|
+
|
|
4
|
+
function TooltipProvider({
|
|
5
|
+
delayDuration = 0,
|
|
6
|
+
...props
|
|
7
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
8
|
+
return (
|
|
9
|
+
<TooltipPrimitive.Provider
|
|
10
|
+
data-slot="tooltip-provider"
|
|
11
|
+
delayDuration={delayDuration}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function Tooltip({
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
20
|
+
return (
|
|
21
|
+
<TooltipProvider>
|
|
22
|
+
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
23
|
+
</TooltipProvider>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function TooltipTrigger({
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
30
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function TooltipContent({
|
|
34
|
+
className,
|
|
35
|
+
sideOffset = 1,
|
|
36
|
+
variant = 'simple',
|
|
37
|
+
children,
|
|
38
|
+
...props
|
|
39
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Content> & {
|
|
40
|
+
variant?: 'simple' | 'rich'
|
|
41
|
+
}) {
|
|
42
|
+
return (
|
|
43
|
+
<TooltipPrimitive.Portal>
|
|
44
|
+
<TooltipPrimitive.Content
|
|
45
|
+
className={cx(
|
|
46
|
+
'text-size-body-sm text-balance',
|
|
47
|
+
'data-[variant=simple]:bg-alt-2 data-[variant=simple]:text-neutral-label data-[variant=simple]:rounded-small-1x data-[variant=simple]:px-small data-[variant=simple]:py-small-1x',
|
|
48
|
+
'data-[variant=rich]:bg-layer-2-idle data-[variant=rich]:text-neutral-dark data-[variant=rich]:rounded-small data-[variant=rich]:border-border-layer-2 data-[variant=rich]:p-large data-[variant=rich]:border',
|
|
49
|
+
'animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin)',
|
|
50
|
+
className
|
|
51
|
+
)}
|
|
52
|
+
data-slot="tooltip-content"
|
|
53
|
+
data-variant={variant}
|
|
54
|
+
sideOffset={sideOffset}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</TooltipPrimitive.Content>
|
|
59
|
+
</TooltipPrimitive.Portal>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useOS } from './use-os'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react'
|
|
2
|
+
|
|
3
|
+
export type OS = 'ios' | 'macos' | 'windows' | 'android' | 'linux' | 'unknown'
|
|
4
|
+
|
|
5
|
+
export function useOS() {
|
|
6
|
+
const [os, setOs] = useState<OS>('unknown')
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (typeof window === 'undefined') return
|
|
10
|
+
|
|
11
|
+
const userAgent = window.navigator.userAgent
|
|
12
|
+
|
|
13
|
+
if (/iPad|iPhone|iPod/.test(userAgent)) {
|
|
14
|
+
setOs('ios')
|
|
15
|
+
} else if (/Mac/.test(userAgent)) {
|
|
16
|
+
setOs('macos')
|
|
17
|
+
} else if (/Win/.test(userAgent)) {
|
|
18
|
+
setOs('windows')
|
|
19
|
+
} else if (/Android/.test(userAgent)) {
|
|
20
|
+
setOs('android')
|
|
21
|
+
} else if (/Linux/.test(userAgent)) {
|
|
22
|
+
setOs('linux')
|
|
23
|
+
} else {
|
|
24
|
+
setOs('unknown')
|
|
25
|
+
}
|
|
26
|
+
}, [])
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
os,
|
|
30
|
+
shortcut: ['macos', 'ios'].includes(os) ? '⌘' : 'Ctrl'
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/resources/icons.ts
CHANGED
|
@@ -140,7 +140,11 @@ export const icons = [
|
|
|
140
140
|
'history',
|
|
141
141
|
'security',
|
|
142
142
|
'bar_chart',
|
|
143
|
-
'category'
|
|
143
|
+
'category',
|
|
144
|
+
'format_underlined',
|
|
145
|
+
'format_list_bulleted',
|
|
146
|
+
'format_list_numbered',
|
|
147
|
+
'redo'
|
|
144
148
|
] as const
|
|
145
149
|
|
|
146
150
|
export type IconType = (typeof icons)[number]
|