@toife/vue 3.1.4 → 3.1.6

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 (104) hide show
  1. package/README.md +1 -1
  2. package/package.json +4 -4
  3. package/src/components/action/action.scss +2 -2
  4. package/src/components/action/action.vue +5 -5
  5. package/src/components/app/app.scss +3 -3
  6. package/src/components/app/app.type.ts +0 -6
  7. package/src/components/app/app.vue +2 -8
  8. package/src/components/avatar/avatar.scss +4 -3
  9. package/src/components/avatar/avatar.vue +6 -6
  10. package/src/components/button/button.scss +29 -21
  11. package/src/components/button/button.type.ts +2 -4
  12. package/src/components/button/button.vue +7 -7
  13. package/src/components/cable/cable.vue +2 -2
  14. package/src/components/card/card/card.scss +3 -3
  15. package/src/components/card/card/card.vue +5 -5
  16. package/src/components/card/card-body/card-body.scss +3 -3
  17. package/src/components/card/card-body/card-body.vue +2 -2
  18. package/src/components/card/card-footer/card-footer.scss +4 -4
  19. package/src/components/card/card-footer/card-footer.vue +2 -2
  20. package/src/components/card/card-header/card-header.scss +4 -4
  21. package/src/components/card/card-header/card-header.vue +2 -2
  22. package/src/components/checkbox/checkbox.html +1 -1
  23. package/src/components/checkbox/checkbox.scss +19 -14
  24. package/src/components/checkbox/checkbox.type.ts +1 -3
  25. package/src/components/checkbox/checkbox.vue +7 -7
  26. package/src/components/collapse/collapse.html +1 -1
  27. package/src/components/collapse/collapse.scss +4 -7
  28. package/src/components/collapse/collapse.vue +9 -9
  29. package/src/components/container/container.vue +2 -2
  30. package/src/components/decision-modal/decision-modal.scss +11 -11
  31. package/src/components/decision-modal/decision-modal.vue +8 -8
  32. package/src/components/divider/divider.scss +3 -3
  33. package/src/components/divider/divider.vue +4 -4
  34. package/src/components/dropdown/dropdown.scss +4 -4
  35. package/src/components/dropdown/dropdown.type.ts +2 -2
  36. package/src/components/dropdown/dropdown.vue +7 -9
  37. package/src/components/field/field.html +28 -9
  38. package/src/components/field/{outline/outline.scss → field.scss} +29 -125
  39. package/src/components/field/field.type.ts +4 -4
  40. package/src/components/field/field.vue +83 -46
  41. package/src/components/field/index.ts +1 -1
  42. package/src/components/form-group/form-group.vue +2 -2
  43. package/src/components/gesture-indicator/gesture-indicator.scss +2 -2
  44. package/src/components/gesture-indicator/gesture-indicator.vue +4 -4
  45. package/src/components/image/image.vue +12 -5
  46. package/src/components/layout/flex/flex.vue +8 -8
  47. package/src/components/layout/flex-item/flex-item.vue +6 -6
  48. package/src/components/layout/grid/grid.vue +6 -6
  49. package/src/components/layout/grid-item/grid-item.vue +6 -6
  50. package/src/components/modal/modal.scss +2 -2
  51. package/src/components/modal/modal.vue +68 -5
  52. package/src/components/page/page.vue +2 -2
  53. package/src/components/present/present.scss +4 -4
  54. package/src/components/present/present.vue +14 -14
  55. package/src/components/radio/radio/radio.html +1 -1
  56. package/src/components/radio/radio/radio.scss +19 -14
  57. package/src/components/radio/radio/radio.type.ts +1 -3
  58. package/src/components/radio/radio/radio.vue +6 -6
  59. package/src/components/radio/radio-group/radio-group.vue +2 -2
  60. package/src/components/refresher/refresher.html +0 -3
  61. package/src/components/refresher/refresher.scss +1 -25
  62. package/src/components/refresher/refresher.vue +2 -16
  63. package/src/components/route/route-navigator/route-navigator.html +1 -1
  64. package/src/components/route/route-navigator/route-navigator.scss +3 -3
  65. package/src/components/route/route-navigator/route-navigator.vue +11 -14
  66. package/src/components/route/route-wrapper/route-wrapper.composable.ts +5 -15
  67. package/src/components/route/route-wrapper/route-wrapper.type.ts +0 -4
  68. package/src/components/route/route-wrapper/route-wrapper.vue +4 -12
  69. package/src/components/route/route.type.ts +0 -1
  70. package/src/components/segmented-field/segmented-field.html +1 -1
  71. package/src/components/segmented-field/segmented-field.scss +3 -3
  72. package/src/components/segmented-field/segmented-field.vue +8 -8
  73. package/src/components/select/select.html +2 -2
  74. package/src/components/select/select.scss +11 -11
  75. package/src/components/select/select.vue +10 -10
  76. package/src/components/skeleton/skeleton.scss +1 -1
  77. package/src/components/skeleton/skeleton.vue +7 -7
  78. package/src/components/slide-range/slide-range.html +3 -4
  79. package/src/components/slide-range/slide-range.scss +17 -14
  80. package/src/components/slide-range/slide-range.vue +17 -16
  81. package/src/components/switch/switch.html +1 -1
  82. package/src/components/switch/switch.scss +23 -21
  83. package/src/components/switch/switch.type.ts +2 -3
  84. package/src/components/switch/switch.vue +23 -9
  85. package/src/components/tabs/tab/tab.html +1 -1
  86. package/src/components/tabs/tab/tab.scss +13 -0
  87. package/src/components/tabs/tab/tab.vue +4 -2
  88. package/src/components/tabs/tabs/index.ts +1 -0
  89. package/src/components/tabs/tabs/tabs.scss +82 -54
  90. package/src/components/tabs/tabs/tabs.type.ts +4 -1
  91. package/src/components/tabs/tabs/tabs.vue +47 -23
  92. package/src/components/toast/toast/toast.scss +1 -1
  93. package/src/components/toast/toast/toast.vue +2 -2
  94. package/src/components/toast/toast-content/toast-content.scss +4 -4
  95. package/src/components/toast/toast-content/toast-content.vue +5 -5
  96. package/src/components/toolbar/toolbar.scss +4 -4
  97. package/src/components/toolbar/toolbar.vue +5 -5
  98. package/src/factory.ts +105 -51
  99. package/src/type.ts +2 -1
  100. package/src/utils/style/index.ts +9 -9
  101. package/src/utils/style.md +9 -9
  102. package/src/components/field/outline/index.ts +0 -1
  103. package/src/components/field/outline/outline.html +0 -36
  104. package/src/components/field/outline/outline.vue +0 -286
@@ -3,7 +3,7 @@
3
3
  <script lang="ts" setup>
4
4
  import { computed, inject, ref } from "vue";
5
5
  import type { CheckboxProps, CheckboxEmit } from "./checkbox.type";
6
- import { withPrefix } from "../../utils";
6
+ import { cssPrefix } from "../../utils";
7
7
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
8
8
 
9
9
  // Component setup (props, emits, injects)
@@ -32,11 +32,11 @@ const checkboxAttrs = computed(() => {
32
32
  const shadow = (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
33
33
  return {
34
34
  class: [
35
- withPrefix(["layer", "checkbox"]),
36
- withPrefix(["role", role]),
37
- withPrefix(["shape", shape]),
38
- withPrefix(["size", props.size]),
39
- withPrefix("checkbox"),
35
+ cssPrefix(["layer", "checkbox"]),
36
+ cssPrefix(["role", role]),
37
+ cssPrefix(["shape", shape]),
38
+ cssPrefix(["size", props.size]),
39
+ cssPrefix("checkbox"),
40
40
  props.variant,
41
41
  {
42
42
  on: props.modelValue,
@@ -50,7 +50,7 @@ const checkboxAttrs = computed(() => {
50
50
  });
51
51
 
52
52
  const checkboxIconAttrs = {
53
- class: [withPrefix("checkbox-icon")],
53
+ class: [cssPrefix("checkbox-icon")],
54
54
  } as const;
55
55
 
56
56
  // Methods
@@ -3,7 +3,7 @@
3
3
  v-bind="triggerAttrs"
4
4
  role="button"
5
5
  tabindex="0"
6
- @click="toggle"
6
+ @pointerup="toggle"
7
7
  @keydown.enter.space.prevent="toggle"
8
8
  >
9
9
  <slot name="trigger" />
@@ -8,19 +8,16 @@ $collapse-content-inner: sass.fn-naming-prefix("collapse-content-inner");
8
8
 
9
9
  // Property name - layer: collapse
10
10
  $collapse-height: sass.fn-naming-dvar(("collapse", "height"), 0);
11
- $collapse-duration: sass.fn-naming-dvar(
12
- ("collapse", "duration"),
13
- sass.fn-naming-var("motion", "duration")
14
- );
11
+ $collapse-duration: sass.fn-naming-dvar(("collapse", "duration"), sass.fn-naming-var("duration"));
15
12
 
16
13
  $collapse-background-color: sass.fn-naming-var("collapse", "background-color");
17
14
  $collapse-color: sass.fn-naming-var("collapse", "color");
18
- $transition-duration: sass.fn-naming-var("motion", "duration");
15
+ $transition-duration: sass.fn-naming-var("duration");
19
16
 
20
17
  // Collapse
21
18
  .#{$collapse} {
22
- background-color: rgb(#{$collapse-background-color});
23
- color: rgb(#{$collapse-color});
19
+ background-color: rgba(#{$collapse-background-color});
20
+ color: rgba(#{$collapse-color});
24
21
  transition:
25
22
  background-color #{$transition-duration} ease,
26
23
  color #{$transition-duration} ease;
@@ -3,7 +3,7 @@
3
3
  <script lang="ts" setup>
4
4
  import { computed, inject, nextTick, onMounted, ref, watch } from "vue";
5
5
  import type { CollapseEmit, CollapseProps } from "./collapse.type";
6
- import { withPrefix, property } from "../../utils";
6
+ import { cssPrefix, cssProperty } from "../../utils";
7
7
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
8
8
 
9
9
  // Component setup (props, emits, injects)
@@ -36,9 +36,9 @@ const durationCss = computed(() =>
36
36
  const wrapperAttrs = computed(() => {
37
37
  return {
38
38
  class: [
39
- withPrefix(["layer", "collapse"]),
40
- withPrefix(["role", role.value]),
41
- withPrefix("collapse"),
39
+ cssPrefix(["layer", "collapse"]),
40
+ cssPrefix(["role", role.value]),
41
+ cssPrefix("collapse"),
42
42
  {
43
43
  open: isOpen.value,
44
44
  disabled: props.disabled,
@@ -49,7 +49,7 @@ const wrapperAttrs = computed(() => {
49
49
 
50
50
  const triggerAttrs = computed(() => {
51
51
  return {
52
- class: [withPrefix("collapse-trigger")],
52
+ class: [cssPrefix("collapse-trigger")],
53
53
  "aria-expanded": isOpen.value,
54
54
  "aria-disabled": props.disabled,
55
55
  };
@@ -57,15 +57,15 @@ const triggerAttrs = computed(() => {
57
57
 
58
58
  const contentAttrs = computed(() => {
59
59
  return {
60
- class: [withPrefix("collapse-content")],
60
+ class: [cssPrefix("collapse-content")],
61
61
  style: {
62
- [property("collapse-duration")]: durationCss.value || undefined,
63
- [property("collapse-height")]: isOpen.value ? `${contentHeight.value}px` : "0px",
62
+ [cssProperty("collapse-duration")]: durationCss.value || undefined,
63
+ [cssProperty("collapse-height")]: isOpen.value ? `${contentHeight.value}px` : "0px",
64
64
  },
65
65
  };
66
66
  });
67
67
 
68
- const contentInnerClass = computed(() => withPrefix("collapse-content-inner"));
68
+ const contentInnerClass = computed(() => cssPrefix("collapse-content-inner"));
69
69
 
70
70
  // Methods
71
71
  // ----------------------------------------------------------------------------
@@ -1,10 +1,10 @@
1
1
  <style lang="scss" src="./container.scss" scoped></style>
2
2
  <template src="./container.html"></template>
3
3
  <script lang="ts" setup>
4
- import { withPrefix } from "../../utils";
4
+ import { cssPrefix } from "../../utils";
5
5
 
6
6
  // Static layout wrapper classes
7
7
  const containerAttrs = {
8
- class: [withPrefix("container")],
8
+ class: [cssPrefix("container")],
9
9
  } as const;
10
10
  </script>
@@ -9,9 +9,9 @@ $button: sass.fn-naming-prefix("button");
9
9
  $shape-pill: sass.fn-naming-prefix("shape-pill");
10
10
 
11
11
  // Property name - layer: decision-modal
12
- $decision-modal-background-color: sass.fn-naming-var("decision-modal", "background-color");
13
- $decision-modal-border-color: sass.fn-naming-var("decision-modal", "border-color");
14
- $decision-modal-color: sass.fn-naming-var("decision-modal", "color");
12
+ $decision-modal-background-color: sass.fn-naming-var("modal", "background-color");
13
+ $decision-modal-border-color: sass.fn-naming-var("modal", "border-color");
14
+ $decision-modal-color: sass.fn-naming-var("modal", "color");
15
15
 
16
16
  $radius-ratio: sass.fn-naming-var("radius-ratio");
17
17
  $radius-size: sass.fn-naming-var("radius-size");
@@ -21,15 +21,15 @@ $padding-y: sass.fn-naming-var("spacing", "y");
21
21
  $padding-x: sass.fn-naming-var("spacing", "x");
22
22
  $margin-y: sass.fn-naming-var("spacing", "y");
23
23
  $margin-x: sass.fn-naming-var("spacing", "x");
24
- $animation-duration: sass.fn-naming-var("motion", "duration");
24
+ $animation-duration: sass.fn-naming-var("duration");
25
25
  $border-width: sass.fn-naming-var("stroke", "width");
26
- $transition-duration: sass.fn-naming-var("motion", "duration");
26
+ $transition-duration: sass.fn-naming-var("duration");
27
27
  $border-radius: calc(min(#{$width}, #{$radius-size}) * #{$radius-ratio});
28
28
 
29
29
  .#{$decision-modal} {
30
30
  // Styles
31
- background-color: rgb(#{$decision-modal-background-color});
32
- color: rgb(#{$decision-modal-color});
31
+ background-color: rgba(#{$decision-modal-background-color});
32
+ color: rgba(#{$decision-modal-color});
33
33
  width: #{$width};
34
34
  max-width: #{$max-width};
35
35
  overflow: hidden;
@@ -51,7 +51,7 @@ $border-radius: calc(min(#{$width}, #{$radius-size}) * #{$radius-ratio});
51
51
  align-items: center;
52
52
  font-weight: 600;
53
53
  border-bottom: #{$border-width} solid transparent;
54
- color: rgb(#{$decision-modal-color});
54
+ color: rgba(#{$decision-modal-color});
55
55
  transition:
56
56
  box-shadow #{$transition-duration} ease,
57
57
  border-color #{$transition-duration} ease,
@@ -63,14 +63,14 @@ $border-radius: calc(min(#{$width}, #{$radius-size}) * #{$radius-ratio});
63
63
  // Content of alert
64
64
  .#{$decision-modal-body} {
65
65
  padding: calc(#{$padding-y} * 4) calc(#{$padding-x} * 4);
66
- color: rgb(#{$decision-modal-color});
66
+ color: rgba(#{$decision-modal-color});
67
67
  }
68
68
 
69
69
  // Footer of alert
70
70
  .#{$decision-modal-footer} {
71
71
  display: flex;
72
72
  border-top: #{$border-width} solid transparent;
73
- color: rgb(#{$decision-modal-color});
73
+ color: rgba(#{$decision-modal-color});
74
74
  transition:
75
75
  box-shadow #{$transition-duration} ease,
76
76
  border-color #{$transition-duration} ease,
@@ -111,7 +111,7 @@ $border-radius: calc(min(#{$width}, #{$radius-size}) * #{$radius-ratio});
111
111
  &.divider {
112
112
  .#{$decision-modal-header},
113
113
  .#{$decision-modal-footer} {
114
- border-color: rgb(#{$decision-modal-border-color});
114
+ border-color: rgba(#{$decision-modal-border-color});
115
115
  }
116
116
  }
117
117
 
@@ -9,7 +9,7 @@ import {
9
9
  type DecisionModalButton,
10
10
  type DecisionModalProps,
11
11
  } from "./decision-modal.type";
12
- import { withPrefix } from "../../utils";
12
+ import { cssPrefix } from "../../utils";
13
13
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
14
14
 
15
15
  // Component setup (props, emits, injects)
@@ -45,10 +45,10 @@ const decisionModalAttrs = computed(() => {
45
45
 
46
46
  return {
47
47
  class: [
48
- withPrefix(["layer", "decision-modal"]),
49
- withPrefix(["role", role]),
50
- withPrefix(["shape", shape.value]),
51
- withPrefix("decision-modal"),
48
+ cssPrefix(["layer", "modal"]),
49
+ cssPrefix(["role", role]),
50
+ cssPrefix(["shape", shape.value]),
51
+ cssPrefix("decision-modal"),
52
52
  {
53
53
  pop: pop.value,
54
54
  divider: divider.value,
@@ -59,19 +59,19 @@ const decisionModalAttrs = computed(() => {
59
59
 
60
60
  const decisionModalHeaderAttrs = computed(() => {
61
61
  return {
62
- class: [withPrefix("decision-modal-header")],
62
+ class: [cssPrefix("decision-modal-header")],
63
63
  };
64
64
  });
65
65
 
66
66
  const decisionModalBodyAttrs = computed(() => {
67
67
  return {
68
- class: [withPrefix("decision-modal-body")],
68
+ class: [cssPrefix("decision-modal-body")],
69
69
  };
70
70
  });
71
71
 
72
72
  const decisionModalFooterAttrs = computed(() => {
73
73
  return {
74
- class: [withPrefix("decision-modal-footer"), `actions-flow-${props.flow}`],
74
+ class: [cssPrefix("decision-modal-footer"), `actions-flow-${props.flow}`],
75
75
  };
76
76
  });
77
77
 
@@ -6,7 +6,7 @@ $divider: sass.fn-naming-prefix("divider");
6
6
  // Property name - layer: divider
7
7
  $divider-border-color: sass.fn-naming-var("divider", "border-color");
8
8
  $border-width: sass.fn-naming-var("stroke", "width");
9
- $transition-duration: sass.fn-naming-var("motion", "duration");
9
+ $transition-duration: sass.fn-naming-var("duration");
10
10
 
11
11
  // Divider
12
12
  .#{$divider} {
@@ -19,11 +19,11 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
19
19
 
20
20
  &.horizontal {
21
21
  width: 100%;
22
- border-bottom: #{$border-width} solid rgb(#{$divider-border-color});
22
+ border-bottom: #{$border-width} solid rgba(#{$divider-border-color});
23
23
  }
24
24
 
25
25
  &.vertical {
26
26
  height: 100%;
27
- border-right: #{$border-width} solid rgb(#{$divider-border-color});
27
+ border-right: #{$border-width} solid rgba(#{$divider-border-color});
28
28
  }
29
29
  }
@@ -1,7 +1,7 @@
1
1
  <style lang="scss" src="./divider.scss" scoped></style>
2
2
  <template src="./divider.html"></template>
3
3
  <script lang="ts" setup>
4
- import { withPrefix } from "../../utils";
4
+ import { cssPrefix } from "../../utils";
5
5
  import { type DividerProps } from "./divider.type";
6
6
  import { computed, inject } from "vue";
7
7
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
@@ -19,9 +19,9 @@ const dividerAttrs = computed(() => {
19
19
  const role = props.role || appState?.role.value || "";
20
20
  return {
21
21
  class: [
22
- withPrefix(["layer", "divider"]),
23
- withPrefix(["role", role]),
24
- withPrefix("divider"),
22
+ cssPrefix(["layer", "divider"]),
23
+ cssPrefix(["role", role]),
24
+ cssPrefix("divider"),
25
25
  {
26
26
  [props.direction]: true,
27
27
  },
@@ -14,7 +14,7 @@ $spacing-x: sass.fn-naming-var("spacing", "x");
14
14
  $spacing-y: sass.fn-naming-var("spacing", "y");
15
15
  $size-font-size: sass.fn-naming-var("font-size");
16
16
  $size-line-height: sass.fn-naming-var("line-height");
17
- $transition-duration: sass.fn-naming-var("motion", "duration");
17
+ $transition-duration: sass.fn-naming-var("duration");
18
18
 
19
19
  $size-control-block-size: sass.fn-naming-var("control-block-size");
20
20
  $radius-size: sass.fn-naming-var("radius-size");
@@ -34,9 +34,9 @@ $radius-size: sass.fn-naming-var("radius-size");
34
34
  border-width: #{$border-width};
35
35
  margin: #{$spacing-y} 0;
36
36
  border-style: solid;
37
- border-color: rgb(#{$dropdown-border-color});
38
- background-color: rgb(#{$dropdown-background-color});
39
- color: rgb(#{$dropdown-color});
37
+ border-color: rgba(#{$dropdown-border-color});
38
+ background-color: rgba(#{$dropdown-background-color});
39
+ color: rgba(#{$dropdown-color});
40
40
  font-size: #{$size-font-size};
41
41
  line-height: #{$size-line-height};
42
42
  max-height: min(50vh, 16rem);
@@ -1,8 +1,8 @@
1
- import type { AppDirection, AppSize } from "../app";
1
+ import type { AppDirection } from "../app";
2
2
 
3
3
  export type DropdownPlacement = "bottom-start" | "bottom-end" | "top-start" | "top-end";
4
4
 
5
- export type DropdownSize = AppSize;
5
+ export type DropdownSize = string;
6
6
 
7
7
  export type DropdownProps = {
8
8
  modelValue?: boolean;
@@ -3,7 +3,7 @@
3
3
  <script lang="ts" setup>
4
4
  import { computed, inject, onMounted, onUnmounted, ref, watch } from "vue";
5
5
  import type { DropdownEmit, DropdownProps } from "./dropdown.type";
6
- import { withPrefix } from "../../utils";
6
+ import { cssPrefix } from "../../utils";
7
7
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
8
8
 
9
9
  // Component setup (props, emits, injects)
@@ -35,11 +35,11 @@ const wrapperAttrs = computed(() => {
35
35
 
36
36
  return {
37
37
  class: [
38
- withPrefix(["layer", "dropdown"]),
39
- withPrefix(["role", role]),
40
- withPrefix(["shape", shape]),
41
- withPrefix(["size", props.size]),
42
- withPrefix("dropdown"),
38
+ cssPrefix(["layer", "dropdown"]),
39
+ cssPrefix(["role", role]),
40
+ cssPrefix(["shape", shape]),
41
+ cssPrefix(["size", props.size]),
42
+ cssPrefix("dropdown"),
43
43
  {
44
44
  open: isOpen.value,
45
45
  disabled: props.disabled,
@@ -50,10 +50,8 @@ const wrapperAttrs = computed(() => {
50
50
  });
51
51
 
52
52
  const panelAttrs = computed(() => {
53
- const shape = props.shape ?? appState?.shape.value ?? "";
54
-
55
53
  return {
56
- class: [withPrefix("dropdown-panel"), props.placement],
54
+ class: [cssPrefix("dropdown-panel"), props.placement],
57
55
  };
58
56
  });
59
57
 
@@ -1,12 +1,31 @@
1
- <OutlineField v-if="props.variant === 'outline'" v-bind="fieldAttrs">
2
- <template #start-input>
1
+ <div v-bind="fieldAttrs">
2
+ <div v-bind="fieldContentAttrs">
3
3
  <slot name="start-input"></slot>
4
- </template>
5
- <template #input>
6
- <slot name="input"></slot>
7
- </template>
8
- <template #end-input>
4
+ <slot name="input">
5
+ <textarea
6
+ v-bind="fieldInputAttrs"
7
+ @input="onInput"
8
+ @focus="onFocus"
9
+ @blur="onBlur"
10
+ @beforeinput="onBeforeinput"
11
+ v-model="content"
12
+ :rows="line"
13
+ v-if="type === 'paragraph'"
14
+ />
15
+ <input
16
+ v-bind="fieldInputAttrs"
17
+ @input="onInput"
18
+ @focus="onFocus"
19
+ @blur="onBlur"
20
+ @beforeinput="onBeforeinput"
21
+ v-model="content"
22
+ :type="type"
23
+ v-else
24
+ />
25
+ </slot>
9
26
  <slot name="end-input"></slot>
10
- </template>
27
+ </div>
28
+ <div v-bind="fieldMessageAttrs" v-if="message">{{ message }}</div>
29
+ <div v-bind="fieldHelpAttrs" v-if="help">{{ help }}</div>
11
30
  <slot></slot>
12
- </OutlineField>
31
+ </div>
@@ -4,20 +4,25 @@
4
4
  $field: sass.fn-naming-prefix("field");
5
5
  $field-content: sass.fn-naming-prefix("field-content");
6
6
  $field-input: sass.fn-naming-prefix("field-input");
7
- $field-input-editable: sass.fn-naming-prefix("field-input-editable");
8
7
  $field-message: sass.fn-naming-prefix("field-message");
9
8
  $field-help: sass.fn-naming-prefix("field-help");
10
9
 
11
10
  // Property name - layer: field
12
11
  $field-border-color: sass.fn-naming-var("field", "border-color");
12
+ $field-border-color-focus: sass.fn-naming-var("field", "border-color", "focus");
13
+ $field-border-color-hover: sass.fn-naming-var("field", "border-color", "hover");
14
+ $field-border-color-active: sass.fn-naming-var("field", "border-color", "active");
15
+ $field-border-color-disabled: sass.fn-naming-var("field", "border-color", "disabled");
13
16
  $field-background-color: sass.fn-naming-var("field", "background-color");
17
+ $field-color: sass.fn-naming-var("field", "color");
18
+ $field-placeholder-color: sass.fn-naming-var("field", "placeholder-color");
19
+ $field-help-color: sass.fn-naming-var("field", "help-color");
14
20
  $field-line: sass.fn-naming-var("field", "line");
15
21
  $field-max-line: sass.fn-naming-var("field", "max-line");
16
22
 
17
23
  $radius-ratio: sass.fn-naming-var("radius-ratio");
18
24
  $radius-size: sass.fn-naming-var("radius-size");
19
25
  $border-width: sass.fn-naming-var("stroke", "width");
20
- $app-color: sass.fn-naming-var("app", "color");
21
26
 
22
27
  $spacing-x: sass.fn-naming-var("spacing", "x");
23
28
  $spacing-y: sass.fn-naming-var("spacing", "y");
@@ -28,7 +33,7 @@ $size-coefficient-x: sass.fn-naming-var("coefficient-x");
28
33
  $size-coefficient-y: sass.fn-naming-var("coefficient-y");
29
34
  $size-line-height: sass.fn-naming-var("line-height");
30
35
 
31
- $transition-duration: sass.fn-naming-var("motion", "duration");
36
+ $transition-duration: sass.fn-naming-var("duration");
32
37
 
33
38
  $direction-text-align: sass.fn-naming-var("text-align");
34
39
  $direction-justify-content: sass.fn-naming-var("justify-content");
@@ -45,7 +50,7 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
45
50
  background-color #{$transition-duration} ease,
46
51
  color #{$transition-duration} ease,
47
52
  border-radius #{$transition-duration} ease;
48
- border-color: rgb(#{$field-border-color});
53
+ border-color: rgba(#{$field-border-color});
49
54
  border-radius: calc(min(#{$size-control-block-size}, #{$radius-size}) * #{$radius-ratio});
50
55
  border-width: #{$border-width};
51
56
  border-style: solid;
@@ -58,38 +63,6 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
58
63
  align-items: center;
59
64
  }
60
65
 
61
- // Input shell wrapping contenteditable (flex layout); must not apply display:flex to <input>.
62
- div.#{$field-input} {
63
- padding: calc(#{$spacing-y} * #{$size-coefficient-y})
64
- calc(#{$spacing-x} * #{$size-coefficient-x});
65
- position: relative;
66
- background-color: transparent;
67
- z-index: 2;
68
- min-height: calc(#{$field-line} * #{$size-control-block-size} - 2 * #{$border-width});
69
- max-height: calc(#{$field-max-line} * #{$size-control-block-size} - 2 * #{$border-width});
70
- box-sizing: border-box;
71
- width: 100%;
72
- flex: 1;
73
- display: flex;
74
- align-items: center;
75
- transition:
76
- box-shadow #{$transition-duration} ease,
77
- border-color #{$transition-duration} ease,
78
- background-color #{$transition-duration} ease,
79
- color #{$transition-duration} ease,
80
- border-radius #{$transition-duration} ease;
81
-
82
- &:focus-within,
83
- &:active,
84
- &:hover {
85
- outline: none;
86
- }
87
-
88
- &::placeholder {
89
- color: rgba(#{$app-color}, 0.5);
90
- }
91
- }
92
-
93
66
  // Native password <input> (single node, not wrapped).
94
67
  input.#{$field-input} {
95
68
  padding: calc(#{$spacing-y} * #{$size-coefficient-y})
@@ -102,8 +75,8 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
102
75
  box-sizing: border-box;
103
76
  width: 100%;
104
77
  flex: 1;
105
- color: rgb(#{$app-color});
106
- caret-color: rgb(#{$app-color});
78
+ color: rgba(#{$field-color});
79
+ caret-color: rgba(#{$field-color});
107
80
  border: none;
108
81
  -webkit-user-select: text;
109
82
  user-select: text;
@@ -136,41 +109,13 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
136
109
  }
137
110
 
138
111
  &::placeholder {
139
- color: rgba(#{$app-color}, 0.5);
140
- }
141
- }
142
-
143
- .#{$field-input-editable} {
144
- flex: 1 1 auto;
145
- min-width: 0;
146
- min-height: 0;
147
- display: block;
148
- position: relative;
149
- z-index: 2;
150
- background-color: transparent;
151
- color: rgb(#{$app-color});
152
- caret-color: rgb(#{$app-color});
153
- border: none;
154
- // user-select:all breaks caret placement on many mobile browsers for contenteditable.
155
- -webkit-user-select: text;
156
- user-select: text;
157
- font-size: #{$size-font-size};
158
- line-height: #{$size-line-height};
159
- box-sizing: border-box;
160
- width: 100%;
161
- overflow: auto;
162
- outline: none;
163
-
164
- &:focus,
165
- &:active {
166
- outline: none;
167
- border: none;
112
+ color: rgba(#{$field-placeholder-color});
168
113
  }
169
114
  }
170
115
 
171
116
  // Message
172
117
  .#{$field-message} {
173
- color: rgb(#{$field-background-color});
118
+ color: rgba(#{$field-background-color});
174
119
  font-size: 0.9em;
175
120
  line-height: 1.5;
176
121
  transition:
@@ -183,7 +128,7 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
183
128
 
184
129
  // Help
185
130
  .#{$field-help} {
186
- color: rgb(#{$app-color}, 0.75);
131
+ color: rgba(#{$field-help-color});
187
132
  font-size: 0.8em;
188
133
  line-height: 1.5;
189
134
  transition:
@@ -195,85 +140,44 @@ $direction-justify-content: sass.fn-naming-var("justify-content");
195
140
  }
196
141
 
197
142
  &.focus {
143
+ .#{$field-content} {
144
+ border-color: rgba(#{$field-border-color-focus});
145
+ }
146
+
198
147
  &.shadow {
199
148
  .#{$field-content} {
200
- box-shadow: 0 0 0 0.25rem rgb(#{$field-border-color}, 0.25);
149
+ box-shadow: 0 0 0 0.25rem rgba(#{$field-border-color-focus}, 0.25);
201
150
  }
202
151
  }
203
152
 
204
153
  &:not(.shadow) {
205
154
  .#{$field-content} {
206
- box-shadow: 0 0 0 calc(#{$border-width} * 1.5) rgb(#{$field-border-color});
155
+ box-shadow: 0 0 0 calc(#{$border-width} * 1.5) rgba(#{$field-border-color-focus});
207
156
  }
208
157
  }
209
158
  }
210
159
 
160
+ &.hover {
161
+ .#{$field-content} {
162
+ border-color: rgba(#{$field-border-color-hover});
163
+ }
164
+ }
165
+
211
166
  &.disabled {
212
167
  opacity: 0.5;
213
168
  cursor: not-allowed;
214
- div.#{$field-input},
215
- input.#{$field-input},
216
- .#{$field-input-editable} {
169
+ input.#{$field-input} {
217
170
  cursor: not-allowed;
218
171
  -webkit-user-select: none;
219
172
  user-select: none;
220
173
  }
221
- }
222
174
 
223
- &.empty:not(.typing) {
224
- div.#{$field-input} {
225
- &::before {
226
- content: attr(placeholder);
227
- color: rgba(#{$app-color}, 0.5);
228
- transition: color #{$transition-duration} ease;
229
- position: absolute;
230
- height: calc(#{$size-control-block-size} - #{$border-width} * 2);
231
- box-sizing: border-box;
232
- top: 0;
233
- pointer-events: none;
234
- z-index: 0;
235
- display: block;
236
- white-space: pre-wrap;
237
- word-break: break-word;
238
- line-height: inherit;
239
- font-size: inherit;
240
- display: flex;
241
- align-items: center;
242
- }
243
- }
244
- }
245
-
246
- // Type
247
- &.paragraph {
248
- div.#{$field-input} {
249
- align-items: flex-start;
250
- }
251
-
252
- .#{$field-input-editable} {
253
- white-space: pre-wrap;
254
- word-break: break-word;
255
- }
256
- }
257
-
258
- &.text {
259
- .#{$field-input-editable},
260
- input.#{$field-input} {
261
- white-space: nowrap;
262
- }
263
- }
264
-
265
- &.password {
266
- input.#{$field-input} {
267
- white-space: nowrap;
175
+ .#{$field-content} {
176
+ border-color: rgba(#{$field-border-color-disabled});
268
177
  }
269
178
  }
270
179
 
271
180
  // Direction
272
- div.#{$field-input} {
273
- justify-content: #{$direction-justify-content};
274
- }
275
-
276
- .#{$field-input-editable},
277
181
  input.#{$field-input} {
278
182
  text-align: #{$direction-text-align};
279
183
  }