@king-design/react 2.0.0-beta.1 → 2.0.2

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 (149) hide show
  1. package/__tests__/__snapshots__/React Demos.md +321 -295
  2. package/__tests__/index.ts +5 -2
  3. package/__tests__/karma.conf.js +1 -1
  4. package/components/breadcrumb/item.d.ts +1 -1
  5. package/components/breadcrumb/item.js +3 -14
  6. package/components/breadcrumb/styles.js +1 -1
  7. package/components/button/index.vdt.js +26 -17
  8. package/components/button/styles.d.ts +82 -1
  9. package/components/button/styles.js +16 -2
  10. package/components/card/styles.js +1 -1
  11. package/components/carousel/styles.js +4 -1
  12. package/components/carousel/useSlide.js +10 -9
  13. package/components/cascader/index.spec.js +89 -1
  14. package/components/cascader/index.vdt.js +4 -4
  15. package/components/cascader/useLabel.js +8 -12
  16. package/components/checkbox/index.vdt.js +15 -10
  17. package/components/checkbox/styles.js +2 -2
  18. package/components/collapse/item.vdt.js +2 -1
  19. package/components/collapse/styles.js +5 -1
  20. package/components/colorpicker/index.d.ts +2 -0
  21. package/components/colorpicker/index.js +2 -1
  22. package/components/colorpicker/index.spec.js +1 -1
  23. package/components/colorpicker/index.vdt.js +3 -1
  24. package/components/context.d.ts +5 -2
  25. package/components/context.js +7 -4
  26. package/components/datepicker/helpers.d.ts +2 -1
  27. package/components/datepicker/helpers.js +8 -2
  28. package/components/datepicker/index.spec.js +1 -1
  29. package/components/datepicker/index.vdt.js +10 -5
  30. package/components/datepicker/styles.d.ts +46 -1
  31. package/components/diagram/shapes/generateShapes.js +3 -3
  32. package/components/diagram/shapes/line.d.ts +2 -2
  33. package/components/diagram/shapes/line.js +0 -1
  34. package/components/dialog/base.d.ts +2 -0
  35. package/components/dialog/base.js +2 -1
  36. package/components/dialog/index.spec.js +59 -94
  37. package/components/dialog/styles.js +5 -1
  38. package/components/dialog/useFixBody.d.ts +6 -0
  39. package/components/dialog/useFixBody.js +12 -0
  40. package/components/drawer/index.spec.js +5 -5
  41. package/components/drawer/styles.js +1 -1
  42. package/components/dropdown/dropdown.js +1 -0
  43. package/components/dropdown/index.js +1 -2
  44. package/components/dropdown/index.spec.js +3 -3
  45. package/components/dropdown/styles.js +1 -1
  46. package/components/editable/index.vdt.js +2 -1
  47. package/components/editable/styles.d.ts +8 -1
  48. package/components/form/index.spec.js +10 -12
  49. package/components/form/item.vdt.js +13 -9
  50. package/components/form/useError.d.ts +5 -1
  51. package/components/form/useError.js +3 -1
  52. package/components/form/useValidate.js +2 -2
  53. package/components/grid/col.vdt.js +4 -2
  54. package/components/grid/styles.js +1 -1
  55. package/components/grid/useGutter.d.ts +1 -1
  56. package/components/icon/index.vdt.js +3 -2
  57. package/components/icon/styles.js +8 -4
  58. package/components/input/index.d.ts +1 -0
  59. package/components/input/index.js +2 -1
  60. package/components/input/index.vdt.js +47 -32
  61. package/components/input/search.vdt.js +4 -2
  62. package/components/input/styles.js +8 -3
  63. package/components/layout/styles.d.ts +1 -1
  64. package/components/layout/styles.js +7 -3
  65. package/components/menu/index.spec.js +15 -8
  66. package/components/menu/item.d.ts +1 -2
  67. package/components/menu/item.js +10 -17
  68. package/components/menu/item.vdt.js +4 -4
  69. package/components/menu/menu.d.ts +3 -0
  70. package/components/menu/menu.js +4 -0
  71. package/components/menu/styles.d.ts +62 -1
  72. package/components/menu/styles.js +6 -2
  73. package/components/menu/useExpanded.d.ts +1 -4
  74. package/components/menu/useHighlight.d.ts +5 -8
  75. package/components/menu/useHighlight.js +44 -33
  76. package/components/message/index.spec.js +1 -1
  77. package/components/message/styles.js +6 -2
  78. package/components/pagination/styles.js +1 -1
  79. package/components/radio/index.vdt.js +14 -9
  80. package/components/radio/styles.js +9 -1
  81. package/components/rate/styles.js +5 -1
  82. package/components/scrollSelect/styles.d.ts +14 -1
  83. package/components/scrollSelect/styles.js +9 -1
  84. package/components/select/base.vdt.js +135 -121
  85. package/components/select/index.spec.js +1 -1
  86. package/components/select/menu.vdt.js +1 -0
  87. package/components/select/styles.js +9 -4
  88. package/components/select/useSearchable.d.ts +1 -1
  89. package/components/slider/styles.js +5 -1
  90. package/components/spinner/index.d.ts +1 -1
  91. package/components/spinner/index.js +1 -1
  92. package/components/split/style.js +1 -1
  93. package/components/steps/context.d.ts +1 -1
  94. package/components/steps/styles.js +5 -1
  95. package/components/switch/styles.js +5 -1
  96. package/components/table/index.d.ts +1 -0
  97. package/components/table/index.spec.js +2 -1
  98. package/components/table/row.vdt.js +12 -4
  99. package/components/table/styles.js +6 -1
  100. package/components/table/table.d.ts +1 -0
  101. package/components/table/table.js +2 -1
  102. package/components/table/table.vdt.js +30 -27
  103. package/components/table/useColumns.d.ts +1 -1
  104. package/components/table/useFixedColumns.d.ts +1 -1
  105. package/components/table/useFixedColumns.js +5 -2
  106. package/components/table/useGroup.d.ts +1 -1
  107. package/components/table/useResizable.d.ts +1 -1
  108. package/components/table/useSortable.d.ts +1 -1
  109. package/components/table/useWidth.js +7 -1
  110. package/components/tabs/index.spec.js +1 -1
  111. package/components/tabs/styles.js +9 -2
  112. package/components/tabs/tab.vdt.js +2 -1
  113. package/components/tabs/useActiveBar.js +6 -3
  114. package/components/tag/base.js +1 -0
  115. package/components/tag/styles.js +8 -2
  116. package/components/timepicker/constants.d.ts +2 -1
  117. package/components/timepicker/constants.js +3 -2
  118. package/components/timepicker/index.spec.js +36 -35
  119. package/components/timepicker/useStep.js +3 -3
  120. package/components/timepicker/useValue.js +2 -2
  121. package/components/tooltip/index.spec.js +32 -25
  122. package/components/transfer/index.spec.js +20 -19
  123. package/components/transfer/styles.js +2 -6
  124. package/components/tree/index.d.ts +1 -1
  125. package/components/tree/index.js +1 -1
  126. package/components/tree/index.spec.js +20 -19
  127. package/components/tree/index.vdt.js +1 -0
  128. package/components/tree/styles.js +5 -1
  129. package/components/treeSelect/index.spec.js +5 -5
  130. package/components/treeSelect/styles.js +5 -1
  131. package/components/upload/index.d.ts +1 -1
  132. package/components/upload/index.spec.js +1 -1
  133. package/components/upload/index.vdt.js +10 -11
  134. package/components/upload/styles.js +5 -1
  135. package/components/utils.d.ts +1 -1
  136. package/components/wave/index.d.ts +19 -0
  137. package/components/wave/index.js +120 -0
  138. package/components/wave/styles.d.ts +2 -0
  139. package/components/wave/styles.js +17 -0
  140. package/hooks/useRouter.d.ts +1 -0
  141. package/hooks/useRouter.js +10 -0
  142. package/i18n/en-US.d.ts +1 -0
  143. package/i18n/en-US.js +1 -0
  144. package/index.d.ts +3 -2
  145. package/index.js +3 -2
  146. package/package.json +2 -2
  147. package/styles/global.js +4 -3
  148. package/styles/theme.d.ts +16 -7
  149. package/styles/theme.js +15 -7
@@ -1,2 +1,8 @@
1
1
  import { RefObject } from 'intact-react';
2
+ declare type Hooks = {
3
+ onStart?: (scrollBarWidth: number | undefined) => void;
4
+ onEnd?: () => void;
5
+ };
2
6
  export declare function useFixBody(elementRef: RefObject<HTMLDivElement>): void;
7
+ export declare function setHooks(h: Hooks | null): void;
8
+ export {};
@@ -4,6 +4,7 @@ import { scrollbarWidth } from '../position';
4
4
  import { SHOW } from './constants';
5
5
  var dialogs = new _Set();
6
6
  var originalStyle = null;
7
+ var hooks = null;
7
8
  export function useFixBody(elementRef) {
8
9
  var instance = useInstance();
9
10
  var fixedBody = false;
@@ -30,6 +31,9 @@ export function useFixBody(elementRef) {
30
31
  }
31
32
  }
32
33
  }
34
+ export function setHooks(h) {
35
+ hooks = h;
36
+ }
33
37
 
34
38
  function onOpen(dialog) {
35
39
  var body = document.body;
@@ -43,6 +47,10 @@ function onOpen(dialog) {
43
47
  if (scrollBarWidth) {
44
48
  bodyStyle.paddingRight = scrollBarWidth + "px";
45
49
  }
50
+
51
+ if (hooks && hooks.onStart) {
52
+ hooks.onStart(scrollBarWidth);
53
+ }
46
54
  }
47
55
 
48
56
  dialogs.add(dialog);
@@ -59,6 +67,10 @@ function onClosed(dialog) {
59
67
  } else {
60
68
  body.removeAttribute('style');
61
69
  }
70
+
71
+ if (hooks && hooks.onEnd) {
72
+ hooks.onEnd();
73
+ }
62
74
  }
63
75
  }
64
76
 
@@ -7,7 +7,7 @@ import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/util
7
7
  describe('Drawer', function () {
8
8
  afterEach(function (done) {
9
9
  unmount();
10
- setTimeout(done, 400);
10
+ setTimeout(done, 500);
11
11
  });
12
12
  it('should show drawer correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
13
13
  var _mount, instance, element, trigger, drawer;
@@ -28,13 +28,13 @@ describe('Drawer', function () {
28
28
  drawer = getElement('.k-dialog-wrapper');
29
29
  expect(drawer.innerHTML).to.matchSnapshot();
30
30
  _context.next = 11;
31
- return wait(400);
31
+ return wait(500);
32
32
 
33
33
  case 11:
34
34
  //hide
35
35
  getElement('.k-dialog-overlay').click();
36
36
  _context.next = 14;
37
- return wait(400);
37
+ return wait(500);
38
38
 
39
39
  case 14:
40
40
  expect(getElement('.k-drawer')).to.be.undefined;
@@ -139,7 +139,7 @@ describe('Drawer', function () {
139
139
  case 9:
140
140
  dispatchEvent(document, 'click');
141
141
  _context4.next = 12;
142
- return wait(400);
142
+ return wait(500);
143
143
 
144
144
  case 12:
145
145
  dialog = getElement('.k-dialog-wrapper');
@@ -147,7 +147,7 @@ describe('Drawer', function () {
147
147
  btn = dialog.querySelector('.k-dialog-ok');
148
148
  btn.click();
149
149
  _context4.next = 18;
150
- return wait(400);
150
+ return wait(500);
151
151
 
152
152
  case 18:
153
153
  expect(getElement('.k-drawer')).to.be.undefined;
@@ -6,7 +6,7 @@ import '../../styles/global';
6
6
  export var placements = ['top', 'right', 'bottom', 'left'];
7
7
  var defaults = {
8
8
  get transition() {
9
- return theme.transition;
9
+ return theme.transition.large;
10
10
  },
11
11
 
12
12
  get boxShadow() {
@@ -167,6 +167,7 @@ export var Dropdown = /*#__PURE__*/function (_Component) {
167
167
  var vnode = props.vnode;
168
168
  if (!vnode) return props;
169
169
  var _props = vnode.props;
170
+ if (!_props) return props;
170
171
  return {
171
172
  vnode: vnode,
172
173
  'ev-click': _props.onClick,
@@ -1,8 +1,7 @@
1
1
  import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
2
2
  import { Dropdown as BaseDropdown } from './dropdown';
3
3
  import { DropdownMenu as BaseDropdownMenu } from './menu';
4
- export * from './item'; // Don't export the generic type class, because it will let
5
- // the type inferring break down
4
+ export * from './item'; // Don't export the generic type class, because it will break down the type inference
6
5
  // declare class _Dropdown extends BaseDropdown<
7
6
  // DropdownProps,
8
7
  // DropdownEvents,
@@ -11,7 +11,7 @@ import ContextMenuDemo from '~/components/dropdown/demos/contextmenu';
11
11
  describe('Dropdown', function () {
12
12
  afterEach(function (done) {
13
13
  unmount();
14
- setTimeout(done, 400);
14
+ setTimeout(done, 500);
15
15
  }); // it('demos test', () => {
16
16
  // const req = require.context('~/components/dropdown/demos', true, /^((?!async).)*index\.js$/i);
17
17
  // req.keys().forEach(item => {
@@ -129,7 +129,7 @@ describe('Dropdown', function () {
129
129
  _dropdown$querySelect = dropdown.querySelectorAll(':scope > .k-dropdown-item'), hoverItem = _dropdown$querySelect[3], clickItem = _dropdown$querySelect[4];
130
130
  clickItem.click();
131
131
  _context4.next = 9;
132
- return wait(300);
132
+ return wait(500);
133
133
 
134
134
  case 9:
135
135
  clickSubDropdown = getElement('.k-dropdown-menu');
@@ -463,7 +463,7 @@ describe('Dropdown', function () {
463
463
  _mount8 = mount(Demo), instance = _mount8[0], element = _mount8[1];
464
464
  dispatchEvent(instance.refs.trigger, 'mouseenter');
465
465
  _context12.next = 6;
466
- return wait(300);
466
+ return wait(500);
467
467
 
468
468
  case 6:
469
469
  dropdown = getElement('.k-dropdown-menu');
@@ -52,5 +52,5 @@ export function makeMenuStyles() {
52
52
  return /*#__PURE__*/css("position:absolute;min-width:", dropdown.menu.minWidth, ";background:", dropdown.menu.bgColor, ";border-radius:", dropdown.menu.borderRadius, ";box-shadow:", theme.boxShadow, ";font-size:", dropdown.menu.fontSize, ";z-index:", dropdown.menu.zIndex, ";top:0;left:0;.k-dropdown{display:block;}");
53
53
  }
54
54
  export function makeItemStyles() {
55
- return /*#__PURE__*/css("padding:", dropdown.item.padding, ";cursor:pointer;white-space:nowrap;height:", dropdown.item.height, ";line-height:", dropdown.item.height, ";&.k-hover{background:", dropdown.item.hoverBgColor, ";}&:first-of-type{border-radius:", dropdown.menu.borderRadius, " ", dropdown.menu.borderRadius, " 0 0;}&:last-of-type{border-radius:0 0 ", dropdown.menu.borderRadius, " ", dropdown.menu.borderRadius, ";}&.k-disabled{background:", dropdown.item.disabledBgColor, ";color:", dropdown.item.disabledColor, ";cursor:not-allowed;}.k-checkbox,.k-radio{display:block;margin:0 -", getRight(dropdown.item.padding), " 0 -", getLeft(dropdown.item.padding), ";padding:", dropdown.item.padding, ";}.k-checkbox-wrapper,.k-radio-wrapper{vertical-align:text-bottom;}.k-checkbox-text,.k-radio-text{vertical-align:baseline;}");
55
+ return /*#__PURE__*/css("padding:", dropdown.item.padding, ";cursor:pointer;white-space:nowrap;height:", dropdown.item.height, ";line-height:", dropdown.item.height, ";&.k-hover{background:", dropdown.item.hoverBgColor, ";}&:first-of-type{border-radius:", dropdown.menu.borderRadius, " ", dropdown.menu.borderRadius, " 0 0;}&:last-of-type{border-radius:0 0 ", dropdown.menu.borderRadius, " ", dropdown.menu.borderRadius, ";}&.k-disabled{background:", dropdown.item.disabledBgColor, ";color:", dropdown.item.disabledColor, ";cursor:not-allowed;}.k-checkbox,.k-radio{display:flex;margin:0 -", getRight(dropdown.item.padding), " 0 -", getLeft(dropdown.item.padding), ";padding:", dropdown.item.padding, ";}.k-checkbox-wrapper,.k-radio-wrapper{vertical-align:text-bottom;}.k-checkbox-text,.k-radio-text{vertical-align:baseline;}");
56
56
  }
@@ -32,7 +32,8 @@ export default function ($props, $blocks, $__proto__) {
32
32
  }), [!disabled && !editing ? _$cc(Icon, {
33
33
  'className': 'k-icon-edit k-editable-icon',
34
34
  'title': tip,
35
- 'ev-click': this.edit
35
+ 'ev-click': this.edit,
36
+ 'hoverable': true
36
37
  }) : undefined, _$ce(2, 'div', !editing ? children : _$cc(Input, {
37
38
  'size': 'small',
38
39
  'defaultValue': value,
@@ -1,4 +1,11 @@
1
1
  import '../../styles/global';
2
- declare let editable: any;
2
+ declare const defaults: {
3
+ iconGap: string;
4
+ lineHeight: string;
5
+ invalid: {
6
+ readonly border: string;
7
+ };
8
+ };
9
+ declare let editable: typeof defaults;
3
10
  export { editable };
4
11
  export declare function makeStyles(): string;
@@ -4,11 +4,11 @@ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
4
4
  import _Promise from "@babel/runtime-corejs3/core-js/promise";
5
5
  import _Array$from2 from "@babel/runtime-corejs3/core-js/array/from";
6
6
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
7
- import BasicDemo from '~/components/form/demos/basic';
7
+ import BasicDemo, { data as basicDemoData } from '~/components/form/demos/basic';
8
8
  import CustomDemo from '~/components/form/demos/custom';
9
9
  import VariableDemo from '~/components/form/demos/variable';
10
10
  import RemoteDemo from '~/components/form/demos/remote';
11
- import { mount, unmount, dispatchEvent, wait } from '../../test/utils';
11
+ import { mount, dispatchEvent, wait } from '../../test/utils';
12
12
  import { Component } from 'intact-react';
13
13
  import { Form, FormItem } from './';
14
14
  import { Input } from '../input';
@@ -29,9 +29,7 @@ RemoteDemo.prototype.validateUserName = function (value) {
29
29
  };
30
30
 
31
31
  describe('Form', function () {
32
- afterEach(function () {
33
- return unmount();
34
- });
32
+ // afterEach(() => unmount());
35
33
  it('validate', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
36
34
  var _mount, instance, element, form, item, input;
37
35
 
@@ -39,7 +37,7 @@ describe('Form', function () {
39
37
  while (1) {
40
38
  switch (_context.prev = _context.next) {
41
39
  case 0:
42
- _mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
40
+ _mount = mount(BasicDemo, null, basicDemoData), instance = _mount[0], element = _mount[1];
43
41
  form = instance.refs.form;
44
42
  _context.next = 4;
45
43
  return instance.handleSubmit();
@@ -88,7 +86,7 @@ describe('Form', function () {
88
86
  instance.set('descriptions.0', '1');
89
87
  dispatchEvent(input, 'focusout');
90
88
  _context2.next = 6;
91
- return wait(300);
89
+ return wait(500);
92
90
 
93
91
  case 6:
94
92
  expect(element.innerHTML).to.matchSnapshot();
@@ -97,7 +95,7 @@ describe('Form', function () {
97
95
  instance.set('descriptions.1', 'a');
98
96
  dispatchEvent(input1, 'focusout');
99
97
  _context2.next = 13;
100
- return wait(300);
98
+ return wait(500);
101
99
 
102
100
  case 13:
103
101
  expect(element.innerHTML).to.matchSnapshot();
@@ -128,13 +126,13 @@ describe('Form', function () {
128
126
  expect(res).to.be.true;
129
127
  instance.set('firstName', 'a');
130
128
  _context3.next = 9;
131
- return wait(100);
129
+ return wait(500);
132
130
 
133
131
  case 9:
134
132
  expect(element.innerHTML).to.matchSnapshot();
135
133
  instance.set('lastName', 'b');
136
134
  _context3.next = 13;
137
- return wait(100);
135
+ return wait(500);
138
136
 
139
137
  case 13:
140
138
  expect(element.innerHTML).to.matchSnapshot();
@@ -168,7 +166,7 @@ describe('Form', function () {
168
166
  res = _context4.sent;
169
167
  expect(res).to.be.false;
170
168
  _context4.next = 12;
171
- return wait(300);
169
+ return wait(500);
172
170
 
173
171
  case 12:
174
172
  expect(element.innerHTML).to.matchSnapshot();
@@ -184,7 +182,7 @@ describe('Form', function () {
184
182
  res = _context4.sent;
185
183
  expect(res).to.be.true;
186
184
  _context4.next = 22;
187
- return wait(300);
185
+ return wait(500);
188
186
 
189
187
  case 22:
190
188
  expect(element.innerHTML).to.matchSnapshot();
@@ -5,6 +5,7 @@ import { Tooltip } from '../tooltip';
5
5
  import { Icon } from '../icon';
6
6
  import { Transition } from 'intact';
7
7
  import { makeItemStyles } from './styles';
8
+ import { context as ErrorContext } from './useError';
8
9
  var _$tmp0 = {
9
10
  'className': 'ion-ios-information-outline k-form-error-more',
10
11
  'size': 'small'
@@ -77,17 +78,20 @@ export default function ($props, $blocks, $__proto__) {
77
78
  }, __$blocks['label'](_$no))], 0, 'k-form-label', {
78
79
  'htmlFor': htmlFor,
79
80
  'style': labelStyle
80
- }) : undefined, _$ce(2, 'div', [(_$blocks['content'] = function ($super) {
81
- return children;
82
- }, __$blocks['content'] = function ($super, data) {
83
- var block = $blocks['content'];
81
+ }) : undefined, _$ce(2, 'div', [_$cc(ErrorContext.Provider, {
82
+ 'value': isDirty && !isValid,
83
+ 'children': (_$blocks['content'] = function ($super) {
84
+ return children;
85
+ }, __$blocks['content'] = function ($super, data) {
86
+ var block = $blocks['content'];
84
87
 
85
- var callBlock = function callBlock() {
86
- return _$blocks['content'].call($this, $super, data);
87
- };
88
+ var callBlock = function callBlock() {
89
+ return _$blocks['content'].call($this, $super, data);
90
+ };
88
91
 
89
- return block ? block.call($this, callBlock, data) : callBlock();
90
- }, __$blocks['content'](_$no)), _$cc(Transition, {
92
+ return block ? block.call($this, callBlock, data) : callBlock();
93
+ }, __$blocks['content'](_$no))
94
+ }), _$cc(Transition, {
91
95
  'key': 'error',
92
96
  'name': 'k-fade',
93
97
  'children': isDirty && !isValid ? _$ce(2, 'div', [_$ce(2, 'div', message.value, 0, 'k-error-message c-ellipsis', null, null, errorRef), _$cc(Tooltip, {
@@ -1,7 +1,11 @@
1
+ export declare const context: {
2
+ Provider: import('intact-react').ComponentConstructor<import("intact").Component<import("../context").ProviderProps<any>, {}, {}, {}>>;
3
+ Consumer: import("intact").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<any>, {}, {}, {}>>;
4
+ };
1
5
  export declare function useError(): {
2
6
  ellipsis: import("../../hooks/useState").State<boolean>;
3
7
  message: import("../../hooks/useState").State<string | undefined>;
4
- errorRef: import('intact-react').RefObject<HTMLDivElement>;
8
+ errorRef: import("intact").RefObject<HTMLDivElement>;
5
9
  getErrorMessage: (key: string) => string;
6
10
  getErrorClassName: (key: string) => string;
7
11
  reset: () => void;
@@ -1,11 +1,13 @@
1
1
  import { useInstance, nextTick, createRef } from 'intact-react';
2
2
  import { useState, watchState } from '../../hooks/useState';
3
3
  import { messages as globalMessages, classNames as globalClassNames } from './methods';
4
- import { isFunction } from 'intact-shared'; // enum MessageOrClassname {
4
+ import { isFunction } from 'intact-shared';
5
+ import { createContext } from '../context'; // enum MessageOrClassname {
5
6
  // Message,
6
7
  // ClassName,
7
8
  // }
8
9
 
10
+ export var context = createContext();
9
11
  export function useError() {
10
12
  var instance = useInstance();
11
13
  var ellipsis = useState(false);
@@ -64,7 +64,7 @@ export function useValidate(getErrorMessage, getErrorClassName, message, isDirty
64
64
 
65
65
  if (result !== true) {
66
66
  var ruleName = ruleNames[index];
67
- return [false, result || getErrorMessage(ruleName), getErrorMessage(ruleName)];
67
+ return [false, result || getErrorMessage(ruleName), getErrorClassName(ruleName)];
68
68
  }
69
69
  }
70
70
 
@@ -77,7 +77,7 @@ export function useValidate(getErrorMessage, getErrorClassName, message, isDirty
77
77
  message = err;
78
78
  } else if (err) {
79
79
  message = err.message || getErrorMessage(err.name);
80
- className = err.className || getErrorMessage(err.name);
80
+ className = err.className || getErrorClassName(err.name);
81
81
  }
82
82
 
83
83
  return [false, message, className];
@@ -22,7 +22,7 @@ export default function ($props, $blocks, $__proto__) {
22
22
 
23
23
  return _$cc(GutterContext.Consumer, {
24
24
  'children': function children(gutter) {
25
- var _extends2;
25
+ var _extends2, _$cn2;
26
26
 
27
27
  var classNameObj = _extends((_extends2 = {
28
28
  'k-col': true
@@ -33,7 +33,9 @@ export default function ($props, $blocks, $__proto__) {
33
33
  'className': _$cn(classNameObj)
34
34
  }, getRestProps(_this), {
35
35
  'style': newStyle
36
- }), gutter ? _$ce(2, 'div', _children, 0, _$cn(className)) : _children);
36
+ }), gutter ? _$ce(2, 'div', _children, 0, _$cn((_$cn2 = {
37
+ 'k-col-wrapper': true
38
+ }, _$cn2[className] = className, _$cn2))) : _children);
37
39
  }
38
40
  });
39
41
  }
@@ -24,7 +24,7 @@ export function makeRowStyles() {
24
24
  }
25
25
  var colsStyles = makeBreakpointsCols();
26
26
  export function makeColStyles() {
27
- return /*#__PURE__*/css("position:relative;width:100%;", colsStyles, ";");
27
+ return /*#__PURE__*/css("position:relative;width:100%;.k-col-wrapper{height:100%;}", colsStyles, ";");
28
28
  }
29
29
 
30
30
  function makeBreakpointsCols() {
@@ -1,6 +1,6 @@
1
1
  export declare const context: {
2
2
  Provider: import('intact-react').ComponentConstructor<import("intact").Component<import("../context").ProviderProps<number>, {}, {}, {}>>;
3
- Consumer: import("intact").ComponentConstructor<import("intact").Component<{}, {}, {}, {}>>;
3
+ Consumer: import("intact").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<number>, {}, {}, {}>>;
4
4
  };
5
5
  export declare function useGutter(): {
6
6
  getGutter: () => import("./constants").PrimitiveValue | null | undefined;
@@ -15,7 +15,8 @@ export default function ($props, $blocks, $__proto__) {
15
15
  size = _this$get.size,
16
16
  color = _this$get.color,
17
17
  rotate = _this$get.rotate,
18
- hoverable = _this$get.hoverable;
18
+ hoverable = _this$get.hoverable,
19
+ children = _this$get.children;
19
20
 
20
21
  var classNameObj = (_classNameObj = {
21
22
  'k-icon': true,
@@ -43,6 +44,6 @@ export default function ($props, $blocks, $__proto__) {
43
44
  return _$cv('i', _extends({
44
45
  'className': _$cn(classNameObj),
45
46
  'style': addStyle(style, _style)
46
- }, getRestProps(this)));
47
+ }, getRestProps(this)), children);
47
48
  }
48
49
  ;
@@ -6,7 +6,11 @@ import { rotate } from '../../styles/keyframes';
6
6
  import '../../styles/fonts/iconfont';
7
7
  import '../../styles/fonts/ionicons';
8
8
  import '../../styles/global';
9
- var iconStyles = {
9
+ var defaults = {
10
+ get transition() {
11
+ return theme.transition.small;
12
+ },
13
+
10
14
  fontSize: {
11
15
  default: '16px',
12
16
  large: '22px',
@@ -14,7 +18,6 @@ var iconStyles = {
14
18
  mini: '12px'
15
19
  }
16
20
  };
17
- var defaults = iconStyles;
18
21
  var icon;
19
22
  setDefault(function () {
20
23
  icon = deepDefaults(theme, {
@@ -25,9 +28,10 @@ export var colors = ['primary', 'warning', 'danger', 'success'];
25
28
  export var sizes = ['large', 'small', 'mini'];
26
29
  export default function makeStyles(color) {
27
30
  return /*#__PURE__*/css("font-size:", icon.fontSize.default, ";line-height:1;", _mapInstanceProperty(sizes).call(sizes, function (size) {
28
- return /*#__PURE__*/css("&.k-", size, "{font-size:", icon.fontSize[size], ";}");
31
+ var fontSize = icon.fontSize[size];
32
+ return /*#__PURE__*/css("&.k-", size, "{font-size:", fontSize, ";}");
29
33
  }), " ", _mapInstanceProperty(colors).call(colors, function (color) {
30
34
  var _color = theme.color[color];
31
35
  return /*#__PURE__*/css("&.k-", color, "{color:", _color, ";&.k-hoverable:hover{color:", palette(_color, -2), ";}}");
32
- }), " &.k-rotate:before{animation:", rotate, " 1s infinite linear;}&:before{font-size:inherit;}&.k-hoverable{cursor:pointer;transition:color ", theme.transition, ";", color && "\n &:hover {\n color: " + palette(color, -2) + " !important;\n }\n ", ";&:hover{color:", theme.color.primary, ";}}");
36
+ }), " &.k-rotate:before{animation:", rotate, " 1s infinite linear;}&:before{position:relative;font-size:inherit;z-index:1;}&.k-hoverable{cursor:pointer;transition:color ", icon.transition, ";", color && "\n &:hover {\n color: " + palette(color, -2) + " !important;\n }\n ", ";&:hover{color:", theme.color.primary, ";}}");
33
37
  }
@@ -27,6 +27,7 @@ export interface InputProps<V extends Value = Value> extends InputHTMLAttributes
27
27
  stackClearIcon?: boolean;
28
28
  frozenOnInput?: boolean;
29
29
  inline?: boolean;
30
+ waveDisabled?: boolean;
30
31
  }
31
32
  export interface InputEvents {
32
33
  clear: [MouseEvent];
@@ -23,7 +23,8 @@ var typeDefs = {
23
23
  width: [Number, String],
24
24
  stackClearIcon: Boolean,
25
25
  frozenOnInput: Boolean,
26
- inline: Boolean
26
+ inline: Boolean,
27
+ waveDisabled: Boolean
27
28
  };
28
29
 
29
30
  var defaults = function defaults() {
@@ -1,13 +1,18 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime-corejs3/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["className", "style", "type", "value", "defaultValue", "placeholder", "clearable", "disabled", "size", "rows", "autoWidth", "fluid", "width", "stackClearIcon", "frozenOnInput", "readonly", "inline", "ev-click", "ev-mounseenter", "ev-mouseleave"];
4
- import { createElementVNode as _$ce, className as _$cn, noop as _$no, createVNode as _$cv, createUnknownComponentVNode as _$cc } from 'intact-react';
3
+ var _excluded = ["className", "style", "type", "value", "defaultValue", "placeholder", "clearable", "disabled", "size", "rows", "autoWidth", "fluid", "width", "stackClearIcon", "frozenOnInput", "readonly", "inline", "waveDisabled", "ev-click", "ev-mounseenter", "ev-mouseleave"];
4
+ import { createElementVNode as _$ce, className as _$cn, createUnknownComponentVNode as _$cc, noop as _$no, createVNode as _$cv } from 'intact-react';
5
5
  import { Icon } from '../icon';
6
6
  import { addStyle, isTextBlock, getRestProps } from '../utils';
7
7
  import { makeStyles } from './styles';
8
8
  import { noop, isNullOrUndefined } from 'intact-shared';
9
+ import { Wave } from '../wave';
10
+ import { context as ErrorContext } from '../form/useError';
9
11
  export default function ($props, $blocks, $__proto__) {
10
- var _classNameObj, children, _children;
12
+ var _classNameObj,
13
+ children,
14
+ _this = this,
15
+ _children;
11
16
 
12
17
  $blocks || ($blocks = {});
13
18
  $props || ($props = {});
@@ -33,6 +38,7 @@ export default function ($props, $blocks, $__proto__) {
33
38
  frozenOnInput = _this$get.frozenOnInput,
34
39
  readonly = _this$get.readonly,
35
40
  inline = _this$get.inline,
41
+ waveDisabled = _this$get.waveDisabled,
36
42
  click = _this$get['ev-click'],
37
43
  mouseenter = _this$get['ev-mounseenter'],
38
44
  mouseleave = _this$get['ev-mouseleave'],
@@ -77,39 +83,48 @@ export default function ($props, $blocks, $__proto__) {
77
83
  return _$ce(2, 'div', [$blocks.prepend ? (children = $blocks.prepend(noop), _$ce(2, 'div', children, 0, _$cn({
78
84
  "k-input-prepend": true,
79
85
  "k-input-padding": isTextBlock(children)
80
- }))) : void 0, _$ce(2, 'div', [$blocks.prefix ? _$ce(2, 'div', (_$blocks['prefix'] = function ($super) {
81
- return null;
82
- }, __$blocks['prefix'] = function ($super, data) {
83
- var block = $blocks['prefix'];
86
+ }))) : void 0, _$cc(ErrorContext.Consumer, {
87
+ 'defaultValue': false,
88
+ 'children': function children(isInvalid) {
89
+ return _$cc(Wave, {
90
+ 'disabled': waveDisabled || disabled || isInvalid,
91
+ 'children': _$ce(2, 'div', [$blocks.prefix ? _$ce(2, 'div', (_$blocks['prefix'] = function ($super) {
92
+ return null;
93
+ }, __$blocks['prefix'] = function ($super, data) {
94
+ var block = $blocks['prefix'];
84
95
 
85
- var callBlock = function callBlock() {
86
- return _$blocks['prefix'].call($this, $super, data);
87
- };
96
+ var callBlock = function callBlock() {
97
+ return _$blocks['prefix'].call($this, $super, data);
98
+ };
88
99
 
89
- return block ? block.call($this, callBlock, data) : callBlock();
90
- }, __$blocks['prefix'](_$no)), 0, 'k-input-prefix') : undefined, type !== 'textarea' ? _$cv('input', _extends({}, inputProps, {
91
- 'className': 'k-input-inner',
92
- 'type': type
93
- })) : _$cv('textarea', _extends({}, inputProps, {
94
- 'className': 'k-input-inner k-textarea',
95
- 'rows': rows
96
- })), $blocks.suffix || clearable && !disabled ? _$ce(2, 'div', [clearable && !disabled ? _$cc(Icon, {
97
- 'className': _$cn({
98
- "k-input-clear ion-ios-close": true,
99
- "k-input-show": hasValue
100
- }),
101
- 'ev-click': this.clear
102
- }) : undefined, ' ', (_$blocks['suffix'] = function ($super) {
103
- return null;
104
- }, __$blocks['suffix'] = function ($super, data) {
105
- var block = $blocks['suffix'];
100
+ return block ? block.call($this, callBlock, data) : callBlock();
101
+ }, __$blocks['prefix'](_$no)), 0, 'k-input-prefix') : undefined, type !== 'textarea' ? _$cv('input', _extends({}, inputProps, {
102
+ 'className': 'k-input-inner',
103
+ 'type': type
104
+ })) : _$cv('textarea', _extends({}, inputProps, {
105
+ 'className': 'k-input-inner k-textarea',
106
+ 'rows': rows
107
+ })), $blocks.suffix || clearable && !disabled ? _$ce(2, 'div', [clearable && !disabled ? _$cc(Icon, {
108
+ 'className': _$cn({
109
+ "k-input-clear ion-ios-close": true,
110
+ "k-input-show": hasValue
111
+ }),
112
+ 'ev-click': _this.clear,
113
+ 'hoverable': true
114
+ }) : undefined, ' ', (_$blocks['suffix'] = function ($super) {
115
+ return null;
116
+ }, __$blocks['suffix'] = function ($super, data) {
117
+ var block = $blocks['suffix'];
106
118
 
107
- var callBlock = function callBlock() {
108
- return _$blocks['suffix'].call($this, $super, data);
109
- };
119
+ var callBlock = function callBlock() {
120
+ return _$blocks['suffix'].call($this, $super, data);
121
+ };
110
122
 
111
- return block ? block.call($this, callBlock, data) : callBlock();
112
- }, __$blocks['suffix'](_$no))], 0, 'k-input-suffix') : undefined, autoWidth ? _$ce(2, 'div', !hasValue ? placeholder : inputValue, 0, 'k-input-fake', null, null, fakeRef) : undefined], 0, 'k-input-wrapper'), $blocks.append ? (_children = $blocks.append(noop), _$ce(2, 'div', _children, 0, _$cn({
123
+ return block ? block.call($this, callBlock, data) : callBlock();
124
+ }, __$blocks['suffix'](_$no))], 0, 'k-input-suffix') : undefined, autoWidth ? _$ce(2, 'div', !hasValue ? placeholder : inputValue, 0, 'k-input-fake', null, null, fakeRef) : undefined], 0, 'k-input-wrapper')
125
+ });
126
+ }
127
+ }), $blocks.append ? (_children = $blocks.append(noop), _$ce(2, 'div', _children, 0, _$cn({
113
128
  "k-input-append": true,
114
129
  "k-input-padding": isTextBlock(_children)
115
130
  }))) : void 0], 0, _$cn(classNameObj), {
@@ -23,9 +23,10 @@ export default function ($props, $blocks, $__proto__) {
23
23
  size = _this$get.size,
24
24
  open = _this$get.open;
25
25
 
26
+ var isTypeNotDefault = type !== 'default';
26
27
  var classNameObj = (_classNameObj = {
27
28
  'k-search': true
28
- }, _classNameObj[className] = className, _classNameObj['k-open'] = open, _classNameObj['k-hide'] = !open, _classNameObj["k-" + type] = type !== 'default', _classNameObj[makeSearchStyles()] = true, _classNameObj);
29
+ }, _classNameObj[className] = className, _classNameObj['k-open'] = open, _classNameObj['k-hide'] = !open, _classNameObj["k-" + type] = isTypeNotDefault, _classNameObj[makeSearchStyles()] = true, _classNameObj);
29
30
  return _$cv('form', _extends({}, getRestProps(this), {
30
31
  'className': _$cn(classNameObj),
31
32
  'ev-submit': this.onSubmit,
@@ -38,7 +39,8 @@ export default function ($props, $blocks, $__proto__) {
38
39
  'ev-$change:value': this.onChangeValue,
39
40
  'readonly': !open,
40
41
  'size': size,
41
- 'className': 'k-with-suffix'
42
+ 'className': 'k-with-suffix',
43
+ 'waveDisabled': isTypeNotDefault
42
44
  }, null, this.inputRef), _$cc(Button, {
43
45
  'icon': true,
44
46
  'type': 'none',