@iota/apps-ui-kit 0.9.1 → 0.9.3
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/CHANGELOG.md +24 -0
- package/README.md +34 -4
- package/dist/index.d.ts +4 -17
- package/dist/index.es.js +1090 -1107
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/lib/components/atoms/button-segment/ButtonSegment.tsx +1 -1
- package/src/lib/components/atoms/toggle/toggle.classes.ts +3 -3
- package/src/lib/components/molecules/account/Account.tsx +4 -44
- package/src/lib/components/molecules/address/Address.tsx +1 -2
- package/src/lib/components/organisms/dialog/Dialog.tsx +1 -1
- package/src/lib/components/organisms/table/Table.tsx +3 -0
- package/src/storybook/stories/molecules/Account.stories.tsx +2 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iota/apps-ui-kit",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"repository": "https://github.com/iotaledger/iota",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"classnames": "^2.5.1",
|
|
28
28
|
"lodash.merge": "^4.6.2",
|
|
29
29
|
"react-number-format": "^5.2.2",
|
|
30
|
-
"@iota/apps-ui-icons": "0.7.
|
|
30
|
+
"@iota/apps-ui-icons": "0.7.3"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": "^18 || ^19",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@storybook/react": "^7.1.0",
|
|
44
44
|
"@storybook/react-vite": "^7.1.0",
|
|
45
45
|
"@types/lodash.merge": "^4.6.9",
|
|
46
|
-
"@types/node": "^
|
|
46
|
+
"@types/node": "^24.0.0",
|
|
47
47
|
"@types/react": "^18.3.3",
|
|
48
48
|
"@types/react-dom": "^18.3.0",
|
|
49
49
|
"@vitejs/plugin-react-swc": "^3.3.2",
|
|
@@ -91,7 +91,7 @@ export function ButtonSegment({
|
|
|
91
91
|
>
|
|
92
92
|
<div className={cx('flex flex-row items-center justify-center gap-2', textSize)}>
|
|
93
93
|
{icon && <span>{icon}</span>}
|
|
94
|
-
<span className="
|
|
94
|
+
<span className="text-start font-inter">{label}</span>
|
|
95
95
|
</div>
|
|
96
96
|
</ButtonUnstyled>
|
|
97
97
|
);
|
|
@@ -17,15 +17,15 @@ export const TOGGLE_SIZE = {
|
|
|
17
17
|
[ToggleSize.Default]: 'h-6 w-12',
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export const TOGGLE_THUMB = 'absolute rounded-full transition-all duration-200 ease-in';
|
|
20
|
+
export const TOGGLE_THUMB = 'absolute rounded-full transition-all duration-200 ease-in-out';
|
|
21
21
|
export const TOGGLE_THUMB_POSITION = {
|
|
22
22
|
[ToggleSize.Small]: {
|
|
23
23
|
unchecked: 'left-1',
|
|
24
|
-
checked: 'left-
|
|
24
|
+
checked: 'left-[34px] -translate-x-full',
|
|
25
25
|
},
|
|
26
26
|
[ToggleSize.Default]: {
|
|
27
27
|
unchecked: 'left-1',
|
|
28
|
-
checked: 'left-
|
|
28
|
+
checked: 'left-[42px] -translate-x-full',
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
export const TOGGLE_THUMB_COLOR = {
|
|
@@ -4,13 +4,7 @@
|
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import type { BadgeType } from '@/components/atoms';
|
|
6
6
|
import { Badge, Tooltip, TooltipPosition, ButtonUnstyled } from '@/components/atoms';
|
|
7
|
-
import {
|
|
8
|
-
LockLocked,
|
|
9
|
-
LockUnlocked,
|
|
10
|
-
MoreHoriz,
|
|
11
|
-
CheckmarkFilled,
|
|
12
|
-
RadioOff,
|
|
13
|
-
} from '@iota/apps-ui-icons';
|
|
7
|
+
import { MoreHoriz, CheckmarkFilled, RadioOff } from '@iota/apps-ui-icons';
|
|
14
8
|
import { Address } from '../address';
|
|
15
9
|
|
|
16
10
|
interface AccountProps {
|
|
@@ -22,26 +16,14 @@ interface AccountProps {
|
|
|
22
16
|
* The subtitle of the account.
|
|
23
17
|
*/
|
|
24
18
|
subtitle: string;
|
|
25
|
-
/**
|
|
26
|
-
* Whether the account is unlocked.
|
|
27
|
-
*/
|
|
28
|
-
isLocked?: boolean;
|
|
29
19
|
/**
|
|
30
20
|
* Handler for more options click.
|
|
31
21
|
*/
|
|
32
22
|
onOptionsClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
33
|
-
/**
|
|
34
|
-
* Handler for the lock account icon click.
|
|
35
|
-
*/
|
|
36
|
-
onLockAccountClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Handle for the unlock account icon click.
|
|
39
|
-
*/
|
|
40
|
-
onUnlockAccountClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
41
23
|
/**
|
|
42
24
|
* Function to render avatar content.
|
|
43
25
|
*/
|
|
44
|
-
avatarContent: (
|
|
26
|
+
avatarContent: () => React.JSX.Element;
|
|
45
27
|
/**
|
|
46
28
|
* The onCopy event of the Address (optional).
|
|
47
29
|
*/
|
|
@@ -97,11 +79,8 @@ export function Account({
|
|
|
97
79
|
subtitle,
|
|
98
80
|
badgeType,
|
|
99
81
|
badgeText,
|
|
100
|
-
isLocked,
|
|
101
82
|
avatarContent,
|
|
102
83
|
onOptionsClick,
|
|
103
|
-
onLockAccountClick,
|
|
104
|
-
onUnlockAccountClick,
|
|
105
84
|
onCopy,
|
|
106
85
|
copyText,
|
|
107
86
|
onOpen,
|
|
@@ -117,17 +96,15 @@ export function Account({
|
|
|
117
96
|
|
|
118
97
|
return (
|
|
119
98
|
<div
|
|
99
|
+
data-testid="account-tile"
|
|
120
100
|
className={cx(
|
|
121
101
|
'state-layer group relative flex w-full items-center justify-between space-x-3 rounded-xl px-sm py-xs hover:cursor-pointer',
|
|
122
102
|
isActive && 'state-active',
|
|
123
|
-
{
|
|
124
|
-
'opacity-60': isLocked && showSelected,
|
|
125
|
-
},
|
|
126
103
|
)}
|
|
127
104
|
>
|
|
128
105
|
<div className="flex w-full items-center gap-x-3">
|
|
129
106
|
<div>
|
|
130
|
-
<Avatar
|
|
107
|
+
<Avatar />
|
|
131
108
|
</div>
|
|
132
109
|
<div className="flex w-full min-w-0 flex-col items-start py-xs">
|
|
133
110
|
<div className="flex w-full min-w-0 items-center space-x-2">
|
|
@@ -161,23 +138,6 @@ export function Account({
|
|
|
161
138
|
<MoreHoriz />
|
|
162
139
|
</ButtonUnstyled>
|
|
163
140
|
)}
|
|
164
|
-
{onLockAccountClick &&
|
|
165
|
-
onUnlockAccountClick &&
|
|
166
|
-
(isLocked ? (
|
|
167
|
-
<div className="flex items-center">
|
|
168
|
-
<ButtonUnstyled
|
|
169
|
-
onClick={onUnlockAccountClick}
|
|
170
|
-
testId="account-unlock"
|
|
171
|
-
className="locked"
|
|
172
|
-
>
|
|
173
|
-
<LockLocked />
|
|
174
|
-
</ButtonUnstyled>
|
|
175
|
-
</div>
|
|
176
|
-
) : (
|
|
177
|
-
<ButtonUnstyled onClick={onLockAccountClick} testId="account-lock">
|
|
178
|
-
<LockUnlocked />
|
|
179
|
-
</ButtonUnstyled>
|
|
180
|
-
))}
|
|
181
141
|
</div>
|
|
182
142
|
{showSelected && (
|
|
183
143
|
<ButtonUnstyled>
|
|
@@ -104,7 +104,7 @@ const DialogContent = React.forwardRef<
|
|
|
104
104
|
: 'overflow-y-auto overflow-x-hidden left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-xl';
|
|
105
105
|
const widthClass =
|
|
106
106
|
position === DialogPosition.Right ? 'md:w-96 max-w-[500px]' : customWidth;
|
|
107
|
-
const heightClass = position === DialogPosition.Right ? 'h-screen' : 'max-h-[
|
|
107
|
+
const heightClass = position === DialogPosition.Right ? 'h-screen' : 'max-h-[90vh] h-full';
|
|
108
108
|
return (
|
|
109
109
|
<RadixDialog.Portal container={containerElement}>
|
|
110
110
|
<DialogContainer isFixedPosition={isFixedPosition}>
|
|
@@ -192,11 +192,13 @@ export function TableBody({ children }: PropsWithChildren): JSX.Element {
|
|
|
192
192
|
export interface TableRowCheckboxProps {
|
|
193
193
|
rowIndex: number;
|
|
194
194
|
onCheckboxChange: (checked: boolean) => void;
|
|
195
|
+
isDisabled?: boolean;
|
|
195
196
|
}
|
|
196
197
|
|
|
197
198
|
export function TableRowCheckbox({
|
|
198
199
|
rowIndex,
|
|
199
200
|
onCheckboxChange,
|
|
201
|
+
isDisabled,
|
|
200
202
|
}: TableRowCheckboxProps): React.JSX.Element {
|
|
201
203
|
const { selectedRowIndexes } = useTableContext();
|
|
202
204
|
|
|
@@ -207,6 +209,7 @@ export function TableRowCheckbox({
|
|
|
207
209
|
onCheckboxChange(event.target.checked);
|
|
208
210
|
}}
|
|
209
211
|
isChecked={selectedRowIndexes.has(rowIndex)}
|
|
212
|
+
isDisabled={isDisabled}
|
|
210
213
|
/>
|
|
211
214
|
</TableCellBase>
|
|
212
215
|
);
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
5
|
import { Account, BadgeType } from '@/components';
|
|
6
|
-
import cx from 'classnames';
|
|
7
6
|
|
|
8
7
|
const meta: Meta<typeof Account> = {
|
|
9
8
|
component: Account,
|
|
@@ -21,10 +20,7 @@ export default meta;
|
|
|
21
20
|
|
|
22
21
|
type Story = StoryObj<typeof meta>;
|
|
23
22
|
|
|
24
|
-
const Avatar = (
|
|
25
|
-
const circleFillClass = isLocked
|
|
26
|
-
? 'fill-iota-neutral-80 dark:fill-iota-neutral-30 names:fill-names-neutral-30'
|
|
27
|
-
: 'fill-iota-primary-30';
|
|
23
|
+
const Avatar = () => {
|
|
28
24
|
return (
|
|
29
25
|
<svg
|
|
30
26
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -33,7 +29,7 @@ const Avatar = ({ isLocked }: { isLocked?: boolean }) => {
|
|
|
33
29
|
viewBox="0 0 33 32"
|
|
34
30
|
fill="none"
|
|
35
31
|
>
|
|
36
|
-
<circle cx="16.5" cy="16" r="16" className=
|
|
32
|
+
<circle cx="16.5" cy="16" r="16" className="fill-iota-primary-30" />
|
|
37
33
|
</svg>
|
|
38
34
|
);
|
|
39
35
|
};
|
|
@@ -42,7 +38,6 @@ export const Default: Story = {
|
|
|
42
38
|
args: {
|
|
43
39
|
title: 'Account',
|
|
44
40
|
subtitle: '0x0d7...3f37',
|
|
45
|
-
isLocked: true,
|
|
46
41
|
avatarContent: Avatar,
|
|
47
42
|
},
|
|
48
43
|
argTypes: {
|
|
@@ -50,17 +45,10 @@ export const Default: Story = {
|
|
|
50
45
|
control: 'select',
|
|
51
46
|
options: Object.values(BadgeType),
|
|
52
47
|
},
|
|
53
|
-
isLocked: {
|
|
54
|
-
control: 'boolean',
|
|
55
|
-
},
|
|
56
48
|
onOptionsClick: {
|
|
57
49
|
action: 'onOptionsClick',
|
|
58
50
|
control: 'none',
|
|
59
51
|
},
|
|
60
|
-
onLockAccountClick: {
|
|
61
|
-
action: 'onLockAccount',
|
|
62
|
-
control: 'none',
|
|
63
|
-
},
|
|
64
52
|
avatarContent: {
|
|
65
53
|
control: 'none',
|
|
66
54
|
},
|