@onereach/ui-components 13.2.2 → 13.2.3-beta.4665.0

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 (29) hide show
  1. package/dist/bundled/v2/components/OrTextareaV3/OrTextarea.js +30 -13
  2. package/dist/bundled/v2/components/OrTextareaV3/OrTextarea.vue.d.ts +15 -8
  3. package/dist/bundled/v2/components/OrTextareaV3/styles.js +2 -4
  4. package/dist/bundled/v2/components/OrTextareaV3/types.d.ts +4 -0
  5. package/dist/bundled/v2/index.js +1 -1
  6. package/dist/bundled/v3/components/OrTextareaV3/OrTextarea.js +1 -1
  7. package/dist/bundled/v3/components/OrTextareaV3/OrTextarea.vue.d.ts +15 -8
  8. package/dist/bundled/v3/components/OrTextareaV3/index.js +1 -1
  9. package/dist/bundled/v3/components/OrTextareaV3/styles.js +1 -1
  10. package/dist/bundled/v3/components/OrTextareaV3/types.d.ts +4 -0
  11. package/dist/bundled/v3/components/{OrTextareaV3-b142dda2.js → OrTextareaV3-12467615.js} +31 -16
  12. package/dist/bundled/v3/components/index.js +1 -1
  13. package/dist/bundled/v3/index.js +2 -2
  14. package/dist/esm/v2/{OrTextarea-899e5220.js → OrTextarea-ef4fd48a.js} +32 -17
  15. package/dist/esm/v2/components/index.js +1 -1
  16. package/dist/esm/v2/components/or-textarea-v3/OrTextarea.vue.d.ts +15 -8
  17. package/dist/esm/v2/components/or-textarea-v3/index.js +2 -1
  18. package/dist/esm/v2/components/or-textarea-v3/types.d.ts +4 -0
  19. package/dist/esm/v2/index.js +1 -1
  20. package/dist/esm/v3/{OrTextarea-76c037a9.js → OrTextarea-f9cbc1c3.js} +31 -16
  21. package/dist/esm/v3/components/index.js +1 -1
  22. package/dist/esm/v3/components/or-textarea-v3/OrTextarea.vue.d.ts +15 -8
  23. package/dist/esm/v3/components/or-textarea-v3/index.js +2 -1
  24. package/dist/esm/v3/components/or-textarea-v3/types.d.ts +4 -0
  25. package/dist/esm/v3/index.js +1 -1
  26. package/package.json +2 -3
  27. package/src/components/or-textarea-v3/OrTextarea.vue +33 -9
  28. package/src/components/or-textarea-v3/styles.ts +8 -5
  29. package/src/components/or-textarea-v3/types.ts +5 -0
@@ -1 +1 @@
1
- export { s as default } from '../OrTextareaV3-b142dda2.js';
1
+ export { s as default } from '../OrTextareaV3-12467615.js';
@@ -1,6 +1,6 @@
1
1
  import { PropType } from 'vue-demi';
2
2
  import { InputBoxSize } from '../or-input-box-v3';
3
- import { TextareaModelValue } from './types';
3
+ import { TextareaModelValue, TextareaRows } from './types';
4
4
  declare const _default: import("vue-demi").DefineComponent<{
5
5
  modelValue: {
6
6
  type: PropType<TextareaModelValue>;
@@ -22,9 +22,9 @@ declare const _default: import("vue-demi").DefineComponent<{
22
22
  type: PropType<"m" | "s">;
23
23
  default: () => InputBoxSize;
24
24
  };
25
- maxHeight: {
26
- type: StringConstructor;
27
- default: undefined;
25
+ rows: {
26
+ type: PropType<TextareaRows>;
27
+ default: number;
28
28
  };
29
29
  label: {
30
30
  type: StringConstructor;
@@ -72,6 +72,13 @@ declare const _default: import("vue-demi").DefineComponent<{
72
72
  rootStyles: import("vue-demi").ComputedRef<string[]>;
73
73
  control: import("vue-demi").Ref<HTMLTextAreaElement | undefined>;
74
74
  controlStyles: import("vue-demi").ComputedRef<string[]>;
75
+ controlInlineStyles: import("vue-demi").ComputedRef<{
76
+ minHeight: string;
77
+ maxHeight: string | undefined;
78
+ } | {
79
+ minHeight?: undefined;
80
+ maxHeight?: undefined;
81
+ }>;
75
82
  model: import("../../hooks").UseProxyModelValueReturn<string>;
76
83
  length: import("vue-demi").ComputedRef<number>;
77
84
  maxLength: import("vue-demi").ComputedRef<number | undefined>;
@@ -98,9 +105,9 @@ declare const _default: import("vue-demi").DefineComponent<{
98
105
  type: PropType<"m" | "s">;
99
106
  default: () => InputBoxSize;
100
107
  };
101
- maxHeight: {
102
- type: StringConstructor;
103
- default: undefined;
108
+ rows: {
109
+ type: PropType<TextareaRows>;
110
+ default: number;
104
111
  };
105
112
  label: {
106
113
  type: StringConstructor;
@@ -143,7 +150,7 @@ declare const _default: import("vue-demi").DefineComponent<{
143
150
  autocomplete: string;
144
151
  variant: "styled" | "unstyled" | "embedded";
145
152
  size: "m" | "s";
146
- maxHeight: string;
153
+ rows: TextareaRows;
147
154
  label: string;
148
155
  placeholder: string;
149
156
  hint: string;
@@ -1 +1 @@
1
- export { s as OrTextareaV3 } from '../OrTextareaV3-b142dda2.js';
1
+ export { s as OrTextareaV3 } from '../OrTextareaV3-12467615.js';
@@ -1,2 +1,2 @@
1
1
  import '../OrInputBoxV3-efe30bd8.js';
2
- export { T as Textarea, a as TextareaControl, b as TextareaControlSizes } from '../OrTextareaV3-b142dda2.js';
2
+ export { T as Textarea, a as TextareaControl, b as TextareaControlSizes } from '../OrTextareaV3-12467615.js';
@@ -1,2 +1,6 @@
1
1
  import { ModelValue } from '../../types';
2
2
  export type TextareaModelValue = ModelValue<string>;
3
+ export type TextareaRows = number | {
4
+ min: number;
5
+ max?: number;
6
+ };
@@ -9,6 +9,7 @@ import { s as script$4 } from './OrLabelV3-2715e117.js';
9
9
  import { useIdAttribute } from '../hooks/useIdAttribute.js';
10
10
  import { useControlAttributes } from '../hooks/useControlAttributes.js';
11
11
  import { useValidationAttributes } from '../hooks/useValidationAttributes.js';
12
+ import { isObject } from '../utils/isObject.js';
12
13
  import { useProxyModelValue } from '../hooks/useProxyModelValue.js';
13
14
 
14
15
  const Textarea = [
@@ -17,8 +18,6 @@ const Textarea = [
17
18
  // Spacing
18
19
  'gap-xs'];
19
20
  const TextareaControl = [
20
- // Interactivity
21
- 'resize-none',
22
21
  // Box
23
22
  'w-full',
24
23
  // Typography
@@ -28,10 +27,10 @@ const TextareaControl = [
28
27
  const TextareaControlSizes = {
29
28
  [InputBoxSize.M]: [
30
29
  // Spacing
31
- 'pt-sm+* md:pt-sm*'],
30
+ '!mx-0', 'px-md md:px-sm+', 'py-sm+* md:py-sm*'],
32
31
  [InputBoxSize.S]: [
33
32
  // Spacing
34
- 'pt-sm*']
33
+ '!mx-0', 'px-md md:px-sm+', 'py-sm*']
35
34
  };
36
35
 
37
36
  var script = defineComponent({
@@ -67,9 +66,9 @@ var script = defineComponent({
67
66
  type: String,
68
67
  default: () => InputBoxSize.M
69
68
  },
70
- maxHeight: {
71
- type: String,
72
- default: undefined
69
+ rows: {
70
+ type: [Number, Object],
71
+ default: 2
73
72
  },
74
73
  label: {
75
74
  type: String,
@@ -112,7 +111,19 @@ var script = defineComponent({
112
111
  const root = ref();
113
112
  const rootStyles = computed(() => ['or-textarea-v3', ...Textarea, ...(props.variant === InputBoxVariant.Embedded ? ['grow'] : [])]);
114
113
  const control = ref();
115
- const controlStyles = computed(() => [...TextareaControl, ...TextareaControlSizes[props.size]]);
114
+ const controlStyles = computed(() => [...TextareaControl, ...TextareaControlSizes[props.size], ...(isObject(props.rows) ? ['resize-none'] : [])]);
115
+ const controlInlineStyles = computed(() => {
116
+ if (control.value) {
117
+ const paddingTop = Number(getComputedStyle(control.value).getPropertyValue('padding-top').match(/^(?<value>\d+)px$/).groups.value);
118
+ const paddingBottom = Number(getComputedStyle(control.value).getPropertyValue('padding-bottom').match(/^(?<value>\d+)px$/).groups.value);
119
+ const lineHeight = Number(getComputedStyle(control.value).getPropertyValue('line-height').match(/^(?<value>\d+)px$/).groups.value);
120
+ return {
121
+ minHeight: `${paddingTop + paddingBottom + (isObject(props.rows) ? props.rows.min : props.rows) * lineHeight}px`,
122
+ maxHeight: isObject(props.rows) && props.rows.max ? `${paddingTop + paddingBottom + props.rows.max * lineHeight}px` : undefined
123
+ };
124
+ }
125
+ return {};
126
+ });
116
127
  // State
117
128
  const model = useProxyModelValue(toRef(props, 'modelValue'), context.emit, {
118
129
  defaultValue: ref('')
@@ -134,16 +145,21 @@ var script = defineComponent({
134
145
  (_a = control.value) === null || _a === void 0 ? void 0 : _a.blur();
135
146
  }
136
147
  // Effects
137
- useTextareaAutosize({
138
- element: control,
139
- input: model
140
- });
148
+ if (isObject(props.rows)) {
149
+ // Unluckily, `useTextareaAutosize` doesn't have a teardown function
150
+ // So, dynamically changed `rows` won't have any effect
151
+ useTextareaAutosize({
152
+ element: control,
153
+ input: model
154
+ });
155
+ }
141
156
  return {
142
157
  attributes,
143
158
  root,
144
159
  rootStyles,
145
160
  control,
146
161
  controlStyles,
162
+ controlInlineStyles,
147
163
  model,
148
164
  length,
149
165
  maxLength,
@@ -153,7 +169,7 @@ var script = defineComponent({
153
169
  }
154
170
  });
155
171
 
156
- const _hoisted_1 = ["name", "autocomplete", "placeholder", "required", "readonly", "disabled"];
172
+ const _hoisted_1 = ["name", "rows", "autocomplete", "placeholder", "required", "readonly", "disabled"];
157
173
  function render(_ctx, _cache, $props, $setup, $data, $options) {
158
174
  const _component_OrLabel = resolveComponent("OrLabel");
159
175
  const _component_OrInputBox = resolveComponent("OrInputBox");
@@ -184,10 +200,9 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
184
200
  }, _ctx.attributes, {
185
201
  "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.model = $event),
186
202
  class: _ctx.controlStyles,
187
- style: {
188
- maxHeight: _ctx.maxHeight
189
- },
203
+ style: _ctx.controlInlineStyles,
190
204
  name: _ctx.name,
205
+ rows: _ctx.rows,
191
206
  autocomplete: _ctx.autocomplete,
192
207
  placeholder: _ctx.placeholder,
193
208
  required: _ctx.required,
@@ -115,7 +115,7 @@ export { s as OrTeleport } from './OrTeleport-5a34b07f.js';
115
115
  export { default as OrTeleportV3 } from './OrTeleportV3/OrTeleport.js';
116
116
  export { s as OrTextV3 } from './OrTextV3-f2e88ff5.js';
117
117
  export { default as OrTextarea } from './OrTextarea/OrTextarea.js';
118
- export { s as OrTextareaV3 } from './OrTextareaV3-b142dda2.js';
118
+ export { s as OrTextareaV3 } from './OrTextareaV3-12467615.js';
119
119
  export { OrTextbox, TextboxTypes } from './OrTextbox/index.js';
120
120
  export { s as OrTimeFormatV3 } from './OrTimeFormatV3-1a3d7a38.js';
121
121
  export { s as OrTimePickerV3 } from './OrTimePickerV3-cc7dd81b.js';