@app-studio/web 0.8.92 → 0.8.94
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/components/Button/Button/Button.style.d.ts +1 -2
- package/dist/components/Form/Select/Select/Select.state.d.ts +2 -1
- package/dist/components/Form/Switch/Switch/Switch.props.d.ts +2 -1
- package/dist/components/Form/Switch/Switch/Switch.state.d.ts +4 -2
- package/dist/components/Form/Switch/Switch/Switch.style.d.ts +3 -3
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/typography.d.ts +29 -0
- package/dist/web.cjs.development.js +220 -165
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +221 -166
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +220 -165
- package/dist/web.umd.development.js.map +1 -1
- package/dist/web.umd.production.min.js +1 -1
- package/dist/web.umd.production.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -439,20 +439,20 @@
|
|
|
439
439
|
* Font sizes following typography guidelines
|
|
440
440
|
*/
|
|
441
441
|
var FontSizes = {
|
|
442
|
-
xs: '
|
|
443
|
-
sm: '
|
|
444
|
-
md: '
|
|
445
|
-
lg: '
|
|
442
|
+
xs: '10px',
|
|
443
|
+
sm: '12px',
|
|
444
|
+
md: '14px',
|
|
445
|
+
lg: '16px',
|
|
446
446
|
xl: '20px'
|
|
447
447
|
};
|
|
448
448
|
/**
|
|
449
449
|
* Line heights following typography guidelines
|
|
450
450
|
*/
|
|
451
451
|
var LineHeights = {
|
|
452
|
-
xs: '
|
|
453
|
-
sm: '
|
|
454
|
-
md: '
|
|
455
|
-
lg: '
|
|
452
|
+
xs: '14px',
|
|
453
|
+
sm: '16px',
|
|
454
|
+
md: '20px',
|
|
455
|
+
lg: '22px',
|
|
456
456
|
xl: '28px'
|
|
457
457
|
};
|
|
458
458
|
/**
|
|
@@ -3234,7 +3234,7 @@
|
|
|
3234
3234
|
height: '32px',
|
|
3235
3235
|
padding: '0 12px',
|
|
3236
3236
|
// Typography
|
|
3237
|
-
fontSize: '
|
|
3237
|
+
fontSize: '16px',
|
|
3238
3238
|
fontWeight: '500',
|
|
3239
3239
|
lineHeight: '32px'
|
|
3240
3240
|
},
|
|
@@ -3244,7 +3244,7 @@
|
|
|
3244
3244
|
height: '36px',
|
|
3245
3245
|
padding: '0 14px',
|
|
3246
3246
|
// Typography
|
|
3247
|
-
fontSize: '
|
|
3247
|
+
fontSize: '20px',
|
|
3248
3248
|
fontWeight: '500',
|
|
3249
3249
|
lineHeight: '36px'
|
|
3250
3250
|
}
|
|
@@ -3370,18 +3370,6 @@
|
|
|
3370
3370
|
// Badge component that displays a small indicator, typically used for counts or status
|
|
3371
3371
|
var Badge = props => /*#__PURE__*/React__default.createElement(BadgeView, Object.assign({}, props));
|
|
3372
3372
|
|
|
3373
|
-
var useButtonState = () => {
|
|
3374
|
-
var [isHovered, setIsHovered] = React__default.useState(false);
|
|
3375
|
-
// This custom react hook 'useButtonState' is defined for managing the state of a button, especially for hover interactions.
|
|
3376
|
-
return {
|
|
3377
|
-
isHovered,
|
|
3378
|
-
setIsHovered
|
|
3379
|
-
};
|
|
3380
|
-
// The 'setIsHovered' function is used to update the value of 'isHovered' state when the hover status of the button changes.
|
|
3381
|
-
// A state variable 'isHovered' is declared with its initial value set to 'false', indicating that the button is not hovered by default.
|
|
3382
|
-
};
|
|
3383
|
-
// The hook returns an object containing 'isHovered' state and the 'setIsHovered' function to enable state management from the consumer component.
|
|
3384
|
-
|
|
3385
3373
|
// This function initializes the Link component's state using the useState hook and exposes its state and setter function.
|
|
3386
3374
|
var useLinkState = () => {
|
|
3387
3375
|
var [isHovered, setIsHovered] = React.useState(false);
|
|
@@ -3667,70 +3655,60 @@
|
|
|
3667
3655
|
*/
|
|
3668
3656
|
/**
|
|
3669
3657
|
* Button sizes following the 4px grid system
|
|
3670
|
-
*/
|
|
3671
|
-
var ButtonSizes = {
|
|
3658
|
+
*/var ButtonSizes = {
|
|
3672
3659
|
xs: {
|
|
3673
|
-
|
|
3660
|
+
minHeight: 3 * 4,
|
|
3661
|
+
paddingTop: 1,
|
|
3662
|
+
paddingBottom: 1,
|
|
3663
|
+
paddingLeft: 2,
|
|
3664
|
+
paddingRight: 2,
|
|
3665
|
+
fontSize: 10,
|
|
3666
|
+
fontWeight: '500',
|
|
3667
|
+
lineHeight: 14,
|
|
3668
|
+
letterSpacing: '-0.01em'
|
|
3669
|
+
},
|
|
3670
|
+
sm: {
|
|
3674
3671
|
minHeight: 4 * 4,
|
|
3675
|
-
paddingTop:
|
|
3676
|
-
paddingBottom:
|
|
3677
|
-
paddingLeft:
|
|
3678
|
-
paddingRight:
|
|
3679
|
-
// Typography
|
|
3672
|
+
paddingTop: 4,
|
|
3673
|
+
paddingBottom: 4,
|
|
3674
|
+
paddingLeft: 8,
|
|
3675
|
+
paddingRight: 8,
|
|
3680
3676
|
fontSize: 12,
|
|
3681
3677
|
fontWeight: '500',
|
|
3682
|
-
lineHeight:
|
|
3678
|
+
lineHeight: 16,
|
|
3683
3679
|
letterSpacing: '-0.01em'
|
|
3684
3680
|
},
|
|
3685
|
-
|
|
3686
|
-
// Height: 32px (8 × 4px)
|
|
3681
|
+
md: {
|
|
3687
3682
|
minHeight: 6 * 4,
|
|
3688
3683
|
paddingTop: 6,
|
|
3689
3684
|
paddingBottom: 6,
|
|
3690
3685
|
paddingLeft: 12,
|
|
3691
3686
|
paddingRight: 12,
|
|
3692
|
-
|
|
3693
|
-
fontSize: 12,
|
|
3687
|
+
fontSize: 14,
|
|
3694
3688
|
fontWeight: '500',
|
|
3695
|
-
lineHeight:
|
|
3689
|
+
lineHeight: 18,
|
|
3696
3690
|
letterSpacing: '-0.01em'
|
|
3697
3691
|
},
|
|
3698
|
-
|
|
3699
|
-
// Height: 40px (10 × 4px) - standard height for interactive elements
|
|
3692
|
+
lg: {
|
|
3700
3693
|
minHeight: 8 * 4,
|
|
3701
3694
|
paddingTop: 8,
|
|
3702
3695
|
paddingBottom: 8,
|
|
3703
3696
|
paddingLeft: 16,
|
|
3704
3697
|
paddingRight: 16,
|
|
3705
|
-
// Typography
|
|
3706
3698
|
fontSize: 16,
|
|
3707
3699
|
fontWeight: '500',
|
|
3708
|
-
lineHeight:
|
|
3700
|
+
lineHeight: 18,
|
|
3709
3701
|
letterSpacing: '-0.01em'
|
|
3710
3702
|
},
|
|
3711
|
-
|
|
3703
|
+
xl: {
|
|
3712
3704
|
minHeight: 10 * 4,
|
|
3713
3705
|
paddingTop: 10,
|
|
3714
3706
|
paddingBottom: 10,
|
|
3715
3707
|
paddingLeft: 20,
|
|
3716
3708
|
paddingRight: 20,
|
|
3717
|
-
|
|
3718
|
-
fontSize: 16,
|
|
3719
|
-
fontWeight: '500',
|
|
3720
|
-
lineHeight: 20,
|
|
3721
|
-
letterSpacing: '-0.01em'
|
|
3722
|
-
},
|
|
3723
|
-
xl: {
|
|
3724
|
-
// Height: 60px (15 × 4px)
|
|
3725
|
-
minHeight: 12 * 4,
|
|
3726
|
-
paddingTop: 12,
|
|
3727
|
-
paddingBottom: 12,
|
|
3728
|
-
paddingLeft: 24,
|
|
3729
|
-
paddingRight: 24,
|
|
3730
|
-
// Typography
|
|
3731
|
-
fontSize: 18,
|
|
3709
|
+
fontSize: 20,
|
|
3732
3710
|
fontWeight: '500',
|
|
3733
|
-
lineHeight:
|
|
3711
|
+
lineHeight: 22,
|
|
3734
3712
|
letterSpacing: '-0.01em'
|
|
3735
3713
|
}
|
|
3736
3714
|
};
|
|
@@ -3966,25 +3944,14 @@
|
|
|
3966
3944
|
|
|
3967
3945
|
// Importing a custom hook to manage the state specific to the button component.
|
|
3968
3946
|
var ButtonComponent = props => {
|
|
3969
|
-
|
|
3970
|
-
var {
|
|
3971
|
-
isHovered,
|
|
3972
|
-
setIsHovered
|
|
3973
|
-
} = useButtonState();
|
|
3974
|
-
// Defining the button component with generic React Functional Component type augmented with ButtonProps type.
|
|
3975
|
-
var handleHover = () => setIsHovered(!isHovered);
|
|
3947
|
+
var [ref, hover] = appStudio.useHover();
|
|
3976
3948
|
// Destructuring the state and state update function from the custom hook for button state management.
|
|
3977
3949
|
return (
|
|
3978
3950
|
/*#__PURE__*/
|
|
3979
3951
|
// Defines a function to toggle the hover state of the button.
|
|
3980
3952
|
React__default.createElement(ButtonView, Object.assign({
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
setIsHovered: setIsHovered,
|
|
3984
|
-
// Passing the isHovered state and the setIsHovered function to the ButtonView.
|
|
3985
|
-
onMouseEnter: handleHover,
|
|
3986
|
-
// Binding handleHover function to onMouseEnter and onMouseLeave events to toggle hover effect.
|
|
3987
|
-
onMouseLeave: handleHover
|
|
3953
|
+
ref: ref,
|
|
3954
|
+
isHovered: hover
|
|
3988
3955
|
}, props))
|
|
3989
3956
|
);
|
|
3990
3957
|
// Exports the Button component for use in other parts of the application.
|
|
@@ -6492,13 +6459,12 @@
|
|
|
6492
6459
|
var {
|
|
6493
6460
|
placeholder,
|
|
6494
6461
|
isMulti,
|
|
6495
|
-
options
|
|
6462
|
+
options,
|
|
6463
|
+
id = "select-" + Math.random().toString(36).substr(2, 9)
|
|
6496
6464
|
} = _ref;
|
|
6497
6465
|
// Determines the default value based on the 'placeholder' and 'isMulti' props, setting to an empty array for multi-select or an empty string/single default option
|
|
6498
6466
|
var defaultValue = placeholder ? isMulti ? [] : '' // If there's a placeholder, set default to empty array for multi-select or empty string for single select
|
|
6499
|
-
: Array.isArray(options) && options.length > 0 ? options[0].value : ''; // If no placeholder, use the first option value if available, otherwise
|
|
6500
|
-
// State hook for managing visibility of the Select dropdown, initially set to hidden
|
|
6501
|
-
var [hide, setHide] = React__default.useState(true);
|
|
6467
|
+
: Array.isArray(options) && options.length > 0 ? options[0].value : isMulti ? [] : ''; // If no placeholder, use the first option value if available, otherwise empty array for multi-select or empty string for single select
|
|
6502
6468
|
// State hook for tracking mouse hover status over the Select component
|
|
6503
6469
|
var [isHovered, setIsHovered] = React__default.useState(false);
|
|
6504
6470
|
// State hook for tracking focus status of the Select input field
|
|
@@ -6507,8 +6473,11 @@
|
|
|
6507
6473
|
var [value, setValue] = React__default.useState(defaultValue);
|
|
6508
6474
|
// State hook for keeping track of the currently highlighted index in the options list
|
|
6509
6475
|
var [highlightedIndex, setHighlightedIndex] = React__default.useState(0);
|
|
6476
|
+
// State hook for managing visibility of the Select dropdown, initially set to hidden
|
|
6477
|
+
var [hide, setHide] = React__default.useState(true);
|
|
6510
6478
|
// Returns an object containing all stateful values and their associated setters to manage the Select component's state
|
|
6511
6479
|
return {
|
|
6480
|
+
id,
|
|
6512
6481
|
value,
|
|
6513
6482
|
setValue,
|
|
6514
6483
|
hide,
|
|
@@ -6723,7 +6692,7 @@
|
|
|
6723
6692
|
flexWrap: "nowrap",
|
|
6724
6693
|
alignItems: "center",
|
|
6725
6694
|
justifyContent: "space-between",
|
|
6726
|
-
marginBottom:
|
|
6695
|
+
marginBottom: 2,
|
|
6727
6696
|
// Visual properties
|
|
6728
6697
|
borderStyle: "solid",
|
|
6729
6698
|
borderColor: color,
|
|
@@ -6745,10 +6714,9 @@
|
|
|
6745
6714
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
|
6746
6715
|
return /*#__PURE__*/React__default.createElement(appStudio.Center, Object.assign({
|
|
6747
6716
|
gap: 10,
|
|
6748
|
-
right:
|
|
6717
|
+
right: 10,
|
|
6749
6718
|
zIndex: 500,
|
|
6750
|
-
flexWrap: "nowrap"
|
|
6751
|
-
position: "absolute"
|
|
6719
|
+
flexWrap: "nowrap"
|
|
6752
6720
|
}, props), children);
|
|
6753
6721
|
};
|
|
6754
6722
|
|
|
@@ -6932,20 +6900,27 @@
|
|
|
6932
6900
|
} = _ref,
|
|
6933
6901
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
|
|
6934
6902
|
// Handles the click event on an option by invoking the callback with the selected option's value
|
|
6935
|
-
var handleOptionClick = option =>
|
|
6903
|
+
var handleOptionClick = (e, option) => {
|
|
6904
|
+
e.stopPropagation();
|
|
6905
|
+
e.preventDefault();
|
|
6906
|
+
if (typeof callback === 'function') {
|
|
6907
|
+
callback(option);
|
|
6908
|
+
}
|
|
6909
|
+
};
|
|
6936
6910
|
// Toggles the hover state on the item
|
|
6937
6911
|
var handleHover = () => setIsHovered(!isHovered);
|
|
6938
6912
|
return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
|
|
6939
6913
|
as: "li",
|
|
6940
6914
|
// Layout properties
|
|
6941
6915
|
margin: 0,
|
|
6942
|
-
paddingVertical:
|
|
6943
|
-
paddingHorizontal:
|
|
6916
|
+
paddingVertical: 8,
|
|
6917
|
+
paddingHorizontal: 8,
|
|
6944
6918
|
listStyleType: "none",
|
|
6919
|
+
cursor: "pointer",
|
|
6945
6920
|
// Event handlers
|
|
6946
6921
|
onMouseEnter: handleHover,
|
|
6947
6922
|
onMouseLeave: handleHover,
|
|
6948
|
-
onClick:
|
|
6923
|
+
onClick: e => handleOptionClick(e, option.value),
|
|
6949
6924
|
// Visual properties
|
|
6950
6925
|
backgroundColor: isHovered ? 'color.gray.100' : 'transparent',
|
|
6951
6926
|
borderRadius: "4px" // Subtle rounded corners for items
|
|
@@ -6991,7 +6966,7 @@
|
|
|
6991
6966
|
width: '95%',
|
|
6992
6967
|
height: '100%',
|
|
6993
6968
|
border: 'none',
|
|
6994
|
-
paddingVertical:
|
|
6969
|
+
paddingVertical: 4,
|
|
6995
6970
|
paddingHorizontal: 0,
|
|
6996
6971
|
// Typography properties
|
|
6997
6972
|
fontSize: appStudio.Typography.fontSizes[size],
|
|
@@ -7071,34 +7046,16 @@
|
|
|
7071
7046
|
} = _ref5;
|
|
7072
7047
|
var itemStates = useItemState();
|
|
7073
7048
|
var handleCallback = option => callback(option);
|
|
7074
|
-
// Shadow styles for the dropdown
|
|
7075
|
-
var shadow = {
|
|
7076
|
-
boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)'
|
|
7077
|
-
};
|
|
7049
|
+
// Shadow styles for the dropdown - now applied directly in the Element
|
|
7078
7050
|
return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
|
|
7079
7051
|
as: "ul",
|
|
7080
7052
|
role: "dropdown",
|
|
7081
|
-
top: "100%",
|
|
7082
7053
|
width: "100%",
|
|
7083
7054
|
display: "flex",
|
|
7084
7055
|
flexDirection: "column",
|
|
7085
|
-
position: "absolute",
|
|
7086
|
-
marginTop: 8,
|
|
7087
|
-
marginLeft: 0,
|
|
7088
|
-
marginRight: 0,
|
|
7089
|
-
marginBottom: 0,
|
|
7090
|
-
padding: 0,
|
|
7091
|
-
maxHeight: "240px" // 60 × 4px grid
|
|
7092
|
-
,
|
|
7093
|
-
overflowY: "auto",
|
|
7094
|
-
zIndex: 1000,
|
|
7095
7056
|
backgroundColor: "color.white",
|
|
7096
|
-
borderRadius: "8px" // Consistent with design system (rounded-md)
|
|
7097
|
-
,
|
|
7098
|
-
borderWidth: "1px",
|
|
7099
|
-
borderStyle: "solid",
|
|
7100
|
-
borderColor: "color.gray.200",
|
|
7101
7057
|
transition: "all 0.2s ease",
|
|
7058
|
+
margin: 0,
|
|
7102
7059
|
style: {
|
|
7103
7060
|
scrollbarWidth: 'thin',
|
|
7104
7061
|
scrollbarColor: 'rgba(0, 0, 0, 0.2) transparent',
|
|
@@ -7113,7 +7070,7 @@
|
|
|
7113
7070
|
borderRadius: '4px'
|
|
7114
7071
|
}
|
|
7115
7072
|
}
|
|
7116
|
-
},
|
|
7073
|
+
}, views == null ? void 0 : views.dropDown), options && options.length > 0 && options.map((option, index) => (/*#__PURE__*/React__default.createElement(Item, Object.assign({
|
|
7117
7074
|
key: option.value,
|
|
7118
7075
|
size: size,
|
|
7119
7076
|
style: views['text'],
|
|
@@ -7196,23 +7153,57 @@
|
|
|
7196
7153
|
highlightedIndex
|
|
7197
7154
|
} = _ref7,
|
|
7198
7155
|
props = _objectWithoutPropertiesLoose(_ref7, _excluded4$6);
|
|
7156
|
+
// close when *any* other select opens
|
|
7157
|
+
React__default.useEffect(() => {
|
|
7158
|
+
var handleCloseAll = () => setHide(true);
|
|
7159
|
+
document.addEventListener('closeAllSelects', handleCloseAll);
|
|
7160
|
+
return () => document.removeEventListener('closeAllSelects', handleCloseAll);
|
|
7161
|
+
}, [setHide]);
|
|
7162
|
+
// Add a global click handler to close the dropdown when clicking outside
|
|
7163
|
+
React__default.useEffect(() => {
|
|
7164
|
+
var handleGlobalClick = e => {
|
|
7165
|
+
var target = e.target;
|
|
7166
|
+
// Only close if clicking outside of this specific select component
|
|
7167
|
+
if (!target.closest("#" + id) && !hide) {
|
|
7168
|
+
setHide(true);
|
|
7169
|
+
}
|
|
7170
|
+
};
|
|
7171
|
+
document.addEventListener('click', handleGlobalClick);
|
|
7172
|
+
return () => {
|
|
7173
|
+
document.removeEventListener('click', handleGlobalClick);
|
|
7174
|
+
};
|
|
7175
|
+
}, [id, hide, setHide]);
|
|
7199
7176
|
var showLabel = !!(isFocused && label);
|
|
7200
7177
|
var handleHover = () => setIsHovered(!isHovered);
|
|
7201
7178
|
var handleFocus = () => setIsFocused(true);
|
|
7202
7179
|
var handleClick = event => {
|
|
7180
|
+
// tell all other selects to close
|
|
7181
|
+
document.dispatchEvent(new Event('closeAllSelects'));
|
|
7203
7182
|
if (event && event.stopPropagation) event.stopPropagation();
|
|
7204
|
-
|
|
7205
|
-
|
|
7183
|
+
// Toggle dropdown visibility
|
|
7184
|
+
var newHideState = !hide;
|
|
7185
|
+
setHide(newHideState);
|
|
7186
|
+
setIsFocused(!newHideState); // Set focus state based on dropdown visibility
|
|
7206
7187
|
};
|
|
7207
7188
|
var handleCallback = React.useCallback(option => {
|
|
7208
|
-
|
|
7189
|
+
// Close dropdown after selection
|
|
7190
|
+
setHide(true);
|
|
7191
|
+
// Tell all other selects to close
|
|
7192
|
+
document.dispatchEvent(new Event('closeAllSelects'));
|
|
7193
|
+
// Update value based on multi-select or single-select mode
|
|
7209
7194
|
if (isMulti && Array.isArray(value)) {
|
|
7210
|
-
!value.includes(option)
|
|
7195
|
+
if (!value.includes(option)) {
|
|
7196
|
+
var newValue = [...value, option];
|
|
7197
|
+
setValue(newValue);
|
|
7198
|
+
if (onChange) onChange(option);
|
|
7199
|
+
}
|
|
7211
7200
|
} else {
|
|
7212
7201
|
setValue(option);
|
|
7202
|
+
if (onChange) onChange(option);
|
|
7213
7203
|
}
|
|
7214
|
-
|
|
7215
|
-
|
|
7204
|
+
// Set focus to indicate selection
|
|
7205
|
+
setIsFocused(true);
|
|
7206
|
+
}, [isMulti, value, setHide, setValue, onChange, setIsFocused]);
|
|
7216
7207
|
var handleRemoveOption = valueOption => {
|
|
7217
7208
|
if (Array.isArray(value) && value.includes(valueOption)) {
|
|
7218
7209
|
var newValue = value.filter(option => option !== valueOption);
|
|
@@ -7220,11 +7211,24 @@
|
|
|
7220
7211
|
}
|
|
7221
7212
|
};
|
|
7222
7213
|
return /*#__PURE__*/React__default.createElement(FieldContainer, {
|
|
7214
|
+
style: {
|
|
7215
|
+
position: 'relative',
|
|
7216
|
+
width: '100%',
|
|
7217
|
+
display: 'inline-block'
|
|
7218
|
+
},
|
|
7219
|
+
id: id,
|
|
7223
7220
|
role: "SelectBox",
|
|
7224
7221
|
helperText: helperText,
|
|
7225
7222
|
error: error,
|
|
7226
7223
|
views: views,
|
|
7227
|
-
onClick:
|
|
7224
|
+
onClick: e => {
|
|
7225
|
+
// Stop propagation to prevent clicks from bubbling up
|
|
7226
|
+
e.stopPropagation();
|
|
7227
|
+
// Only handle click if not disabled or readonly
|
|
7228
|
+
if (!(isDisabled || isReadOnly)) {
|
|
7229
|
+
handleClick(e);
|
|
7230
|
+
}
|
|
7231
|
+
}
|
|
7228
7232
|
}, /*#__PURE__*/React__default.createElement(FieldContent, {
|
|
7229
7233
|
label: label,
|
|
7230
7234
|
size: size,
|
|
@@ -7274,39 +7278,78 @@
|
|
|
7274
7278
|
orientation: "up",
|
|
7275
7279
|
widthHeight: IconSizes$2[size],
|
|
7276
7280
|
style: views.icon
|
|
7277
|
-
})))))), !hide && (/*#__PURE__*/React__default.createElement(
|
|
7281
|
+
})))))), !hide && options.length > 0 && (/*#__PURE__*/React__default.createElement(appStudio.Element, {
|
|
7282
|
+
onClick: e => e.stopPropagation(),
|
|
7283
|
+
style: {
|
|
7284
|
+
position: 'absolute',
|
|
7285
|
+
top: 'calc(100% + 4px)',
|
|
7286
|
+
left: 0,
|
|
7287
|
+
right: 0,
|
|
7288
|
+
zIndex: 1000
|
|
7289
|
+
}
|
|
7290
|
+
}, /*#__PURE__*/React__default.createElement(DropDown, {
|
|
7278
7291
|
size: size,
|
|
7279
|
-
views: views,
|
|
7292
|
+
views: Object.assign({}, views, {
|
|
7293
|
+
dropDown: {
|
|
7294
|
+
borderRadius: '6px',
|
|
7295
|
+
border: '1px solid color.gray.200',
|
|
7296
|
+
boxShadow: '0 8px 16px rgba(0,0,0,0.1)',
|
|
7297
|
+
padding: '8px',
|
|
7298
|
+
maxHeight: '240px',
|
|
7299
|
+
overflowY: 'auto'
|
|
7300
|
+
}
|
|
7301
|
+
}),
|
|
7280
7302
|
options: options,
|
|
7281
7303
|
callback: handleCallback,
|
|
7282
7304
|
highlightedIndex: highlightedIndex,
|
|
7283
7305
|
setHighlightedIndex: setHighlightedIndex
|
|
7284
|
-
})));
|
|
7306
|
+
}))));
|
|
7285
7307
|
};
|
|
7286
7308
|
|
|
7287
7309
|
// Defines a functional component named 'SelectComponent', which is expected to receive 'SelectProps' as properties.
|
|
7288
7310
|
var SelectComponent = props => {
|
|
7311
|
+
// Ensure options is always an array
|
|
7312
|
+
var safeProps = Object.assign({}, props, {
|
|
7313
|
+
options: props.options || []
|
|
7314
|
+
});
|
|
7289
7315
|
// Invokes the 'useSelectState' hook with props to obtain stateful logic for the Select component.
|
|
7290
|
-
var selectStates = useSelectState(
|
|
7316
|
+
var selectStates = useSelectState(safeProps);
|
|
7291
7317
|
// Renders the 'SelectView' component, passing along any states controlled by 'useSelectState' and all properties passed to 'SelectComponent'.
|
|
7292
|
-
return /*#__PURE__*/React__default.createElement(SelectView, Object.assign({}, selectStates,
|
|
7318
|
+
return /*#__PURE__*/React__default.createElement(SelectView, Object.assign({}, selectStates, safeProps, {
|
|
7319
|
+
onClick: e => {
|
|
7320
|
+
// Stop propagation to prevent the global click handler from closing other dropdowns
|
|
7321
|
+
e.stopPropagation();
|
|
7322
|
+
if (props.onClick) props.onClick(e);
|
|
7323
|
+
}
|
|
7324
|
+
}));
|
|
7293
7325
|
};
|
|
7294
7326
|
// Exports 'SelectComponent' as 'Select', making it available for import in other parts of the application.
|
|
7295
7327
|
var Select = SelectComponent;
|
|
7296
7328
|
|
|
7297
|
-
// This file defines a custom hook for managing the state of a Switch component.
|
|
7329
|
+
// This file defines a custom hook for managing the state of a Switch component.
|
|
7330
|
+
// It allows tracking whether the switch is hovered, and its on/off state based on 'isDisabled' and 'isChecked' properties.
|
|
7298
7331
|
var useSwitchState = _ref => {
|
|
7299
7332
|
var {
|
|
7300
7333
|
isDisabled,
|
|
7301
7334
|
isChecked
|
|
7302
7335
|
} = _ref;
|
|
7303
7336
|
var [isHovered, setIsHovered] = React__default.useState(false);
|
|
7304
|
-
var [on, setOn] = React__default.useState(
|
|
7337
|
+
var [on, setOn] = React__default.useState(isChecked || false);
|
|
7338
|
+
var [value, setValue] = React__default.useState(isChecked || false);
|
|
7339
|
+
// Update the value when isChecked changes
|
|
7340
|
+
React.useEffect(() => {
|
|
7341
|
+
if (isChecked !== undefined) {
|
|
7342
|
+
setOn(isChecked);
|
|
7343
|
+
setValue(isChecked);
|
|
7344
|
+
}
|
|
7345
|
+
}, [isChecked]);
|
|
7305
7346
|
return {
|
|
7306
7347
|
isHovered,
|
|
7307
7348
|
setIsHovered,
|
|
7308
7349
|
on,
|
|
7309
|
-
setOn
|
|
7350
|
+
setOn,
|
|
7351
|
+
value,
|
|
7352
|
+
setValue
|
|
7310
7353
|
};
|
|
7311
7354
|
};
|
|
7312
7355
|
|
|
@@ -7322,68 +7365,68 @@
|
|
|
7322
7365
|
*/
|
|
7323
7366
|
/**
|
|
7324
7367
|
* Knob (circle) sizes for the Switch component
|
|
7325
|
-
* Following the 4px grid system
|
|
7368
|
+
* Following the 4px grid system - dimensions réduites
|
|
7326
7369
|
*/
|
|
7327
7370
|
var KnobSizes = {
|
|
7328
7371
|
xs: {
|
|
7372
|
+
height: '8px',
|
|
7373
|
+
width: '8px'
|
|
7374
|
+
},
|
|
7375
|
+
sm: {
|
|
7329
7376
|
height: '12px',
|
|
7330
7377
|
width: '12px'
|
|
7331
7378
|
},
|
|
7332
|
-
|
|
7379
|
+
md: {
|
|
7333
7380
|
height: '16px',
|
|
7334
7381
|
width: '16px'
|
|
7335
7382
|
},
|
|
7336
|
-
|
|
7383
|
+
lg: {
|
|
7337
7384
|
height: '20px',
|
|
7338
7385
|
width: '20px'
|
|
7339
7386
|
},
|
|
7340
|
-
|
|
7387
|
+
xl: {
|
|
7341
7388
|
height: '24px',
|
|
7342
7389
|
width: '24px'
|
|
7343
|
-
},
|
|
7344
|
-
xl: {
|
|
7345
|
-
height: '28px',
|
|
7346
|
-
width: '28px'
|
|
7347
7390
|
}
|
|
7348
7391
|
};
|
|
7349
7392
|
/**
|
|
7350
7393
|
* Slider (track) sizes for the Switch component
|
|
7351
|
-
* Following the 4px grid system
|
|
7394
|
+
* Following the 4px grid system - dimensions réduites
|
|
7352
7395
|
*/
|
|
7353
7396
|
var SliderSizes = {
|
|
7354
7397
|
xs: {
|
|
7355
|
-
height: '
|
|
7356
|
-
width: '
|
|
7398
|
+
height: '16px',
|
|
7399
|
+
width: '36px'
|
|
7357
7400
|
},
|
|
7358
7401
|
sm: {
|
|
7359
|
-
height: '
|
|
7360
|
-
width: '
|
|
7402
|
+
height: '20px',
|
|
7403
|
+
width: '44px'
|
|
7361
7404
|
},
|
|
7362
7405
|
md: {
|
|
7363
|
-
height: '
|
|
7364
|
-
width: '
|
|
7406
|
+
height: '24px',
|
|
7407
|
+
width: '52px'
|
|
7365
7408
|
},
|
|
7366
7409
|
lg: {
|
|
7367
|
-
height: '
|
|
7368
|
-
width: '
|
|
7410
|
+
height: '28px',
|
|
7411
|
+
width: '60px'
|
|
7369
7412
|
},
|
|
7370
7413
|
xl: {
|
|
7371
|
-
height: '
|
|
7372
|
-
width: '
|
|
7414
|
+
height: '32px',
|
|
7415
|
+
width: '68px'
|
|
7373
7416
|
}
|
|
7374
7417
|
};
|
|
7375
7418
|
/**
|
|
7376
|
-
* Padding for the Switch slider
|
|
7419
|
+
* Padding for the Switch slider - ajusté pour les nouvelles dimensions
|
|
7377
7420
|
* Following the 4px grid system
|
|
7378
7421
|
*/
|
|
7379
7422
|
var SliderPadding = {
|
|
7380
7423
|
xs: {
|
|
7381
7424
|
paddingVertical: 4,
|
|
7382
|
-
paddingHorizontal:
|
|
7425
|
+
paddingHorizontal: 2
|
|
7383
7426
|
},
|
|
7384
7427
|
sm: {
|
|
7385
7428
|
paddingVertical: 4,
|
|
7386
|
-
paddingHorizontal:
|
|
7429
|
+
paddingHorizontal: 2
|
|
7387
7430
|
},
|
|
7388
7431
|
md: {
|
|
7389
7432
|
paddingVertical: 4,
|
|
@@ -7441,7 +7484,6 @@
|
|
|
7441
7484
|
isHovered = false,
|
|
7442
7485
|
isDisabled = false,
|
|
7443
7486
|
isReadOnly = false,
|
|
7444
|
-
on,
|
|
7445
7487
|
setOn,
|
|
7446
7488
|
onChange,
|
|
7447
7489
|
setValue = () => {},
|
|
@@ -7454,10 +7496,11 @@
|
|
|
7454
7496
|
} = _ref,
|
|
7455
7497
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$q);
|
|
7456
7498
|
var handleToggle = event => {
|
|
7457
|
-
if (!isReadOnly) {
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7499
|
+
if (!isReadOnly && !isDisabled) {
|
|
7500
|
+
var newValue = event.target.checked;
|
|
7501
|
+
setValue(newValue);
|
|
7502
|
+
setOn(newValue);
|
|
7503
|
+
if (onChange) onChange(newValue);
|
|
7461
7504
|
}
|
|
7462
7505
|
};
|
|
7463
7506
|
var handleHover = () => setIsHovered(!isHovered);
|
|
@@ -7505,27 +7548,39 @@
|
|
|
7505
7548
|
// Layout properties
|
|
7506
7549
|
display: "flex",
|
|
7507
7550
|
alignItems: "center",
|
|
7508
|
-
justifyContent: activeChild ? 'space-between' :
|
|
7551
|
+
justifyContent: value ? activeChild ? 'space-between' : 'flex-end' : inActiveChild ? 'space-between' : 'flex-start',
|
|
7509
7552
|
marginBottom: 4,
|
|
7510
7553
|
// Visual properties
|
|
7511
7554
|
borderRadius: "9999px" // Full rounded for pill shape
|
|
7512
7555
|
,
|
|
7513
7556
|
backgroundColor: isDisabled ? ColorSchemes.default.disabled : value ? isHovered ? ColorSchemes.states.hover.active : ColorSchemes.default.active : isHovered ? ColorSchemes.states.hover.inactive : ColorSchemes.default.inactive,
|
|
7557
|
+
overflow: "hidden",
|
|
7514
7558
|
// State properties
|
|
7515
7559
|
cursor: "pointer",
|
|
7516
7560
|
// Animation
|
|
7517
7561
|
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
7518
7562
|
}, shadow, SliderPadding[size], SliderSizes[size], views['slider']), activeChild && value && (/*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
7519
7563
|
marginLeft: 8,
|
|
7520
|
-
|
|
7564
|
+
marginRight: 4,
|
|
7565
|
+
transition: "all 0.3s ease",
|
|
7566
|
+
display: "flex",
|
|
7567
|
+
alignItems: "center",
|
|
7568
|
+
justifyContent: "center",
|
|
7569
|
+
height: "100%"
|
|
7521
7570
|
}, activeChild)), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
7522
7571
|
borderRadius: "50%",
|
|
7523
7572
|
backgroundColor: ColorSchemes.default.knob,
|
|
7524
7573
|
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
|
|
7525
|
-
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
7574
|
+
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
7575
|
+
zIndex: 1
|
|
7526
7576
|
}, KnobSizes[size], views['circle'])), inActiveChild && !value && (/*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
7527
7577
|
marginRight: 8,
|
|
7528
|
-
|
|
7578
|
+
marginLeft: 4,
|
|
7579
|
+
transition: "all 0.3s ease",
|
|
7580
|
+
display: "flex",
|
|
7581
|
+
alignItems: "center",
|
|
7582
|
+
justifyContent: "center",
|
|
7583
|
+
height: "100%"
|
|
7529
7584
|
}, inActiveChild))), labelPosition === 'right' && label && (/*#__PURE__*/React__default.createElement(Text, {
|
|
7530
7585
|
fontWeight: "500" // Medium weight for better readability
|
|
7531
7586
|
,
|
|
@@ -7811,7 +7866,7 @@
|
|
|
7811
7866
|
var fieldStyles = Object.assign({
|
|
7812
7867
|
// Layout properties
|
|
7813
7868
|
margin: 0,
|
|
7814
|
-
paddingVertical:
|
|
7869
|
+
paddingVertical: 4,
|
|
7815
7870
|
paddingHorizontal: 0,
|
|
7816
7871
|
width: '100%',
|
|
7817
7872
|
height: '100%',
|
|
@@ -7951,24 +8006,24 @@
|
|
|
7951
8006
|
*/
|
|
7952
8007
|
var Sizes = {
|
|
7953
8008
|
xs: {
|
|
8009
|
+
height: '12px',
|
|
8010
|
+
width: '12px'
|
|
8011
|
+
},
|
|
8012
|
+
sm: {
|
|
7954
8013
|
height: '16px',
|
|
7955
8014
|
width: '16px'
|
|
7956
8015
|
},
|
|
7957
|
-
|
|
8016
|
+
md: {
|
|
7958
8017
|
height: '20px',
|
|
7959
8018
|
width: '20px'
|
|
7960
8019
|
},
|
|
7961
|
-
|
|
8020
|
+
lg: {
|
|
7962
8021
|
height: '24px',
|
|
7963
8022
|
width: '24px'
|
|
7964
8023
|
},
|
|
7965
|
-
|
|
8024
|
+
xl: {
|
|
7966
8025
|
height: '28px',
|
|
7967
8026
|
width: '28px'
|
|
7968
|
-
},
|
|
7969
|
-
xl: {
|
|
7970
|
-
height: '32px',
|
|
7971
|
-
width: '32px'
|
|
7972
8027
|
}
|
|
7973
8028
|
};
|
|
7974
8029
|
/**
|
|
@@ -10206,7 +10261,7 @@
|
|
|
10206
10261
|
hint: placeholder,
|
|
10207
10262
|
isClearable: false,
|
|
10208
10263
|
left: /*#__PURE__*/React__default.createElement(SearchIcon, {
|
|
10209
|
-
widthHeight:
|
|
10264
|
+
widthHeight: 16
|
|
10210
10265
|
}),
|
|
10211
10266
|
views: {
|
|
10212
10267
|
container: Object.assign({
|
|
@@ -12767,17 +12822,17 @@
|
|
|
12767
12822
|
var NavigationMenuSizes = {
|
|
12768
12823
|
sm: {
|
|
12769
12824
|
padding: '8px 12px',
|
|
12770
|
-
fontSize: '
|
|
12825
|
+
fontSize: '12px',
|
|
12771
12826
|
fontWeight: '500'
|
|
12772
12827
|
},
|
|
12773
12828
|
md: {
|
|
12774
12829
|
padding: '12px 16px',
|
|
12775
|
-
fontSize: '
|
|
12830
|
+
fontSize: '14px',
|
|
12776
12831
|
fontWeight: '500'
|
|
12777
12832
|
},
|
|
12778
12833
|
lg: {
|
|
12779
12834
|
padding: '16px 20px',
|
|
12780
|
-
fontSize: '
|
|
12835
|
+
fontSize: '16px',
|
|
12781
12836
|
fontWeight: '500'
|
|
12782
12837
|
}
|
|
12783
12838
|
};
|
|
@@ -13725,8 +13780,8 @@
|
|
|
13725
13780
|
}),
|
|
13726
13781
|
gradient: (color, secondaryColor) => ({
|
|
13727
13782
|
background: "linear-gradient(135deg, " + color + ", " + (secondaryColor || color) + ")",
|
|
13728
|
-
backgroundClip: 'text',
|
|
13729
|
-
webkitBackgroundClip: 'text',
|
|
13783
|
+
backgroundClip: 'text !important',
|
|
13784
|
+
webkitBackgroundClip: 'text !important',
|
|
13730
13785
|
color: 'transparent',
|
|
13731
13786
|
webkitTextFillColor: 'transparent',
|
|
13732
13787
|
display: 'inline-block',
|