ywana-core8 0.1.76 → 0.1.77
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/dist/index.cjs +2781 -142
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1772 -72
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +2775 -143
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +2781 -142
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/index.js +3 -0
- package/src/html/tab.css +4 -3
- package/src/html/table2.example.js +1 -1
- package/src/html/table2.js +1 -1
- package/src/html/textfield2.css +3 -4
- package/src/html/textfield2.example.js +1013 -142
- package/src/html/textfield2.js +22 -9
- package/src/html/tree.css +18 -16
- package/src/html/tree.js +6 -4
package/src/html/textfield2.js
CHANGED
@@ -65,10 +65,10 @@ export const TextField2 = (props) => {
|
|
65
65
|
const validationResult = validation(value)
|
66
66
|
const valid = typeof validationResult === 'boolean' ? validationResult : validationResult.valid
|
67
67
|
const errorMessage = typeof validationResult === 'object' ? validationResult.message : ''
|
68
|
-
|
68
|
+
|
69
69
|
setIsValid(valid)
|
70
70
|
setInternalError(valid ? '' : errorMessage || (required && !value ? 'This field is required' : 'Invalid value'))
|
71
|
-
|
71
|
+
|
72
72
|
if (onValidation) {
|
73
73
|
onValidation(id, valid, errorMessage)
|
74
74
|
}
|
@@ -79,7 +79,7 @@ export const TextField2 = (props) => {
|
|
79
79
|
setIsValid(true)
|
80
80
|
setInternalError('')
|
81
81
|
}
|
82
|
-
}, [value,
|
82
|
+
}, [value, required, id]) // Removed validation and onValidation from dependencies to prevent infinite loops
|
83
83
|
|
84
84
|
// Handle input changes with debouncing
|
85
85
|
const handleChange = useCallback((event) => {
|
@@ -169,6 +169,7 @@ export const TextField2 = (props) => {
|
|
169
169
|
readOnly && 'readonly',
|
170
170
|
error || internalError ? 'error' : '',
|
171
171
|
!isValid && 'invalid',
|
172
|
+
placeholder && 'has-placeholder',
|
172
173
|
safeClassName,
|
173
174
|
id
|
174
175
|
].filter(Boolean).join(' ')
|
@@ -941,9 +942,15 @@ export const DateRange2 = (props) => {
|
|
941
942
|
// Initialize form from value
|
942
943
|
useEffect(() => {
|
943
944
|
if (value && typeof value === 'object') {
|
944
|
-
setForm({
|
945
|
-
|
946
|
-
to
|
945
|
+
setForm(prevForm => {
|
946
|
+
// Only update if values are actually different
|
947
|
+
if (prevForm.from !== (value.from || '') || prevForm.to !== (value.to || '')) {
|
948
|
+
return {
|
949
|
+
from: value.from || '',
|
950
|
+
to: value.to || ''
|
951
|
+
}
|
952
|
+
}
|
953
|
+
return prevForm
|
947
954
|
})
|
948
955
|
}
|
949
956
|
}, [value])
|
@@ -978,14 +985,20 @@ export const DateRange2 = (props) => {
|
|
978
985
|
if (onValidation) {
|
979
986
|
onValidation(id, valid, errorMessage)
|
980
987
|
}
|
981
|
-
}, [form, required, minDate, maxDate, id
|
988
|
+
}, [form, required, minDate, maxDate, id]) // Removed onValidation to prevent infinite loops
|
982
989
|
|
983
990
|
// Handle form changes
|
984
991
|
useEffect(() => {
|
985
992
|
if (form.from && form.to && onChange) {
|
986
|
-
onChange
|
993
|
+
// Only call onChange if the form values are different from the current value
|
994
|
+
const hasChanged = !value ||
|
995
|
+
value.from !== form.from ||
|
996
|
+
value.to !== form.to
|
997
|
+
if (hasChanged) {
|
998
|
+
onChange(id, form)
|
999
|
+
}
|
987
1000
|
}
|
988
|
-
}, [form, id,
|
1001
|
+
}, [form, id, value]) // Added value to check for changes
|
989
1002
|
|
990
1003
|
// Handle field changes
|
991
1004
|
const handleChange = useCallback((fieldId, fieldValue) => {
|
package/src/html/tree.css
CHANGED
@@ -39,7 +39,10 @@
|
|
39
39
|
|
40
40
|
.tree-item>.label {
|
41
41
|
padding-left: .8rem;
|
42
|
-
|
42
|
+
flex: 1;
|
43
|
+
display: flex;
|
44
|
+
align-items: center;
|
45
|
+
justify-content: space-between;
|
43
46
|
}
|
44
47
|
|
45
48
|
.tree-item>.label.clickable:hover {
|
@@ -47,6 +50,14 @@
|
|
47
50
|
color: var(--accent-color);
|
48
51
|
}
|
49
52
|
|
53
|
+
/* TreeNode label text */
|
54
|
+
.tree-node__label-text {
|
55
|
+
flex: 1;
|
56
|
+
overflow: hidden;
|
57
|
+
text-overflow: ellipsis;
|
58
|
+
white-space: nowrap;
|
59
|
+
}
|
60
|
+
|
50
61
|
.tree-item>.actions {
|
51
62
|
padding: 0 .5rem;
|
52
63
|
color: var(--text-color-lighter);
|
@@ -59,18 +70,7 @@
|
|
59
70
|
height: 2rem;
|
60
71
|
}
|
61
72
|
|
62
|
-
|
63
|
-
content: "\25B6";
|
64
|
-
color: black;
|
65
|
-
display: inline-block;
|
66
|
-
margin-right: 6px;
|
67
|
-
font-size: 10px;
|
68
|
-
color: rgba(0,0,0,.3);
|
69
|
-
}
|
70
|
-
|
71
|
-
details[open].tree-node>summary::before {
|
72
|
-
transform: rotate(90deg)
|
73
|
-
}
|
73
|
+
/* Removed native CSS triangle icon to avoid duplication with Material Design icons */
|
74
74
|
|
75
75
|
/* Enhanced Tree Styles - New functionality while maintaining compatibility */
|
76
76
|
|
@@ -221,13 +221,15 @@ details[open].tree-node>summary::before {
|
|
221
221
|
font-weight: 500;
|
222
222
|
padding: 0.125rem 0.375rem;
|
223
223
|
border-radius: 10px;
|
224
|
-
margin
|
224
|
+
margin: 0.5rem;
|
225
225
|
min-width: 1.25rem;
|
226
226
|
height: 1.25rem;
|
227
|
-
display: flex;
|
227
|
+
display: inline-flex;
|
228
228
|
align-items: center;
|
229
229
|
justify-content: center;
|
230
230
|
line-height: 1;
|
231
|
+
flex-shrink: 0;
|
232
|
+
white-space: nowrap;
|
231
233
|
}
|
232
234
|
|
233
235
|
/* TreeNode children */
|
@@ -291,7 +293,7 @@ details[open].tree-node>summary::before {
|
|
291
293
|
font-weight: 500;
|
292
294
|
padding: 0.125rem 0.375rem;
|
293
295
|
border-radius: 10px;
|
294
|
-
margin
|
296
|
+
margin: 0.5rem;
|
295
297
|
min-width: 1.25rem;
|
296
298
|
height: 1.25rem;
|
297
299
|
display: flex;
|
package/src/html/tree.js
CHANGED
@@ -102,7 +102,7 @@ export const Tree = (props) => {
|
|
102
102
|
return (
|
103
103
|
<div className={cssClasses} style={style} {...ariaAttributes} {...restProps}>
|
104
104
|
<div className="tree__loading">
|
105
|
-
<Icon icon="hourglass_empty" size="
|
105
|
+
<Icon icon="hourglass_empty" size="normal" />
|
106
106
|
<Text>Loading...</Text>
|
107
107
|
</div>
|
108
108
|
</div>
|
@@ -165,7 +165,7 @@ export const Tree = (props) => {
|
|
165
165
|
aria-label="Expand all nodes"
|
166
166
|
>
|
167
167
|
<Icon icon="unfold_more" size="small" />
|
168
|
-
<Text size="
|
168
|
+
<Text size="sm">Expand All</Text>
|
169
169
|
</button>
|
170
170
|
)}
|
171
171
|
{collapseAll && (
|
@@ -175,7 +175,7 @@ export const Tree = (props) => {
|
|
175
175
|
aria-label="Collapse all nodes"
|
176
176
|
>
|
177
177
|
<Icon icon="unfold_less" size="small" />
|
178
|
-
<Text size="
|
178
|
+
<Text size="sm">Collapse All</Text>
|
179
179
|
</button>
|
180
180
|
)}
|
181
181
|
</div>
|
@@ -376,7 +376,9 @@ export const TreeNode = (props) => {
|
|
376
376
|
className={`label ${clickable}`}
|
377
377
|
onClick={handleSelect}
|
378
378
|
>
|
379
|
-
|
379
|
+
<span className="tree-node__label-text">
|
380
|
+
{labelTxt}
|
381
|
+
</span>
|
380
382
|
{badge && (
|
381
383
|
<span className="tree-node__badge">
|
382
384
|
{typeof badge === 'number' && badge > 99 ? '99+' : badge}
|