@app-studio/web 0.3.58 → 0.3.60

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.
@@ -50,6 +50,10 @@ export interface CheckboxProps {
50
50
  * Indicates that the checkbox is neither checked nor unchecked.
51
51
  */
52
52
  isIndeterminate?: boolean;
53
+ /**
54
+ * Label position
55
+ */
56
+ labelPosition?: 'left' | 'right';
53
57
  /**
54
58
  * Handler function called when the controlled checkbox value changes.
55
59
  */
@@ -15,10 +15,6 @@ export interface SwitchProps {
15
15
  * Specifies the unique identifier of the switch.
16
16
  */
17
17
  id?: string;
18
- /**
19
- * Indicates the initial value of the switch.
20
- */
21
- isChecked?: boolean;
22
18
  /**
23
19
  * If set to true, the switch is disabled and cannot be interacted with.
24
20
  */
@@ -31,10 +27,6 @@ export interface SwitchProps {
31
27
  * A callback function that is invoked when the switch's value changes.
32
28
  */
33
29
  onChange?: Function;
34
- /**
35
- * A callback function that is invoked when the switch's value changes on iOS and Android devices.
36
- */
37
- onValueChange?: (event: any) => void;
38
30
  /**
39
31
  * The name of the switch.
40
32
  */
@@ -55,6 +47,10 @@ export interface SwitchProps {
55
47
  * Specifies the size of the switch, affecting its height and width.
56
48
  */
57
49
  size?: Size;
50
+ /**
51
+ * Label position
52
+ */
53
+ labelPosition?: 'left' | 'right';
58
54
  /**
59
55
  * Additional properties and attributes.
60
56
  */
@@ -66,7 +62,7 @@ export interface SwitchViewProps extends SwitchProps {
66
62
  /** Callback prop to update the hover state of the switch */
67
63
  setIsHovered: Function;
68
64
  /** Prop indicating the current state of the switch */
69
- on?: boolean;
65
+ value?: boolean;
70
66
  /** Callback prop to update the state of the switch */
71
- setOn?: Function;
67
+ setValue?: Function;
72
68
  }
@@ -1023,7 +1023,7 @@ var IconSizes$2 = {
1023
1023
  '6xl': 60
1024
1024
  };
1025
1025
 
1026
- var _excluded$e = ["id", "icon", "name", "label", "isChecked", "onChange", "onValueChange", "shadow", "size", "colorScheme", "error", "isSelected", "isHovered", "isDisabled", "isReadOnly", "isIndeterminate", "defaultIsSelected", "setIsSelected", "setIsHovered", "styles"];
1026
+ var _excluded$e = ["id", "icon", "name", "label", "isChecked", "onChange", "onValueChange", "shadow", "labelPosition", "size", "colorScheme", "error", "isSelected", "isHovered", "isDisabled", "isReadOnly", "isIndeterminate", "defaultIsSelected", "setIsSelected", "setIsHovered", "styles"];
1027
1027
  var CheckboxView = function CheckboxView(_ref) {
1028
1028
  var id = _ref.id,
1029
1029
  icon = _ref.icon,
@@ -1033,6 +1033,8 @@ var CheckboxView = function CheckboxView(_ref) {
1033
1033
  onValueChange = _ref.onValueChange,
1034
1034
  _ref$shadow = _ref.shadow,
1035
1035
  shadow = _ref$shadow === void 0 ? {} : _ref$shadow,
1036
+ _ref$labelPosition = _ref.labelPosition,
1037
+ labelPosition = _ref$labelPosition === void 0 ? 'right' : _ref$labelPosition,
1036
1038
  _ref$size = _ref.size,
1037
1039
  size = _ref$size === void 0 ? 'md' : _ref$size,
1038
1040
  _ref$colorScheme = _ref.colorScheme,
@@ -1099,9 +1101,9 @@ var CheckboxView = function CheckboxView(_ref) {
1099
1101
  onMouseEnter: handleHover,
1100
1102
  onMouseLeave: handleHover,
1101
1103
  size: appStudio.Typography.fontSizes[size]
1102
- }, checkboxStyle.container, props), React__default.createElement(Center, Object.assign({}, checkboxStyle.checkbox), isIndeterminate ? React__default.createElement(IndeterminateSvg, null) : (isChecked || isSelected) && (icon != null ? icon : React__default.createElement(CheckSvg, {
1104
+ }, checkboxStyle.container, props), labelPosition === 'left' && label && React__default.createElement(appStudio.View, null, label), React__default.createElement(Center, Object.assign({}, checkboxStyle.checkbox), isIndeterminate ? React__default.createElement(IndeterminateSvg, null) : (isChecked || isSelected) && (icon != null ? icon : React__default.createElement(CheckSvg, {
1103
1105
  size: IconSizes$2[size]
1104
- }))), label);
1106
+ }))), labelPosition === 'right' && label && React__default.createElement(appStudio.View, null, label));
1105
1107
  };
1106
1108
 
1107
1109
  var CheckboxComponent = function CheckboxComponent(props) {
@@ -4118,7 +4120,7 @@ var SliderPadding = {
4118
4120
  }
4119
4121
  };
4120
4122
 
4121
- var _excluded$s = ["id", "name", "inActiveChild", "activeChild", "shadow", "size", "colorScheme", "on", "isHovered", "isChecked", "isDisabled", "isReadOnly", "onChange", "onValueChange", "setOn", "setIsHovered", "styles"];
4123
+ var _excluded$s = ["id", "name", "label", "inActiveChild", "activeChild", "labelPosition", "shadow", "size", "colorScheme", "value", "isHovered", "isDisabled", "isReadOnly", "onChange", "setValue", "setIsHovered", "styles"];
4122
4124
  var SwitchContent = function SwitchContent(props) {
4123
4125
  return React__default.createElement(appStudio.Input, Object.assign({
4124
4126
  type: "checkbox"
@@ -4127,16 +4129,19 @@ var SwitchContent = function SwitchContent(props) {
4127
4129
  var SwitchView = function SwitchView(_ref) {
4128
4130
  var id = _ref.id,
4129
4131
  name = _ref.name,
4132
+ label = _ref.label,
4130
4133
  inActiveChild = _ref.inActiveChild,
4131
4134
  activeChild = _ref.activeChild,
4135
+ _ref$labelPosition = _ref.labelPosition,
4136
+ labelPosition = _ref$labelPosition === void 0 ? 'right' : _ref$labelPosition,
4132
4137
  _ref$shadow = _ref.shadow,
4133
4138
  shadow = _ref$shadow === void 0 ? {} : _ref$shadow,
4134
4139
  _ref$size = _ref.size,
4135
4140
  size = _ref$size === void 0 ? 'sm' : _ref$size,
4136
4141
  _ref$colorScheme = _ref.colorScheme,
4137
4142
  colorScheme = _ref$colorScheme === void 0 ? 'theme.primary' : _ref$colorScheme,
4138
- _ref$on = _ref.on,
4139
- on = _ref$on === void 0 ? false : _ref$on,
4143
+ _ref$value = _ref.value,
4144
+ value = _ref$value === void 0 ? false : _ref$value,
4140
4145
  _ref$isHovered = _ref.isHovered,
4141
4146
  isHovered = _ref$isHovered === void 0 ? false : _ref$isHovered,
4142
4147
  _ref$isDisabled = _ref.isDisabled,
@@ -4144,56 +4149,63 @@ var SwitchView = function SwitchView(_ref) {
4144
4149
  _ref$isReadOnly = _ref.isReadOnly,
4145
4150
  isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
4146
4151
  onChange = _ref.onChange,
4147
- onValueChange = _ref.onValueChange,
4148
- _ref$setOn = _ref.setOn,
4149
- setOn = _ref$setOn === void 0 ? function () {} : _ref$setOn,
4152
+ _ref$setValue = _ref.setValue,
4153
+ setValue = _ref$setValue === void 0 ? function () {} : _ref$setValue,
4150
4154
  _ref$setIsHovered = _ref.setIsHovered,
4151
4155
  setIsHovered = _ref$setIsHovered === void 0 ? function () {} : _ref$setIsHovered,
4152
4156
  _ref$styles = _ref.styles,
4153
4157
  styles = _ref$styles === void 0 ? {
4154
4158
  slider: {},
4155
- circle: {}
4159
+ circle: {},
4160
+ label: {}
4156
4161
  } : _ref$styles,
4157
4162
  props = _objectWithoutPropertiesLoose(_ref, _excluded$s);
4158
4163
  var handleToggle = function handleToggle(event) {
4159
4164
  if (!isReadOnly) {
4160
- setOn(!on);
4165
+ setValue(!value);
4161
4166
  if (onChange) onChange(event.target.checked);
4162
4167
  }
4163
4168
  };
4164
4169
  var handleHover = function handleHover() {
4165
4170
  return setIsHovered(!isHovered);
4166
4171
  };
4167
- return React__default.createElement(Label, {
4172
+ var switchStyle = {
4173
+ container: _extends({
4174
+ gap: 10,
4175
+ display: 'flex',
4176
+ height: 'fit-content',
4177
+ width: 'fit-content',
4178
+ cursor: isDisabled ? 'not-allowed' : isReadOnly ? 'default' : 'pointer'
4179
+ }, styles.label)
4180
+ };
4181
+ return React__default.createElement(Label, Object.assign({
4168
4182
  htmlFor: id,
4169
4183
  onMouseEnter: handleHover,
4170
4184
  onMouseLeave: handleHover
4171
- }, React__default.createElement(SwitchContent, Object.assign({
4185
+ }, switchStyle.container, props), React__default.createElement(SwitchContent, Object.assign({
4172
4186
  id: id,
4173
4187
  name: name,
4174
4188
  opacity: 0,
4175
4189
  width: 0,
4176
4190
  height: 0,
4177
- checked: on,
4191
+ checked: value,
4178
4192
  onChange: handleToggle,
4179
4193
  disabled: isDisabled,
4180
4194
  readOnly: isReadOnly
4181
- }, onValueChange && {
4182
- onValueChange: handleToggle
4183
- }, props)), React__default.createElement(View, Object.assign({
4195
+ }, props)), labelPosition === 'left' && label && React__default.createElement(View, null, label), React__default.createElement(View, Object.assign({
4184
4196
  display: "flex",
4185
4197
  cursor: "pointer",
4186
4198
  alignItems: "center",
4187
4199
  borderRadius: 24,
4188
4200
  marginBottom: 5,
4189
- filter: isHovered && on ? 'brightness(0.9)' : 'brightness(1)',
4201
+ filter: isHovered && value ? 'brightness(0.9)' : 'brightness(1)',
4190
4202
  transition: "justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
4191
- backgroundColor: isDisabled ? 'disabled' : on ? colorScheme : 'lightgray',
4192
- justifyContent: activeChild ? 'space-between' : on ? 'flex-end' : 'flex-start'
4193
- }, shadow, SliderPadding[size], SliderSizes[size], styles['slider']), activeChild && on && React__default.createElement(View, null, activeChild), React__default.createElement(View, Object.assign({
4203
+ backgroundColor: isDisabled ? 'disabled' : value ? colorScheme : 'lightgray',
4204
+ justifyContent: activeChild ? 'space-between' : value ? 'flex-end' : 'flex-start'
4205
+ }, shadow, SliderPadding[size], SliderSizes[size], styles['slider']), activeChild && value && React__default.createElement(View, null, activeChild), React__default.createElement(View, Object.assign({
4194
4206
  borderRadius: "50%",
4195
4207
  backgroundColor: "white"
4196
- }, KnobSizes[size], styles['circle'])), inActiveChild && !on && React__default.createElement(View, null, inActiveChild)));
4208
+ }, KnobSizes[size], styles['circle'])), inActiveChild && !value && React__default.createElement(View, null, inActiveChild)), labelPosition === 'right' && label && React__default.createElement(View, null, label));
4197
4209
  };
4198
4210
 
4199
4211
  var SwitchComponent = function SwitchComponent(props) {
@@ -4578,12 +4590,8 @@ var SelectComponent$1 = function SelectComponent(props) {
4578
4590
  */
4579
4591
  var FormikSelect = SelectComponent$1;
4580
4592
 
4581
- var _excluded$w = ["value"];
4582
4593
  var SwitchComponent$1 = function SwitchComponent(props) {
4583
- var _useFormikInput = useFormikInput(props),
4584
- value = _useFormikInput.value,
4585
- formProps = _objectWithoutPropertiesLoose(_useFormikInput, _excluded$w);
4586
- formProps.isChecked = value;
4594
+ var formProps = useFormikInput(props);
4587
4595
  var switchStates = useSwitchState(props);
4588
4596
  return React__default.createElement(SwitchView, Object.assign({}, switchStates, formProps));
4589
4597
  };
@@ -4599,11 +4607,11 @@ var TextAreaComponent$1 = function TextAreaComponent(props) {
4599
4607
  */
4600
4608
  var FormikTextArea = TextAreaComponent$1;
4601
4609
 
4602
- var _excluded$x = ["value"];
4610
+ var _excluded$w = ["value"];
4603
4611
  var TextFieldComponent$1 = function TextFieldComponent(props) {
4604
4612
  var formProps = useFormikInput(props);
4605
4613
  var _useTextFieldState = useTextFieldState(props),
4606
- textFieldStates = _objectWithoutPropertiesLoose(_useTextFieldState, _excluded$x);
4614
+ textFieldStates = _objectWithoutPropertiesLoose(_useTextFieldState, _excluded$w);
4607
4615
  return React__default.createElement(TextFieldView, Object.assign({}, textFieldStates, formProps));
4608
4616
  };
4609
4617
  /**
@@ -4611,7 +4619,7 @@ var TextFieldComponent$1 = function TextFieldComponent(props) {
4611
4619
  */
4612
4620
  var FormikTextField = TextFieldComponent$1;
4613
4621
 
4614
- var _excluded$y = ["visibleIcon", "hiddenIcon"],
4622
+ var _excluded$x = ["visibleIcon", "hiddenIcon"],
4615
4623
  _excluded2$3 = ["isVisible", "setIsVisible"];
4616
4624
  var PasswordComponent$1 = function PasswordComponent(_ref) {
4617
4625
  var _ref$visibleIcon = _ref.visibleIcon,
@@ -4622,7 +4630,7 @@ var PasswordComponent$1 = function PasswordComponent(_ref) {
4622
4630
  hiddenIcon = _ref$hiddenIcon === void 0 ? React__default.createElement(CloseEyeSvg, {
4623
4631
  size: 14
4624
4632
  }) : _ref$hiddenIcon,
4625
- props = _objectWithoutPropertiesLoose(_ref, _excluded$y);
4633
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$x);
4626
4634
  var formProps = useFormikInput(props);
4627
4635
  var _usePasswordState = usePasswordState(formProps),
4628
4636
  isVisible = _usePasswordState.isVisible,
@@ -4730,7 +4738,7 @@ var HeaderIconSizes = {
4730
4738
  xl: 28
4731
4739
  };
4732
4740
 
4733
- var _excluded$z = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position"],
4741
+ var _excluded$y = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position"],
4734
4742
  _excluded2$4 = ["children", "shadow", "isFullScreen", "shape"],
4735
4743
  _excluded3$2 = ["children", "buttonColor", "iconSize", "buttonPosition"],
4736
4744
  _excluded4$2 = ["children"],
@@ -4746,7 +4754,7 @@ var ModalOverlay = function ModalOverlay(_ref) {
4746
4754
  onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
4747
4755
  _ref$position = _ref.position,
4748
4756
  position = _ref$position === void 0 ? 'center' : _ref$position,
4749
- props = _objectWithoutPropertiesLoose(_ref, _excluded$z);
4757
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$y);
4750
4758
  var handleClick = function handleClick() {
4751
4759
  if (!isClosePrevented) onClose();
4752
4760
  };
@@ -4902,12 +4910,12 @@ Modal.Body = ModalBody;
4902
4910
  Modal.Footer = ModalFooter;
4903
4911
  Modal.Layout = ModalLayout;
4904
4912
 
4905
- var _excluded$A = ["src", "color"],
4913
+ var _excluded$z = ["src", "color"],
4906
4914
  _excluded2$5 = ["path"];
4907
4915
  var FileSVG = function FileSVG(_ref) {
4908
4916
  var src = _ref.src,
4909
4917
  color = _ref.color,
4910
- props = _objectWithoutPropertiesLoose(_ref, _excluded$A);
4918
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$z);
4911
4919
  var _useTheme = appStudio.useTheme(),
4912
4920
  getColor = _useTheme.getColor;
4913
4921
  var Colorprops = color ? {