oneslash-design-system 1.1.4 → 1.1.6
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/components/button.tsx +21 -3
- package/components/modal.tsx +17 -14
- package/components/popover.tsx +5 -1
- package/dist/components/modal.jsx +6 -4
- package/dist/components/popover.jsx +1 -1
- package/dist/output.css +15 -0
- package/dist/tailwind.config.js +17 -5
- package/package.json +1 -1
- package/tailwind.config.ts +6 -3
package/components/button.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import UserImage from './userImage';
|
|
3
4
|
|
|
4
5
|
interface ButtonProps{
|
|
5
6
|
size: 'small' | 'medium' | 'large';
|
|
@@ -7,6 +8,8 @@ interface ButtonProps{
|
|
|
7
8
|
state: 'enabled' | 'hovered' | 'focused' | 'disabled';
|
|
8
9
|
label: string;
|
|
9
10
|
decoIcon?: string;
|
|
11
|
+
userHandle?: string;
|
|
12
|
+
userImgUrl?: string;
|
|
10
13
|
actionIcon?: string;
|
|
11
14
|
onClickButton?: any;
|
|
12
15
|
onClickActionIcon?: () => void;
|
|
@@ -20,6 +23,8 @@ export default function Button({
|
|
|
20
23
|
state,
|
|
21
24
|
label,
|
|
22
25
|
decoIcon,
|
|
26
|
+
userHandle,
|
|
27
|
+
userImgUrl,
|
|
23
28
|
actionIcon,
|
|
24
29
|
onClickButton,
|
|
25
30
|
onClickActionIcon,
|
|
@@ -108,12 +113,25 @@ export default function Button({
|
|
|
108
113
|
onMouseLeave={() => { if (state !== 'disabled') setIsHovered(false); }}
|
|
109
114
|
onClick={onClickButton} // Button click action
|
|
110
115
|
>
|
|
111
|
-
{
|
|
116
|
+
{/* left icon or userImage */}
|
|
117
|
+
<div className="flex items-center space-x-2">
|
|
118
|
+
{/* Render dynamic icon if available */}
|
|
119
|
+
{IconLeft && (
|
|
112
120
|
<IconLeft className={sizeIcon} />
|
|
113
|
-
|
|
114
|
-
|
|
121
|
+
)}
|
|
122
|
+
|
|
123
|
+
{/* Render UserImage if userImgUrl or userHandle is provided */}
|
|
124
|
+
{(userImgUrl || userHandle) && (
|
|
125
|
+
<UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl} />
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
{/* label */}
|
|
130
|
+
<div className="flex-1 whitespace-nowrap overflow-hidden truncate px-2 text-left">
|
|
115
131
|
{label}
|
|
116
132
|
</div>
|
|
133
|
+
|
|
134
|
+
{/* right icon */}
|
|
117
135
|
{IconRight && (
|
|
118
136
|
<div onClick={onClickActionIcon} className="cursor-pointer">
|
|
119
137
|
<IconRight className={sizeIcon} />
|
package/components/modal.tsx
CHANGED
|
@@ -41,10 +41,10 @@ export default function Modal({
|
|
|
41
41
|
};
|
|
42
42
|
}, [onClose]);
|
|
43
43
|
|
|
44
|
-
//
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
// Define dimensions based on size
|
|
45
|
+
const dimensions = size === 'large'
|
|
46
|
+
? { width: '1200px', height: '800px' }
|
|
47
|
+
: { width: '600px' };
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
return (
|
|
@@ -55,28 +55,31 @@ export default function Modal({
|
|
|
55
55
|
aria-labelledby="modal-title"
|
|
56
56
|
aria-modal="true"
|
|
57
57
|
tabIndex={-1}
|
|
58
|
-
|
|
58
|
+
>
|
|
59
59
|
<div
|
|
60
|
-
className={`bg-light-background-default dark:bg-dark-background-default p-6 rounded-[8px] space-y-4 ${modalWidth}`}
|
|
61
60
|
style={{
|
|
62
|
-
maxWidth,
|
|
61
|
+
maxWidth: dimensions.width,
|
|
62
|
+
...(size === 'large' && { maxHeight: dimensions.height }),
|
|
63
63
|
width: 'calc(100vw - 64px)',
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
overflowY: 'auto',
|
|
64
|
+
height: size === 'large' ? 'calc(100vh - 64px)' : 'auto',
|
|
65
|
+
overflowY: size === 'large' ? 'auto' : 'visible',
|
|
67
66
|
}}
|
|
68
|
-
|
|
67
|
+
className={`flex flex-col bg-light-background-default dark:bg-dark-background-default p-6 rounded-[8px] space-y-4`}
|
|
68
|
+
|
|
69
|
+
>
|
|
69
70
|
{title && (
|
|
70
71
|
<h2 id="modal-title" className="text-h6">
|
|
71
72
|
{title}
|
|
72
73
|
</h2>
|
|
73
74
|
)}
|
|
74
|
-
<div className="
|
|
75
|
+
<div className="flex-grow overflow-auto">
|
|
75
76
|
{children}
|
|
76
77
|
</div>
|
|
77
78
|
{actions && (
|
|
78
|
-
<div className=
|
|
79
|
-
|
|
79
|
+
<div className='pt-6 border-t border-light-misc-divider dark:border-dark-misc-divider'>
|
|
80
|
+
<div className="flex justify-between" >
|
|
81
|
+
{actions}
|
|
82
|
+
</div>
|
|
80
83
|
</div>
|
|
81
84
|
)}
|
|
82
85
|
</div>
|
package/components/popover.tsx
CHANGED
|
@@ -57,7 +57,11 @@ export default function Popover({
|
|
|
57
57
|
<div
|
|
58
58
|
id={id}
|
|
59
59
|
ref={setPopoverElement}
|
|
60
|
-
style={{
|
|
60
|
+
style={{
|
|
61
|
+
...styles.popper,
|
|
62
|
+
display: open ? 'block' : 'none',
|
|
63
|
+
zIndex: 10000,
|
|
64
|
+
}}
|
|
61
65
|
{...attributes.popper}
|
|
62
66
|
className="bg-light-background-accent100 dark:bg-dark-background-accent100 rounded-[8px] shadow-lg p-2"
|
|
63
67
|
role="dialog"
|
|
@@ -26,7 +26,7 @@ export default function Modal(_a) {
|
|
|
26
26
|
var modalWidth = size === 'large' ? 'w-[1200px]' : 'w-[600px]';
|
|
27
27
|
var maxWidth = size === 'large' ? '1200px' : '600px';
|
|
28
28
|
return (<div className="fixed inset-[-32px] bg-black bg-opacity-50 flex items-center justify-center z-50" onClick={handleOverlayClick} role="dialog" aria-labelledby="modal-title" aria-modal="true" tabIndex={-1}>
|
|
29
|
-
<div className={"bg-light-background-default dark:bg-dark-background-default p-6 rounded-[8px] space-y-4 ".concat(modalWidth)} style={{
|
|
29
|
+
<div className={"flex flex-col bg-light-background-default dark:bg-dark-background-default p-6 rounded-[8px] space-y-4 ".concat(modalWidth)} style={{
|
|
30
30
|
maxWidth: maxWidth,
|
|
31
31
|
width: 'calc(100vw - 64px)',
|
|
32
32
|
maxHeight: '800px',
|
|
@@ -36,11 +36,13 @@ export default function Modal(_a) {
|
|
|
36
36
|
{title && (<h2 id="modal-title" className="text-h6">
|
|
37
37
|
{title}
|
|
38
38
|
</h2>)}
|
|
39
|
-
<div className="text-body1
|
|
39
|
+
<div className="text-body1">
|
|
40
40
|
{children}
|
|
41
41
|
</div>
|
|
42
|
-
{actions && (<div className=
|
|
43
|
-
|
|
42
|
+
{actions && (<div className='pt-6 border-t border-light-misc-divider dark:border-dark-misc-divider'>
|
|
43
|
+
<div className="flex justify-between">
|
|
44
|
+
{actions}
|
|
45
|
+
</div>
|
|
44
46
|
</div>)}
|
|
45
47
|
</div>
|
|
46
48
|
</div>);
|
|
@@ -45,7 +45,7 @@ export default function Popover(_a) {
|
|
|
45
45
|
if (!open || !hasMounted || !anchorEl)
|
|
46
46
|
return null;
|
|
47
47
|
// Render popover in a portal to prevent layout shifts and positioning issues
|
|
48
|
-
return createPortal(<div id={id} ref={setPopoverElement} style={__assign(__assign({}, styles.popper), { display: open ? 'block' : 'none' })} {...attributes.popper} className="bg-light-background-accent100 dark:bg-dark-background-accent100 rounded-[8px] shadow-lg p-2" role="dialog">
|
|
48
|
+
return createPortal(<div id={id} ref={setPopoverElement} style={__assign(__assign({}, styles.popper), { display: open ? 'block' : 'none', zIndex: 10000 })} {...attributes.popper} className="bg-light-background-accent100 dark:bg-dark-background-accent100 rounded-[8px] shadow-lg p-2" role="dialog">
|
|
49
49
|
{children}
|
|
50
50
|
</div>, document.body // Mounting the popover in the document body for isolation
|
|
51
51
|
);
|
package/dist/output.css
CHANGED
|
@@ -702,6 +702,9 @@ video {
|
|
|
702
702
|
.border-4 {
|
|
703
703
|
border-width: 4px;
|
|
704
704
|
}
|
|
705
|
+
.border-t {
|
|
706
|
+
border-top-width: 1px;
|
|
707
|
+
}
|
|
705
708
|
.border-none {
|
|
706
709
|
border-style: none;
|
|
707
710
|
}
|
|
@@ -713,6 +716,10 @@ video {
|
|
|
713
716
|
--tw-border-opacity: 1;
|
|
714
717
|
border-color: rgb(238 174 3 / var(--tw-border-opacity));
|
|
715
718
|
}
|
|
719
|
+
.border-light-misc-divider {
|
|
720
|
+
--tw-border-opacity: 1;
|
|
721
|
+
border-color: rgb(209 209 209 / var(--tw-border-opacity));
|
|
722
|
+
}
|
|
716
723
|
.border-light-text-secondary {
|
|
717
724
|
--tw-border-opacity: 1;
|
|
718
725
|
border-color: rgb(109 109 109 / var(--tw-border-opacity));
|
|
@@ -823,6 +830,9 @@ video {
|
|
|
823
830
|
.pr-3 {
|
|
824
831
|
padding-right: 0.75rem;
|
|
825
832
|
}
|
|
833
|
+
.pt-6 {
|
|
834
|
+
padding-top: 1.5rem;
|
|
835
|
+
}
|
|
826
836
|
.text-center {
|
|
827
837
|
text-align: center;
|
|
828
838
|
}
|
|
@@ -1000,6 +1010,11 @@ body {
|
|
|
1000
1010
|
|
|
1001
1011
|
@media (prefers-color-scheme: dark) {
|
|
1002
1012
|
|
|
1013
|
+
.dark\:border-dark-misc-divider {
|
|
1014
|
+
--tw-border-opacity: 1;
|
|
1015
|
+
border-color: rgb(64 64 64 / var(--tw-border-opacity));
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1003
1018
|
.dark\:border-dark-text-secondary {
|
|
1004
1019
|
--tw-border-opacity: 1;
|
|
1005
1020
|
border-color: rgb(176 176 176 / var(--tw-border-opacity));
|
package/dist/tailwind.config.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
var designTokens = require('./designTokens');
|
|
2
13
|
var config = {
|
|
3
14
|
content: [
|
|
4
|
-
"./
|
|
15
|
+
"./app/**/*.{js,ts,jsx,tsx}",
|
|
16
|
+
"./components/**/*.{js,ts,jsx,tsx}",
|
|
17
|
+
"./pages/**/*.{js,ts,jsx,tsx}",
|
|
5
18
|
],
|
|
6
19
|
theme: {
|
|
7
20
|
extend: {
|
|
@@ -125,10 +138,9 @@ var config = {
|
|
|
125
138
|
'dark-misc-scrollbar-bg': designTokens.colors.dark.background.default,
|
|
126
139
|
'dark-misc-scrollbar-thumb': designTokens.colors.dark.background.accent200,
|
|
127
140
|
},
|
|
128
|
-
spacing: {
|
|
129
|
-
|
|
130
|
-
medium: designTokens.spacing.medium,
|
|
131
|
-
large: designTokens.spacing.large,
|
|
141
|
+
spacing: function (_a) {
|
|
142
|
+
var theme = _a.theme;
|
|
143
|
+
return (__assign(__assign({}, theme('spacing')), { small: designTokens.spacing.small, medium: designTokens.spacing.medium, large: designTokens.spacing.large }));
|
|
132
144
|
},
|
|
133
145
|
fontSize: {
|
|
134
146
|
h1: designTokens.typography.h1.size,
|
package/package.json
CHANGED
package/tailwind.config.ts
CHANGED
|
@@ -4,7 +4,9 @@ const designTokens = require('./designTokens');
|
|
|
4
4
|
|
|
5
5
|
const config: Config = {
|
|
6
6
|
content: [
|
|
7
|
-
"./
|
|
7
|
+
"./app/**/*.{js,ts,jsx,tsx}",
|
|
8
|
+
"./components/**/*.{js,ts,jsx,tsx}",
|
|
9
|
+
"./pages/**/*.{js,ts,jsx,tsx}",
|
|
8
10
|
],
|
|
9
11
|
theme: {
|
|
10
12
|
extend: {
|
|
@@ -154,11 +156,12 @@ const config: Config = {
|
|
|
154
156
|
'dark-misc-scrollbar-bg': designTokens.colors.dark.background.default,
|
|
155
157
|
'dark-misc-scrollbar-thumb': designTokens.colors.dark.background.accent200,
|
|
156
158
|
},
|
|
157
|
-
spacing: {
|
|
159
|
+
spacing: ({ theme }) => ({
|
|
160
|
+
...theme('spacing'), // Retain default spacing
|
|
158
161
|
small: designTokens.spacing.small,
|
|
159
162
|
medium: designTokens.spacing.medium,
|
|
160
163
|
large: designTokens.spacing.large,
|
|
161
|
-
},
|
|
164
|
+
}),
|
|
162
165
|
fontSize: {
|
|
163
166
|
h1: designTokens.typography.h1.size,
|
|
164
167
|
h2: designTokens.typography.h2.size,
|