@stellar-expert/ui-framework 1.14.4 → 1.14.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.
@@ -262,7 +262,7 @@ class PaginatedListViewModel {
262
262
  }
263
263
 
264
264
  /**
265
- * Update naviagtion links retrieved from the response
265
+ * Update navigation links retrieved from the response
266
266
  * @param {String} self
267
267
  * @param {String} next
268
268
  * @param {String} prev
@@ -360,7 +360,7 @@ class PaginatedListViewModel {
360
360
  * @typedef {Object} ExplorerApiListResponse
361
361
  * @property {Object[]} data - Data retrieved from the server
362
362
  * @property {Boolean} loaded - Response result loaded flag
363
- * @property {Function} load - Load pgae function
363
+ * @property {Function} load - Load page function
364
364
  * @property {Boolean} canLoadPrevPage - Whether the prev page is available
365
365
  * @property {Boolean} canLoadNextPage - Whether the next page is available
366
366
  */
@@ -15,7 +15,7 @@ import './asset-link.scss'
15
15
  * @param {String|AssetDescriptor|Asset} asset - Asset name/descriptor
16
16
  * @param {Boolean|String} [link] - Reference link
17
17
  * @param {Boolean} [issuer] - Whether to show asset issuer
18
- * @param {Boolean} [icon] - Wheter to show asset icon
18
+ * @param {Boolean} [icon] - Whether to show asset icon
19
19
  * @param {String} [className] - Optional CSS class name
20
20
  * @param {{}} [style] - Optional CSS style
21
21
  * @param {*} [children] - Optional inner link text
@@ -21,7 +21,7 @@ export function AssetSelector({value, predefinedAssets, onChange, restricted, ti
21
21
 
22
22
  const focusSearch = useCallback(() => {
23
23
  setTimeout(() => searchRef.current?.focus(), 200)
24
- })
24
+ }, [])
25
25
 
26
26
  if (predefinedAssets) {
27
27
  for (const asset of predefinedAssets) {
@@ -28,7 +28,7 @@ export const Dropdown = React.memo(function Dropdown({
28
28
  const headerRef = useRef()
29
29
  const listRef = useRef()
30
30
  const [listOpen, updateListOpen] = useState(false)
31
- const [alignRigth, setAlignRight] = useState(false)
31
+ const [alignRight, setAlignRight] = useState(false)
32
32
  //collapse dropdown handler
33
33
  const collapseDropdown = useCallback(function () {
34
34
  updateListOpen(open => {
@@ -39,7 +39,7 @@ export const Dropdown = React.memo(function Dropdown({
39
39
  })
40
40
  }, [onClose])
41
41
 
42
- //collapse dropdwon list on click
42
+ //collapse dropdown list on click
43
43
  const [selectedValue, updateSelectedValue] = useDependantState(() => {
44
44
  if (listOpen) {
45
45
  setTimeout(() => {
@@ -51,7 +51,7 @@ export const Dropdown = React.memo(function Dropdown({
51
51
  document.removeEventListener('click', collapseDropdown)
52
52
  })
53
53
 
54
- //close/open dropdown on header cick
54
+ //close/open dropdown on header click
55
55
  const toggleList = useCallback(function toggleList(e) {
56
56
  e && e.nativeEvent.stopImmediatePropagation()
57
57
  updateListOpen(prevState => {
@@ -71,7 +71,7 @@ export const Dropdown = React.memo(function Dropdown({
71
71
  updateSelectedValue(option)
72
72
  }, [collapseDropdown, onChange])
73
73
 
74
- //handle user scroll action for infinit scroll support
74
+ //handle user scroll action for infinity scroll support
75
75
  const scrollList = useMemo(() => throttle(200, e => {
76
76
  if (!onScroll)
77
77
  return
@@ -84,12 +84,19 @@ export const Dropdown = React.memo(function Dropdown({
84
84
  onScroll(pos)
85
85
  }), [onScroll])
86
86
 
87
- //locate currently selectd option
87
+ //locate currently selected option
88
88
  const {option: selectedItem, isDefault} = getSelectedOption([value, selectedValue], options)
89
89
 
90
- //check dropdown container alignement
90
+ //check dropdown container alignment
91
91
  if (listOpen) {
92
- setTimeout(() => setAlignRight(isAlignedRight(listRef.current)), 200)
92
+ setTimeout(() => {
93
+ if (!alignRight) {
94
+ const shouldAlignRight = isAlignedRight(listRef.current)
95
+ if (alignRight !== shouldAlignRight) {
96
+ setAlignRight(shouldAlignRight)
97
+ }
98
+ }
99
+ }, 200)
93
100
  }
94
101
  //show a dropdown after the initial render
95
102
  useEffect(() => {
@@ -106,7 +113,7 @@ export const Dropdown = React.memo(function Dropdown({
106
113
  </a>
107
114
  {!!listOpen && createPortal(<div className={className}>
108
115
  <div className={cn('dd-backdrop', {solo})}/>
109
- <div className={cn('dd-list', {solo, visible: listOpen && !disabled, 'align-right': alignRigth})}
116
+ <div className={cn('dd-list', {solo, visible: listOpen && !disabled, 'align-right': alignRight})}
110
117
  style={getListPosition(headerRef.current, solo)} ref={listRef}>
111
118
  {!!header && <>
112
119
  <div className="dd-list-header" onClick={preventClosing}>{header}</div>
@@ -2,7 +2,7 @@ import React, {useCallback, useMemo, useState} from 'react'
2
2
  import {throttle} from 'throttle-debounce'
3
3
  import './slider.scss'
4
4
 
5
- export function Slider({value, categroies, onChange, min = 0, max = 100, step = 1, ...otherProps}) {
5
+ export function Slider({value, categories, onChange, min = 0, max = 100, step = 1, ...otherProps}) {
6
6
  const [inputValue, setInputValue] = useState(value || min)
7
7
  const change = useMemo(() => throttle(300, onChange), [onChange])
8
8
  const onSlide = useCallback(function (e) {
@@ -12,8 +12,8 @@ export function Slider({value, categroies, onChange, min = 0, max = 100, step =
12
12
  }, [change])
13
13
 
14
14
  return <div className="slider dimmed text-small" {...otherProps}>
15
- {categroies && <datalist className="categories dimmed condensed">
16
- {categroies.map((category, index) => <option key={index + category} value={category} label={category}/>)}
15
+ {categories && <datalist className="categories dimmed condensed">
16
+ {categories.map((category, index) => <option key={index + category} value={category} label={category}/>)}
17
17
  </datalist>}
18
18
  <input type="range" min={min} max={max} step={step} value={inputValue} onChange={onSlide}/>
19
19
  </div>
@@ -7,7 +7,7 @@ import QR from 'qrcode.react'
7
7
  * @param {String} [caption] - Additional caption under QR code
8
8
  * @param {Number} [size] - Width|height fo the rendered QR code image
9
9
  * @param {String} [embeddedImage] - Optional logo to render in the center of QR code
10
- * @param {Number} [embeddedSize] - Embeded logo size (by default 10% of QR code size)
10
+ * @param {Number} [embeddedSize] - Embedded logo size (by default 10% of QR code size)
11
11
  * @return {JSX.Element}
12
12
  */
13
13
  export const QrCode = React.memo(function QrCode({value, caption, size = 320, embeddedImage, embeddedSize}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar-expert/ui-framework",
3
- "version": "1.14.4",
3
+ "version": "1.14.5",
4
4
  "description": "StellarExpert shared UI components library",
5
5
  "main": "index.js",
6
6
  "module": "./index.js",
@@ -45,7 +45,7 @@ export function findKeyBySignatureHint(hint, allKeys) {
45
45
  /**
46
46
  * Find tx signature for a given signer key
47
47
  * @param {String} key
48
- * @param {Singature} allSignatures
48
+ * @param {Signature} allSignatures
49
49
  * @returns {Signature}
50
50
  */
51
51
  export function findSignatureByKey(key, allSignatures = []) {
@@ -35,7 +35,7 @@ import TxMatcher from './tx-matcher'
35
35
  * @param {String} tx - Base64-encoded tx envelope xdr
36
36
  * @param {String} [result] - Base64-encoded tx envelope result
37
37
  * @param {String} [meta] - Base64-encoded tx envelope meta
38
- * @param {String} [id] - Unique trasnaction id
38
+ * @param {String} [id] - Unique transaction id
39
39
  * @param {TxFiltersContext} [context] - Filters applied to transactions search
40
40
  * @param {String} [createdAt] - Ledger execution timestamp
41
41
  * @param {Boolean} [skipUnrelated] - Ledger execution timestamp
@@ -202,7 +202,7 @@ export default class TxMatcher {
202
202
  }
203
203
  //add op source account
204
204
  matchingProps.source = new Set([op.source])
205
- //porcess assets
205
+ //process assets
206
206
  if (filters.asset || filters.src_asset || filters.dest_asset)
207
207
  switch (op.type) {
208
208
  case 'createAccount':
@@ -1,4 +1,4 @@
1
- const operatinTypeMap = {
1
+ const operationTypeMap = {
2
2
  createAccount: 0,
3
3
  payment: 1,
4
4
  pathPaymentStrictReceive: 2,
@@ -53,7 +53,7 @@ export class TypeFilterMatcher {
53
53
  * @return {Boolean}
54
54
  */
55
55
  match(operationType) {
56
- return !this.types || this.types.has(operatinTypeMap[operationType])
56
+ return !this.types || this.types.has(operationTypeMap[operationType])
57
57
  }
58
58
 
59
59
  /**
@@ -74,51 +74,51 @@ export class TypeFilterMatcher {
74
74
  switch (filter) {
75
75
  case 'payments':
76
76
  return [
77
- operatinTypeMap.createAccount,
78
- operatinTypeMap.accountMerge,
79
- operatinTypeMap.payment,
80
- operatinTypeMap.pathPaymentStrictReceive,
81
- operatinTypeMap.pathPaymentStrictSend,
82
- operatinTypeMap.createClaimableBalance,
83
- operatinTypeMap.claimClaimableBalance,
84
- operatinTypeMap.clawback,
85
- operatinTypeMap.clawbackClaimableBalance,
86
- operatinTypeMap.inflation
77
+ operationTypeMap.createAccount,
78
+ operationTypeMap.accountMerge,
79
+ operationTypeMap.payment,
80
+ operationTypeMap.pathPaymentStrictReceive,
81
+ operationTypeMap.pathPaymentStrictSend,
82
+ operationTypeMap.createClaimableBalance,
83
+ operationTypeMap.claimClaimableBalance,
84
+ operationTypeMap.clawback,
85
+ operationTypeMap.clawbackClaimableBalance,
86
+ operationTypeMap.inflation
87
87
  ]
88
88
  case 'trustlines':
89
89
  return [
90
- operatinTypeMap.changeTrust,
91
- operatinTypeMap.allowTrust,
92
- operatinTypeMap.setTrustLineFlags
90
+ operationTypeMap.changeTrust,
91
+ operationTypeMap.allowTrust,
92
+ operationTypeMap.setTrustLineFlags
93
93
  ]
94
94
  case 'dex':
95
95
  return [
96
- operatinTypeMap.manageSellOffer,
97
- operatinTypeMap.manageBuyOffer,
98
- operatinTypeMap.createPassiveSellOffer,
99
- operatinTypeMap.liquidityPoolDeposit,
100
- operatinTypeMap.liquidityPoolWithdraw
96
+ operationTypeMap.manageSellOffer,
97
+ operationTypeMap.manageBuyOffer,
98
+ operationTypeMap.createPassiveSellOffer,
99
+ operationTypeMap.liquidityPoolDeposit,
100
+ operationTypeMap.liquidityPoolWithdraw
101
101
  ]
102
102
  case 'settings':
103
103
  return [
104
- operatinTypeMap.createAccount,
105
- operatinTypeMap.setOptions,
106
- operatinTypeMap.changeTrust,
107
- operatinTypeMap.allowTrust,
108
- operatinTypeMap.accountMerge,
109
- operatinTypeMap.inflation,
110
- operatinTypeMap.manageData,
111
- operatinTypeMap.bumpSequence,
112
- operatinTypeMap.beginSponsoringFutureReserves,
113
- operatinTypeMap.endSponsoringFutureReserves,
114
- operatinTypeMap.revokeSponsorship,
115
- operatinTypeMap.setTrustLineFlags
104
+ operationTypeMap.createAccount,
105
+ operationTypeMap.setOptions,
106
+ operationTypeMap.changeTrust,
107
+ operationTypeMap.allowTrust,
108
+ operationTypeMap.accountMerge,
109
+ operationTypeMap.inflation,
110
+ operationTypeMap.manageData,
111
+ operationTypeMap.bumpSequence,
112
+ operationTypeMap.beginSponsoringFutureReserves,
113
+ operationTypeMap.endSponsoringFutureReserves,
114
+ operationTypeMap.revokeSponsorship,
115
+ operationTypeMap.setTrustLineFlags
116
116
  ]
117
117
  case 'contracts':
118
118
  return [
119
- operatinTypeMap.invokeHostFunction,
120
- operatinTypeMap.bumpFootprintExpiration,
121
- operatinTypeMap.restoreFootprint
119
+ operationTypeMap.invokeHostFunction,
120
+ operationTypeMap.bumpFootprintExpiration,
121
+ operationTypeMap.restoreFootprint
122
122
  ]
123
123
  default:
124
124
  return [parseInt(filter, 10)]