@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
package/dist/web.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import 'core-js/modules/es.array.iterator.js';
|
|
|
5
5
|
import 'core-js/modules/es.string.includes.js';
|
|
6
6
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
7
7
|
import 'core-js/modules/es.regexp.to-string.js';
|
|
8
|
-
import { View, Horizontal, Vertical, Element, Text as Text$1, Center, useTheme, Image, Typography, Input, Form, useInView } from 'app-studio';
|
|
8
|
+
import { View, Horizontal, Vertical, Element, Text as Text$1, Center, useTheme, Image, useHover, Typography, Input, Form, useInView } from 'app-studio';
|
|
9
9
|
import 'core-js/modules/es.symbol.description.js';
|
|
10
10
|
import 'core-js/modules/es.parse-float.js';
|
|
11
11
|
import 'core-js/modules/es.string.trim-end.js';
|
|
@@ -463,20 +463,20 @@ var HeadingSizes = {
|
|
|
463
463
|
* Font sizes following typography guidelines
|
|
464
464
|
*/
|
|
465
465
|
var FontSizes = {
|
|
466
|
-
xs: '
|
|
467
|
-
sm: '
|
|
468
|
-
md: '
|
|
469
|
-
lg: '
|
|
466
|
+
xs: '10px',
|
|
467
|
+
sm: '12px',
|
|
468
|
+
md: '14px',
|
|
469
|
+
lg: '16px',
|
|
470
470
|
xl: '20px'
|
|
471
471
|
};
|
|
472
472
|
/**
|
|
473
473
|
* Line heights following typography guidelines
|
|
474
474
|
*/
|
|
475
475
|
var LineHeights = {
|
|
476
|
-
xs: '
|
|
477
|
-
sm: '
|
|
478
|
-
md: '
|
|
479
|
-
lg: '
|
|
476
|
+
xs: '14px',
|
|
477
|
+
sm: '16px',
|
|
478
|
+
md: '20px',
|
|
479
|
+
lg: '22px',
|
|
480
480
|
xl: '28px'
|
|
481
481
|
};
|
|
482
482
|
/**
|
|
@@ -3258,7 +3258,7 @@ var BadgeSizes = {
|
|
|
3258
3258
|
height: '32px',
|
|
3259
3259
|
padding: '0 12px',
|
|
3260
3260
|
// Typography
|
|
3261
|
-
fontSize: '
|
|
3261
|
+
fontSize: '16px',
|
|
3262
3262
|
fontWeight: '500',
|
|
3263
3263
|
lineHeight: '32px'
|
|
3264
3264
|
},
|
|
@@ -3268,7 +3268,7 @@ var BadgeSizes = {
|
|
|
3268
3268
|
height: '36px',
|
|
3269
3269
|
padding: '0 14px',
|
|
3270
3270
|
// Typography
|
|
3271
|
-
fontSize: '
|
|
3271
|
+
fontSize: '20px',
|
|
3272
3272
|
fontWeight: '500',
|
|
3273
3273
|
lineHeight: '36px'
|
|
3274
3274
|
}
|
|
@@ -3394,18 +3394,6 @@ var BadgeView = _ref => {
|
|
|
3394
3394
|
// Badge component that displays a small indicator, typically used for counts or status
|
|
3395
3395
|
var Badge = props => /*#__PURE__*/React.createElement(BadgeView, Object.assign({}, props));
|
|
3396
3396
|
|
|
3397
|
-
var useButtonState = () => {
|
|
3398
|
-
var [isHovered, setIsHovered] = React.useState(false);
|
|
3399
|
-
// This custom react hook 'useButtonState' is defined for managing the state of a button, especially for hover interactions.
|
|
3400
|
-
return {
|
|
3401
|
-
isHovered,
|
|
3402
|
-
setIsHovered
|
|
3403
|
-
};
|
|
3404
|
-
// The 'setIsHovered' function is used to update the value of 'isHovered' state when the hover status of the button changes.
|
|
3405
|
-
// A state variable 'isHovered' is declared with its initial value set to 'false', indicating that the button is not hovered by default.
|
|
3406
|
-
};
|
|
3407
|
-
// The hook returns an object containing 'isHovered' state and the 'setIsHovered' function to enable state management from the consumer component.
|
|
3408
|
-
|
|
3409
3397
|
// This function initializes the Link component's state using the useState hook and exposes its state and setter function.
|
|
3410
3398
|
var useLinkState = () => {
|
|
3411
3399
|
var [isHovered, setIsHovered] = useState(false);
|
|
@@ -3691,70 +3679,60 @@ var Loader = LoaderComponent;
|
|
|
3691
3679
|
*/
|
|
3692
3680
|
/**
|
|
3693
3681
|
* Button sizes following the 4px grid system
|
|
3694
|
-
*/
|
|
3695
|
-
var ButtonSizes = {
|
|
3682
|
+
*/var ButtonSizes = {
|
|
3696
3683
|
xs: {
|
|
3697
|
-
|
|
3684
|
+
minHeight: 3 * 4,
|
|
3685
|
+
paddingTop: 1,
|
|
3686
|
+
paddingBottom: 1,
|
|
3687
|
+
paddingLeft: 2,
|
|
3688
|
+
paddingRight: 2,
|
|
3689
|
+
fontSize: 10,
|
|
3690
|
+
fontWeight: '500',
|
|
3691
|
+
lineHeight: 14,
|
|
3692
|
+
letterSpacing: '-0.01em'
|
|
3693
|
+
},
|
|
3694
|
+
sm: {
|
|
3698
3695
|
minHeight: 4 * 4,
|
|
3699
|
-
paddingTop:
|
|
3700
|
-
paddingBottom:
|
|
3701
|
-
paddingLeft:
|
|
3702
|
-
paddingRight:
|
|
3703
|
-
// Typography
|
|
3696
|
+
paddingTop: 4,
|
|
3697
|
+
paddingBottom: 4,
|
|
3698
|
+
paddingLeft: 8,
|
|
3699
|
+
paddingRight: 8,
|
|
3704
3700
|
fontSize: 12,
|
|
3705
3701
|
fontWeight: '500',
|
|
3706
|
-
lineHeight:
|
|
3702
|
+
lineHeight: 16,
|
|
3707
3703
|
letterSpacing: '-0.01em'
|
|
3708
3704
|
},
|
|
3709
|
-
|
|
3710
|
-
// Height: 32px (8 × 4px)
|
|
3705
|
+
md: {
|
|
3711
3706
|
minHeight: 6 * 4,
|
|
3712
3707
|
paddingTop: 6,
|
|
3713
3708
|
paddingBottom: 6,
|
|
3714
3709
|
paddingLeft: 12,
|
|
3715
3710
|
paddingRight: 12,
|
|
3716
|
-
|
|
3717
|
-
fontSize: 12,
|
|
3711
|
+
fontSize: 14,
|
|
3718
3712
|
fontWeight: '500',
|
|
3719
|
-
lineHeight:
|
|
3713
|
+
lineHeight: 18,
|
|
3720
3714
|
letterSpacing: '-0.01em'
|
|
3721
3715
|
},
|
|
3722
|
-
|
|
3723
|
-
// Height: 40px (10 × 4px) - standard height for interactive elements
|
|
3716
|
+
lg: {
|
|
3724
3717
|
minHeight: 8 * 4,
|
|
3725
3718
|
paddingTop: 8,
|
|
3726
3719
|
paddingBottom: 8,
|
|
3727
3720
|
paddingLeft: 16,
|
|
3728
3721
|
paddingRight: 16,
|
|
3729
|
-
// Typography
|
|
3730
3722
|
fontSize: 16,
|
|
3731
3723
|
fontWeight: '500',
|
|
3732
|
-
lineHeight:
|
|
3724
|
+
lineHeight: 18,
|
|
3733
3725
|
letterSpacing: '-0.01em'
|
|
3734
3726
|
},
|
|
3735
|
-
|
|
3727
|
+
xl: {
|
|
3736
3728
|
minHeight: 10 * 4,
|
|
3737
3729
|
paddingTop: 10,
|
|
3738
3730
|
paddingBottom: 10,
|
|
3739
3731
|
paddingLeft: 20,
|
|
3740
3732
|
paddingRight: 20,
|
|
3741
|
-
|
|
3742
|
-
fontSize: 16,
|
|
3743
|
-
fontWeight: '500',
|
|
3744
|
-
lineHeight: 20,
|
|
3745
|
-
letterSpacing: '-0.01em'
|
|
3746
|
-
},
|
|
3747
|
-
xl: {
|
|
3748
|
-
// Height: 60px (15 × 4px)
|
|
3749
|
-
minHeight: 12 * 4,
|
|
3750
|
-
paddingTop: 12,
|
|
3751
|
-
paddingBottom: 12,
|
|
3752
|
-
paddingLeft: 24,
|
|
3753
|
-
paddingRight: 24,
|
|
3754
|
-
// Typography
|
|
3755
|
-
fontSize: 18,
|
|
3733
|
+
fontSize: 20,
|
|
3756
3734
|
fontWeight: '500',
|
|
3757
|
-
lineHeight:
|
|
3735
|
+
lineHeight: 22,
|
|
3758
3736
|
letterSpacing: '-0.01em'
|
|
3759
3737
|
}
|
|
3760
3738
|
};
|
|
@@ -3990,25 +3968,14 @@ var ButtonView = _ref => {
|
|
|
3990
3968
|
|
|
3991
3969
|
// Importing a custom hook to manage the state specific to the button component.
|
|
3992
3970
|
var ButtonComponent = props => {
|
|
3993
|
-
|
|
3994
|
-
var {
|
|
3995
|
-
isHovered,
|
|
3996
|
-
setIsHovered
|
|
3997
|
-
} = useButtonState();
|
|
3998
|
-
// Defining the button component with generic React Functional Component type augmented with ButtonProps type.
|
|
3999
|
-
var handleHover = () => setIsHovered(!isHovered);
|
|
3971
|
+
var [ref, hover] = useHover();
|
|
4000
3972
|
// Destructuring the state and state update function from the custom hook for button state management.
|
|
4001
3973
|
return (
|
|
4002
3974
|
/*#__PURE__*/
|
|
4003
3975
|
// Defines a function to toggle the hover state of the button.
|
|
4004
3976
|
React.createElement(ButtonView, Object.assign({
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
setIsHovered: setIsHovered,
|
|
4008
|
-
// Passing the isHovered state and the setIsHovered function to the ButtonView.
|
|
4009
|
-
onMouseEnter: handleHover,
|
|
4010
|
-
// Binding handleHover function to onMouseEnter and onMouseLeave events to toggle hover effect.
|
|
4011
|
-
onMouseLeave: handleHover
|
|
3977
|
+
ref: ref,
|
|
3978
|
+
isHovered: hover
|
|
4012
3979
|
}, props))
|
|
4013
3980
|
);
|
|
4014
3981
|
// Exports the Button component for use in other parts of the application.
|
|
@@ -6516,13 +6483,12 @@ var useSelectState = _ref => {
|
|
|
6516
6483
|
var {
|
|
6517
6484
|
placeholder,
|
|
6518
6485
|
isMulti,
|
|
6519
|
-
options
|
|
6486
|
+
options,
|
|
6487
|
+
id = "select-" + Math.random().toString(36).substr(2, 9)
|
|
6520
6488
|
} = _ref;
|
|
6521
6489
|
// 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
|
|
6522
6490
|
var defaultValue = placeholder ? isMulti ? [] : '' // If there's a placeholder, set default to empty array for multi-select or empty string for single select
|
|
6523
|
-
: Array.isArray(options) && options.length > 0 ? options[0].value : ''; // If no placeholder, use the first option value if available, otherwise
|
|
6524
|
-
// State hook for managing visibility of the Select dropdown, initially set to hidden
|
|
6525
|
-
var [hide, setHide] = React.useState(true);
|
|
6491
|
+
: 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
|
|
6526
6492
|
// State hook for tracking mouse hover status over the Select component
|
|
6527
6493
|
var [isHovered, setIsHovered] = React.useState(false);
|
|
6528
6494
|
// State hook for tracking focus status of the Select input field
|
|
@@ -6531,8 +6497,11 @@ var useSelectState = _ref => {
|
|
|
6531
6497
|
var [value, setValue] = React.useState(defaultValue);
|
|
6532
6498
|
// State hook for keeping track of the currently highlighted index in the options list
|
|
6533
6499
|
var [highlightedIndex, setHighlightedIndex] = React.useState(0);
|
|
6500
|
+
// State hook for managing visibility of the Select dropdown, initially set to hidden
|
|
6501
|
+
var [hide, setHide] = React.useState(true);
|
|
6534
6502
|
// Returns an object containing all stateful values and their associated setters to manage the Select component's state
|
|
6535
6503
|
return {
|
|
6504
|
+
id,
|
|
6536
6505
|
value,
|
|
6537
6506
|
setValue,
|
|
6538
6507
|
hide,
|
|
@@ -6747,7 +6716,7 @@ var FieldContent = _ref => {
|
|
|
6747
6716
|
flexWrap: "nowrap",
|
|
6748
6717
|
alignItems: "center",
|
|
6749
6718
|
justifyContent: "space-between",
|
|
6750
|
-
marginBottom:
|
|
6719
|
+
marginBottom: 2,
|
|
6751
6720
|
// Visual properties
|
|
6752
6721
|
borderStyle: "solid",
|
|
6753
6722
|
borderColor: color,
|
|
@@ -6769,10 +6738,9 @@ var FieldIcons = _ref => {
|
|
|
6769
6738
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
|
6770
6739
|
return /*#__PURE__*/React.createElement(Center, Object.assign({
|
|
6771
6740
|
gap: 10,
|
|
6772
|
-
right:
|
|
6741
|
+
right: 10,
|
|
6773
6742
|
zIndex: 500,
|
|
6774
|
-
flexWrap: "nowrap"
|
|
6775
|
-
position: "absolute"
|
|
6743
|
+
flexWrap: "nowrap"
|
|
6776
6744
|
}, props), children);
|
|
6777
6745
|
};
|
|
6778
6746
|
|
|
@@ -6956,20 +6924,27 @@ var Item = _ref => {
|
|
|
6956
6924
|
} = _ref,
|
|
6957
6925
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
|
|
6958
6926
|
// Handles the click event on an option by invoking the callback with the selected option's value
|
|
6959
|
-
var handleOptionClick = option =>
|
|
6927
|
+
var handleOptionClick = (e, option) => {
|
|
6928
|
+
e.stopPropagation();
|
|
6929
|
+
e.preventDefault();
|
|
6930
|
+
if (typeof callback === 'function') {
|
|
6931
|
+
callback(option);
|
|
6932
|
+
}
|
|
6933
|
+
};
|
|
6960
6934
|
// Toggles the hover state on the item
|
|
6961
6935
|
var handleHover = () => setIsHovered(!isHovered);
|
|
6962
6936
|
return /*#__PURE__*/React.createElement(Element, Object.assign({
|
|
6963
6937
|
as: "li",
|
|
6964
6938
|
// Layout properties
|
|
6965
6939
|
margin: 0,
|
|
6966
|
-
paddingVertical:
|
|
6967
|
-
paddingHorizontal:
|
|
6940
|
+
paddingVertical: 8,
|
|
6941
|
+
paddingHorizontal: 8,
|
|
6968
6942
|
listStyleType: "none",
|
|
6943
|
+
cursor: "pointer",
|
|
6969
6944
|
// Event handlers
|
|
6970
6945
|
onMouseEnter: handleHover,
|
|
6971
6946
|
onMouseLeave: handleHover,
|
|
6972
|
-
onClick:
|
|
6947
|
+
onClick: e => handleOptionClick(e, option.value),
|
|
6973
6948
|
// Visual properties
|
|
6974
6949
|
backgroundColor: isHovered ? 'color.gray.100' : 'transparent',
|
|
6975
6950
|
borderRadius: "4px" // Subtle rounded corners for items
|
|
@@ -7015,7 +6990,7 @@ var SelectBox = _ref2 => {
|
|
|
7015
6990
|
width: '95%',
|
|
7016
6991
|
height: '100%',
|
|
7017
6992
|
border: 'none',
|
|
7018
|
-
paddingVertical:
|
|
6993
|
+
paddingVertical: 4,
|
|
7019
6994
|
paddingHorizontal: 0,
|
|
7020
6995
|
// Typography properties
|
|
7021
6996
|
fontSize: Typography.fontSizes[size],
|
|
@@ -7095,34 +7070,16 @@ var DropDown = _ref5 => {
|
|
|
7095
7070
|
} = _ref5;
|
|
7096
7071
|
var itemStates = useItemState();
|
|
7097
7072
|
var handleCallback = option => callback(option);
|
|
7098
|
-
// Shadow styles for the dropdown
|
|
7099
|
-
var shadow = {
|
|
7100
|
-
boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)'
|
|
7101
|
-
};
|
|
7073
|
+
// Shadow styles for the dropdown - now applied directly in the Element
|
|
7102
7074
|
return /*#__PURE__*/React.createElement(Element, Object.assign({
|
|
7103
7075
|
as: "ul",
|
|
7104
7076
|
role: "dropdown",
|
|
7105
|
-
top: "100%",
|
|
7106
7077
|
width: "100%",
|
|
7107
7078
|
display: "flex",
|
|
7108
7079
|
flexDirection: "column",
|
|
7109
|
-
position: "absolute",
|
|
7110
|
-
marginTop: 8,
|
|
7111
|
-
marginLeft: 0,
|
|
7112
|
-
marginRight: 0,
|
|
7113
|
-
marginBottom: 0,
|
|
7114
|
-
padding: 0,
|
|
7115
|
-
maxHeight: "240px" // 60 × 4px grid
|
|
7116
|
-
,
|
|
7117
|
-
overflowY: "auto",
|
|
7118
|
-
zIndex: 1000,
|
|
7119
7080
|
backgroundColor: "color.white",
|
|
7120
|
-
borderRadius: "8px" // Consistent with design system (rounded-md)
|
|
7121
|
-
,
|
|
7122
|
-
borderWidth: "1px",
|
|
7123
|
-
borderStyle: "solid",
|
|
7124
|
-
borderColor: "color.gray.200",
|
|
7125
7081
|
transition: "all 0.2s ease",
|
|
7082
|
+
margin: 0,
|
|
7126
7083
|
style: {
|
|
7127
7084
|
scrollbarWidth: 'thin',
|
|
7128
7085
|
scrollbarColor: 'rgba(0, 0, 0, 0.2) transparent',
|
|
@@ -7137,7 +7094,7 @@ var DropDown = _ref5 => {
|
|
|
7137
7094
|
borderRadius: '4px'
|
|
7138
7095
|
}
|
|
7139
7096
|
}
|
|
7140
|
-
},
|
|
7097
|
+
}, views == null ? void 0 : views.dropDown), options && options.length > 0 && options.map((option, index) => (/*#__PURE__*/React.createElement(Item, Object.assign({
|
|
7141
7098
|
key: option.value,
|
|
7142
7099
|
size: size,
|
|
7143
7100
|
style: views['text'],
|
|
@@ -7220,23 +7177,57 @@ var SelectView = _ref7 => {
|
|
|
7220
7177
|
highlightedIndex
|
|
7221
7178
|
} = _ref7,
|
|
7222
7179
|
props = _objectWithoutPropertiesLoose(_ref7, _excluded4$6);
|
|
7180
|
+
// close when *any* other select opens
|
|
7181
|
+
React.useEffect(() => {
|
|
7182
|
+
var handleCloseAll = () => setHide(true);
|
|
7183
|
+
document.addEventListener('closeAllSelects', handleCloseAll);
|
|
7184
|
+
return () => document.removeEventListener('closeAllSelects', handleCloseAll);
|
|
7185
|
+
}, [setHide]);
|
|
7186
|
+
// Add a global click handler to close the dropdown when clicking outside
|
|
7187
|
+
React.useEffect(() => {
|
|
7188
|
+
var handleGlobalClick = e => {
|
|
7189
|
+
var target = e.target;
|
|
7190
|
+
// Only close if clicking outside of this specific select component
|
|
7191
|
+
if (!target.closest("#" + id) && !hide) {
|
|
7192
|
+
setHide(true);
|
|
7193
|
+
}
|
|
7194
|
+
};
|
|
7195
|
+
document.addEventListener('click', handleGlobalClick);
|
|
7196
|
+
return () => {
|
|
7197
|
+
document.removeEventListener('click', handleGlobalClick);
|
|
7198
|
+
};
|
|
7199
|
+
}, [id, hide, setHide]);
|
|
7223
7200
|
var showLabel = !!(isFocused && label);
|
|
7224
7201
|
var handleHover = () => setIsHovered(!isHovered);
|
|
7225
7202
|
var handleFocus = () => setIsFocused(true);
|
|
7226
7203
|
var handleClick = event => {
|
|
7204
|
+
// tell all other selects to close
|
|
7205
|
+
document.dispatchEvent(new Event('closeAllSelects'));
|
|
7227
7206
|
if (event && event.stopPropagation) event.stopPropagation();
|
|
7228
|
-
|
|
7229
|
-
|
|
7207
|
+
// Toggle dropdown visibility
|
|
7208
|
+
var newHideState = !hide;
|
|
7209
|
+
setHide(newHideState);
|
|
7210
|
+
setIsFocused(!newHideState); // Set focus state based on dropdown visibility
|
|
7230
7211
|
};
|
|
7231
7212
|
var handleCallback = useCallback(option => {
|
|
7232
|
-
|
|
7213
|
+
// Close dropdown after selection
|
|
7214
|
+
setHide(true);
|
|
7215
|
+
// Tell all other selects to close
|
|
7216
|
+
document.dispatchEvent(new Event('closeAllSelects'));
|
|
7217
|
+
// Update value based on multi-select or single-select mode
|
|
7233
7218
|
if (isMulti && Array.isArray(value)) {
|
|
7234
|
-
!value.includes(option)
|
|
7219
|
+
if (!value.includes(option)) {
|
|
7220
|
+
var newValue = [...value, option];
|
|
7221
|
+
setValue(newValue);
|
|
7222
|
+
if (onChange) onChange(option);
|
|
7223
|
+
}
|
|
7235
7224
|
} else {
|
|
7236
7225
|
setValue(option);
|
|
7226
|
+
if (onChange) onChange(option);
|
|
7237
7227
|
}
|
|
7238
|
-
|
|
7239
|
-
|
|
7228
|
+
// Set focus to indicate selection
|
|
7229
|
+
setIsFocused(true);
|
|
7230
|
+
}, [isMulti, value, setHide, setValue, onChange, setIsFocused]);
|
|
7240
7231
|
var handleRemoveOption = valueOption => {
|
|
7241
7232
|
if (Array.isArray(value) && value.includes(valueOption)) {
|
|
7242
7233
|
var newValue = value.filter(option => option !== valueOption);
|
|
@@ -7244,11 +7235,24 @@ var SelectView = _ref7 => {
|
|
|
7244
7235
|
}
|
|
7245
7236
|
};
|
|
7246
7237
|
return /*#__PURE__*/React.createElement(FieldContainer, {
|
|
7238
|
+
style: {
|
|
7239
|
+
position: 'relative',
|
|
7240
|
+
width: '100%',
|
|
7241
|
+
display: 'inline-block'
|
|
7242
|
+
},
|
|
7243
|
+
id: id,
|
|
7247
7244
|
role: "SelectBox",
|
|
7248
7245
|
helperText: helperText,
|
|
7249
7246
|
error: error,
|
|
7250
7247
|
views: views,
|
|
7251
|
-
onClick:
|
|
7248
|
+
onClick: e => {
|
|
7249
|
+
// Stop propagation to prevent clicks from bubbling up
|
|
7250
|
+
e.stopPropagation();
|
|
7251
|
+
// Only handle click if not disabled or readonly
|
|
7252
|
+
if (!(isDisabled || isReadOnly)) {
|
|
7253
|
+
handleClick(e);
|
|
7254
|
+
}
|
|
7255
|
+
}
|
|
7252
7256
|
}, /*#__PURE__*/React.createElement(FieldContent, {
|
|
7253
7257
|
label: label,
|
|
7254
7258
|
size: size,
|
|
@@ -7298,39 +7302,78 @@ var SelectView = _ref7 => {
|
|
|
7298
7302
|
orientation: "up",
|
|
7299
7303
|
widthHeight: IconSizes$2[size],
|
|
7300
7304
|
style: views.icon
|
|
7301
|
-
})))))), !hide && (/*#__PURE__*/React.createElement(
|
|
7305
|
+
})))))), !hide && options.length > 0 && (/*#__PURE__*/React.createElement(Element, {
|
|
7306
|
+
onClick: e => e.stopPropagation(),
|
|
7307
|
+
style: {
|
|
7308
|
+
position: 'absolute',
|
|
7309
|
+
top: 'calc(100% + 4px)',
|
|
7310
|
+
left: 0,
|
|
7311
|
+
right: 0,
|
|
7312
|
+
zIndex: 1000
|
|
7313
|
+
}
|
|
7314
|
+
}, /*#__PURE__*/React.createElement(DropDown, {
|
|
7302
7315
|
size: size,
|
|
7303
|
-
views: views,
|
|
7316
|
+
views: Object.assign({}, views, {
|
|
7317
|
+
dropDown: {
|
|
7318
|
+
borderRadius: '6px',
|
|
7319
|
+
border: '1px solid color.gray.200',
|
|
7320
|
+
boxShadow: '0 8px 16px rgba(0,0,0,0.1)',
|
|
7321
|
+
padding: '8px',
|
|
7322
|
+
maxHeight: '240px',
|
|
7323
|
+
overflowY: 'auto'
|
|
7324
|
+
}
|
|
7325
|
+
}),
|
|
7304
7326
|
options: options,
|
|
7305
7327
|
callback: handleCallback,
|
|
7306
7328
|
highlightedIndex: highlightedIndex,
|
|
7307
7329
|
setHighlightedIndex: setHighlightedIndex
|
|
7308
|
-
})));
|
|
7330
|
+
}))));
|
|
7309
7331
|
};
|
|
7310
7332
|
|
|
7311
7333
|
// Defines a functional component named 'SelectComponent', which is expected to receive 'SelectProps' as properties.
|
|
7312
7334
|
var SelectComponent = props => {
|
|
7335
|
+
// Ensure options is always an array
|
|
7336
|
+
var safeProps = Object.assign({}, props, {
|
|
7337
|
+
options: props.options || []
|
|
7338
|
+
});
|
|
7313
7339
|
// Invokes the 'useSelectState' hook with props to obtain stateful logic for the Select component.
|
|
7314
|
-
var selectStates = useSelectState(
|
|
7340
|
+
var selectStates = useSelectState(safeProps);
|
|
7315
7341
|
// Renders the 'SelectView' component, passing along any states controlled by 'useSelectState' and all properties passed to 'SelectComponent'.
|
|
7316
|
-
return /*#__PURE__*/React.createElement(SelectView, Object.assign({}, selectStates,
|
|
7342
|
+
return /*#__PURE__*/React.createElement(SelectView, Object.assign({}, selectStates, safeProps, {
|
|
7343
|
+
onClick: e => {
|
|
7344
|
+
// Stop propagation to prevent the global click handler from closing other dropdowns
|
|
7345
|
+
e.stopPropagation();
|
|
7346
|
+
if (props.onClick) props.onClick(e);
|
|
7347
|
+
}
|
|
7348
|
+
}));
|
|
7317
7349
|
};
|
|
7318
7350
|
// Exports 'SelectComponent' as 'Select', making it available for import in other parts of the application.
|
|
7319
7351
|
var Select = SelectComponent;
|
|
7320
7352
|
|
|
7321
|
-
// This file defines a custom hook for managing the state of a Switch component.
|
|
7353
|
+
// This file defines a custom hook for managing the state of a Switch component.
|
|
7354
|
+
// It allows tracking whether the switch is hovered, and its on/off state based on 'isDisabled' and 'isChecked' properties.
|
|
7322
7355
|
var useSwitchState = _ref => {
|
|
7323
7356
|
var {
|
|
7324
7357
|
isDisabled,
|
|
7325
7358
|
isChecked
|
|
7326
7359
|
} = _ref;
|
|
7327
7360
|
var [isHovered, setIsHovered] = React.useState(false);
|
|
7328
|
-
var [on, setOn] = React.useState(
|
|
7361
|
+
var [on, setOn] = React.useState(isChecked || false);
|
|
7362
|
+
var [value, setValue] = React.useState(isChecked || false);
|
|
7363
|
+
// Update the value when isChecked changes
|
|
7364
|
+
useEffect(() => {
|
|
7365
|
+
if (isChecked !== undefined) {
|
|
7366
|
+
setOn(isChecked);
|
|
7367
|
+
setValue(isChecked);
|
|
7368
|
+
}
|
|
7369
|
+
}, [isChecked]);
|
|
7329
7370
|
return {
|
|
7330
7371
|
isHovered,
|
|
7331
7372
|
setIsHovered,
|
|
7332
7373
|
on,
|
|
7333
|
-
setOn
|
|
7374
|
+
setOn,
|
|
7375
|
+
value,
|
|
7376
|
+
setValue
|
|
7334
7377
|
};
|
|
7335
7378
|
};
|
|
7336
7379
|
|
|
@@ -7346,68 +7389,68 @@ var useSwitchState = _ref => {
|
|
|
7346
7389
|
*/
|
|
7347
7390
|
/**
|
|
7348
7391
|
* Knob (circle) sizes for the Switch component
|
|
7349
|
-
* Following the 4px grid system
|
|
7392
|
+
* Following the 4px grid system - dimensions réduites
|
|
7350
7393
|
*/
|
|
7351
7394
|
var KnobSizes = {
|
|
7352
7395
|
xs: {
|
|
7396
|
+
height: '8px',
|
|
7397
|
+
width: '8px'
|
|
7398
|
+
},
|
|
7399
|
+
sm: {
|
|
7353
7400
|
height: '12px',
|
|
7354
7401
|
width: '12px'
|
|
7355
7402
|
},
|
|
7356
|
-
|
|
7403
|
+
md: {
|
|
7357
7404
|
height: '16px',
|
|
7358
7405
|
width: '16px'
|
|
7359
7406
|
},
|
|
7360
|
-
|
|
7407
|
+
lg: {
|
|
7361
7408
|
height: '20px',
|
|
7362
7409
|
width: '20px'
|
|
7363
7410
|
},
|
|
7364
|
-
|
|
7411
|
+
xl: {
|
|
7365
7412
|
height: '24px',
|
|
7366
7413
|
width: '24px'
|
|
7367
|
-
},
|
|
7368
|
-
xl: {
|
|
7369
|
-
height: '28px',
|
|
7370
|
-
width: '28px'
|
|
7371
7414
|
}
|
|
7372
7415
|
};
|
|
7373
7416
|
/**
|
|
7374
7417
|
* Slider (track) sizes for the Switch component
|
|
7375
|
-
* Following the 4px grid system
|
|
7418
|
+
* Following the 4px grid system - dimensions réduites
|
|
7376
7419
|
*/
|
|
7377
7420
|
var SliderSizes = {
|
|
7378
7421
|
xs: {
|
|
7379
|
-
height: '
|
|
7380
|
-
width: '
|
|
7422
|
+
height: '16px',
|
|
7423
|
+
width: '36px'
|
|
7381
7424
|
},
|
|
7382
7425
|
sm: {
|
|
7383
|
-
height: '
|
|
7384
|
-
width: '
|
|
7426
|
+
height: '20px',
|
|
7427
|
+
width: '44px'
|
|
7385
7428
|
},
|
|
7386
7429
|
md: {
|
|
7387
|
-
height: '
|
|
7388
|
-
width: '
|
|
7430
|
+
height: '24px',
|
|
7431
|
+
width: '52px'
|
|
7389
7432
|
},
|
|
7390
7433
|
lg: {
|
|
7391
|
-
height: '
|
|
7392
|
-
width: '
|
|
7434
|
+
height: '28px',
|
|
7435
|
+
width: '60px'
|
|
7393
7436
|
},
|
|
7394
7437
|
xl: {
|
|
7395
|
-
height: '
|
|
7396
|
-
width: '
|
|
7438
|
+
height: '32px',
|
|
7439
|
+
width: '68px'
|
|
7397
7440
|
}
|
|
7398
7441
|
};
|
|
7399
7442
|
/**
|
|
7400
|
-
* Padding for the Switch slider
|
|
7443
|
+
* Padding for the Switch slider - ajusté pour les nouvelles dimensions
|
|
7401
7444
|
* Following the 4px grid system
|
|
7402
7445
|
*/
|
|
7403
7446
|
var SliderPadding = {
|
|
7404
7447
|
xs: {
|
|
7405
7448
|
paddingVertical: 4,
|
|
7406
|
-
paddingHorizontal:
|
|
7449
|
+
paddingHorizontal: 2
|
|
7407
7450
|
},
|
|
7408
7451
|
sm: {
|
|
7409
7452
|
paddingVertical: 4,
|
|
7410
|
-
paddingHorizontal:
|
|
7453
|
+
paddingHorizontal: 2
|
|
7411
7454
|
},
|
|
7412
7455
|
md: {
|
|
7413
7456
|
paddingVertical: 4,
|
|
@@ -7465,7 +7508,6 @@ var SwitchView = _ref => {
|
|
|
7465
7508
|
isHovered = false,
|
|
7466
7509
|
isDisabled = false,
|
|
7467
7510
|
isReadOnly = false,
|
|
7468
|
-
on,
|
|
7469
7511
|
setOn,
|
|
7470
7512
|
onChange,
|
|
7471
7513
|
setValue = () => {},
|
|
@@ -7478,10 +7520,11 @@ var SwitchView = _ref => {
|
|
|
7478
7520
|
} = _ref,
|
|
7479
7521
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$q);
|
|
7480
7522
|
var handleToggle = event => {
|
|
7481
|
-
if (!isReadOnly) {
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7523
|
+
if (!isReadOnly && !isDisabled) {
|
|
7524
|
+
var newValue = event.target.checked;
|
|
7525
|
+
setValue(newValue);
|
|
7526
|
+
setOn(newValue);
|
|
7527
|
+
if (onChange) onChange(newValue);
|
|
7485
7528
|
}
|
|
7486
7529
|
};
|
|
7487
7530
|
var handleHover = () => setIsHovered(!isHovered);
|
|
@@ -7529,27 +7572,39 @@ var SwitchView = _ref => {
|
|
|
7529
7572
|
// Layout properties
|
|
7530
7573
|
display: "flex",
|
|
7531
7574
|
alignItems: "center",
|
|
7532
|
-
justifyContent: activeChild ? 'space-between' :
|
|
7575
|
+
justifyContent: value ? activeChild ? 'space-between' : 'flex-end' : inActiveChild ? 'space-between' : 'flex-start',
|
|
7533
7576
|
marginBottom: 4,
|
|
7534
7577
|
// Visual properties
|
|
7535
7578
|
borderRadius: "9999px" // Full rounded for pill shape
|
|
7536
7579
|
,
|
|
7537
7580
|
backgroundColor: isDisabled ? ColorSchemes.default.disabled : value ? isHovered ? ColorSchemes.states.hover.active : ColorSchemes.default.active : isHovered ? ColorSchemes.states.hover.inactive : ColorSchemes.default.inactive,
|
|
7581
|
+
overflow: "hidden",
|
|
7538
7582
|
// State properties
|
|
7539
7583
|
cursor: "pointer",
|
|
7540
7584
|
// Animation
|
|
7541
7585
|
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
7542
7586
|
}, shadow, SliderPadding[size], SliderSizes[size], views['slider']), activeChild && value && (/*#__PURE__*/React.createElement(View, {
|
|
7543
7587
|
marginLeft: 8,
|
|
7544
|
-
|
|
7588
|
+
marginRight: 4,
|
|
7589
|
+
transition: "all 0.3s ease",
|
|
7590
|
+
display: "flex",
|
|
7591
|
+
alignItems: "center",
|
|
7592
|
+
justifyContent: "center",
|
|
7593
|
+
height: "100%"
|
|
7545
7594
|
}, activeChild)), /*#__PURE__*/React.createElement(View, Object.assign({
|
|
7546
7595
|
borderRadius: "50%",
|
|
7547
7596
|
backgroundColor: ColorSchemes.default.knob,
|
|
7548
7597
|
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
|
|
7549
|
-
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
7598
|
+
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
7599
|
+
zIndex: 1
|
|
7550
7600
|
}, KnobSizes[size], views['circle'])), inActiveChild && !value && (/*#__PURE__*/React.createElement(View, {
|
|
7551
7601
|
marginRight: 8,
|
|
7552
|
-
|
|
7602
|
+
marginLeft: 4,
|
|
7603
|
+
transition: "all 0.3s ease",
|
|
7604
|
+
display: "flex",
|
|
7605
|
+
alignItems: "center",
|
|
7606
|
+
justifyContent: "center",
|
|
7607
|
+
height: "100%"
|
|
7553
7608
|
}, inActiveChild))), labelPosition === 'right' && label && (/*#__PURE__*/React.createElement(Text, {
|
|
7554
7609
|
fontWeight: "500" // Medium weight for better readability
|
|
7555
7610
|
,
|
|
@@ -7835,7 +7890,7 @@ var TextFieldView = _ref => {
|
|
|
7835
7890
|
var fieldStyles = Object.assign({
|
|
7836
7891
|
// Layout properties
|
|
7837
7892
|
margin: 0,
|
|
7838
|
-
paddingVertical:
|
|
7893
|
+
paddingVertical: 4,
|
|
7839
7894
|
paddingHorizontal: 0,
|
|
7840
7895
|
width: '100%',
|
|
7841
7896
|
height: '100%',
|
|
@@ -7975,24 +8030,24 @@ var useCheckboxState = _ref => {
|
|
|
7975
8030
|
*/
|
|
7976
8031
|
var Sizes = {
|
|
7977
8032
|
xs: {
|
|
8033
|
+
height: '12px',
|
|
8034
|
+
width: '12px'
|
|
8035
|
+
},
|
|
8036
|
+
sm: {
|
|
7978
8037
|
height: '16px',
|
|
7979
8038
|
width: '16px'
|
|
7980
8039
|
},
|
|
7981
|
-
|
|
8040
|
+
md: {
|
|
7982
8041
|
height: '20px',
|
|
7983
8042
|
width: '20px'
|
|
7984
8043
|
},
|
|
7985
|
-
|
|
8044
|
+
lg: {
|
|
7986
8045
|
height: '24px',
|
|
7987
8046
|
width: '24px'
|
|
7988
8047
|
},
|
|
7989
|
-
|
|
8048
|
+
xl: {
|
|
7990
8049
|
height: '28px',
|
|
7991
8050
|
width: '28px'
|
|
7992
|
-
},
|
|
7993
|
-
xl: {
|
|
7994
|
-
height: '32px',
|
|
7995
|
-
width: '32px'
|
|
7996
8051
|
}
|
|
7997
8052
|
};
|
|
7998
8053
|
/**
|
|
@@ -10230,7 +10285,7 @@ var ComboBoxView = _ref => {
|
|
|
10230
10285
|
hint: placeholder,
|
|
10231
10286
|
isClearable: false,
|
|
10232
10287
|
left: /*#__PURE__*/React.createElement(SearchIcon, {
|
|
10233
|
-
widthHeight:
|
|
10288
|
+
widthHeight: 16
|
|
10234
10289
|
}),
|
|
10235
10290
|
views: {
|
|
10236
10291
|
container: Object.assign({
|
|
@@ -12791,17 +12846,17 @@ var useNavigationMenuState = function useNavigationMenuState(defaultActiveItemId
|
|
|
12791
12846
|
var NavigationMenuSizes = {
|
|
12792
12847
|
sm: {
|
|
12793
12848
|
padding: '8px 12px',
|
|
12794
|
-
fontSize: '
|
|
12849
|
+
fontSize: '12px',
|
|
12795
12850
|
fontWeight: '500'
|
|
12796
12851
|
},
|
|
12797
12852
|
md: {
|
|
12798
12853
|
padding: '12px 16px',
|
|
12799
|
-
fontSize: '
|
|
12854
|
+
fontSize: '14px',
|
|
12800
12855
|
fontWeight: '500'
|
|
12801
12856
|
},
|
|
12802
12857
|
lg: {
|
|
12803
12858
|
padding: '16px 20px',
|
|
12804
|
-
fontSize: '
|
|
12859
|
+
fontSize: '16px',
|
|
12805
12860
|
fontWeight: '500'
|
|
12806
12861
|
}
|
|
12807
12862
|
};
|
|
@@ -13749,8 +13804,8 @@ var HighlightStyles = {
|
|
|
13749
13804
|
}),
|
|
13750
13805
|
gradient: (color, secondaryColor) => ({
|
|
13751
13806
|
background: "linear-gradient(135deg, " + color + ", " + (secondaryColor || color) + ")",
|
|
13752
|
-
backgroundClip: 'text',
|
|
13753
|
-
webkitBackgroundClip: 'text',
|
|
13807
|
+
backgroundClip: 'text !important',
|
|
13808
|
+
webkitBackgroundClip: 'text !important',
|
|
13754
13809
|
color: 'transparent',
|
|
13755
13810
|
webkitTextFillColor: 'transparent',
|
|
13756
13811
|
display: 'inline-block',
|