@app-studio/web 0.3.59 → 0.3.61

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", "value", "isHovered", "isDisabled", "isReadOnly", "onChange", "setValue", "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,8 +4129,11 @@ 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,
@@ -4151,7 +4156,8 @@ var SwitchView = function SwitchView(_ref) {
4151
4156
  _ref$styles = _ref.styles,
4152
4157
  styles = _ref$styles === void 0 ? {
4153
4158
  slider: {},
4154
- circle: {}
4159
+ circle: {},
4160
+ label: {}
4155
4161
  } : _ref$styles,
4156
4162
  props = _objectWithoutPropertiesLoose(_ref, _excluded$s);
4157
4163
  var handleToggle = function handleToggle(event) {
@@ -4163,11 +4169,20 @@ var SwitchView = function SwitchView(_ref) {
4163
4169
  var handleHover = function handleHover() {
4164
4170
  return setIsHovered(!isHovered);
4165
4171
  };
4166
- 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({
4167
4182
  htmlFor: id,
4168
4183
  onMouseEnter: handleHover,
4169
4184
  onMouseLeave: handleHover
4170
- }, React__default.createElement(SwitchContent, Object.assign({
4185
+ }, switchStyle.container, props), React__default.createElement(SwitchContent, Object.assign({
4171
4186
  id: id,
4172
4187
  name: name,
4173
4188
  opacity: 0,
@@ -4177,7 +4192,7 @@ var SwitchView = function SwitchView(_ref) {
4177
4192
  onChange: handleToggle,
4178
4193
  disabled: isDisabled,
4179
4194
  readOnly: isReadOnly
4180
- }, props)), React__default.createElement(View, Object.assign({
4195
+ }, props)), labelPosition === 'left' && label && React__default.createElement(View, null, label), React__default.createElement(View, Object.assign({
4181
4196
  display: "flex",
4182
4197
  cursor: "pointer",
4183
4198
  alignItems: "center",
@@ -4190,7 +4205,7 @@ var SwitchView = function SwitchView(_ref) {
4190
4205
  }, shadow, SliderPadding[size], SliderSizes[size], styles['slider']), activeChild && value && React__default.createElement(View, null, activeChild), React__default.createElement(View, Object.assign({
4191
4206
  borderRadius: "50%",
4192
4207
  backgroundColor: "white"
4193
- }, KnobSizes[size], styles['circle'])), inActiveChild && !value && 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));
4194
4209
  };
4195
4210
 
4196
4211
  var SwitchComponent = function SwitchComponent(props) {