4a03cc4319e96bc047ff999105b24e70183e0cbd066450f7c61e871ea0911dd331c1703e447cb6867cf7e74976ff784b69a54062913a1b17fdafe14c284a14 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { isValidComponentSize } from '../../../utils/vue/validator.mjs';
  2. import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
  3. import { iconPropType } from '../../../utils/vue/icon.mjs';
  4. import { useAriaProps } from '../../../hooks/use-aria/index.mjs';
  5. import { UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT } from '../../../constants/event.mjs';
  6. import { isBoolean, isNumber } from '../../../utils/types.mjs';
  7. import { isString } from '@vue/shared';
  8. const switchProps = buildProps({
  9. modelValue: {
  10. type: [Boolean, String, Number],
  11. default: false
  12. },
  13. disabled: Boolean,
  14. loading: Boolean,
  15. size: {
  16. type: String,
  17. validator: isValidComponentSize
  18. },
  19. width: {
  20. type: [String, Number],
  21. default: ""
  22. },
  23. inlinePrompt: Boolean,
  24. inactiveActionIcon: {
  25. type: iconPropType
  26. },
  27. activeActionIcon: {
  28. type: iconPropType
  29. },
  30. activeIcon: {
  31. type: iconPropType
  32. },
  33. inactiveIcon: {
  34. type: iconPropType
  35. },
  36. activeText: {
  37. type: String,
  38. default: ""
  39. },
  40. inactiveText: {
  41. type: String,
  42. default: ""
  43. },
  44. activeValue: {
  45. type: [Boolean, String, Number],
  46. default: true
  47. },
  48. inactiveValue: {
  49. type: [Boolean, String, Number],
  50. default: false
  51. },
  52. name: {
  53. type: String,
  54. default: ""
  55. },
  56. validateEvent: {
  57. type: Boolean,
  58. default: true
  59. },
  60. beforeChange: {
  61. type: definePropType(Function)
  62. },
  63. id: String,
  64. tabindex: {
  65. type: [String, Number]
  66. },
  67. ...useAriaProps(["ariaLabel"])
  68. });
  69. const switchEmits = {
  70. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  71. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  72. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  73. };
  74. export { switchEmits, switchProps };
  75. //# sourceMappingURL=switch.mjs.map