@lukso/web-components 1.2.2 → 1.3.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/CHANGELOG.md +15 -0
- package/README.md +4 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +1596 -527
- package/dist/components/index.umd.cjs +159 -40
- package/dist/components/lukso-button/index.d.ts +1 -0
- package/dist/components/lukso-button/index.js +131 -127
- package/dist/components/lukso-button/index.umd.cjs +16 -16
- package/dist/components/lukso-card/index.d.ts +19 -0
- package/dist/components/lukso-card/index.js +1541 -0
- package/dist/components/lukso-card/index.umd.cjs +144 -0
- package/dist/components/lukso-navbar/index.js +2 -2
- package/dist/components/lukso-navbar/index.umd.cjs +2 -2
- package/dist/components/lukso-profile/index.d.ts +25 -0
- package/dist/components/lukso-profile/index.js +1423 -0
- package/dist/components/lukso-profile/index.umd.cjs +90 -0
- package/dist/components/lukso-sanitize/index.d.ts +12 -0
- package/dist/components/lukso-sanitize/index.js +1626 -0
- package/dist/components/lukso-sanitize/index.umd.cjs +61 -0
- package/dist/components/lukso-tag/index.d.ts +20 -0
- package/dist/components/lukso-tag/index.js +1209 -0
- package/dist/components/lukso-tag/index.umd.cjs +67 -0
- package/dist/components/lukso-test/index.js +46 -46
- package/dist/components/lukso-test/index.umd.cjs +22 -22
- package/dist/components/lukso-username/index.d.ts +34 -0
- package/dist/components/lukso-username/index.js +1255 -0
- package/dist/components/lukso-username/index.umd.cjs +75 -0
- package/dist/components/lukso-wizard/index.js +2 -2
- package/dist/components/lukso-wizard/index.umd.cjs +2 -2
- package/dist/index.js +1596 -527
- package/dist/index.umd.cjs +159 -40
- package/dist/sass/typography.scss +4 -4
- package/dist/shared/tailwind-element/index.js +146 -146
- package/dist/shared/tailwind-element/index.umd.cjs +1 -1
- package/dist/shared/tailwind-element.js +146 -146
- package/dist/shared/tailwind-element.umd.cjs +1 -1
- package/dist/shared/utils/sliceAddress.d.ts +9 -0
- package/dist/styles/main.css +4 -4
- package/package.json +30 -2
- package/src/components/index.ts +5 -0
- package/src/components/lukso-button/index.ts +4 -0
- package/src/components/lukso-button/lukso-button.stories.ts +64 -5
- package/src/components/lukso-card/index.ts +118 -0
- package/src/components/lukso-card/lukso-card.stories.ts +135 -0
- package/src/components/lukso-navbar/index.ts +1 -1
- package/src/components/lukso-navbar/lukso-navbar.stories.ts +13 -4
- package/src/components/lukso-profile/index.ts +100 -0
- package/src/components/lukso-profile/lukso-profile.stories.ts +87 -0
- package/src/components/lukso-sanitize/index.ts +28 -0
- package/src/components/lukso-sanitize/lukso-sanitize.stories.ts +26 -0
- package/src/components/lukso-tag/index.ts +68 -0
- package/src/components/lukso-tag/lukso-tag.stories.ts +107 -0
- package/src/components/lukso-username/index.ts +104 -0
- package/src/components/lukso-username/lukso-username.stories.ts +94 -0
- package/src/components/lukso-wizard/index.ts +1 -1
- package/src/components/lukso-wizard/lukso-wizard.stories.ts +6 -2
- package/src/shared/styles/typography.scss +4 -4
- package/src/shared/utils/__tests__/sliceAddress.spec.ts +15 -0
- package/src/shared/utils/sliceAddress.ts +30 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { html } from 'lit-html'
|
|
2
|
+
import './index'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Design System/Components/Username',
|
|
6
|
+
component: 'lukso-username',
|
|
7
|
+
argTypes: {
|
|
8
|
+
name: {
|
|
9
|
+
control: { type: 'text' },
|
|
10
|
+
},
|
|
11
|
+
address: {
|
|
12
|
+
control: { type: 'text' },
|
|
13
|
+
},
|
|
14
|
+
maxWidth: {
|
|
15
|
+
control: { type: 'number' },
|
|
16
|
+
if: { arg: 'name', neq: '' },
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
control: { type: 'select' },
|
|
20
|
+
options: ['large', 'small'],
|
|
21
|
+
},
|
|
22
|
+
sliceBy: {
|
|
23
|
+
control: { type: 'number' },
|
|
24
|
+
if: { arg: 'name', eq: '' },
|
|
25
|
+
},
|
|
26
|
+
addressColor: {
|
|
27
|
+
control: { type: 'text' },
|
|
28
|
+
if: { arg: 'name', eq: '' },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
args: {
|
|
32
|
+
name: 'John',
|
|
33
|
+
address: '0x9671Db683406EE0817B1f5cB6A3b3BD111477457',
|
|
34
|
+
maxWidth: 200,
|
|
35
|
+
size: 'large',
|
|
36
|
+
sliceBy: 8,
|
|
37
|
+
addressColor: '',
|
|
38
|
+
},
|
|
39
|
+
parameters: {
|
|
40
|
+
controls: {
|
|
41
|
+
exclude: ['bytesWidth', 'max-width', 'slice-by', 'address-color'],
|
|
42
|
+
},
|
|
43
|
+
design: {
|
|
44
|
+
type: 'figma',
|
|
45
|
+
url: 'https://www.figma.com/file/NFCh20xAq3Jg2g8A0DNC9I/UI-Library?node-id=1096%3A14641&t=W8onPGbREKjGG9sS-4',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const Template = ({ name, address, maxWidth, size, sliceBy, addressColor }) =>
|
|
51
|
+
html`<lukso-username
|
|
52
|
+
name=${name}
|
|
53
|
+
address=${address}
|
|
54
|
+
max-width=${maxWidth}
|
|
55
|
+
size=${size}
|
|
56
|
+
slice-by=${sliceBy}
|
|
57
|
+
address-color=${addressColor}
|
|
58
|
+
></lukso-username>`
|
|
59
|
+
|
|
60
|
+
export const DefaultUsername = Template.bind({})
|
|
61
|
+
|
|
62
|
+
export const LongName = Template.bind({})
|
|
63
|
+
LongName.args = {
|
|
64
|
+
name: 'ThisIsAReallyLongName',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const OnlyName = Template.bind({})
|
|
68
|
+
OnlyName.args = {
|
|
69
|
+
address: '',
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const OnlyAddress = Template.bind({})
|
|
73
|
+
OnlyAddress.args = {
|
|
74
|
+
name: '',
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const SliceAddressBy4 = Template.bind({})
|
|
78
|
+
SliceAddressBy4.args = {
|
|
79
|
+
name: '',
|
|
80
|
+
sliceBy: 4,
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const SmallAddress = Template.bind({})
|
|
84
|
+
SmallAddress.args = {
|
|
85
|
+
name: '',
|
|
86
|
+
size: 'small',
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const CustomAddressColor = Template.bind({})
|
|
90
|
+
CustomAddressColor.args = {
|
|
91
|
+
name: '',
|
|
92
|
+
addressColor: 'neutral-60',
|
|
93
|
+
size: 'small',
|
|
94
|
+
}
|
|
@@ -26,7 +26,7 @@ export class LuksoWizard extends TailwindElement {
|
|
|
26
26
|
|
|
27
27
|
stepTemplate(step: WizardStep, index: number) {
|
|
28
28
|
return html`<li
|
|
29
|
-
class="inline-flex flex-col items-center justify-end w-
|
|
29
|
+
class="inline-flex flex-col items-center justify-end w-[121px] first:-ml-12 last:-mr-12 relative
|
|
30
30
|
[&>.lukso-wizard-circle]:after:last:hidden ${customClassMap({
|
|
31
31
|
[this.completedStepStyles]: index + 1 < this.activeStep,
|
|
32
32
|
[this.activeStepStyles]: index + 1 === this.activeStep,
|
|
@@ -3,7 +3,7 @@ import { html } from 'lit-html'
|
|
|
3
3
|
import '../lukso-wizard'
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
title: 'Design System/
|
|
6
|
+
title: 'Design System/Components/Wizard',
|
|
7
7
|
component: 'lukso-wizard',
|
|
8
8
|
argTypes: {
|
|
9
9
|
steps: {
|
|
@@ -33,6 +33,10 @@ LYXe`,
|
|
|
33
33
|
controls: {
|
|
34
34
|
exclude: ['activeStepStyles', 'completedStepStyles', 'active-step'],
|
|
35
35
|
},
|
|
36
|
+
design: {
|
|
37
|
+
type: 'figma',
|
|
38
|
+
url: 'https://www.figma.com/file/NFCh20xAq3Jg2g8A0DNC9I/UI-Library?node-id=1094%3A13512&t=AGmdbG8fXRENuU3o-4',
|
|
39
|
+
},
|
|
36
40
|
},
|
|
37
41
|
}
|
|
38
42
|
|
|
@@ -42,4 +46,4 @@ const Template = ({ steps, activeStep }) =>
|
|
|
42
46
|
active-step=${activeStep}
|
|
43
47
|
></lukso-wizard>`
|
|
44
48
|
|
|
45
|
-
export const
|
|
49
|
+
export const BasicWizard = Template.bind({})
|
|
@@ -104,19 +104,19 @@
|
|
|
104
104
|
|
|
105
105
|
// Monospaced
|
|
106
106
|
|
|
107
|
-
.
|
|
107
|
+
.monospaced-16-regular {
|
|
108
108
|
@apply text-16 not-italic font-400 leading-22 font-mono;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
.
|
|
111
|
+
.monospaced-16-bold {
|
|
112
112
|
@apply text-16 not-italic font-700 leading-22 font-mono;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
.
|
|
115
|
+
.monospaced-12-bold {
|
|
116
116
|
@apply text-12 not-italic font-700 leading-14 font-mono;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
.
|
|
119
|
+
.monospaced-10-bold {
|
|
120
120
|
@apply text-10 not-italic font-700 leading-14 font-mono;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { sliceAddress } from '../sliceAddress.js'
|
|
2
|
+
|
|
3
|
+
test('sliceAddress', () => {
|
|
4
|
+
expect(sliceAddress()).toEqual('')
|
|
5
|
+
expect(sliceAddress('0xA60DDd4eB501bd5bfeC3d50187C3889B658775B5')).toEqual(
|
|
6
|
+
'0xA60DDd...8775B5'
|
|
7
|
+
)
|
|
8
|
+
expect(sliceAddress('0xA60DDd4eB501bd5bfeC3d50187C3889B658775B5', 3)).toEqual(
|
|
9
|
+
'0xA60...5B5'
|
|
10
|
+
)
|
|
11
|
+
expect(
|
|
12
|
+
sliceAddress('0xA60DDd4eB501bd5bfeC3d50187C3889B658775B5', 3, 6)
|
|
13
|
+
).toEqual('0xA60...8775B5')
|
|
14
|
+
expect(sliceAddress('0xA60DDd4eB51', 10)).toEqual('0xA60DDd4eB51')
|
|
15
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shorten address by removing middle part, i.e: 0x123...789
|
|
3
|
+
*
|
|
4
|
+
* @param address - the address
|
|
5
|
+
* @param sliceBy - slice by amount from top and end, it doesn't include 0x
|
|
6
|
+
* @returns sliced address
|
|
7
|
+
*/
|
|
8
|
+
export const sliceAddress = (
|
|
9
|
+
address?: string,
|
|
10
|
+
startSliceBy = 6,
|
|
11
|
+
endSliceBy?: number
|
|
12
|
+
): string => {
|
|
13
|
+
if (!address) {
|
|
14
|
+
return ''
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let sliceAddress = ''
|
|
18
|
+
endSliceBy = endSliceBy || startSliceBy
|
|
19
|
+
|
|
20
|
+
if (address.length < startSliceBy + endSliceBy) {
|
|
21
|
+
return address
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
sliceAddress =
|
|
25
|
+
address.length > startSliceBy + 2
|
|
26
|
+
? `${address.slice(0, startSliceBy + 2)}...${address.slice(-endSliceBy)}`
|
|
27
|
+
: address
|
|
28
|
+
|
|
29
|
+
return sliceAddress
|
|
30
|
+
}
|