switch.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
  2. require("../../../_virtual/_rolldown/runtime.js");
  3. const require_event = require("../../../constants/event.js");
  4. const require_types = require("../../../utils/types.js");
  5. const require_runtime$1 = require("../../../utils/vue/props/runtime.js");
  6. const require_icon = require("../../../utils/vue/icon.js");
  7. const require_validator = require("../../../utils/vue/validator.js");
  8. const require_index = require("../../../hooks/use-aria/index.js");
  9. let _vue_shared = require("@vue/shared");
  10. //#region ../../packages/components/switch/src/switch.ts
  11. /**
  12. * @deprecated Removed after 3.0.0, Use `SwitchProps` instead.
  13. */
  14. const switchProps = require_runtime$1.buildProps({
  15. /**
  16. * @description binding value, it should be equivalent to either `active-value` or `inactive-value`, by default it's `boolean` type
  17. */
  18. modelValue: {
  19. type: [
  20. Boolean,
  21. String,
  22. Number
  23. ],
  24. default: false
  25. },
  26. /**
  27. * @description whether Switch is disabled
  28. */
  29. disabled: {
  30. type: Boolean,
  31. default: void 0
  32. },
  33. /**
  34. * @description whether Switch is in loading state
  35. */
  36. loading: Boolean,
  37. /**
  38. * @description size of Switch
  39. */
  40. size: {
  41. type: String,
  42. validator: require_validator.isValidComponentSize
  43. },
  44. /**
  45. * @description width of Switch
  46. */
  47. width: {
  48. type: [String, Number],
  49. default: ""
  50. },
  51. /**
  52. * @description whether icon or text is displayed inside dot, only the first character will be rendered for text
  53. */
  54. inlinePrompt: Boolean,
  55. /**
  56. * @description component of the icon displayed in action when in `off` state
  57. */
  58. inactiveActionIcon: { type: require_icon.iconPropType },
  59. /**
  60. * @description component of the icon displayed in action when in `on` state
  61. */
  62. activeActionIcon: { type: require_icon.iconPropType },
  63. /**
  64. * @description component of the icon displayed when in `on` state, overrides `active-text`
  65. */
  66. activeIcon: { type: require_icon.iconPropType },
  67. /**
  68. * @description component of the icon displayed when in `off` state, overrides `inactive-text`
  69. */
  70. inactiveIcon: { type: require_icon.iconPropType },
  71. /**
  72. * @description text displayed when in `on` state
  73. */
  74. activeText: {
  75. type: String,
  76. default: ""
  77. },
  78. /**
  79. * @description text displayed when in `off` state
  80. */
  81. inactiveText: {
  82. type: String,
  83. default: ""
  84. },
  85. /**
  86. * @description switch value when in `on` state
  87. */
  88. activeValue: {
  89. type: [
  90. Boolean,
  91. String,
  92. Number
  93. ],
  94. default: true
  95. },
  96. /**
  97. * @description switch value when in `off` state
  98. */
  99. inactiveValue: {
  100. type: [
  101. Boolean,
  102. String,
  103. Number
  104. ],
  105. default: false
  106. },
  107. /**
  108. * @description input name of Switch
  109. */
  110. name: {
  111. type: String,
  112. default: ""
  113. },
  114. /**
  115. * @description whether to trigger form validation
  116. */
  117. validateEvent: {
  118. type: Boolean,
  119. default: true
  120. },
  121. /**
  122. * @description before-change hook before the switch state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop switching
  123. */
  124. beforeChange: { type: require_runtime$1.definePropType(Function) },
  125. /**
  126. * @description id for input
  127. */
  128. id: String,
  129. /**
  130. * @description tabindex for input
  131. */
  132. tabindex: { type: [String, Number] },
  133. ...require_index.useAriaProps(["ariaLabel"])
  134. });
  135. const switchEmits = {
  136. [require_event.UPDATE_MODEL_EVENT]: (val) => require_types.isBoolean(val) || (0, _vue_shared.isString)(val) || require_types.isNumber(val),
  137. [require_event.CHANGE_EVENT]: (val) => require_types.isBoolean(val) || (0, _vue_shared.isString)(val) || require_types.isNumber(val),
  138. [require_event.INPUT_EVENT]: (val) => require_types.isBoolean(val) || (0, _vue_shared.isString)(val) || require_types.isNumber(val)
  139. };
  140. //#endregion
  141. exports.switchEmits = switchEmits;
  142. exports.switchProps = switchProps;
  143. //# sourceMappingURL=switch.js.map