@tb-dev/vue 0.3.21 → 0.3.22

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.
@@ -1,6 +1,8 @@
1
1
  import { Option } from '@tb-dev/utils';
2
2
  import { InputHTMLAttributes } from 'vue';
3
3
  export interface InputProps {
4
+ autocomplete?: InputHTMLAttributes['autocomplete'];
5
+ autofocus?: InputHTMLAttributes['autofocus'];
4
6
  class?: string;
5
7
  disabled?: InputHTMLAttributes['disabled'];
6
8
  label?: string;
@@ -10,6 +12,8 @@ export interface InputProps {
10
12
  modelValue: Option<string>;
11
13
  onBlur?: () => void;
12
14
  placeholder?: InputHTMLAttributes['placeholder'];
15
+ readonly?: InputHTMLAttributes['readonly'];
16
+ required?: InputHTMLAttributes['required'];
13
17
  size?: InputHTMLAttributes['size'];
14
18
  spellcheck?: InputHTMLAttributes['spellcheck'];
15
19
  type?: InputHTMLAttributes['type'];
@@ -1,12 +1,18 @@
1
1
  import { Option } from '@tb-dev/utils';
2
+ import { NumberFieldRootProps } from 'reka-ui';
2
3
  export interface InputNumberProps {
3
4
  class?: string;
4
5
  defaultValue?: number;
5
6
  disabled?: boolean;
6
- formatOptions?: Intl.NumberFormatOptions;
7
+ disableDecrement?: boolean;
8
+ disableIncrement?: boolean;
9
+ disableWheelChange?: NumberFieldRootProps['disableWheelChange'];
10
+ formatOptions?: NumberFieldRootProps['formatOptions'];
7
11
  label?: string;
8
12
  labelClass?: string;
9
- max?: number;
10
- min?: number;
13
+ max?: NumberFieldRootProps['max'];
14
+ min?: NumberFieldRootProps['min'];
11
15
  modelValue: Option<number>;
16
+ step?: NumberFieldRootProps['step'];
17
+ stepSnapping?: NumberFieldRootProps['stepSnapping'];
12
18
  }
@@ -1,5 +1,7 @@
1
1
  import { InputHTMLAttributes } from 'vue';
2
2
  export interface InputTextProps {
3
+ autocomplete?: InputHTMLAttributes['autocomplete'];
4
+ autofocus?: InputHTMLAttributes['autofocus'];
3
5
  class?: string;
4
6
  disabled?: InputHTMLAttributes['disabled'];
5
7
  label?: string;
@@ -8,6 +10,8 @@ export interface InputTextProps {
8
10
  min?: InputHTMLAttributes['minlength'];
9
11
  onBlur?: () => void;
10
12
  placeholder?: InputHTMLAttributes['placeholder'];
13
+ readonly?: InputHTMLAttributes['readonly'];
14
+ required?: InputHTMLAttributes['required'];
11
15
  size?: InputHTMLAttributes['size'];
12
16
  spellcheck?: InputHTMLAttributes['spellcheck'];
13
17
  }
@@ -1,5 +1,8 @@
1
1
  import { Option } from '@tb-dev/utils';
2
+ import { SelectHTMLAttributes } from 'vue';
2
3
  export interface SelectProps {
4
+ autocomplete?: SelectHTMLAttributes['autocomplete'];
5
+ autofocus?: SelectHTMLAttributes['autofocus'];
3
6
  class?: string;
4
7
  contentClass?: string;
5
8
  disabled?: boolean;
@@ -7,5 +10,6 @@ export interface SelectProps {
7
10
  labelClass?: string;
8
11
  modelValue: Option<string>;
9
12
  placeholder?: string;
13
+ required?: boolean;
10
14
  triggerClass?: string;
11
15
  }
@@ -4,8 +4,8 @@ declare const _default: import('vue').DefineComponent<TextareaProps, {}, {}, {},
4
4
  }, string, import('vue').PublicProps, Readonly<TextareaProps> & Readonly<{
5
5
  "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
6
6
  }>, {
7
- spellcheck: boolean | "true" | "false";
8
7
  autocomplete: string;
8
+ spellcheck: boolean | "true" | "false";
9
9
  autocorrect: string;
10
10
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
11
  export default _default;
package/dist/index.js CHANGED
@@ -206,17 +206,17 @@ const _sfc_main$2P = /* @__PURE__ */ defineComponent({
206
206
  return openBlock(), createElementBlock(Fragment, null, [
207
207
  createVNode(unref(DefineTemplate), null, {
208
208
  default: withCtx(() => [
209
- createVNode(unref(_sfc_main$2Q), {
209
+ createVNode(unref(_sfc_main$2Q), mergeProps(_ctx.$attrs, {
210
210
  variant: _ctx.variant,
211
211
  size: _ctx.size,
212
212
  disabled: _ctx.disabled,
213
- class: normalizeClass(unref(cn)("size-full", _ctx.buttonClass))
214
- }, {
213
+ class: unref(cn)("size-full", _ctx.buttonClass)
214
+ }), {
215
215
  default: withCtx(() => [
216
216
  _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_1$i, toDisplayString(_ctx.label), 1)) : renderSlot(_ctx.$slots, "default", { key: 1 })
217
217
  ]),
218
218
  _: 3
219
- }, 8, ["variant", "size", "disabled", "class"])
219
+ }, 16, ["variant", "size", "disabled", "class"])
220
220
  ]),
221
221
  _: 3
222
222
  }),
@@ -653,14 +653,14 @@ const _sfc_main$2C = /* @__PURE__ */ defineComponent({
653
653
  return openBlock(), createElementBlock(Fragment, null, [
654
654
  createVNode(unref(DefineTemplate), null, {
655
655
  default: withCtx(() => [
656
- createVNode(unref(_sfc_main$2D), {
656
+ createVNode(unref(_sfc_main$2D), mergeProps(_ctx.$attrs, {
657
657
  modelValue: value.value,
658
658
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
659
659
  "default-value": _ctx.defaultValue,
660
660
  disabled: _ctx.disabled,
661
661
  required: _ctx.required,
662
- class: normalizeClass(props.class)
663
- }, null, 8, ["modelValue", "default-value", "disabled", "required", "class"])
662
+ class: props.class
663
+ }), null, 16, ["modelValue", "default-value", "disabled", "required", "class"])
664
664
  ]),
665
665
  _: 1
666
666
  }),
@@ -2217,6 +2217,8 @@ const _hoisted_1$b = { class: "w-full" };
2217
2217
  const _sfc_main$1Q = /* @__PURE__ */ defineComponent({
2218
2218
  __name: "Input",
2219
2219
  props: {
2220
+ autocomplete: {},
2221
+ autofocus: {},
2220
2222
  class: {},
2221
2223
  disabled: {},
2222
2224
  label: {},
@@ -2226,6 +2228,8 @@ const _sfc_main$1Q = /* @__PURE__ */ defineComponent({
2226
2228
  modelValue: {},
2227
2229
  onBlur: {},
2228
2230
  placeholder: {},
2231
+ readonly: {},
2232
+ required: {},
2229
2233
  size: {},
2230
2234
  spellcheck: { default: "false" },
2231
2235
  type: { default: "text" }
@@ -2244,19 +2248,23 @@ const _sfc_main$1Q = /* @__PURE__ */ defineComponent({
2244
2248
  return openBlock(), createElementBlock(Fragment, null, [
2245
2249
  createVNode(unref(DefineTemplate), null, {
2246
2250
  default: withCtx(() => [
2247
- createVNode(unref(_sfc_main$1R), {
2251
+ createVNode(unref(_sfc_main$1R), mergeProps(_ctx.$attrs, {
2248
2252
  modelValue: value.value,
2249
2253
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
2250
2254
  type: _ctx.type,
2255
+ autocomplete: _ctx.autocomplete,
2256
+ autofocus: _ctx.autofocus,
2251
2257
  placeholder: _ctx.placeholder,
2252
2258
  disabled: _ctx.disabled,
2253
2259
  maxlength: _ctx.max,
2254
2260
  minlength: _ctx.min,
2261
+ readonly: _ctx.readonly,
2262
+ required: _ctx.required,
2255
2263
  size: _ctx.size,
2256
2264
  spellcheck: _ctx.spellcheck,
2257
- class: normalizeClass(unref(cn)("focus-visible:ring-0 disabled:cursor-default", props.class)),
2265
+ class: unref(cn)("focus-visible:ring-0 disabled:cursor-default", props.class),
2258
2266
  onBlur: _ctx.onBlur
2259
- }, null, 8, ["modelValue", "type", "placeholder", "disabled", "maxlength", "minlength", "size", "spellcheck", "class", "onBlur"])
2267
+ }), null, 16, ["modelValue", "type", "autocomplete", "autofocus", "placeholder", "disabled", "maxlength", "minlength", "readonly", "required", "size", "spellcheck", "class", "onBlur"])
2260
2268
  ]),
2261
2269
  _: 1
2262
2270
  }),
@@ -2433,12 +2441,17 @@ const _sfc_main$1K = /* @__PURE__ */ defineComponent({
2433
2441
  class: {},
2434
2442
  defaultValue: {},
2435
2443
  disabled: { type: Boolean },
2444
+ disableDecrement: { type: Boolean },
2445
+ disableIncrement: { type: Boolean },
2446
+ disableWheelChange: { type: Boolean },
2436
2447
  formatOptions: { default: () => ({ useGrouping: false }) },
2437
2448
  label: {},
2438
2449
  labelClass: {},
2439
2450
  max: {},
2440
2451
  min: {},
2441
- modelValue: {}
2452
+ modelValue: {},
2453
+ step: {},
2454
+ stepSnapping: { type: Boolean }
2442
2455
  },
2443
2456
  emits: ["update:modelValue"],
2444
2457
  setup(__props, { emit: __emit }) {
@@ -2454,28 +2467,35 @@ const _sfc_main$1K = /* @__PURE__ */ defineComponent({
2454
2467
  return openBlock(), createElementBlock(Fragment, null, [
2455
2468
  createVNode(unref(DefineTemplate), null, {
2456
2469
  default: withCtx(() => [
2457
- createVNode(unref(_sfc_main$1P), {
2470
+ createVNode(unref(_sfc_main$1P), mergeProps(_ctx.$attrs, {
2458
2471
  modelValue: value.value,
2459
2472
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
2460
2473
  "default-value": _ctx.defaultValue,
2474
+ disabled: _ctx.disabled,
2475
+ "disable-wheel-change": _ctx.disableWheelChange,
2461
2476
  "format-options": _ctx.formatOptions,
2462
2477
  min: _ctx.min,
2463
2478
  max: _ctx.max,
2464
- disabled: _ctx.disabled,
2465
- class: normalizeClass(unref(cn)("w-full", props.class))
2466
- }, {
2479
+ step: _ctx.step,
2480
+ "step-snapping": _ctx.stepSnapping,
2481
+ class: unref(cn)("w-full", props.class)
2482
+ }), {
2467
2483
  default: withCtx(() => [
2468
2484
  createVNode(unref(_sfc_main$1O), null, {
2469
2485
  default: withCtx(() => [
2470
- createVNode(unref(_sfc_main$1N)),
2486
+ createVNode(unref(_sfc_main$1N), {
2487
+ disabled: _ctx.disabled || _ctx.disableDecrement
2488
+ }, null, 8, ["disabled"]),
2471
2489
  createVNode(unref(_sfc_main$1L)),
2472
- createVNode(unref(_sfc_main$1M))
2490
+ createVNode(unref(_sfc_main$1M), {
2491
+ disabled: _ctx.disabled || _ctx.disableIncrement
2492
+ }, null, 8, ["disabled"])
2473
2493
  ]),
2474
2494
  _: 1
2475
2495
  })
2476
2496
  ]),
2477
2497
  _: 1
2478
- }, 8, ["modelValue", "default-value", "format-options", "min", "max", "disabled", "class"])
2498
+ }, 16, ["modelValue", "default-value", "disabled", "disable-wheel-change", "format-options", "min", "max", "step", "step-snapping", "class"])
2479
2499
  ]),
2480
2500
  _: 1
2481
2501
  }),
@@ -2497,6 +2517,8 @@ const _sfc_main$1K = /* @__PURE__ */ defineComponent({
2497
2517
  const _sfc_main$1J = /* @__PURE__ */ defineComponent({
2498
2518
  __name: "InputText",
2499
2519
  props: /* @__PURE__ */ mergeModels({
2520
+ autocomplete: {},
2521
+ autofocus: {},
2500
2522
  class: {},
2501
2523
  disabled: {},
2502
2524
  label: {},
@@ -2505,6 +2527,8 @@ const _sfc_main$1J = /* @__PURE__ */ defineComponent({
2505
2527
  min: {},
2506
2528
  onBlur: {},
2507
2529
  placeholder: {},
2530
+ readonly: {},
2531
+ required: {},
2508
2532
  size: {},
2509
2533
  spellcheck: { default: "false" }
2510
2534
  }, {
@@ -2516,11 +2540,13 @@ const _sfc_main$1J = /* @__PURE__ */ defineComponent({
2516
2540
  const props = __props;
2517
2541
  const value = useModel(__props, "modelValue");
2518
2542
  return (_ctx, _cache) => {
2519
- return openBlock(), createBlock(unref(_sfc_main$1Q), {
2543
+ return openBlock(), createBlock(unref(_sfc_main$1Q), mergeProps(_ctx.$attrs, {
2520
2544
  modelValue: value.value,
2521
2545
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
2522
2546
  type: "text",
2523
- class: normalizeClass(props.class),
2547
+ class: props.class,
2548
+ autocomplete: _ctx.autocomplete,
2549
+ autofocus: _ctx.autofocus,
2524
2550
  disabled: _ctx.disabled,
2525
2551
  label: _ctx.label,
2526
2552
  "label-class": _ctx.labelClass,
@@ -2528,9 +2554,11 @@ const _sfc_main$1J = /* @__PURE__ */ defineComponent({
2528
2554
  min: _ctx.min,
2529
2555
  "on-blur": _ctx.onBlur,
2530
2556
  placeholder: _ctx.placeholder,
2557
+ readonly: _ctx.readonly,
2558
+ required: _ctx.required,
2531
2559
  size: _ctx.size,
2532
2560
  spellcheck: _ctx.spellcheck
2533
- }, null, 8, ["modelValue", "class", "disabled", "label", "label-class", "max", "min", "on-blur", "placeholder", "size", "spellcheck"]);
2561
+ }), null, 16, ["modelValue", "class", "autocomplete", "autofocus", "disabled", "label", "label-class", "max", "min", "on-blur", "placeholder", "readonly", "required", "size", "spellcheck"]);
2534
2562
  };
2535
2563
  }
2536
2564
  });
@@ -3887,6 +3915,8 @@ const _hoisted_2$1 = { class: "w-full" };
3887
3915
  const _sfc_main$12 = /* @__PURE__ */ defineComponent({
3888
3916
  __name: "Select",
3889
3917
  props: {
3918
+ autocomplete: {},
3919
+ autofocus: {},
3890
3920
  class: {},
3891
3921
  contentClass: {},
3892
3922
  disabled: { type: Boolean },
@@ -3894,6 +3924,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
3894
3924
  labelClass: {},
3895
3925
  modelValue: {},
3896
3926
  placeholder: {},
3927
+ required: { type: Boolean },
3897
3928
  triggerClass: {}
3898
3929
  },
3899
3930
  emits: ["update:modelValue"],
@@ -3911,13 +3942,15 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
3911
3942
  createVNode(unref(DefineTemplate), null, {
3912
3943
  default: withCtx(() => [
3913
3944
  createElementVNode("div", _hoisted_1$5, [
3914
- createVNode(unref(_sfc_main$1d), {
3945
+ createVNode(unref(_sfc_main$1d), mergeProps(_ctx.$attrs, {
3915
3946
  modelValue: value.value,
3916
3947
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
3948
+ autocomplete: _ctx.autocomplete,
3949
+ autofocus: _ctx.autofocus,
3917
3950
  disabled: _ctx.disabled,
3918
- autocomplete: "off",
3919
- class: normalizeClass(props.class)
3920
- }, {
3951
+ required: _ctx.required,
3952
+ class: props.class
3953
+ }), {
3921
3954
  default: withCtx(() => [
3922
3955
  createVNode(unref(_sfc_main$14), {
3923
3956
  class: normalizeClass(unref(cn)("w-full", _ctx.triggerClass))
@@ -3937,7 +3970,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
3937
3970
  }, 8, ["class"])
3938
3971
  ]),
3939
3972
  _: 3
3940
- }, 8, ["modelValue", "disabled", "class"]),
3973
+ }, 16, ["modelValue", "autocomplete", "autofocus", "disabled", "required", "class"]),
3941
3974
  renderSlot(_ctx.$slots, "action")
3942
3975
  ])
3943
3976
  ]),
@@ -5313,12 +5346,12 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
5313
5346
  return openBlock(), createElementBlock(Fragment, null, [
5314
5347
  createVNode(unref(DefineTemplate), null, {
5315
5348
  default: withCtx(() => [
5316
- createVNode(unref(_sfc_main$p), {
5349
+ createVNode(unref(_sfc_main$p), mergeProps(_ctx.$attrs, {
5317
5350
  modelValue: toggled.value,
5318
5351
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => toggled.value = $event),
5319
5352
  disabled: _ctx.disabled,
5320
- class: normalizeClass(props.class)
5321
- }, createSlots({ _: 2 }, [
5353
+ class: props.class
5354
+ }), createSlots({ _: 2 }, [
5322
5355
  _ctx.$slots.thumb ? {
5323
5356
  name: "thumb",
5324
5357
  fn: withCtx(() => [
@@ -5326,7 +5359,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
5326
5359
  ]),
5327
5360
  key: "0"
5328
5361
  } : void 0
5329
- ]), 1032, ["modelValue", "disabled", "class"])
5362
+ ]), 1040, ["modelValue", "disabled", "class"])
5330
5363
  ]),
5331
5364
  _: 3
5332
5365
  }),
@@ -5970,7 +6003,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5970
6003
  return openBlock(), createElementBlock(Fragment, null, [
5971
6004
  createVNode(unref(DefineTemplate), null, {
5972
6005
  default: withCtx(() => [
5973
- createVNode(unref(_sfc_main$3), {
6006
+ createVNode(unref(_sfc_main$3), mergeProps(_ctx.$attrs, {
5974
6007
  modelValue: value.value,
5975
6008
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
5976
6009
  autocapitalize: _ctx.autocapitalize,
@@ -5986,14 +6019,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5986
6019
  required: _ctx.required,
5987
6020
  rows: _ctx.rows,
5988
6021
  spellcheck: _ctx.spellcheck,
5989
- class: normalizeClass(
5990
- unref(cn)(
5991
- "size-full resize-none font-normal focus-visible:ring-0 disabled:cursor-default",
5992
- props.class
5993
- )
6022
+ class: unref(cn)(
6023
+ "size-full resize-none font-normal focus-visible:ring-0 disabled:cursor-default",
6024
+ props.class
5994
6025
  ),
5995
6026
  onBlur: _ctx.onBlur
5996
- }, null, 8, ["modelValue", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "cols", "disabled", "maxlength", "minlength", "placeholder", "readonly", "required", "rows", "spellcheck", "class", "onBlur"])
6027
+ }), null, 16, ["modelValue", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "cols", "disabled", "maxlength", "minlength", "placeholder", "readonly", "required", "rows", "spellcheck", "class", "onBlur"])
5997
6028
  ]),
5998
6029
  _: 1
5999
6030
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/vue",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "description": "Vue utilities",
5
5
  "license": "MIT",
6
6
  "type": "module",