@vuetify/nightly 3.4.11-dev.2024-01-19 → 3.5.0-dev.2024-01-20

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +2 -29
  2. package/dist/json/attributes.json +6 -6
  3. package/dist/json/importMap.json +116 -116
  4. package/dist/json/web-types.json +42 -7
  5. package/dist/vuetify-labs.css +2802 -2782
  6. package/dist/vuetify-labs.d.ts +61 -8
  7. package/dist/vuetify-labs.esm.js +153 -22
  8. package/dist/vuetify-labs.esm.js.map +1 -1
  9. package/dist/vuetify-labs.js +153 -21
  10. package/dist/vuetify-labs.min.css +2 -2
  11. package/dist/vuetify.css +757 -737
  12. package/dist/vuetify.d.ts +97 -44
  13. package/dist/vuetify.esm.js +153 -22
  14. package/dist/vuetify.esm.js.map +1 -1
  15. package/dist/vuetify.js +153 -21
  16. package/dist/vuetify.js.map +1 -1
  17. package/dist/vuetify.min.css +2 -2
  18. package/dist/vuetify.min.js +359 -337
  19. package/dist/vuetify.min.js.map +1 -1
  20. package/lib/blueprints/index.d.mts +11 -1
  21. package/lib/blueprints/md1.d.mts +11 -1
  22. package/lib/blueprints/md2.d.mts +11 -1
  23. package/lib/blueprints/md3.d.mts +11 -1
  24. package/lib/components/VSwitch/VSwitch.css +22 -2
  25. package/lib/components/VSwitch/VSwitch.mjs +26 -3
  26. package/lib/components/VSwitch/VSwitch.mjs.map +1 -1
  27. package/lib/components/VSwitch/VSwitch.sass +20 -2
  28. package/lib/components/VSwitch/index.d.mts +37 -6
  29. package/lib/components/index.d.mts +37 -6
  30. package/lib/composables/goto.mjs +105 -0
  31. package/lib/composables/goto.mjs.map +1 -0
  32. package/lib/composables/index.mjs +1 -0
  33. package/lib/composables/index.mjs.map +1 -1
  34. package/lib/entry-bundler.mjs +1 -1
  35. package/lib/entry-bundler.mjs.map +1 -1
  36. package/lib/framework.mjs +6 -2
  37. package/lib/framework.mjs.map +1 -1
  38. package/lib/index.d.mts +60 -38
  39. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { Ref, JSXComponent, PropType } from 'vue';
1
+ import { Ref, ComponentPublicInstance, JSXComponent, PropType } from 'vue';
2
2
 
3
3
  interface DateAdapter<T = unknown> {
4
4
  date(value?: any): T | null;
@@ -144,6 +144,15 @@ type DefaultsInstance = undefined | {
144
144
  };
145
145
  type DefaultsOptions = Partial<DefaultsInstance>;
146
146
 
147
+ interface GoToOptions {
148
+ container: ComponentPublicInstance | HTMLElement | string;
149
+ duration: number;
150
+ layout: boolean;
151
+ offset: number;
152
+ easing: string | ((t: number) => number);
153
+ patterns: Record<string, (t: number) => number>;
154
+ }
155
+
147
156
  type IconValue = string | (string | [path: string, opacity: number])[] | JSXComponent;
148
157
  declare const IconValue: PropType<IconValue>;
149
158
  interface IconAliases {
@@ -207,6 +216,7 @@ interface VuetifyOptions {
207
216
  directives?: Record<string, any>;
208
217
  defaults?: DefaultsOptions;
209
218
  display?: DisplayOptions;
219
+ goTo?: GoToOptions;
210
220
  theme?: ThemeOptions;
211
221
  icons?: IconOptions;
212
222
  locale?: LocaleOptions & RtlOptions;
@@ -1,4 +1,4 @@
1
- import { Ref, JSXComponent, PropType } from 'vue';
1
+ import { Ref, ComponentPublicInstance, JSXComponent, PropType } from 'vue';
2
2
 
3
3
  interface DateAdapter<T = unknown> {
4
4
  date(value?: any): T | null;
@@ -144,6 +144,15 @@ type DefaultsInstance = undefined | {
144
144
  };
145
145
  type DefaultsOptions = Partial<DefaultsInstance>;
146
146
 
147
+ interface GoToOptions {
148
+ container: ComponentPublicInstance | HTMLElement | string;
149
+ duration: number;
150
+ layout: boolean;
151
+ offset: number;
152
+ easing: string | ((t: number) => number);
153
+ patterns: Record<string, (t: number) => number>;
154
+ }
155
+
147
156
  type IconValue = string | (string | [path: string, opacity: number])[] | JSXComponent;
148
157
  declare const IconValue: PropType<IconValue>;
149
158
  interface IconAliases {
@@ -207,6 +216,7 @@ interface VuetifyOptions {
207
216
  directives?: Record<string, any>;
208
217
  defaults?: DefaultsOptions;
209
218
  display?: DisplayOptions;
219
+ goTo?: GoToOptions;
210
220
  theme?: ThemeOptions;
211
221
  icons?: IconOptions;
212
222
  locale?: LocaleOptions & RtlOptions;
@@ -1,4 +1,4 @@
1
- import { Ref, JSXComponent, PropType } from 'vue';
1
+ import { Ref, ComponentPublicInstance, JSXComponent, PropType } from 'vue';
2
2
 
3
3
  interface DateAdapter<T = unknown> {
4
4
  date(value?: any): T | null;
@@ -144,6 +144,15 @@ type DefaultsInstance = undefined | {
144
144
  };
145
145
  type DefaultsOptions = Partial<DefaultsInstance>;
146
146
 
147
+ interface GoToOptions {
148
+ container: ComponentPublicInstance | HTMLElement | string;
149
+ duration: number;
150
+ layout: boolean;
151
+ offset: number;
152
+ easing: string | ((t: number) => number);
153
+ patterns: Record<string, (t: number) => number>;
154
+ }
155
+
147
156
  type IconValue = string | (string | [path: string, opacity: number])[] | JSXComponent;
148
157
  declare const IconValue: PropType<IconValue>;
149
158
  interface IconAliases {
@@ -207,6 +216,7 @@ interface VuetifyOptions {
207
216
  directives?: Record<string, any>;
208
217
  defaults?: DefaultsOptions;
209
218
  display?: DisplayOptions;
219
+ goTo?: GoToOptions;
210
220
  theme?: ThemeOptions;
211
221
  icons?: IconOptions;
212
222
  locale?: LocaleOptions & RtlOptions;
@@ -1,4 +1,4 @@
1
- import { Ref, JSXComponent, PropType } from 'vue';
1
+ import { Ref, ComponentPublicInstance, JSXComponent, PropType } from 'vue';
2
2
 
3
3
  interface DateAdapter<T = unknown> {
4
4
  date(value?: any): T | null;
@@ -144,6 +144,15 @@ type DefaultsInstance = undefined | {
144
144
  };
145
145
  type DefaultsOptions = Partial<DefaultsInstance>;
146
146
 
147
+ interface GoToOptions {
148
+ container: ComponentPublicInstance | HTMLElement | string;
149
+ duration: number;
150
+ layout: boolean;
151
+ offset: number;
152
+ easing: string | ((t: number) => number);
153
+ patterns: Record<string, (t: number) => number>;
154
+ }
155
+
147
156
  type IconValue = string | (string | [path: string, opacity: number])[] | JSXComponent;
148
157
  declare const IconValue: PropType<IconValue>;
149
158
  interface IconAliases {
@@ -207,6 +216,7 @@ interface VuetifyOptions {
207
216
  directives?: Record<string, any>;
208
217
  defaults?: DefaultsOptions;
209
218
  display?: DisplayOptions;
219
+ goTo?: GoToOptions;
210
220
  theme?: ThemeOptions;
211
221
  icons?: IconOptions;
212
222
  locale?: LocaleOptions & RtlOptions;
@@ -23,25 +23,45 @@
23
23
  color: rgb(var(--v-theme-on-error));
24
24
  }
25
25
 
26
+ .v-switch__track-true {
27
+ margin-inline-end: auto;
28
+ }
29
+ .v-selection-control:not(.v-selection-control--dirty) .v-switch__track-true {
30
+ opacity: 0;
31
+ }
32
+
33
+ .v-switch__track-false {
34
+ margin-inline-start: auto;
35
+ }
36
+ .v-selection-control--dirty .v-switch__track-false {
37
+ opacity: 0;
38
+ }
39
+
26
40
  .v-switch__track {
41
+ display: inline-flex;
42
+ align-items: center;
43
+ font-size: 0.5rem;
44
+ padding: 0 5px;
27
45
  background-color: rgb(var(--v-theme-surface-variant));
28
46
  border-radius: 9999px;
29
47
  height: 14px;
30
48
  opacity: 0.6;
31
- width: 36px;
49
+ min-width: 36px;
32
50
  cursor: pointer;
33
51
  transition: 0.2s background-color cubic-bezier(0.4, 0, 0.2, 1);
34
52
  }
35
53
  .v-switch--inset .v-switch__track {
36
54
  border-radius: 9999px;
55
+ font-size: 0.75rem;
37
56
  height: 32px;
38
- width: 52px;
57
+ min-width: 52px;
39
58
  }
40
59
 
41
60
  .v-switch__thumb {
42
61
  align-items: center;
43
62
  border-radius: 50%;
44
63
  display: flex;
64
+ font-size: 0.75rem;
45
65
  height: 20px;
46
66
  justify-content: center;
47
67
  width: 20px;
@@ -4,6 +4,7 @@ import "./VSwitch.css";
4
4
 
5
5
  // Components
6
6
  import { VScaleTransition } from "../transitions/index.mjs";
7
+ import { VDefaultsProvider } from "../VDefaultsProvider/VDefaultsProvider.mjs";
7
8
  import { VIcon } from "../VIcon/index.mjs";
8
9
  import { makeVInputProps, VInput } from "../VInput/VInput.mjs";
9
10
  import { VProgressCircular } from "../VProgressCircular/index.mjs";
@@ -90,6 +91,10 @@ export const VSwitch = genericComponent()({
90
91
  isReadonly,
91
92
  isValid
92
93
  } = _ref2;
94
+ const slotProps = {
95
+ model,
96
+ isValid
97
+ };
93
98
  return _createVNode(VSelectionControl, _mergeProps({
94
99
  "ref": control
95
100
  }, controlProps, {
@@ -114,7 +119,13 @@ export const VSwitch = genericComponent()({
114
119
  "class": ['v-switch__track', ...backgroundColorClasses.value],
115
120
  "style": backgroundColorStyles.value,
116
121
  "onClick": onTrackClick
117
- }, null);
122
+ }, [slots['track-true'] && _createVNode("div", {
123
+ "key": "prepend",
124
+ "class": "v-switch__track-true"
125
+ }, [slots['track-true'](slotProps)]), slots['track-false'] && _createVNode("div", {
126
+ "key": "append",
127
+ "class": "v-switch__track-false"
128
+ }, [slots['track-false'](slotProps)])]);
118
129
  },
119
130
  input: _ref4 => {
120
131
  let {
@@ -128,9 +139,21 @@ export const VSwitch = genericComponent()({
128
139
  'v-switch__thumb--filled': icon || props.loading
129
140
  }, props.inset ? undefined : backgroundColorClasses.value],
130
141
  "style": props.inset ? undefined : backgroundColorStyles.value
131
- }, [_createVNode(VScaleTransition, null, {
142
+ }, [slots.thumb ? _createVNode(VDefaultsProvider, {
143
+ "defaults": {
144
+ VIcon: {
145
+ icon,
146
+ size: 'x-small'
147
+ }
148
+ }
149
+ }, {
150
+ default: () => [slots.thumb({
151
+ ...slotProps,
152
+ icon
153
+ })]
154
+ }) : _createVNode(VScaleTransition, null, {
132
155
  default: () => [!props.loading ? icon && _createVNode(VIcon, {
133
- "key": icon,
156
+ "key": String(icon),
134
157
  "icon": icon,
135
158
  "size": "x-small"
136
159
  }, null) : _createVNode(LoaderSlot, {
@@ -1 +1 @@
1
- {"version":3,"file":"VSwitch.mjs","names":["VScaleTransition","VIcon","makeVInputProps","VInput","VProgressCircular","makeVSelectionControlProps","VSelectionControl","useFocus","LoaderSlot","useLoader","useProxiedModel","computed","ref","filterInputAttrs","genericComponent","getUid","propsFactory","useRender","makeVSwitchProps","indeterminate","Boolean","inset","flat","loading","type","String","default","VSwitch","name","inheritAttrs","props","emits","focused","value","setup","_ref","attrs","slots","model","loaderClasses","isFocused","focus","blur","control","loaderColor","color","uid","id","onChange","onTrackClick","e","stopPropagation","preventDefault","input","click","rootAttrs","controlAttrs","inputProps","filterProps","controlProps","_createVNode","_mergeProps","class","$event","style","_ref2","messagesId","isDisabled","isReadonly","isValid","undefined","_ref3","backgroundColorClasses","backgroundColorStyles","_ref4","inputNode","icon","_Fragment","slotProps","loader","isActive"],"sources":["../../../src/components/VSwitch/VSwitch.tsx"],"sourcesContent":["// Styles\nimport './VSwitch.sass'\n\n// Components\nimport { VScaleTransition } from '@/components/transitions'\nimport { VIcon } from '@/components/VIcon'\nimport { makeVInputProps, VInput } from '@/components/VInput/VInput'\nimport { VProgressCircular } from '@/components/VProgressCircular'\nimport { makeVSelectionControlProps, VSelectionControl } from '@/components/VSelectionControl/VSelectionControl'\n\n// Composables\nimport { useFocus } from '@/composables/focus'\nimport { LoaderSlot, useLoader } from '@/composables/loader'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, ref } from 'vue'\nimport { filterInputAttrs, genericComponent, getUid, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { VInputSlots } from '@/components/VInput/VInput'\nimport type { VSelectionControlSlots } from '@/components/VSelectionControl/VSelectionControl'\nimport type { LoaderSlotProps } from '@/composables/loader'\nimport type { GenericProps } from '@/util'\n\nexport type VSwitchSlots =\n & VInputSlots\n & VSelectionControlSlots\n & { loader: LoaderSlotProps }\n\nexport const makeVSwitchProps = propsFactory({\n indeterminate: Boolean,\n inset: Boolean,\n flat: Boolean,\n loading: {\n type: [Boolean, String],\n default: false,\n },\n\n ...makeVInputProps(),\n ...makeVSelectionControlProps(),\n}, 'VSwitch')\n\nexport const VSwitch = genericComponent<new <T>(\n props: {\n modelValue?: T | null\n 'onUpdate:modelValue'?: (value: T | null) => void\n },\n slots: VSwitchSlots,\n) => GenericProps<typeof props, typeof slots>>()({\n name: 'VSwitch',\n\n inheritAttrs: false,\n\n props: makeVSwitchProps(),\n\n emits: {\n 'update:focused': (focused: boolean) => true,\n 'update:modelValue': (value: any) => true,\n 'update:indeterminate': (value: boolean) => true,\n },\n\n setup (props, { attrs, slots }) {\n const indeterminate = useProxiedModel(props, 'indeterminate')\n const model = useProxiedModel(props, 'modelValue')\n const { loaderClasses } = useLoader(props)\n const { isFocused, focus, blur } = useFocus(props)\n const control = ref<VSelectionControl>()\n\n const loaderColor = computed(() => {\n return typeof props.loading === 'string' && props.loading !== ''\n ? props.loading\n : props.color\n })\n\n const uid = getUid()\n const id = computed(() => props.id || `switch-${uid}`)\n\n function onChange () {\n if (indeterminate.value) {\n indeterminate.value = false\n }\n }\n function onTrackClick (e: Event) {\n e.stopPropagation()\n e.preventDefault()\n control.value?.input?.click()\n }\n\n useRender(() => {\n const [rootAttrs, controlAttrs] = filterInputAttrs(attrs)\n const inputProps = VInput.filterProps(props)\n const controlProps = VSelectionControl.filterProps(props)\n\n return (\n <VInput\n class={[\n 'v-switch',\n { 'v-switch--inset': props.inset },\n { 'v-switch--indeterminate': indeterminate.value },\n loaderClasses.value,\n props.class,\n ]}\n { ...rootAttrs }\n { ...inputProps }\n v-model={ model.value }\n id={ id.value }\n focused={ isFocused.value }\n style={ props.style }\n >\n {{\n ...slots,\n default: ({\n id,\n messagesId,\n isDisabled,\n isReadonly,\n isValid,\n }) => (\n <VSelectionControl\n ref={ control }\n { ...controlProps }\n v-model={ model.value }\n id={ id.value }\n aria-describedby={ messagesId.value }\n type=\"checkbox\"\n onUpdate:modelValue={ onChange }\n aria-checked={ indeterminate.value ? 'mixed' : undefined }\n disabled={ isDisabled.value }\n readonly={ isReadonly.value }\n onFocus={ focus }\n onBlur={ blur }\n { ...controlAttrs }\n >\n {{\n ...slots,\n default: ({ backgroundColorClasses, backgroundColorStyles }) => (\n <div\n class={[\n 'v-switch__track',\n ...backgroundColorClasses.value,\n ]}\n style={ backgroundColorStyles.value }\n onClick={ onTrackClick }\n ></div>\n ),\n input: ({ inputNode, icon, backgroundColorClasses, backgroundColorStyles }) => (\n <>\n { inputNode }\n <div\n class={[\n 'v-switch__thumb',\n { 'v-switch__thumb--filled': icon || props.loading },\n props.inset ? undefined : backgroundColorClasses.value,\n ]}\n style={ props.inset ? undefined : backgroundColorStyles.value }\n >\n <VScaleTransition>\n { !props.loading ? (\n icon && <VIcon key={ icon as any } icon={ icon } size=\"x-small\" />\n ) : (\n <LoaderSlot\n name=\"v-switch\"\n active\n color={ isValid.value === false ? undefined : loaderColor.value }\n >\n { slotProps => (\n slots.loader\n ? slots.loader(slotProps)\n : (\n <VProgressCircular\n active={ slotProps.isActive }\n color={ slotProps.color }\n indeterminate\n size=\"16\"\n width=\"2\"\n />\n )\n )}\n </LoaderSlot>\n )}\n </VScaleTransition>\n </div>\n </>\n ),\n }}\n </VSelectionControl>\n ),\n }}\n </VInput>\n )\n })\n\n return {}\n },\n})\n\nexport type VSwitch = InstanceType<typeof VSwitch>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,gBAAgB;AAAA,SAChBC,KAAK;AAAA,SACLC,eAAe,EAAEC,MAAM;AAAA,SACvBC,iBAAiB;AAAA,SACjBC,0BAA0B,EAAEC,iBAAiB,sDAEtD;AAAA,SACSC,QAAQ;AAAA,SACRC,UAAU,EAAEC,SAAS;AAAA,SACrBC,eAAe,8CAExB;AACA,SAASC,QAAQ,EAAEC,GAAG,QAAQ,KAAK;AAAA,SAC1BC,gBAAgB,EAAEC,gBAAgB,EAAEC,MAAM,EAAEC,YAAY,EAAEC,SAAS,gCAE5E;AAWA,OAAO,MAAMC,gBAAgB,GAAGF,YAAY,CAAC;EAC3CG,aAAa,EAAEC,OAAO;EACtBC,KAAK,EAAED,OAAO;EACdE,IAAI,EAAEF,OAAO;EACbG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A;kBAAA,OAAiB2E,IAAI;kBAAA,QAAiBA,IAAI;kBAAA;gBAAA,QAAoB,GAAAhB,YAAA,CAAApD,UAAA;kBAAA;kBAAA;kBAAA,SAKxD6D,OAAO,CAACpC,KAAK,KAAK,KAAK,GAAGqC,SAAS,GAAG1B,WAAW,CAACX;gBAAK;kBAAAP,OAAA,EAE7DoD,SAAS,IACTzC,KAAK,CAAC0C,MAAM,GACR1C,KAAK,CAAC0C,MAAM,CAACD,SAAS,CAAC,GAAAlB,YAAA,CAAAxD,iBAAA;oBAAA,UAGZ0E,SAAS,CAACE,QAAQ;oBAAA,SACnBF,SAAS,CAACjC,KAAK;oBAAA;oBAAA;oBAAA;kBAAA;gBAM9B,EAEJ;cAAA;YAAA;UAIR;QAAA;MAGN;IAIT,CAAC,CAAC;IAEF,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC"}
1
+ {"version":3,"file":"VSwitch.mjs","names":["VScaleTransition","VDefaultsProvider","VIcon","makeVInputProps","VInput","VProgressCircular","makeVSelectionControlProps","VSelectionControl","useFocus","LoaderSlot","useLoader","useProxiedModel","computed","ref","filterInputAttrs","genericComponent","getUid","propsFactory","useRender","makeVSwitchProps","indeterminate","Boolean","inset","flat","loading","type","String","default","VSwitch","name","inheritAttrs","props","emits","focused","value","setup","_ref","attrs","slots","model","loaderClasses","isFocused","focus","blur","control","loaderColor","color","uid","id","onChange","onTrackClick","e","stopPropagation","preventDefault","input","click","rootAttrs","controlAttrs","inputProps","filterProps","controlProps","_createVNode","_mergeProps","class","$event","style","_ref2","messagesId","isDisabled","isReadonly","isValid","slotProps","undefined","_ref3","backgroundColorClasses","backgroundColorStyles","_ref4","inputNode","icon","_Fragment","thumb","size","loader","isActive"],"sources":["../../../src/components/VSwitch/VSwitch.tsx"],"sourcesContent":["// Styles\nimport './VSwitch.sass'\n\n// Components\nimport { VScaleTransition } from '@/components/transitions'\nimport { VDefaultsProvider } from '@/components/VDefaultsProvider/VDefaultsProvider'\nimport { VIcon } from '@/components/VIcon'\nimport { makeVInputProps, VInput } from '@/components/VInput/VInput'\nimport { VProgressCircular } from '@/components/VProgressCircular'\nimport { makeVSelectionControlProps, VSelectionControl } from '@/components/VSelectionControl/VSelectionControl'\n\n// Composables\nimport { useFocus } from '@/composables/focus'\nimport { LoaderSlot, useLoader } from '@/composables/loader'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, ref } from 'vue'\nimport { filterInputAttrs, genericComponent, getUid, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { ComputedRef, Ref } from 'vue'\nimport type { VInputSlots } from '@/components/VInput/VInput'\nimport type { VSelectionControlSlots } from '@/components/VSelectionControl/VSelectionControl'\nimport type { IconValue } from '@/composables/icons'\nimport type { LoaderSlotProps } from '@/composables/loader'\nimport type { GenericProps } from '@/util'\n\nexport type VSwitchSlot = {\n model: Ref<boolean>\n isValid: ComputedRef<boolean | null>\n}\n\nexport type VSwitchSlots =\n & VInputSlots\n & VSelectionControlSlots\n & {\n loader: LoaderSlotProps\n thumb: { icon: IconValue | undefined } & VSwitchSlot\n 'track-false': VSwitchSlot\n 'track-true': VSwitchSlot\n }\n\nexport const makeVSwitchProps = propsFactory({\n indeterminate: Boolean,\n inset: Boolean,\n flat: Boolean,\n loading: {\n type: [Boolean, String],\n default: false,\n },\n\n ...makeVInputProps(),\n ...makeVSelectionControlProps(),\n}, 'VSwitch')\n\nexport const VSwitch = genericComponent<new <T>(\n props: {\n modelValue?: T | null\n 'onUpdate:modelValue'?: (value: T | null) => void\n },\n slots: VSwitchSlots,\n) => GenericProps<typeof props, typeof slots>>()({\n name: 'VSwitch',\n\n inheritAttrs: false,\n\n props: makeVSwitchProps(),\n\n emits: {\n 'update:focused': (focused: boolean) => true,\n 'update:modelValue': (value: any) => true,\n 'update:indeterminate': (value: boolean) => true,\n },\n\n setup (props, { attrs, slots }) {\n const indeterminate = useProxiedModel(props, 'indeterminate')\n const model = useProxiedModel(props, 'modelValue')\n const { loaderClasses } = useLoader(props)\n const { isFocused, focus, blur } = useFocus(props)\n const control = ref<VSelectionControl>()\n\n const loaderColor = computed(() => {\n return typeof props.loading === 'string' && props.loading !== ''\n ? props.loading\n : props.color\n })\n\n const uid = getUid()\n const id = computed(() => props.id || `switch-${uid}`)\n\n function onChange () {\n if (indeterminate.value) {\n indeterminate.value = false\n }\n }\n function onTrackClick (e: Event) {\n e.stopPropagation()\n e.preventDefault()\n control.value?.input?.click()\n }\n\n useRender(() => {\n const [rootAttrs, controlAttrs] = filterInputAttrs(attrs)\n const inputProps = VInput.filterProps(props)\n const controlProps = VSelectionControl.filterProps(props)\n\n return (\n <VInput\n class={[\n 'v-switch',\n { 'v-switch--inset': props.inset },\n { 'v-switch--indeterminate': indeterminate.value },\n loaderClasses.value,\n props.class,\n ]}\n { ...rootAttrs }\n { ...inputProps }\n v-model={ model.value }\n id={ id.value }\n focused={ isFocused.value }\n style={ props.style }\n >\n {{\n ...slots,\n default: ({\n id,\n messagesId,\n isDisabled,\n isReadonly,\n isValid,\n }) => {\n const slotProps = {\n model,\n isValid,\n }\n\n return (\n <VSelectionControl\n ref={ control }\n { ...controlProps }\n v-model={ model.value }\n id={ id.value }\n aria-describedby={ messagesId.value }\n type=\"checkbox\"\n onUpdate:modelValue={ onChange }\n aria-checked={ indeterminate.value ? 'mixed' : undefined }\n disabled={ isDisabled.value }\n readonly={ isReadonly.value }\n onFocus={ focus }\n onBlur={ blur }\n { ...controlAttrs }\n >\n {{\n ...slots,\n default: ({ backgroundColorClasses, backgroundColorStyles }) => (\n <div\n class={[\n 'v-switch__track',\n ...backgroundColorClasses.value,\n ]}\n style={ backgroundColorStyles.value }\n onClick={ onTrackClick }\n >\n { slots['track-true'] && (\n <div key=\"prepend\" class=\"v-switch__track-true\">\n { slots['track-true'](slotProps) }\n </div>\n )}\n\n { slots['track-false'] && (\n <div key=\"append\" class=\"v-switch__track-false\">\n { slots['track-false'](slotProps) }\n </div>\n )}\n </div>\n ),\n input: ({ inputNode, icon, backgroundColorClasses, backgroundColorStyles }) => (\n <>\n { inputNode }\n <div\n class={[\n 'v-switch__thumb',\n { 'v-switch__thumb--filled': icon || props.loading },\n props.inset ? undefined : backgroundColorClasses.value,\n ]}\n style={ props.inset ? undefined : backgroundColorStyles.value }\n >\n { slots.thumb ? (\n <VDefaultsProvider\n defaults={{\n VIcon: {\n icon,\n size: 'x-small',\n },\n }}\n >\n { slots.thumb({ ...slotProps, icon }) }\n </VDefaultsProvider>\n ) : (\n <VScaleTransition>\n { !props.loading ? (\n (icon && (\n <VIcon\n key={ String(icon) }\n icon={ icon }\n size=\"x-small\"\n />\n ))) : (\n <LoaderSlot\n name=\"v-switch\"\n active\n color={ isValid.value === false ? undefined : loaderColor.value }\n >\n { slotProps => (\n slots.loader\n ? slots.loader(slotProps)\n : (\n <VProgressCircular\n active={ slotProps.isActive }\n color={ slotProps.color }\n indeterminate\n size=\"16\"\n width=\"2\"\n />\n )\n )}\n </LoaderSlot>\n )}\n </VScaleTransition>\n )}\n </div>\n </>\n ),\n }}\n </VSelectionControl>\n )\n },\n }}\n </VInput>\n )\n })\n\n return {}\n },\n})\n\nexport type VSwitch = InstanceType<typeof VSwitch>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,gBAAgB;AAAA,SAChBC,iBAAiB;AAAA,SACjBC,KAAK;AAAA,SACLC,eAAe,EAAEC,MAAM;AAAA,SACvBC,iBAAiB;AAAA,SACjBC,0BAA0B,EAAEC,iBAAiB,sDAEtD;AAAA,SACSC,QAAQ;AAAA,SACRC,UAAU,EAAEC,SAAS;AAAA,SACrBC,eAAe,8CAExB;AACA,SAASC,QAAQ,EAAEC,GAAG,QAAQ,KAAK;AAAA,SAC1BC,gBAAgB,EAAEC,gBAAgB,EAAEC,MAAM,EAAEC,YAAY,EAAEC,SAAS,gCAE5E;AAuBA,OAAO,MAAMC,gBAAgB,GAAGF,YAAY,CAAC;EAC3CG,aAAa,EAAEC,OAAO;EACtBC,KAAK,EAAED,OAAO;EACdE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 
28
+ .v-switch__track-true
29
+ margin-inline-end: auto
30
+
31
+ .v-selection-control:not(.v-selection-control--dirty) &
32
+ opacity: 0
33
+
34
+ .v-switch__track-false
35
+ margin-inline-start: auto
36
+
37
+ .v-selection-control--dirty &
38
+ opacity: 0
39
+
28
40
  .v-switch__track
41
+ display: inline-flex
42
+ align-items: center
43
+ font-size: .5rem
44
+ padding: 0 5px
29
45
  background-color: $switch-track-background
30
46
  border-radius: $switch-track-radius
31
47
  height: $switch-track-height
32
48
  opacity: $switch-track-opacity
33
- width: $switch-track-width
49
+ min-width: $switch-track-width
34
50
  cursor: pointer
35
51
  transition: $switch-track-transition
36
52
 
37
53
  .v-switch--inset &
38
54
  border-radius: $switch-inset-track-border-radius
55
+ font-size: .75rem
39
56
  height: $switch-inset-track-height
40
- width: $switch-inset-track-width
57
+ min-width: $switch-inset-track-width
41
58
 
42
59
  .v-switch__thumb
43
60
  align-items: center
44
61
  border-radius: $switch-thumb-radius
45
62
  display: flex
63
+ font-size: .75rem
46
64
  height: $switch-thumb-height
47
65
  justify-content: center
48
66
  width: $switch-thumb-width
@@ -96,8 +96,17 @@ interface LoaderSlotProps {
96
96
  isActive: boolean;
97
97
  }
98
98
 
99
+ type VSwitchSlot = {
100
+ model: Ref<boolean>;
101
+ isValid: ComputedRef<boolean | null>;
102
+ };
99
103
  type VSwitchSlots = VInputSlots & VSelectionControlSlots & {
100
104
  loader: LoaderSlotProps;
105
+ thumb: {
106
+ icon: IconValue | undefined;
107
+ } & VSwitchSlot;
108
+ 'track-false': VSwitchSlot;
109
+ 'track-true': VSwitchSlot;
101
110
  };
102
111
  declare const VSwitch: {
103
112
  new (...args: any[]): vue.CreateComponentPublicInstance<{
@@ -154,7 +163,7 @@ declare const VSwitch: {
154
163
  'update:focused': (focused: boolean) => boolean;
155
164
  'update:modelValue': (value: any) => boolean;
156
165
  'update:indeterminate': (value: boolean) => boolean;
157
- }, "$children" | "v-slot:default" | "v-slots" | "v-slot:append" | "v-slot:prepend" | "modelValue" | "update:modelValue" | "v-slot:loader" | "v-slot:input" | "v-slot:label" | "v-slot:message" | "v-slot:details">, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & {
166
+ }, "$children" | "v-slot:default" | "v-slots" | "v-slot:append" | "v-slot:prepend" | "modelValue" | "update:modelValue" | "v-slot:loader" | "v-slot:input" | "v-slot:label" | "v-slot:message" | "v-slot:details" | "v-slot:thumb" | "v-slot:track-false" | "v-slot:track-true">, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & {
158
167
  flat: boolean;
159
168
  inline: boolean;
160
169
  error: boolean;
@@ -229,8 +238,8 @@ declare const VSwitch: {
229
238
  persistentHint: boolean;
230
239
  }, true, {}, vue.SlotsType<Partial<{
231
240
  default: (arg: VInputSlot & {
232
- backgroundColorClasses: vue.Ref<string[]>;
233
- backgroundColorStyles: vue.Ref<vue.CSSProperties>;
241
+ backgroundColorClasses: Ref<string[]>;
242
+ backgroundColorStyles: Ref<vue.CSSProperties>;
234
243
  }) => vue.VNode<vue.RendererNode, vue.RendererElement, {
235
244
  [key: string]: any;
236
245
  }>[];
@@ -258,6 +267,17 @@ declare const VSwitch: {
258
267
  loader: (arg: LoaderSlotProps) => vue.VNode<vue.RendererNode, vue.RendererElement, {
259
268
  [key: string]: any;
260
269
  }>[];
270
+ thumb: (arg: {
271
+ icon: IconValue | undefined;
272
+ } & VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
273
+ [key: string]: any;
274
+ }>[];
275
+ 'track-false': (arg: VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
276
+ [key: string]: any;
277
+ }>[];
278
+ 'track-true': (arg: VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
279
+ [key: string]: any;
280
+ }>[];
261
281
  }>>, {
262
282
  P: {};
263
283
  B: {};
@@ -396,7 +416,7 @@ declare const VSwitch: {
396
416
  'update:focused': (focused: boolean) => boolean;
397
417
  'update:modelValue': (value: any) => boolean;
398
418
  'update:indeterminate': (value: boolean) => boolean;
399
- }, "$children" | "v-slot:default" | "v-slots" | "v-slot:append" | "v-slot:prepend" | "modelValue" | "update:modelValue" | "v-slot:loader" | "v-slot:input" | "v-slot:label" | "v-slot:message" | "v-slot:details">, string, {
419
+ }, "$children" | "v-slot:default" | "v-slots" | "v-slot:append" | "v-slot:prepend" | "modelValue" | "update:modelValue" | "v-slot:loader" | "v-slot:input" | "v-slot:label" | "v-slot:message" | "v-slot:details" | "v-slot:thumb" | "v-slot:track-false" | "v-slot:track-true">, string, {
400
420
  flat: boolean;
401
421
  inline: boolean;
402
422
  error: boolean;
@@ -421,8 +441,8 @@ declare const VSwitch: {
421
441
  persistentHint: boolean;
422
442
  }, {}, string, vue.SlotsType<Partial<{
423
443
  default: (arg: VInputSlot & {
424
- backgroundColorClasses: vue.Ref<string[]>;
425
- backgroundColorStyles: vue.Ref<vue.CSSProperties>;
444
+ backgroundColorClasses: Ref<string[]>;
445
+ backgroundColorStyles: Ref<vue.CSSProperties>;
426
446
  }) => vue.VNode<vue.RendererNode, vue.RendererElement, {
427
447
  [key: string]: any;
428
448
  }>[];
@@ -450,6 +470,17 @@ declare const VSwitch: {
450
470
  loader: (arg: LoaderSlotProps) => vue.VNode<vue.RendererNode, vue.RendererElement, {
451
471
  [key: string]: any;
452
472
  }>[];
473
+ thumb: (arg: {
474
+ icon: IconValue | undefined;
475
+ } & VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
476
+ [key: string]: any;
477
+ }>[];
478
+ 'track-false': (arg: VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
479
+ [key: string]: any;
480
+ }>[];
481
+ 'track-true': (arg: VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
482
+ [key: string]: any;
483
+ }>[];
453
484
  }>>> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new <T>(props: {
454
485
  modelValue?: T | null | undefined;
455
486
  'onUpdate:modelValue'?: ((value: T | null) => void) | undefined;
@@ -54208,8 +54208,17 @@ declare const VStepperWindowItem: {
54208
54208
  }>>;
54209
54209
  type VStepperWindowItem = InstanceType<typeof VStepperWindowItem>;
54210
54210
 
54211
+ type VSwitchSlot = {
54212
+ model: Ref<boolean>;
54213
+ isValid: ComputedRef<boolean | null>;
54214
+ };
54211
54215
  type VSwitchSlots = VInputSlots & VSelectionControlSlots & {
54212
54216
  loader: LoaderSlotProps;
54217
+ thumb: {
54218
+ icon: IconValue | undefined;
54219
+ } & VSwitchSlot;
54220
+ 'track-false': VSwitchSlot;
54221
+ 'track-true': VSwitchSlot;
54213
54222
  };
54214
54223
  declare const VSwitch: {
54215
54224
  new (...args: any[]): vue.CreateComponentPublicInstance<{
@@ -54266,7 +54275,7 @@ declare const VSwitch: {
54266
54275
  'update:focused': (focused: boolean) => boolean;
54267
54276
  'update:modelValue': (value: any) => boolean;
54268
54277
  'update:indeterminate': (value: boolean) => boolean;
54269
- }, "$children" | "v-slot:default" | "v-slots" | "v-slot:append" | "v-slot:prepend" | "modelValue" | "update:modelValue" | "v-slot:loader" | "v-slot:input" | "v-slot:label" | "v-slot:message" | "v-slot:details">, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & {
54278
+ }, "$children" | "v-slot:default" | "v-slots" | "v-slot:append" | "v-slot:prepend" | "modelValue" | "update:modelValue" | "v-slot:loader" | "v-slot:input" | "v-slot:label" | "v-slot:message" | "v-slot:details" | "v-slot:thumb" | "v-slot:track-false" | "v-slot:track-true">, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & {
54270
54279
  flat: boolean;
54271
54280
  inline: boolean;
54272
54281
  error: boolean;
@@ -54341,8 +54350,8 @@ declare const VSwitch: {
54341
54350
  persistentHint: boolean;
54342
54351
  }, true, {}, vue.SlotsType<Partial<{
54343
54352
  default: (arg: VInputSlot & {
54344
- backgroundColorClasses: vue.Ref<string[]>;
54345
- backgroundColorStyles: vue.Ref<vue.CSSProperties>;
54353
+ backgroundColorClasses: Ref<string[]>;
54354
+ backgroundColorStyles: Ref<vue.CSSProperties>;
54346
54355
  }) => vue.VNode<vue.RendererNode, vue.RendererElement, {
54347
54356
  [key: string]: any;
54348
54357
  }>[];
@@ -54370,6 +54379,17 @@ declare const VSwitch: {
54370
54379
  loader: (arg: LoaderSlotProps) => vue.VNode<vue.RendererNode, vue.RendererElement, {
54371
54380
  [key: string]: any;
54372
54381
  }>[];
54382
+ thumb: (arg: {
54383
+ icon: IconValue | undefined;
54384
+ } & VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
54385
+ [key: string]: any;
54386
+ }>[];
54387
+ 'track-false': (arg: VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
54388
+ [key: string]: any;
54389
+ }>[];
54390
+ 'track-true': (arg: VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
54391
+ [key: string]: any;
54392
+ }>[];
54373
54393
  }>>, {
54374
54394
  P: {};
54375
54395
  B: {};
@@ -54508,7 +54528,7 @@ declare const VSwitch: {
54508
54528
  'update:focused': (focused: boolean) => boolean;
54509
54529
  'update:modelValue': (value: any) => boolean;
54510
54530
  'update:indeterminate': (value: boolean) => boolean;
54511
- }, "$children" | "v-slot:default" | "v-slots" | "v-slot:append" | "v-slot:prepend" | "modelValue" | "update:modelValue" | "v-slot:loader" | "v-slot:input" | "v-slot:label" | "v-slot:message" | "v-slot:details">, string, {
54531
+ }, "$children" | "v-slot:default" | "v-slots" | "v-slot:append" | "v-slot:prepend" | "modelValue" | "update:modelValue" | "v-slot:loader" | "v-slot:input" | "v-slot:label" | "v-slot:message" | "v-slot:details" | "v-slot:thumb" | "v-slot:track-false" | "v-slot:track-true">, string, {
54512
54532
  flat: boolean;
54513
54533
  inline: boolean;
54514
54534
  error: boolean;
@@ -54533,8 +54553,8 @@ declare const VSwitch: {
54533
54553
  persistentHint: boolean;
54534
54554
  }, {}, string, vue.SlotsType<Partial<{
54535
54555
  default: (arg: VInputSlot & {
54536
- backgroundColorClasses: vue.Ref<string[]>;
54537
- backgroundColorStyles: vue.Ref<vue.CSSProperties>;
54556
+ backgroundColorClasses: Ref<string[]>;
54557
+ backgroundColorStyles: Ref<vue.CSSProperties>;
54538
54558
  }) => vue.VNode<vue.RendererNode, vue.RendererElement, {
54539
54559
  [key: string]: any;
54540
54560
  }>[];
@@ -54562,6 +54582,17 @@ declare const VSwitch: {
54562
54582
  loader: (arg: LoaderSlotProps) => vue.VNode<vue.RendererNode, vue.RendererElement, {
54563
54583
  [key: string]: any;
54564
54584
  }>[];
54585
+ thumb: (arg: {
54586
+ icon: IconValue | undefined;
54587
+ } & VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
54588
+ [key: string]: any;
54589
+ }>[];
54590
+ 'track-false': (arg: VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
54591
+ [key: string]: any;
54592
+ }>[];
54593
+ 'track-true': (arg: VSwitchSlot) => vue.VNode<vue.RendererNode, vue.RendererElement, {
54594
+ [key: string]: any;
54595
+ }>[];
54565
54596
  }>>> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new <T>(props: {
54566
54597
  modelValue?: T | null | undefined;
54567
54598
  'onUpdate:modelValue'?: ((value: T | null) => void) | undefined;
@@ -0,0 +1,105 @@
1
+ // Utilities
2
+ import { inject } from 'vue';
3
+ import { mergeDeep, refElement } from "../util/index.mjs"; // Types
4
+ export const GoToSymbol = Symbol.for('vuetify:goto');
5
+ function genDefaults() {
6
+ return {
7
+ container: undefined,
8
+ duration: 300,
9
+ layout: false,
10
+ offset: 0,
11
+ easing: 'easeInOutCubic',
12
+ patterns: {
13
+ linear: t => t,
14
+ easeInQuad: t => t ** 2,
15
+ easeOutQuad: t => t * (2 - t),
16
+ easeInOutQuad: t => t < 0.5 ? 2 * t ** 2 : -1 + (4 - 2 * t) * t,
17
+ easeInCubic: t => t ** 3,
18
+ easeOutCubic: t => --t ** 3 + 1,
19
+ easeInOutCubic: t => t < 0.5 ? 4 * t ** 3 : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1,
20
+ easeInQuart: t => t ** 4,
21
+ easeOutQuart: t => 1 - --t ** 4,
22
+ easeInOutQuart: t => t < 0.5 ? 8 * t ** 4 : 1 - 8 * --t ** 4,
23
+ easeInQuint: t => t ** 5,
24
+ easeOutQuint: t => 1 + --t ** 5,
25
+ easeInOutQuint: t => t < 0.5 ? 16 * t ** 5 : 1 + 16 * --t ** 5
26
+ }
27
+ };
28
+ }
29
+ function getContainer(el) {
30
+ return getTarget(el) ?? (document.scrollingElement || document.body);
31
+ }
32
+ function getTarget(el) {
33
+ return typeof el === 'string' ? document.querySelector(el) : refElement(el);
34
+ }
35
+ function getOffset(target, horizontal, rtl) {
36
+ if (typeof target === 'number') return horizontal && rtl ? -target : target;
37
+ let el = getTarget(target);
38
+ let totalOffset = 0;
39
+ while (el) {
40
+ totalOffset += horizontal ? el.offsetLeft : el.offsetTop;
41
+ el = el.offsetParent;
42
+ }
43
+ return totalOffset;
44
+ }
45
+ export function createGoTo(options, locale) {
46
+ return {
47
+ rtl: locale.isRtl,
48
+ options: mergeDeep(genDefaults(), options)
49
+ };
50
+ }
51
+ async function scrollTo(_target, _options, horizontal, goTo) {
52
+ const options = mergeDeep(goTo?.options, _options);
53
+ const rtl = goTo?.rtl.value;
54
+ const target = (typeof _target === 'number' ? _target : getTarget(_target)) ?? 0;
55
+ const container = options.container === 'parent' && target instanceof HTMLElement ? target.parentElement : getContainer(options.container);
56
+ const ease = typeof options.easing === 'function' ? options.easing : options.patterns[options.easing];
57
+ if (!ease) throw new TypeError(`Easing function "${options.easing}" not found.`);
58
+ let targetLocation;
59
+ if (typeof target === 'number') {
60
+ targetLocation = getOffset(target, horizontal, rtl);
61
+ } else {
62
+ targetLocation = getOffset(target, horizontal, rtl) - getOffset(container, horizontal, rtl);
63
+ if (options.layout) {
64
+ const styles = window.getComputedStyle(target);
65
+ const layoutOffset = styles.getPropertyValue('--v-layout-top');
66
+ if (layoutOffset) targetLocation -= parseInt(layoutOffset, 10);
67
+ }
68
+ }
69
+ targetLocation += options.offset;
70
+ const startLocation = (horizontal ? container.scrollLeft : container.scrollTop) ?? 0;
71
+ if (targetLocation === startLocation) return Promise.resolve(targetLocation);
72
+ const startTime = performance.now();
73
+ return new Promise(resolve => requestAnimationFrame(function step(currentTime) {
74
+ const timeElapsed = currentTime - startTime;
75
+ const progress = Math.abs(options.duration ? Math.min(timeElapsed / options.duration, 1) : 1);
76
+ const location = Math.floor(startLocation + (targetLocation - startLocation) * ease(progress));
77
+ container[horizontal ? 'scrollLeft' : 'scrollTop'] = location;
78
+ if (progress === 1) return resolve(targetLocation);
79
+ let clientSize;
80
+ let reachEnd;
81
+ if (!horizontal) {
82
+ clientSize = container === document.body ? document.documentElement.clientHeight : container.clientHeight;
83
+ reachEnd = clientSize + container.scrollTop >= container.scrollHeight;
84
+ if (targetLocation > container.scrollTop && reachEnd) return resolve(targetLocation);
85
+ } else {
86
+ clientSize = container === document.body ? document.documentElement.clientWidth : container.clientWidth;
87
+ reachEnd = clientSize + container.scrollLeft >= container.scrollWidth;
88
+ if (targetLocation > container.scrollLeft && reachEnd) return resolve(targetLocation);
89
+ }
90
+ requestAnimationFrame(step);
91
+ }));
92
+ }
93
+ export function useGoTo() {
94
+ let _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
95
+ const goTo = inject(GoToSymbol);
96
+ if (!goTo) throw new Error('[Vuetify] Could not find injected goto instance');
97
+ async function go(target, options) {
98
+ return scrollTo(target, mergeDeep(_options, options), false, goTo);
99
+ }
100
+ go.horizontal = async (target, options) => {
101
+ return scrollTo(target, mergeDeep(_options, options), true, goTo);
102
+ };
103
+ return go;
104
+ }
105
+ //# sourceMappingURL=goto.mjs.map