@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
|
@@ -470,20 +470,20 @@ var HeadingSizes = {
|
|
|
470
470
|
* Font sizes following typography guidelines
|
|
471
471
|
*/
|
|
472
472
|
var FontSizes = {
|
|
473
|
-
xs: '
|
|
474
|
-
sm: '
|
|
475
|
-
md: '
|
|
476
|
-
lg: '
|
|
473
|
+
xs: '10px',
|
|
474
|
+
sm: '12px',
|
|
475
|
+
md: '14px',
|
|
476
|
+
lg: '16px',
|
|
477
477
|
xl: '20px'
|
|
478
478
|
};
|
|
479
479
|
/**
|
|
480
480
|
* Line heights following typography guidelines
|
|
481
481
|
*/
|
|
482
482
|
var LineHeights = {
|
|
483
|
-
xs: '
|
|
484
|
-
sm: '
|
|
485
|
-
md: '
|
|
486
|
-
lg: '
|
|
483
|
+
xs: '14px',
|
|
484
|
+
sm: '16px',
|
|
485
|
+
md: '20px',
|
|
486
|
+
lg: '22px',
|
|
487
487
|
xl: '28px'
|
|
488
488
|
};
|
|
489
489
|
/**
|
|
@@ -3265,7 +3265,7 @@ var BadgeSizes = {
|
|
|
3265
3265
|
height: '32px',
|
|
3266
3266
|
padding: '0 12px',
|
|
3267
3267
|
// Typography
|
|
3268
|
-
fontSize: '
|
|
3268
|
+
fontSize: '16px',
|
|
3269
3269
|
fontWeight: '500',
|
|
3270
3270
|
lineHeight: '32px'
|
|
3271
3271
|
},
|
|
@@ -3275,7 +3275,7 @@ var BadgeSizes = {
|
|
|
3275
3275
|
height: '36px',
|
|
3276
3276
|
padding: '0 14px',
|
|
3277
3277
|
// Typography
|
|
3278
|
-
fontSize: '
|
|
3278
|
+
fontSize: '20px',
|
|
3279
3279
|
fontWeight: '500',
|
|
3280
3280
|
lineHeight: '36px'
|
|
3281
3281
|
}
|
|
@@ -3401,18 +3401,6 @@ var BadgeView = _ref => {
|
|
|
3401
3401
|
// Badge component that displays a small indicator, typically used for counts or status
|
|
3402
3402
|
var Badge = props => /*#__PURE__*/React__default.createElement(BadgeView, Object.assign({}, props));
|
|
3403
3403
|
|
|
3404
|
-
var useButtonState = () => {
|
|
3405
|
-
var [isHovered, setIsHovered] = React__default.useState(false);
|
|
3406
|
-
// This custom react hook 'useButtonState' is defined for managing the state of a button, especially for hover interactions.
|
|
3407
|
-
return {
|
|
3408
|
-
isHovered,
|
|
3409
|
-
setIsHovered
|
|
3410
|
-
};
|
|
3411
|
-
// The 'setIsHovered' function is used to update the value of 'isHovered' state when the hover status of the button changes.
|
|
3412
|
-
// A state variable 'isHovered' is declared with its initial value set to 'false', indicating that the button is not hovered by default.
|
|
3413
|
-
};
|
|
3414
|
-
// The hook returns an object containing 'isHovered' state and the 'setIsHovered' function to enable state management from the consumer component.
|
|
3415
|
-
|
|
3416
3404
|
// This function initializes the Link component's state using the useState hook and exposes its state and setter function.
|
|
3417
3405
|
var useLinkState = () => {
|
|
3418
3406
|
var [isHovered, setIsHovered] = React.useState(false);
|
|
@@ -3698,70 +3686,60 @@ var Loader = LoaderComponent;
|
|
|
3698
3686
|
*/
|
|
3699
3687
|
/**
|
|
3700
3688
|
* Button sizes following the 4px grid system
|
|
3701
|
-
*/
|
|
3702
|
-
var ButtonSizes = {
|
|
3689
|
+
*/var ButtonSizes = {
|
|
3703
3690
|
xs: {
|
|
3704
|
-
|
|
3691
|
+
minHeight: 3 * 4,
|
|
3692
|
+
paddingTop: 1,
|
|
3693
|
+
paddingBottom: 1,
|
|
3694
|
+
paddingLeft: 2,
|
|
3695
|
+
paddingRight: 2,
|
|
3696
|
+
fontSize: 10,
|
|
3697
|
+
fontWeight: '500',
|
|
3698
|
+
lineHeight: 14,
|
|
3699
|
+
letterSpacing: '-0.01em'
|
|
3700
|
+
},
|
|
3701
|
+
sm: {
|
|
3705
3702
|
minHeight: 4 * 4,
|
|
3706
|
-
paddingTop:
|
|
3707
|
-
paddingBottom:
|
|
3708
|
-
paddingLeft:
|
|
3709
|
-
paddingRight:
|
|
3710
|
-
// Typography
|
|
3703
|
+
paddingTop: 4,
|
|
3704
|
+
paddingBottom: 4,
|
|
3705
|
+
paddingLeft: 8,
|
|
3706
|
+
paddingRight: 8,
|
|
3711
3707
|
fontSize: 12,
|
|
3712
3708
|
fontWeight: '500',
|
|
3713
|
-
lineHeight:
|
|
3709
|
+
lineHeight: 16,
|
|
3714
3710
|
letterSpacing: '-0.01em'
|
|
3715
3711
|
},
|
|
3716
|
-
|
|
3717
|
-
// Height: 32px (8 × 4px)
|
|
3712
|
+
md: {
|
|
3718
3713
|
minHeight: 6 * 4,
|
|
3719
3714
|
paddingTop: 6,
|
|
3720
3715
|
paddingBottom: 6,
|
|
3721
3716
|
paddingLeft: 12,
|
|
3722
3717
|
paddingRight: 12,
|
|
3723
|
-
|
|
3724
|
-
fontSize: 12,
|
|
3718
|
+
fontSize: 14,
|
|
3725
3719
|
fontWeight: '500',
|
|
3726
|
-
lineHeight:
|
|
3720
|
+
lineHeight: 18,
|
|
3727
3721
|
letterSpacing: '-0.01em'
|
|
3728
3722
|
},
|
|
3729
|
-
|
|
3730
|
-
// Height: 40px (10 × 4px) - standard height for interactive elements
|
|
3723
|
+
lg: {
|
|
3731
3724
|
minHeight: 8 * 4,
|
|
3732
3725
|
paddingTop: 8,
|
|
3733
3726
|
paddingBottom: 8,
|
|
3734
3727
|
paddingLeft: 16,
|
|
3735
3728
|
paddingRight: 16,
|
|
3736
|
-
// Typography
|
|
3737
3729
|
fontSize: 16,
|
|
3738
3730
|
fontWeight: '500',
|
|
3739
|
-
lineHeight:
|
|
3731
|
+
lineHeight: 18,
|
|
3740
3732
|
letterSpacing: '-0.01em'
|
|
3741
3733
|
},
|
|
3742
|
-
|
|
3734
|
+
xl: {
|
|
3743
3735
|
minHeight: 10 * 4,
|
|
3744
3736
|
paddingTop: 10,
|
|
3745
3737
|
paddingBottom: 10,
|
|
3746
3738
|
paddingLeft: 20,
|
|
3747
3739
|
paddingRight: 20,
|
|
3748
|
-
|
|
3749
|
-
fontSize: 16,
|
|
3750
|
-
fontWeight: '500',
|
|
3751
|
-
lineHeight: 20,
|
|
3752
|
-
letterSpacing: '-0.01em'
|
|
3753
|
-
},
|
|
3754
|
-
xl: {
|
|
3755
|
-
// Height: 60px (15 × 4px)
|
|
3756
|
-
minHeight: 12 * 4,
|
|
3757
|
-
paddingTop: 12,
|
|
3758
|
-
paddingBottom: 12,
|
|
3759
|
-
paddingLeft: 24,
|
|
3760
|
-
paddingRight: 24,
|
|
3761
|
-
// Typography
|
|
3762
|
-
fontSize: 18,
|
|
3740
|
+
fontSize: 20,
|
|
3763
3741
|
fontWeight: '500',
|
|
3764
|
-
lineHeight:
|
|
3742
|
+
lineHeight: 22,
|
|
3765
3743
|
letterSpacing: '-0.01em'
|
|
3766
3744
|
}
|
|
3767
3745
|
};
|
|
@@ -3997,25 +3975,14 @@ var ButtonView = _ref => {
|
|
|
3997
3975
|
|
|
3998
3976
|
// Importing a custom hook to manage the state specific to the button component.
|
|
3999
3977
|
var ButtonComponent = props => {
|
|
4000
|
-
|
|
4001
|
-
var {
|
|
4002
|
-
isHovered,
|
|
4003
|
-
setIsHovered
|
|
4004
|
-
} = useButtonState();
|
|
4005
|
-
// Defining the button component with generic React Functional Component type augmented with ButtonProps type.
|
|
4006
|
-
var handleHover = () => setIsHovered(!isHovered);
|
|
3978
|
+
var [ref, hover] = appStudio.useHover();
|
|
4007
3979
|
// Destructuring the state and state update function from the custom hook for button state management.
|
|
4008
3980
|
return (
|
|
4009
3981
|
/*#__PURE__*/
|
|
4010
3982
|
// Defines a function to toggle the hover state of the button.
|
|
4011
3983
|
React__default.createElement(ButtonView, Object.assign({
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
setIsHovered: setIsHovered,
|
|
4015
|
-
// Passing the isHovered state and the setIsHovered function to the ButtonView.
|
|
4016
|
-
onMouseEnter: handleHover,
|
|
4017
|
-
// Binding handleHover function to onMouseEnter and onMouseLeave events to toggle hover effect.
|
|
4018
|
-
onMouseLeave: handleHover
|
|
3984
|
+
ref: ref,
|
|
3985
|
+
isHovered: hover
|
|
4019
3986
|
}, props))
|
|
4020
3987
|
);
|
|
4021
3988
|
// Exports the Button component for use in other parts of the application.
|
|
@@ -6523,13 +6490,12 @@ var useSelectState = _ref => {
|
|
|
6523
6490
|
var {
|
|
6524
6491
|
placeholder,
|
|
6525
6492
|
isMulti,
|
|
6526
|
-
options
|
|
6493
|
+
options,
|
|
6494
|
+
id = "select-" + Math.random().toString(36).substr(2, 9)
|
|
6527
6495
|
} = _ref;
|
|
6528
6496
|
// 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
|
|
6529
6497
|
var defaultValue = placeholder ? isMulti ? [] : '' // If there's a placeholder, set default to empty array for multi-select or empty string for single select
|
|
6530
|
-
: Array.isArray(options) && options.length > 0 ? options[0].value : ''; // If no placeholder, use the first option value if available, otherwise
|
|
6531
|
-
// State hook for managing visibility of the Select dropdown, initially set to hidden
|
|
6532
|
-
var [hide, setHide] = React__default.useState(true);
|
|
6498
|
+
: 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
|
|
6533
6499
|
// State hook for tracking mouse hover status over the Select component
|
|
6534
6500
|
var [isHovered, setIsHovered] = React__default.useState(false);
|
|
6535
6501
|
// State hook for tracking focus status of the Select input field
|
|
@@ -6538,8 +6504,11 @@ var useSelectState = _ref => {
|
|
|
6538
6504
|
var [value, setValue] = React__default.useState(defaultValue);
|
|
6539
6505
|
// State hook for keeping track of the currently highlighted index in the options list
|
|
6540
6506
|
var [highlightedIndex, setHighlightedIndex] = React__default.useState(0);
|
|
6507
|
+
// State hook for managing visibility of the Select dropdown, initially set to hidden
|
|
6508
|
+
var [hide, setHide] = React__default.useState(true);
|
|
6541
6509
|
// Returns an object containing all stateful values and their associated setters to manage the Select component's state
|
|
6542
6510
|
return {
|
|
6511
|
+
id,
|
|
6543
6512
|
value,
|
|
6544
6513
|
setValue,
|
|
6545
6514
|
hide,
|
|
@@ -6754,7 +6723,7 @@ var FieldContent = _ref => {
|
|
|
6754
6723
|
flexWrap: "nowrap",
|
|
6755
6724
|
alignItems: "center",
|
|
6756
6725
|
justifyContent: "space-between",
|
|
6757
|
-
marginBottom:
|
|
6726
|
+
marginBottom: 2,
|
|
6758
6727
|
// Visual properties
|
|
6759
6728
|
borderStyle: "solid",
|
|
6760
6729
|
borderColor: color,
|
|
@@ -6776,10 +6745,9 @@ var FieldIcons = _ref => {
|
|
|
6776
6745
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
|
6777
6746
|
return /*#__PURE__*/React__default.createElement(appStudio.Center, Object.assign({
|
|
6778
6747
|
gap: 10,
|
|
6779
|
-
right:
|
|
6748
|
+
right: 10,
|
|
6780
6749
|
zIndex: 500,
|
|
6781
|
-
flexWrap: "nowrap"
|
|
6782
|
-
position: "absolute"
|
|
6750
|
+
flexWrap: "nowrap"
|
|
6783
6751
|
}, props), children);
|
|
6784
6752
|
};
|
|
6785
6753
|
|
|
@@ -6963,20 +6931,27 @@ var Item = _ref => {
|
|
|
6963
6931
|
} = _ref,
|
|
6964
6932
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
|
|
6965
6933
|
// Handles the click event on an option by invoking the callback with the selected option's value
|
|
6966
|
-
var handleOptionClick = option =>
|
|
6934
|
+
var handleOptionClick = (e, option) => {
|
|
6935
|
+
e.stopPropagation();
|
|
6936
|
+
e.preventDefault();
|
|
6937
|
+
if (typeof callback === 'function') {
|
|
6938
|
+
callback(option);
|
|
6939
|
+
}
|
|
6940
|
+
};
|
|
6967
6941
|
// Toggles the hover state on the item
|
|
6968
6942
|
var handleHover = () => setIsHovered(!isHovered);
|
|
6969
6943
|
return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
|
|
6970
6944
|
as: "li",
|
|
6971
6945
|
// Layout properties
|
|
6972
6946
|
margin: 0,
|
|
6973
|
-
paddingVertical:
|
|
6974
|
-
paddingHorizontal:
|
|
6947
|
+
paddingVertical: 8,
|
|
6948
|
+
paddingHorizontal: 8,
|
|
6975
6949
|
listStyleType: "none",
|
|
6950
|
+
cursor: "pointer",
|
|
6976
6951
|
// Event handlers
|
|
6977
6952
|
onMouseEnter: handleHover,
|
|
6978
6953
|
onMouseLeave: handleHover,
|
|
6979
|
-
onClick:
|
|
6954
|
+
onClick: e => handleOptionClick(e, option.value),
|
|
6980
6955
|
// Visual properties
|
|
6981
6956
|
backgroundColor: isHovered ? 'color.gray.100' : 'transparent',
|
|
6982
6957
|
borderRadius: "4px" // Subtle rounded corners for items
|
|
@@ -7022,7 +6997,7 @@ var SelectBox = _ref2 => {
|
|
|
7022
6997
|
width: '95%',
|
|
7023
6998
|
height: '100%',
|
|
7024
6999
|
border: 'none',
|
|
7025
|
-
paddingVertical:
|
|
7000
|
+
paddingVertical: 4,
|
|
7026
7001
|
paddingHorizontal: 0,
|
|
7027
7002
|
// Typography properties
|
|
7028
7003
|
fontSize: appStudio.Typography.fontSizes[size],
|
|
@@ -7102,34 +7077,16 @@ var DropDown = _ref5 => {
|
|
|
7102
7077
|
} = _ref5;
|
|
7103
7078
|
var itemStates = useItemState();
|
|
7104
7079
|
var handleCallback = option => callback(option);
|
|
7105
|
-
// Shadow styles for the dropdown
|
|
7106
|
-
var shadow = {
|
|
7107
|
-
boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)'
|
|
7108
|
-
};
|
|
7080
|
+
// Shadow styles for the dropdown - now applied directly in the Element
|
|
7109
7081
|
return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
|
|
7110
7082
|
as: "ul",
|
|
7111
7083
|
role: "dropdown",
|
|
7112
|
-
top: "100%",
|
|
7113
7084
|
width: "100%",
|
|
7114
7085
|
display: "flex",
|
|
7115
7086
|
flexDirection: "column",
|
|
7116
|
-
position: "absolute",
|
|
7117
|
-
marginTop: 8,
|
|
7118
|
-
marginLeft: 0,
|
|
7119
|
-
marginRight: 0,
|
|
7120
|
-
marginBottom: 0,
|
|
7121
|
-
padding: 0,
|
|
7122
|
-
maxHeight: "240px" // 60 × 4px grid
|
|
7123
|
-
,
|
|
7124
|
-
overflowY: "auto",
|
|
7125
|
-
zIndex: 1000,
|
|
7126
7087
|
backgroundColor: "color.white",
|
|
7127
|
-
borderRadius: "8px" // Consistent with design system (rounded-md)
|
|
7128
|
-
,
|
|
7129
|
-
borderWidth: "1px",
|
|
7130
|
-
borderStyle: "solid",
|
|
7131
|
-
borderColor: "color.gray.200",
|
|
7132
7088
|
transition: "all 0.2s ease",
|
|
7089
|
+
margin: 0,
|
|
7133
7090
|
style: {
|
|
7134
7091
|
scrollbarWidth: 'thin',
|
|
7135
7092
|
scrollbarColor: 'rgba(0, 0, 0, 0.2) transparent',
|
|
@@ -7144,7 +7101,7 @@ var DropDown = _ref5 => {
|
|
|
7144
7101
|
borderRadius: '4px'
|
|
7145
7102
|
}
|
|
7146
7103
|
}
|
|
7147
|
-
},
|
|
7104
|
+
}, views == null ? void 0 : views.dropDown), options && options.length > 0 && options.map((option, index) => (/*#__PURE__*/React__default.createElement(Item, Object.assign({
|
|
7148
7105
|
key: option.value,
|
|
7149
7106
|
size: size,
|
|
7150
7107
|
style: views['text'],
|
|
@@ -7227,23 +7184,57 @@ var SelectView = _ref7 => {
|
|
|
7227
7184
|
highlightedIndex
|
|
7228
7185
|
} = _ref7,
|
|
7229
7186
|
props = _objectWithoutPropertiesLoose(_ref7, _excluded4$6);
|
|
7187
|
+
// close when *any* other select opens
|
|
7188
|
+
React__default.useEffect(() => {
|
|
7189
|
+
var handleCloseAll = () => setHide(true);
|
|
7190
|
+
document.addEventListener('closeAllSelects', handleCloseAll);
|
|
7191
|
+
return () => document.removeEventListener('closeAllSelects', handleCloseAll);
|
|
7192
|
+
}, [setHide]);
|
|
7193
|
+
// Add a global click handler to close the dropdown when clicking outside
|
|
7194
|
+
React__default.useEffect(() => {
|
|
7195
|
+
var handleGlobalClick = e => {
|
|
7196
|
+
var target = e.target;
|
|
7197
|
+
// Only close if clicking outside of this specific select component
|
|
7198
|
+
if (!target.closest("#" + id) && !hide) {
|
|
7199
|
+
setHide(true);
|
|
7200
|
+
}
|
|
7201
|
+
};
|
|
7202
|
+
document.addEventListener('click', handleGlobalClick);
|
|
7203
|
+
return () => {
|
|
7204
|
+
document.removeEventListener('click', handleGlobalClick);
|
|
7205
|
+
};
|
|
7206
|
+
}, [id, hide, setHide]);
|
|
7230
7207
|
var showLabel = !!(isFocused && label);
|
|
7231
7208
|
var handleHover = () => setIsHovered(!isHovered);
|
|
7232
7209
|
var handleFocus = () => setIsFocused(true);
|
|
7233
7210
|
var handleClick = event => {
|
|
7211
|
+
// tell all other selects to close
|
|
7212
|
+
document.dispatchEvent(new Event('closeAllSelects'));
|
|
7234
7213
|
if (event && event.stopPropagation) event.stopPropagation();
|
|
7235
|
-
|
|
7236
|
-
|
|
7214
|
+
// Toggle dropdown visibility
|
|
7215
|
+
var newHideState = !hide;
|
|
7216
|
+
setHide(newHideState);
|
|
7217
|
+
setIsFocused(!newHideState); // Set focus state based on dropdown visibility
|
|
7237
7218
|
};
|
|
7238
7219
|
var handleCallback = React.useCallback(option => {
|
|
7239
|
-
|
|
7220
|
+
// Close dropdown after selection
|
|
7221
|
+
setHide(true);
|
|
7222
|
+
// Tell all other selects to close
|
|
7223
|
+
document.dispatchEvent(new Event('closeAllSelects'));
|
|
7224
|
+
// Update value based on multi-select or single-select mode
|
|
7240
7225
|
if (isMulti && Array.isArray(value)) {
|
|
7241
|
-
!value.includes(option)
|
|
7226
|
+
if (!value.includes(option)) {
|
|
7227
|
+
var newValue = [...value, option];
|
|
7228
|
+
setValue(newValue);
|
|
7229
|
+
if (onChange) onChange(option);
|
|
7230
|
+
}
|
|
7242
7231
|
} else {
|
|
7243
7232
|
setValue(option);
|
|
7233
|
+
if (onChange) onChange(option);
|
|
7244
7234
|
}
|
|
7245
|
-
|
|
7246
|
-
|
|
7235
|
+
// Set focus to indicate selection
|
|
7236
|
+
setIsFocused(true);
|
|
7237
|
+
}, [isMulti, value, setHide, setValue, onChange, setIsFocused]);
|
|
7247
7238
|
var handleRemoveOption = valueOption => {
|
|
7248
7239
|
if (Array.isArray(value) && value.includes(valueOption)) {
|
|
7249
7240
|
var newValue = value.filter(option => option !== valueOption);
|
|
@@ -7251,11 +7242,24 @@ var SelectView = _ref7 => {
|
|
|
7251
7242
|
}
|
|
7252
7243
|
};
|
|
7253
7244
|
return /*#__PURE__*/React__default.createElement(FieldContainer, {
|
|
7245
|
+
style: {
|
|
7246
|
+
position: 'relative',
|
|
7247
|
+
width: '100%',
|
|
7248
|
+
display: 'inline-block'
|
|
7249
|
+
},
|
|
7250
|
+
id: id,
|
|
7254
7251
|
role: "SelectBox",
|
|
7255
7252
|
helperText: helperText,
|
|
7256
7253
|
error: error,
|
|
7257
7254
|
views: views,
|
|
7258
|
-
onClick:
|
|
7255
|
+
onClick: e => {
|
|
7256
|
+
// Stop propagation to prevent clicks from bubbling up
|
|
7257
|
+
e.stopPropagation();
|
|
7258
|
+
// Only handle click if not disabled or readonly
|
|
7259
|
+
if (!(isDisabled || isReadOnly)) {
|
|
7260
|
+
handleClick(e);
|
|
7261
|
+
}
|
|
7262
|
+
}
|
|
7259
7263
|
}, /*#__PURE__*/React__default.createElement(FieldContent, {
|
|
7260
7264
|
label: label,
|
|
7261
7265
|
size: size,
|
|
@@ -7305,39 +7309,78 @@ var SelectView = _ref7 => {
|
|
|
7305
7309
|
orientation: "up",
|
|
7306
7310
|
widthHeight: IconSizes$2[size],
|
|
7307
7311
|
style: views.icon
|
|
7308
|
-
})))))), !hide && (/*#__PURE__*/React__default.createElement(
|
|
7312
|
+
})))))), !hide && options.length > 0 && (/*#__PURE__*/React__default.createElement(appStudio.Element, {
|
|
7313
|
+
onClick: e => e.stopPropagation(),
|
|
7314
|
+
style: {
|
|
7315
|
+
position: 'absolute',
|
|
7316
|
+
top: 'calc(100% + 4px)',
|
|
7317
|
+
left: 0,
|
|
7318
|
+
right: 0,
|
|
7319
|
+
zIndex: 1000
|
|
7320
|
+
}
|
|
7321
|
+
}, /*#__PURE__*/React__default.createElement(DropDown, {
|
|
7309
7322
|
size: size,
|
|
7310
|
-
views: views,
|
|
7323
|
+
views: Object.assign({}, views, {
|
|
7324
|
+
dropDown: {
|
|
7325
|
+
borderRadius: '6px',
|
|
7326
|
+
border: '1px solid color.gray.200',
|
|
7327
|
+
boxShadow: '0 8px 16px rgba(0,0,0,0.1)',
|
|
7328
|
+
padding: '8px',
|
|
7329
|
+
maxHeight: '240px',
|
|
7330
|
+
overflowY: 'auto'
|
|
7331
|
+
}
|
|
7332
|
+
}),
|
|
7311
7333
|
options: options,
|
|
7312
7334
|
callback: handleCallback,
|
|
7313
7335
|
highlightedIndex: highlightedIndex,
|
|
7314
7336
|
setHighlightedIndex: setHighlightedIndex
|
|
7315
|
-
})));
|
|
7337
|
+
}))));
|
|
7316
7338
|
};
|
|
7317
7339
|
|
|
7318
7340
|
// Defines a functional component named 'SelectComponent', which is expected to receive 'SelectProps' as properties.
|
|
7319
7341
|
var SelectComponent = props => {
|
|
7342
|
+
// Ensure options is always an array
|
|
7343
|
+
var safeProps = Object.assign({}, props, {
|
|
7344
|
+
options: props.options || []
|
|
7345
|
+
});
|
|
7320
7346
|
// Invokes the 'useSelectState' hook with props to obtain stateful logic for the Select component.
|
|
7321
|
-
var selectStates = useSelectState(
|
|
7347
|
+
var selectStates = useSelectState(safeProps);
|
|
7322
7348
|
// Renders the 'SelectView' component, passing along any states controlled by 'useSelectState' and all properties passed to 'SelectComponent'.
|
|
7323
|
-
return /*#__PURE__*/React__default.createElement(SelectView, Object.assign({}, selectStates,
|
|
7349
|
+
return /*#__PURE__*/React__default.createElement(SelectView, Object.assign({}, selectStates, safeProps, {
|
|
7350
|
+
onClick: e => {
|
|
7351
|
+
// Stop propagation to prevent the global click handler from closing other dropdowns
|
|
7352
|
+
e.stopPropagation();
|
|
7353
|
+
if (props.onClick) props.onClick(e);
|
|
7354
|
+
}
|
|
7355
|
+
}));
|
|
7324
7356
|
};
|
|
7325
7357
|
// Exports 'SelectComponent' as 'Select', making it available for import in other parts of the application.
|
|
7326
7358
|
var Select = SelectComponent;
|
|
7327
7359
|
|
|
7328
|
-
// This file defines a custom hook for managing the state of a Switch component.
|
|
7360
|
+
// This file defines a custom hook for managing the state of a Switch component.
|
|
7361
|
+
// It allows tracking whether the switch is hovered, and its on/off state based on 'isDisabled' and 'isChecked' properties.
|
|
7329
7362
|
var useSwitchState = _ref => {
|
|
7330
7363
|
var {
|
|
7331
7364
|
isDisabled,
|
|
7332
7365
|
isChecked
|
|
7333
7366
|
} = _ref;
|
|
7334
7367
|
var [isHovered, setIsHovered] = React__default.useState(false);
|
|
7335
|
-
var [on, setOn] = React__default.useState(
|
|
7368
|
+
var [on, setOn] = React__default.useState(isChecked || false);
|
|
7369
|
+
var [value, setValue] = React__default.useState(isChecked || false);
|
|
7370
|
+
// Update the value when isChecked changes
|
|
7371
|
+
React.useEffect(() => {
|
|
7372
|
+
if (isChecked !== undefined) {
|
|
7373
|
+
setOn(isChecked);
|
|
7374
|
+
setValue(isChecked);
|
|
7375
|
+
}
|
|
7376
|
+
}, [isChecked]);
|
|
7336
7377
|
return {
|
|
7337
7378
|
isHovered,
|
|
7338
7379
|
setIsHovered,
|
|
7339
7380
|
on,
|
|
7340
|
-
setOn
|
|
7381
|
+
setOn,
|
|
7382
|
+
value,
|
|
7383
|
+
setValue
|
|
7341
7384
|
};
|
|
7342
7385
|
};
|
|
7343
7386
|
|
|
@@ -7353,68 +7396,68 @@ var useSwitchState = _ref => {
|
|
|
7353
7396
|
*/
|
|
7354
7397
|
/**
|
|
7355
7398
|
* Knob (circle) sizes for the Switch component
|
|
7356
|
-
* Following the 4px grid system
|
|
7399
|
+
* Following the 4px grid system - dimensions réduites
|
|
7357
7400
|
*/
|
|
7358
7401
|
var KnobSizes = {
|
|
7359
7402
|
xs: {
|
|
7403
|
+
height: '8px',
|
|
7404
|
+
width: '8px'
|
|
7405
|
+
},
|
|
7406
|
+
sm: {
|
|
7360
7407
|
height: '12px',
|
|
7361
7408
|
width: '12px'
|
|
7362
7409
|
},
|
|
7363
|
-
|
|
7410
|
+
md: {
|
|
7364
7411
|
height: '16px',
|
|
7365
7412
|
width: '16px'
|
|
7366
7413
|
},
|
|
7367
|
-
|
|
7414
|
+
lg: {
|
|
7368
7415
|
height: '20px',
|
|
7369
7416
|
width: '20px'
|
|
7370
7417
|
},
|
|
7371
|
-
|
|
7418
|
+
xl: {
|
|
7372
7419
|
height: '24px',
|
|
7373
7420
|
width: '24px'
|
|
7374
|
-
},
|
|
7375
|
-
xl: {
|
|
7376
|
-
height: '28px',
|
|
7377
|
-
width: '28px'
|
|
7378
7421
|
}
|
|
7379
7422
|
};
|
|
7380
7423
|
/**
|
|
7381
7424
|
* Slider (track) sizes for the Switch component
|
|
7382
|
-
* Following the 4px grid system
|
|
7425
|
+
* Following the 4px grid system - dimensions réduites
|
|
7383
7426
|
*/
|
|
7384
7427
|
var SliderSizes = {
|
|
7385
7428
|
xs: {
|
|
7386
|
-
height: '
|
|
7387
|
-
width: '
|
|
7429
|
+
height: '16px',
|
|
7430
|
+
width: '36px'
|
|
7388
7431
|
},
|
|
7389
7432
|
sm: {
|
|
7390
|
-
height: '
|
|
7391
|
-
width: '
|
|
7433
|
+
height: '20px',
|
|
7434
|
+
width: '44px'
|
|
7392
7435
|
},
|
|
7393
7436
|
md: {
|
|
7394
|
-
height: '
|
|
7395
|
-
width: '
|
|
7437
|
+
height: '24px',
|
|
7438
|
+
width: '52px'
|
|
7396
7439
|
},
|
|
7397
7440
|
lg: {
|
|
7398
|
-
height: '
|
|
7399
|
-
width: '
|
|
7441
|
+
height: '28px',
|
|
7442
|
+
width: '60px'
|
|
7400
7443
|
},
|
|
7401
7444
|
xl: {
|
|
7402
|
-
height: '
|
|
7403
|
-
width: '
|
|
7445
|
+
height: '32px',
|
|
7446
|
+
width: '68px'
|
|
7404
7447
|
}
|
|
7405
7448
|
};
|
|
7406
7449
|
/**
|
|
7407
|
-
* Padding for the Switch slider
|
|
7450
|
+
* Padding for the Switch slider - ajusté pour les nouvelles dimensions
|
|
7408
7451
|
* Following the 4px grid system
|
|
7409
7452
|
*/
|
|
7410
7453
|
var SliderPadding = {
|
|
7411
7454
|
xs: {
|
|
7412
7455
|
paddingVertical: 4,
|
|
7413
|
-
paddingHorizontal:
|
|
7456
|
+
paddingHorizontal: 2
|
|
7414
7457
|
},
|
|
7415
7458
|
sm: {
|
|
7416
7459
|
paddingVertical: 4,
|
|
7417
|
-
paddingHorizontal:
|
|
7460
|
+
paddingHorizontal: 2
|
|
7418
7461
|
},
|
|
7419
7462
|
md: {
|
|
7420
7463
|
paddingVertical: 4,
|
|
@@ -7472,7 +7515,6 @@ var SwitchView = _ref => {
|
|
|
7472
7515
|
isHovered = false,
|
|
7473
7516
|
isDisabled = false,
|
|
7474
7517
|
isReadOnly = false,
|
|
7475
|
-
on,
|
|
7476
7518
|
setOn,
|
|
7477
7519
|
onChange,
|
|
7478
7520
|
setValue = () => {},
|
|
@@ -7485,10 +7527,11 @@ var SwitchView = _ref => {
|
|
|
7485
7527
|
} = _ref,
|
|
7486
7528
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$q);
|
|
7487
7529
|
var handleToggle = event => {
|
|
7488
|
-
if (!isReadOnly) {
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7530
|
+
if (!isReadOnly && !isDisabled) {
|
|
7531
|
+
var newValue = event.target.checked;
|
|
7532
|
+
setValue(newValue);
|
|
7533
|
+
setOn(newValue);
|
|
7534
|
+
if (onChange) onChange(newValue);
|
|
7492
7535
|
}
|
|
7493
7536
|
};
|
|
7494
7537
|
var handleHover = () => setIsHovered(!isHovered);
|
|
@@ -7536,27 +7579,39 @@ var SwitchView = _ref => {
|
|
|
7536
7579
|
// Layout properties
|
|
7537
7580
|
display: "flex",
|
|
7538
7581
|
alignItems: "center",
|
|
7539
|
-
justifyContent: activeChild ? 'space-between' :
|
|
7582
|
+
justifyContent: value ? activeChild ? 'space-between' : 'flex-end' : inActiveChild ? 'space-between' : 'flex-start',
|
|
7540
7583
|
marginBottom: 4,
|
|
7541
7584
|
// Visual properties
|
|
7542
7585
|
borderRadius: "9999px" // Full rounded for pill shape
|
|
7543
7586
|
,
|
|
7544
7587
|
backgroundColor: isDisabled ? ColorSchemes.default.disabled : value ? isHovered ? ColorSchemes.states.hover.active : ColorSchemes.default.active : isHovered ? ColorSchemes.states.hover.inactive : ColorSchemes.default.inactive,
|
|
7588
|
+
overflow: "hidden",
|
|
7545
7589
|
// State properties
|
|
7546
7590
|
cursor: "pointer",
|
|
7547
7591
|
// Animation
|
|
7548
7592
|
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
7549
7593
|
}, shadow, SliderPadding[size], SliderSizes[size], views['slider']), activeChild && value && (/*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
7550
7594
|
marginLeft: 8,
|
|
7551
|
-
|
|
7595
|
+
marginRight: 4,
|
|
7596
|
+
transition: "all 0.3s ease",
|
|
7597
|
+
display: "flex",
|
|
7598
|
+
alignItems: "center",
|
|
7599
|
+
justifyContent: "center",
|
|
7600
|
+
height: "100%"
|
|
7552
7601
|
}, activeChild)), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
7553
7602
|
borderRadius: "50%",
|
|
7554
7603
|
backgroundColor: ColorSchemes.default.knob,
|
|
7555
7604
|
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
|
|
7556
|
-
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
7605
|
+
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
7606
|
+
zIndex: 1
|
|
7557
7607
|
}, KnobSizes[size], views['circle'])), inActiveChild && !value && (/*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
7558
7608
|
marginRight: 8,
|
|
7559
|
-
|
|
7609
|
+
marginLeft: 4,
|
|
7610
|
+
transition: "all 0.3s ease",
|
|
7611
|
+
display: "flex",
|
|
7612
|
+
alignItems: "center",
|
|
7613
|
+
justifyContent: "center",
|
|
7614
|
+
height: "100%"
|
|
7560
7615
|
}, inActiveChild))), labelPosition === 'right' && label && (/*#__PURE__*/React__default.createElement(Text, {
|
|
7561
7616
|
fontWeight: "500" // Medium weight for better readability
|
|
7562
7617
|
,
|
|
@@ -7842,7 +7897,7 @@ var TextFieldView = _ref => {
|
|
|
7842
7897
|
var fieldStyles = Object.assign({
|
|
7843
7898
|
// Layout properties
|
|
7844
7899
|
margin: 0,
|
|
7845
|
-
paddingVertical:
|
|
7900
|
+
paddingVertical: 4,
|
|
7846
7901
|
paddingHorizontal: 0,
|
|
7847
7902
|
width: '100%',
|
|
7848
7903
|
height: '100%',
|
|
@@ -7982,24 +8037,24 @@ var useCheckboxState = _ref => {
|
|
|
7982
8037
|
*/
|
|
7983
8038
|
var Sizes = {
|
|
7984
8039
|
xs: {
|
|
8040
|
+
height: '12px',
|
|
8041
|
+
width: '12px'
|
|
8042
|
+
},
|
|
8043
|
+
sm: {
|
|
7985
8044
|
height: '16px',
|
|
7986
8045
|
width: '16px'
|
|
7987
8046
|
},
|
|
7988
|
-
|
|
8047
|
+
md: {
|
|
7989
8048
|
height: '20px',
|
|
7990
8049
|
width: '20px'
|
|
7991
8050
|
},
|
|
7992
|
-
|
|
8051
|
+
lg: {
|
|
7993
8052
|
height: '24px',
|
|
7994
8053
|
width: '24px'
|
|
7995
8054
|
},
|
|
7996
|
-
|
|
8055
|
+
xl: {
|
|
7997
8056
|
height: '28px',
|
|
7998
8057
|
width: '28px'
|
|
7999
|
-
},
|
|
8000
|
-
xl: {
|
|
8001
|
-
height: '32px',
|
|
8002
|
-
width: '32px'
|
|
8003
8058
|
}
|
|
8004
8059
|
};
|
|
8005
8060
|
/**
|
|
@@ -10237,7 +10292,7 @@ var ComboBoxView = _ref => {
|
|
|
10237
10292
|
hint: placeholder,
|
|
10238
10293
|
isClearable: false,
|
|
10239
10294
|
left: /*#__PURE__*/React__default.createElement(SearchIcon, {
|
|
10240
|
-
widthHeight:
|
|
10295
|
+
widthHeight: 16
|
|
10241
10296
|
}),
|
|
10242
10297
|
views: {
|
|
10243
10298
|
container: Object.assign({
|
|
@@ -12798,17 +12853,17 @@ var useNavigationMenuState = function useNavigationMenuState(defaultActiveItemId
|
|
|
12798
12853
|
var NavigationMenuSizes = {
|
|
12799
12854
|
sm: {
|
|
12800
12855
|
padding: '8px 12px',
|
|
12801
|
-
fontSize: '
|
|
12856
|
+
fontSize: '12px',
|
|
12802
12857
|
fontWeight: '500'
|
|
12803
12858
|
},
|
|
12804
12859
|
md: {
|
|
12805
12860
|
padding: '12px 16px',
|
|
12806
|
-
fontSize: '
|
|
12861
|
+
fontSize: '14px',
|
|
12807
12862
|
fontWeight: '500'
|
|
12808
12863
|
},
|
|
12809
12864
|
lg: {
|
|
12810
12865
|
padding: '16px 20px',
|
|
12811
|
-
fontSize: '
|
|
12866
|
+
fontSize: '16px',
|
|
12812
12867
|
fontWeight: '500'
|
|
12813
12868
|
}
|
|
12814
12869
|
};
|
|
@@ -13756,8 +13811,8 @@ var HighlightStyles = {
|
|
|
13756
13811
|
}),
|
|
13757
13812
|
gradient: (color, secondaryColor) => ({
|
|
13758
13813
|
background: "linear-gradient(135deg, " + color + ", " + (secondaryColor || color) + ")",
|
|
13759
|
-
backgroundClip: 'text',
|
|
13760
|
-
webkitBackgroundClip: 'text',
|
|
13814
|
+
backgroundClip: 'text !important',
|
|
13815
|
+
webkitBackgroundClip: 'text !important',
|
|
13761
13816
|
color: 'transparent',
|
|
13762
13817
|
webkitTextFillColor: 'transparent',
|
|
13763
13818
|
display: 'inline-block',
|