@stellar-expert/ui-framework 1.9.4 → 1.9.5
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/account/identicon.js +1 -1
- package/account/signer-key.js +3 -3
- package/asset/amount.js +5 -5
- package/controls/tabs.js +9 -9
- package/controls/tooltip.js +4 -4
- package/index.js +1 -0
- package/interaction/accordion.js +29 -0
- package/interaction/accordion.scss +32 -0
- package/package.json +1 -1
package/account/identicon.js
CHANGED
|
@@ -41,7 +41,7 @@ function decodeBase32(input) {
|
|
|
41
41
|
/**
|
|
42
42
|
* Draw Stellar address identicon on the given canvas
|
|
43
43
|
* @param {String} address - StrKey-encoded account address
|
|
44
|
-
* @param {Number} size
|
|
44
|
+
* @param {Number} [size] - Identicon painting area size, in pixels (by default 448)
|
|
45
45
|
* @return {String}
|
|
46
46
|
*/
|
|
47
47
|
export function drawIdenticon(address, size = SIZE) {
|
package/account/signer-key.js
CHANGED
|
@@ -49,9 +49,9 @@ function decodeSigner(signer) {
|
|
|
49
49
|
/**
|
|
50
50
|
* Account signer key description
|
|
51
51
|
* @param {Signer} signer - StrKey-encoded Account/MuxedAccount/Sha256Hash/PreAuthTx/SignedPayload
|
|
52
|
-
* @param {String} name
|
|
53
|
-
* @param {String} className
|
|
54
|
-
* @param {Boolean} showWeight
|
|
52
|
+
* @param {String} [name] - Explicit account name that overrides the name from Directory; if false, friendly name is ignored
|
|
53
|
+
* @param {String} [className] - Optional CSS class attribute
|
|
54
|
+
* @param {Boolean} [showWeight] - Whether to display weight attribute
|
|
55
55
|
* @constructor
|
|
56
56
|
*/
|
|
57
57
|
export const SignerKey = React.memo(function SignerKey({signer, name, className, showWeight = true}) {
|
package/asset/amount.js
CHANGED
|
@@ -7,11 +7,11 @@ import {AssetLink} from './asset-link'
|
|
|
7
7
|
* Formatted tokens amount
|
|
8
8
|
* @param {String|Number} amount - Amount of tokens
|
|
9
9
|
* @param {String|AssetDescriptor|Asset} asset - Asset name/descriptor
|
|
10
|
-
* @param {String|Number|'auto'} decimals
|
|
11
|
-
* @param {Boolean} adjust
|
|
12
|
-
* @param {Boolean|'floor'} round
|
|
13
|
-
* @param {Boolean} issuer
|
|
14
|
-
* @param {Boolean} icon
|
|
10
|
+
* @param {String|Number|'auto'} decimals - Number of decimals to show for a formatted numeric value
|
|
11
|
+
* @param {Boolean} [adjust] - Treat amount value as raw Int64 stroops amount
|
|
12
|
+
* @param {Boolean|'floor'} [round] - Round the amount
|
|
13
|
+
* @param {Boolean} [issuer] - Whether to show asset issuer
|
|
14
|
+
* @param {Boolean} [icon] - Whether to show asset icon
|
|
15
15
|
* @constructor
|
|
16
16
|
*/
|
|
17
17
|
export const Amount = React.memo(function Amount({amount, asset, decimals, adjust, round, issuer, icon}) {
|
package/controls/tabs.js
CHANGED
|
@@ -7,12 +7,12 @@ import './tabs.scss'
|
|
|
7
7
|
/**
|
|
8
8
|
* Tabs control
|
|
9
9
|
* @param {TabDescriptor[]} tabs - Tabs list
|
|
10
|
-
* @param {String} selectedTab
|
|
11
|
-
* @param {Function} onChange
|
|
12
|
-
* @param {String} queryParam
|
|
13
|
-
* @param {String} className
|
|
14
|
-
* @param {Boolean} right
|
|
15
|
-
* @param {*} children
|
|
10
|
+
* @param {String} [selectedTab] - Currently selected tab
|
|
11
|
+
* @param {Function} [onChange] - Handler for tabChanged event
|
|
12
|
+
* @param {String} [queryParam] - Associated query param name (control will auto-update query string)
|
|
13
|
+
* @param {String} [className] - Optional CSS class name
|
|
14
|
+
* @param {Boolean} [right] - Position tabs to the right within the header
|
|
15
|
+
* @param {*} [children] - Additional content to render in the tabs header
|
|
16
16
|
* @constructor
|
|
17
17
|
*/
|
|
18
18
|
export function Tabs({tabs, selectedTab, queryParam, className, onChange, right, children}) {
|
|
@@ -88,7 +88,7 @@ export function Tabs({tabs, selectedTab, queryParam, className, onChange, right,
|
|
|
88
88
|
/**
|
|
89
89
|
* @typedef {{}} TabDescriptor
|
|
90
90
|
* @property {String} name - Unique table name
|
|
91
|
-
* @property {String} title
|
|
92
|
-
* @property {Function} render
|
|
93
|
-
* @property {Boolean} isDefault
|
|
91
|
+
* @property {String} [title] - Display name (if differs from tab name)
|
|
92
|
+
* @property {Function} [render] - Render callback
|
|
93
|
+
* @property {Boolean} [isDefault] - Whether this tab should be displayed by default
|
|
94
94
|
*/
|
package/controls/tooltip.js
CHANGED
|
@@ -207,8 +207,8 @@ export const Tooltip = React.memo(function Tooltip({trigger, desiredPlace = 'top
|
|
|
207
207
|
*/
|
|
208
208
|
/**
|
|
209
209
|
* @typedef {Object} PositionOffset
|
|
210
|
-
* @property {Number} top
|
|
211
|
-
* @property {Number} bottom
|
|
212
|
-
* @property {Number} left
|
|
213
|
-
* @property {Number} right
|
|
210
|
+
* @property {Number} [top] - Top offset
|
|
211
|
+
* @property {Number} [bottom] - Bottom offset
|
|
212
|
+
* @property {Number} [left] - Left offset
|
|
213
|
+
* @property {Number} [right] - Right offset
|
|
214
214
|
*/
|
package/index.js
CHANGED
|
@@ -44,6 +44,7 @@ export * from './interaction/autofocus'
|
|
|
44
44
|
export * from './interaction/block-select'
|
|
45
45
|
export * from './interaction/copy-to-clipboard'
|
|
46
46
|
export * from './interaction/spoiler'
|
|
47
|
+
export * from './interaction/accordion'
|
|
47
48
|
export * from './interaction/theme-selector'
|
|
48
49
|
export * from './interaction/inline-progress'
|
|
49
50
|
export * from './interaction/responsive'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, {useCallback, useEffect, useState} from 'react'
|
|
2
|
+
import cn from 'classnames'
|
|
3
|
+
import './accordion.scss'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {{title, content}[]} options
|
|
7
|
+
*/
|
|
8
|
+
export function Accordion({options}) {
|
|
9
|
+
const [selectedOption, setSelectedOption] = useState()
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setSelectedOption(options[0].title)
|
|
12
|
+
}, [options])
|
|
13
|
+
const changeSelected = useCallback(e => {
|
|
14
|
+
const {title} = e.currentTarget.dataset
|
|
15
|
+
setSelectedOption(title)
|
|
16
|
+
}, [options])
|
|
17
|
+
return <div className="accordion">
|
|
18
|
+
{options.map(({title, content}) => <div key={title} className={cn('option', {open: selectedOption === title})}>
|
|
19
|
+
<div className="accordion-header" data-title={title} onClick={changeSelected}>
|
|
20
|
+
{title}
|
|
21
|
+
</div>
|
|
22
|
+
<div className="accordion-collapse">
|
|
23
|
+
<div className="accordion-body">
|
|
24
|
+
{content}
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>)}
|
|
28
|
+
</div>
|
|
29
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.accordion {
|
|
2
|
+
.accordion-header {
|
|
3
|
+
position: relative;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
user-select: none;
|
|
6
|
+
|
|
7
|
+
&:before {
|
|
8
|
+
content: '+';
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 50%;
|
|
11
|
+
transform: translateY(-50%);
|
|
12
|
+
left: -20px;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.accordion-collapse {
|
|
17
|
+
height: 0;
|
|
18
|
+
overflow-y: hidden;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.option {
|
|
22
|
+
&.open {
|
|
23
|
+
.accordion-header:before {
|
|
24
|
+
content: '-';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.accordion-collapse {
|
|
28
|
+
height: auto;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|