@king-design/vue 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 (154) hide show
  1. package/__tests__/__snapshots__/Vue Next Demos.md +1795 -0
  2. package/__tests__/components/dropdown.spec.ts +72 -0
  3. package/__tests__/components/select.spec.ts +29 -0
  4. package/__tests__/index.ts +46 -0
  5. package/__tests__/karma.conf.js +54 -0
  6. package/__tests__/webpack.config.js +61 -0
  7. package/components/breadcrumb/item.d.ts +1 -1
  8. package/components/breadcrumb/item.js +3 -14
  9. package/components/breadcrumb/styles.js +1 -1
  10. package/components/button/index.vdt.js +26 -17
  11. package/components/button/styles.d.ts +82 -1
  12. package/components/button/styles.js +16 -2
  13. package/components/card/styles.js +1 -1
  14. package/components/carousel/styles.js +4 -1
  15. package/components/carousel/useSlide.js +10 -9
  16. package/components/cascader/index.spec.js +89 -1
  17. package/components/cascader/index.vdt.js +4 -4
  18. package/components/cascader/useLabel.js +8 -12
  19. package/components/checkbox/index.vdt.js +15 -10
  20. package/components/checkbox/styles.js +2 -2
  21. package/components/collapse/item.vdt.js +2 -1
  22. package/components/collapse/styles.js +5 -1
  23. package/components/colorpicker/index.d.ts +2 -0
  24. package/components/colorpicker/index.js +2 -1
  25. package/components/colorpicker/index.spec.js +1 -1
  26. package/components/colorpicker/index.vdt.js +3 -1
  27. package/components/context.d.ts +5 -2
  28. package/components/context.js +7 -4
  29. package/components/datepicker/helpers.d.ts +2 -1
  30. package/components/datepicker/helpers.js +8 -2
  31. package/components/datepicker/index.spec.js +1 -1
  32. package/components/datepicker/index.vdt.js +10 -5
  33. package/components/datepicker/styles.d.ts +46 -1
  34. package/components/diagram/shapes/generateShapes.js +3 -3
  35. package/components/diagram/shapes/line.d.ts +2 -2
  36. package/components/diagram/shapes/line.js +0 -1
  37. package/components/dialog/base.d.ts +2 -0
  38. package/components/dialog/base.js +2 -1
  39. package/components/dialog/index.spec.js +59 -94
  40. package/components/dialog/styles.js +5 -1
  41. package/components/dialog/useFixBody.d.ts +6 -0
  42. package/components/dialog/useFixBody.js +12 -0
  43. package/components/drawer/index.spec.js +5 -5
  44. package/components/drawer/styles.js +1 -1
  45. package/components/dropdown/dropdown.js +1 -0
  46. package/components/dropdown/index.js +1 -2
  47. package/components/dropdown/index.spec.js +3 -3
  48. package/components/dropdown/styles.js +1 -1
  49. package/components/editable/index.vdt.js +2 -1
  50. package/components/editable/styles.d.ts +8 -1
  51. package/components/form/index.spec.js +10 -12
  52. package/components/form/item.vdt.js +13 -9
  53. package/components/form/useError.d.ts +5 -1
  54. package/components/form/useError.js +3 -1
  55. package/components/form/useValidate.js +2 -2
  56. package/components/grid/col.vdt.js +4 -2
  57. package/components/grid/styles.js +1 -1
  58. package/components/grid/useGutter.d.ts +1 -1
  59. package/components/icon/index.vdt.js +3 -2
  60. package/components/icon/styles.js +8 -4
  61. package/components/input/index.d.ts +1 -0
  62. package/components/input/index.js +2 -1
  63. package/components/input/index.vdt.js +47 -32
  64. package/components/input/search.vdt.js +4 -2
  65. package/components/input/styles.js +8 -3
  66. package/components/layout/styles.d.ts +1 -1
  67. package/components/layout/styles.js +7 -3
  68. package/components/menu/index.spec.js +15 -8
  69. package/components/menu/item.d.ts +1 -2
  70. package/components/menu/item.js +10 -17
  71. package/components/menu/item.vdt.js +4 -4
  72. package/components/menu/menu.d.ts +3 -0
  73. package/components/menu/menu.js +4 -0
  74. package/components/menu/styles.d.ts +62 -1
  75. package/components/menu/styles.js +6 -2
  76. package/components/menu/useExpanded.d.ts +1 -4
  77. package/components/menu/useHighlight.d.ts +5 -8
  78. package/components/menu/useHighlight.js +44 -33
  79. package/components/message/index.spec.js +1 -1
  80. package/components/message/styles.js +6 -2
  81. package/components/pagination/styles.js +1 -1
  82. package/components/radio/index.vdt.js +14 -9
  83. package/components/radio/styles.js +9 -1
  84. package/components/rate/styles.js +5 -1
  85. package/components/scrollSelect/styles.d.ts +14 -1
  86. package/components/scrollSelect/styles.js +9 -1
  87. package/components/select/base.vdt.js +135 -121
  88. package/components/select/index.spec.js +1 -1
  89. package/components/select/menu.vdt.js +1 -0
  90. package/components/select/styles.js +9 -4
  91. package/components/select/useSearchable.d.ts +1 -1
  92. package/components/slider/styles.js +5 -1
  93. package/components/spinner/index.d.ts +1 -1
  94. package/components/spinner/index.js +1 -1
  95. package/components/split/style.js +1 -1
  96. package/components/steps/context.d.ts +1 -1
  97. package/components/steps/styles.js +5 -1
  98. package/components/switch/styles.js +5 -1
  99. package/components/table/index.d.ts +1 -0
  100. package/components/table/index.spec.js +2 -1
  101. package/components/table/row.vdt.js +12 -4
  102. package/components/table/styles.js +6 -1
  103. package/components/table/table.d.ts +1 -0
  104. package/components/table/table.js +2 -1
  105. package/components/table/table.vdt.js +30 -27
  106. package/components/table/useColumns.d.ts +1 -1
  107. package/components/table/useFixedColumns.d.ts +1 -1
  108. package/components/table/useFixedColumns.js +5 -2
  109. package/components/table/useGroup.d.ts +1 -1
  110. package/components/table/useResizable.d.ts +1 -1
  111. package/components/table/useSortable.d.ts +1 -1
  112. package/components/table/useWidth.js +7 -1
  113. package/components/tabs/index.spec.js +1 -1
  114. package/components/tabs/styles.js +9 -2
  115. package/components/tabs/tab.vdt.js +2 -1
  116. package/components/tabs/useActiveBar.js +6 -3
  117. package/components/tag/base.js +1 -0
  118. package/components/tag/styles.js +8 -2
  119. package/components/timepicker/constants.d.ts +2 -1
  120. package/components/timepicker/constants.js +3 -2
  121. package/components/timepicker/index.spec.js +36 -35
  122. package/components/timepicker/useStep.js +3 -3
  123. package/components/timepicker/useValue.js +2 -2
  124. package/components/tooltip/index.spec.js +32 -25
  125. package/components/transfer/index.spec.js +20 -19
  126. package/components/transfer/styles.js +2 -6
  127. package/components/tree/index.d.ts +1 -1
  128. package/components/tree/index.js +1 -1
  129. package/components/tree/index.spec.js +20 -19
  130. package/components/tree/index.vdt.js +1 -0
  131. package/components/tree/styles.js +5 -1
  132. package/components/treeSelect/index.spec.js +5 -5
  133. package/components/treeSelect/styles.js +5 -1
  134. package/components/upload/index.d.ts +1 -1
  135. package/components/upload/index.spec.js +1 -1
  136. package/components/upload/index.vdt.js +10 -11
  137. package/components/upload/styles.js +5 -1
  138. package/components/utils.d.ts +1 -1
  139. package/components/wave/index.d.ts +19 -0
  140. package/components/wave/index.js +120 -0
  141. package/components/wave/styles.d.ts +2 -0
  142. package/components/wave/styles.js +17 -0
  143. package/hooks/useRouter.d.ts +1 -0
  144. package/hooks/useRouter.js +10 -0
  145. package/i18n/en-US.d.ts +1 -0
  146. package/i18n/en-US.js +1 -0
  147. package/index.d.ts +3 -2
  148. package/index.js +3 -2
  149. package/install.d.ts +2 -0
  150. package/package.json +2 -12
  151. package/styles/global.js +4 -3
  152. package/styles/theme.d.ts +16 -7
  153. package/styles/theme.js +15 -7
  154. package/tsconfig.json +22 -0
@@ -0,0 +1,72 @@
1
+ import {createApp, render} from 'vue';
2
+ import {mount, unmount, dispatchEvent, getElement, wait} from '@/test/utils';
3
+ import {Dropdown, DropdownMenu, DropdownItem} from '../../';
4
+
5
+ describe('Dropdown', () => {
6
+ it('should save original events', async () => {
7
+ const click = sinon.spy();
8
+ const container = document.createElement('div');
9
+ document.body.appendChild(container);
10
+ const vue = createApp({
11
+ template: `
12
+ <div>
13
+ <Dropdown>
14
+ <button ref="button" @click="test">
15
+ hover
16
+ </button>
17
+ <DropdownMenu>
18
+ <DropdownItem>item 1</DropdownItem>
19
+ <DropdownItem>item 2</DropdownItem>
20
+ <DropdownItem>item 3</DropdownItem>
21
+ </DropdownMenu>
22
+ </Dropdown>
23
+ </div>
24
+ `,
25
+ components: {
26
+ Dropdown, DropdownMenu, DropdownItem
27
+ },
28
+ methods: {
29
+ test() {
30
+ click();
31
+ }
32
+ }
33
+ }).mount(container);
34
+
35
+ (vue.$refs.button as HTMLElement).click();
36
+ await wait();
37
+ expect(click.callCount).to.eql(1);
38
+ expect(getElement('.k-dropdown-menu')).to.be.exist;
39
+
40
+ render(null, container);
41
+ document.body.removeChild(container);
42
+ });
43
+
44
+ it('handle trigger without props', async () => {
45
+ const container = document.createElement('div');
46
+ document.body.appendChild(container);
47
+ const vue = createApp({
48
+ template: `
49
+ <div>
50
+ <Dropdown>
51
+ <button>hover</button>
52
+ <DropdownMenu>
53
+ <DropdownItem>item 1</DropdownItem>
54
+ <DropdownItem>item 2</DropdownItem>
55
+ <DropdownItem>item 3</DropdownItem>
56
+ </DropdownMenu>
57
+ </Dropdown>
58
+ </div>
59
+ `,
60
+ components: {
61
+ Dropdown, DropdownMenu, DropdownItem
62
+ },
63
+ }).mount(container);
64
+
65
+ vue.$el.querySelector('button').click();
66
+ await wait();
67
+ expect(getElement('.k-dropdown-menu')).to.be.exist;
68
+
69
+ render(null, container);
70
+ document.body.removeChild(container);
71
+ });
72
+ });
@@ -0,0 +1,29 @@
1
+ import {createApp, render} from 'vue';
2
+ import {mount, unmount, dispatchEvent, getElement, wait} from '@/test/utils';
3
+ import {Select, Option} from '../../';
4
+
5
+ describe('Select', () => {
6
+ it('handle trigger without props', async () => {
7
+ const container = document.createElement('div');
8
+ document.body.appendChild(container);
9
+ const vue = createApp({
10
+ template: `
11
+ <div>
12
+ <Select>
13
+ <Option v-for="item in [1, 2]" :value="item">{{ item }}</Option>
14
+ </Select>
15
+ </div>
16
+ `,
17
+ components: {
18
+ Select, Option
19
+ },
20
+ }).mount(container);
21
+
22
+ vue.$el.querySelector('.k-select').click();
23
+ await wait();
24
+ expect(getElement('.k-select-menu').textContent).to.eql('12');
25
+
26
+ render(null, container);
27
+ document.body.removeChild(container);
28
+ });
29
+ });
@@ -0,0 +1,46 @@
1
+ import {createApp, render, h} from 'vue';
2
+ import {Component, createRef} from 'intact';
3
+ import {mount, unmount, testDemos, wait, nextFrame} from '@/test/utils';
4
+ import {matchSnapshot} from 'chai-karma-snapshot';
5
+ import mx from '../components/diagram/mxgraph/mx';
6
+ import '../../../test/test.styl';
7
+
8
+ chai.use(matchSnapshot);
9
+
10
+ mx.mxClient.IS_POINTER = false;
11
+
12
+ const testsContext = require.context('./components/', true, /.*\.spec\.ts/);
13
+ testsContext.keys().forEach(testsContext);
14
+
15
+ const reactReq = require.context('~/components/', true, /^((?!(affix|code)).)*\/demos\/.*next\.vue$/);
16
+ // const reactReq = require.context('~/components/', true, /button\/demos\/.*next\.vue$/);
17
+
18
+ describe('Vue Next Demos', () => {
19
+ afterEach(() => unmount());
20
+
21
+ function wrap(Demo: any) {
22
+ return class extends Component {
23
+ static template = '<div ref={this.elementRef}></div>';
24
+ private elementRef = createRef<HTMLElement>();
25
+
26
+ mounted() {
27
+ createApp({
28
+ render: () => h(Demo)
29
+ }).mount(this.elementRef.value!);
30
+ }
31
+
32
+ beforeUnmount() {
33
+ render(null, this.elementRef.value!);
34
+ }
35
+ }
36
+ }
37
+
38
+ testDemos(reactReq, async (Demo) => {
39
+ const [instance, element] = mount(wrap(Demo as any));
40
+ await wait();
41
+ // FIXME: I don't why the width of `autoWidth` input is an unexpected value
42
+ // while we run test on Github Actions.
43
+ const innerHTML = element.innerHTML.replace(/(\<input.*?style="width: )(?:.*?)(px;")/g, '$1$2');
44
+ expect(innerHTML).to.matchSnapshot();
45
+ });
46
+ });
@@ -0,0 +1,54 @@
1
+ const path = require('path');
2
+ const os = require('os');
3
+ const createWebpackConfig = require('./webpack.config');
4
+
5
+ const isDebug = !process.env.UPDATE && !process.env.CI
6
+
7
+ // for get font files
8
+ // https://github.com/ryanclark/karma-webpack/issues/498#issuecomment-790040818
9
+ const output = {
10
+ path: path.join(os.tmpdir(), '_karma_webpack_') + Math.floor(Math.random() * 1000000),
11
+ };
12
+
13
+ module.exports = function (config) {
14
+ config.set({
15
+ browsers: process.env.UPDATE || process.env.CI ? ['MyChromeHeadless'] : undefined,
16
+ customLaunchers: {
17
+ 'MyChromeHeadless': {
18
+ base: 'ChromeHeadless',
19
+ flags: ['--window-size=1920,1080', '--force-device-scale-factor=1'],
20
+ }
21
+ },
22
+ frameworks: ['webpack', 'mocha', 'sinon-chai', 'snapshot', 'mocha-snapshot'],
23
+ reporters: ['mocha'],
24
+ files: [
25
+ './index.ts',
26
+ './__snapshots__/**/*.md',
27
+ ],
28
+ preprocessors: {
29
+ './index.ts': ['webpack', 'sourcemap'],
30
+ './__snapshots__/**/*.md': ['snapshot'],
31
+ },
32
+ webpack: {...createWebpackConfig().toConfig(), output},
33
+ // webpack: createWebpackConfig().toConfig(),
34
+ webpackMiddleware: {
35
+ // noInfo: true
36
+ },
37
+ autoWatch: true,
38
+ mochaReporter: {
39
+ showDiff: true,
40
+ },
41
+ client: {
42
+ mocha: {
43
+ reporter: 'html',
44
+ ui: 'bdd',
45
+ }
46
+ },
47
+ snapshot: {
48
+ update: process.env.UPDATE === '1',
49
+ prune: process.env.UPDATE === '3',
50
+ },
51
+ logLevel: config.LOG_INFO,
52
+ singleRun: !isDebug,
53
+ });
54
+ };
@@ -0,0 +1,61 @@
1
+ const path = require('path');
2
+ const genConfig = require('../../../scripts/webpack');
3
+ const {VueLoaderPlugin} = require('vue-loader');
4
+ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
5
+ const {addConfig} = require('../../../test/webpack');
6
+
7
+ const resolve = (p) => path.resolve(__dirname, p);
8
+
9
+ module.exports = function() {
10
+ const config = genConfig()
11
+ // .context(resolve(''))
12
+ .module
13
+ .rule('ts')
14
+ .test(/\.ts$/)
15
+ .use('ts')
16
+ .loader('ts-loader')
17
+ .options({
18
+ appendTsSuffixTo: [/\.vue$/],
19
+ configFile: resolve('../tsconfig.json'),
20
+ happyPackMode: true,
21
+ })
22
+ .end()
23
+ .end()
24
+ .rule('vue')
25
+ .test(/\.vue$/)
26
+ .use('vue')
27
+ .loader(resolve('../node_modules/vue-loader'))
28
+ .end()
29
+ .end()
30
+ .end()
31
+ .resolve
32
+ .alias
33
+ .set('vue$', resolve('../node_modules/vue/dist/vue.esm-bundler.js'))
34
+ .set('vue-router', resolve('../node_modules/vue-router/dist/vue-router.esm-bundler.js'))
35
+ .end()
36
+ .end()
37
+ .plugin('vue')
38
+ .use(VueLoaderPlugin)
39
+ .end()
40
+ .devtool('inline-source-map');
41
+
42
+ config.stats({
43
+ errorDetails: true
44
+ });
45
+
46
+ addConfig(config);
47
+
48
+ // config.plugin('ts-checker').use(ForkTsCheckerWebpackPlugin, [{
49
+ // typescript: {
50
+ // configFile: resolve('../tsconfig.json'),
51
+ // diagnosticOptions: {
52
+ // semantic: true,
53
+ // syntactic: true,
54
+ // },
55
+ // },
56
+ // }]);
57
+
58
+ return config;
59
+ }
60
+
61
+
@@ -1,6 +1,6 @@
1
1
  import { Component, TypeDefs } from 'intact-vue-next';
2
2
  export interface BreadcrumbItemProps {
3
- to?: string;
3
+ to?: string | object;
4
4
  }
5
5
  export declare class BreadcrumbItem extends Component<BreadcrumbItemProps> {
6
6
  static template: string | import("intact").Template<any>;
@@ -4,10 +4,9 @@ import { __decorate } from "tslib";
4
4
  import { Component } from 'intact-vue-next';
5
5
  import { bind } from '../utils';
6
6
  import template from './item.vdt';
7
- import { isExternalLink } from '../utils';
8
- import { useRouter } from '../../hooks/useRouter';
7
+ import { useRouter, navigate } from '../../hooks/useRouter';
9
8
  var typeDefs = {
10
- to: String
9
+ to: [String, Object]
11
10
  };
12
11
  export var BreadcrumbItem = /*#__PURE__*/function (_Component) {
13
12
  _inheritsLoose(BreadcrumbItem, _Component);
@@ -29,17 +28,7 @@ export var BreadcrumbItem = /*#__PURE__*/function (_Component) {
29
28
  var _proto = BreadcrumbItem.prototype;
30
29
 
31
30
  _proto.onClick = function onClick() {
32
- var to = this.get('to');
33
-
34
- if (to) {
35
- var router = this.router.value;
36
-
37
- if (router && !isExternalLink(to)) {
38
- router.push(to);
39
- } else {
40
- window.location.href = to;
41
- }
42
- }
31
+ navigate(this.router.value, this.get('to'));
43
32
  };
44
33
 
45
34
  return BreadcrumbItem;
@@ -24,5 +24,5 @@ setDefault(function () {
24
24
  }).breadcrumb;
25
25
  });
26
26
  export default function makeStyles() {
27
- return /*#__PURE__*/css("font-size:", breadcrumb.fontSize, ";.k-breadcrumb-item{display:inline-block;&:last-of-type .k-breadcrumb-link{font-weight:", breadcrumb.activeFontWeight, ";color:", breadcrumb.activeColor, ";}}.k-breadcrumb-link,.k-breadcrumb-link a{color:", breadcrumb.color, ";}a.k-breadcrumb-link:hover,.k-breadcrumb-link a:hover{color:", breadcrumb.hoverColor, ";}.k-breadcrumb-separator{margin:0 ", breadcrumb.gap, ";}");
27
+ return /*#__PURE__*/css("font-size:", breadcrumb.fontSize, ";display:flex;align-items:center;.k-breadcrumb-item{&:last-of-type .k-breadcrumb-link{font-weight:", breadcrumb.activeFontWeight, ";color:", breadcrumb.activeColor, ";}}.k-breadcrumb-link,.k-breadcrumb-link a{color:", breadcrumb.color, ";}a.k-breadcrumb-link,.k-breadcrumb-link a{cursor:pointer;&:hover{color:", breadcrumb.hoverColor, ";}}.k-breadcrumb-separator{margin:0 ", breadcrumb.gap, ";}");
28
28
  }
@@ -4,6 +4,8 @@ import { getRestProps } from '../utils';
4
4
  import { Icon } from '../icon';
5
5
  import { makeButtonStyles } from './styles';
6
6
  import { DynamicButton } from './dynamicButton';
7
+ import { Wave } from '../wave';
8
+ import { button as theme } from './styles';
7
9
  export default function ($props, $blocks, $__proto__) {
8
10
  var _classNameObj;
9
11
 
@@ -72,22 +74,29 @@ export default function ($props, $blocks, $__proto__) {
72
74
  var buttonGroup = this.buttonGroup;
73
75
  var checkType = buttonGroup ? buttonGroup.get('checkType') : 'none';
74
76
  var isCheckType = checkType !== 'none';
75
- return _$cc(DynamicButton, _extends({
76
- 'className': _$cn(classNameObj),
77
- 'tagName': tagName
78
- }, getRestProps(this), {
79
- 'ref': this.elementRef,
80
- 'tabindex': disabled || loading ? '-1' : tabindex,
81
- 'ev-click': this.onClick,
82
- 'ev-mouseup': this.onMouseUp,
83
- 'htmlType': htmlType,
84
- 'name': isCheckType ? null : name,
85
- 'children': [loading ? iconSide === 'right' ? [children, loadingIcon] : [loadingIcon, children] : children, isCheckType ? _$ce(64, 'input', null, 1, 'k-button-input', {
86
- 'type': checkType,
87
- 'name': name,
88
- 'checked': checked,
89
- 'tabindex': '-1'
90
- }) : undefined]
91
- }), null, this.elementRef);
77
+ var typeStyles = theme[type];
78
+ var waveColor = typeStyles && typeStyles.borderColor || theme.primary.borderColor;
79
+ return _$cc(Wave, {
80
+ 'disabled': loading || disabled || type === 'none' || type === 'link',
81
+ 'inset': '-2px',
82
+ 'color': waveColor,
83
+ 'children': _$cc(DynamicButton, _extends({
84
+ 'className': _$cn(classNameObj),
85
+ 'tagName': tagName
86
+ }, getRestProps(this), {
87
+ 'ref': this.elementRef,
88
+ 'tabindex': disabled || loading ? '-1' : tabindex,
89
+ 'ev-click': this.onClick,
90
+ 'ev-mouseup': this.onMouseUp,
91
+ 'htmlType': htmlType,
92
+ 'name': isCheckType ? null : name,
93
+ 'children': [loading ? iconSide === 'right' ? [children, loadingIcon] : [loadingIcon, children] : children, isCheckType ? _$ce(64, 'input', null, 1, 'k-button-input', {
94
+ 'type': checkType,
95
+ 'name': name,
96
+ 'checked': checked,
97
+ 'tabindex': '-1'
98
+ }) : undefined]
99
+ }), null, this.elementRef)
100
+ });
92
101
  }
93
102
  ;
@@ -1,6 +1,87 @@
1
1
  import '../../styles/global';
2
+ declare type TypeStyles = {
3
+ color: string;
4
+ bgColor: string;
5
+ borderColor: string;
6
+ hoverBorderColor: string;
7
+ ghostColor: string;
8
+ };
9
+ declare type SizeStyles = {
10
+ fontSize: string;
11
+ height: string;
12
+ padding: string;
13
+ };
2
14
  export declare const types: readonly ["primary", "warning", "danger", "active", "success"];
3
- declare let button: any;
15
+ declare const defaults: {
16
+ readonly transition: string;
17
+ active: TypeStyles;
18
+ secondary: {
19
+ readonly color: string;
20
+ readonly borderColor: string;
21
+ readonly hoverBgColor: string;
22
+ readonly activeBgColor: string;
23
+ };
24
+ link: {
25
+ readonly color: string;
26
+ readonly hoverColor: string;
27
+ readonly hoverBgColor: string;
28
+ };
29
+ none: {
30
+ readonly hoverBgColor: string;
31
+ };
32
+ group: {
33
+ primary: {
34
+ readonly borderColor: string;
35
+ };
36
+ warning: {
37
+ readonly borderColor: string;
38
+ };
39
+ danger: {
40
+ readonly borderColor: string;
41
+ };
42
+ success: {
43
+ readonly borderColor: string;
44
+ };
45
+ };
46
+ } & {
47
+ readonly color: string;
48
+ bgColor: string;
49
+ lineHeight: string;
50
+ readonly padding: string;
51
+ readonly borderColor: string;
52
+ readonly borderRadius: string;
53
+ readonly fontSize: string;
54
+ readonly height: string;
55
+ readonly hoverBorderColor: string;
56
+ readonly hoverColor: string;
57
+ ghost: {
58
+ color: string;
59
+ readonly hoverColor: string;
60
+ borderColor: string;
61
+ readonly hoverBorderColor: string;
62
+ };
63
+ icon: {
64
+ gap: string;
65
+ fontSize: string;
66
+ };
67
+ disabled: {
68
+ readonly color: string;
69
+ readonly bgColor: string;
70
+ readonly borderColor: string;
71
+ readonly ghostBorderColor: string;
72
+ };
73
+ } & {
74
+ primary: TypeStyles;
75
+ warning: TypeStyles;
76
+ danger: TypeStyles;
77
+ success: TypeStyles;
78
+ active: TypeStyles;
79
+ } & {
80
+ small: SizeStyles;
81
+ large: SizeStyles;
82
+ mini: SizeStyles;
83
+ };
84
+ declare let button: typeof defaults;
4
85
  export { button };
5
86
  export declare function makeButtonStyles({ iconSide }: {
6
87
  iconSide?: string;
@@ -149,6 +149,10 @@ var btnSizeStyles = sizes.reduce(function (memo, size) {
149
149
  return memo;
150
150
  }, {});
151
151
  var defaults = deepDefaults({
152
+ get transition() {
153
+ return theme.transition.middle;
154
+ },
155
+
152
156
  active: btnActiveStyles,
153
157
  secondary: {
154
158
  get color() {
@@ -175,6 +179,16 @@ var defaults = deepDefaults({
175
179
 
176
180
  get hoverColor() {
177
181
  return theme.color.linkHover;
182
+ },
183
+
184
+ get hoverBgColor() {
185
+ return theme.color.hoverBg;
186
+ }
187
+
188
+ },
189
+ none: {
190
+ get hoverBgColor() {
191
+ return theme.color.bg;
178
192
  }
179
193
 
180
194
  },
@@ -221,10 +235,10 @@ export function makeButtonStyles(_ref) {
221
235
  return cx(
222
236
  /*#__PURE__*/
223
237
  // extract static styles to individual css method for performance
224
- css("display:inline-flex;align-items:center;justify-content:center;cursor:pointer;height:", button.height, ";padding:", button.padding, ";outline:none;vertical-align:middle;color:", button.color, ";background:", button.bgColor, ";border-radius:", button.borderRadius, ";border:1px solid ", button.borderColor, ";font-size:", button.fontSize, ";white-space:nowrap;transition:all ", theme.transition, ";line-height:", button.lineHeight, ";&:hover,&:focus{border-color:", button.hoverBorderColor, ";color:", button.hoverColor, ";}&:active{background:", palette(theme.color.primary, -4), ";}.k-button-input{position:absolute;opacity:0;width:0;height:0;}", _mapInstanceProperty(types).call(types, function (type) {
238
+ css("display:inline-flex;align-items:center;justify-content:center;cursor:pointer;height:", button.height, ";padding:", button.padding, ";outline:none;vertical-align:middle;color:", button.color, ";background:", button.bgColor, ";border-radius:", button.borderRadius, ";border:1px solid ", button.borderColor, ";font-size:", button.fontSize, ";white-space:nowrap;transition:all ", button.transition, ";line-height:", button.lineHeight, ";&:hover,&:focus{border-color:", button.hoverBorderColor, ";color:", button.hoverColor, ";}&:active{background:", palette(theme.color.primary, -4), ";}.k-button-input{position:absolute;opacity:0;width:0;height:0;}", _mapInstanceProperty(types).call(types, function (type) {
225
239
  var typeStyles = button[type];
226
240
  return /*#__PURE__*/css("&.k-", type, "{background:", typeStyles.bgColor, ";color:", typeStyles.color, ";border-color:", typeStyles.borderColor, ";&:hover,&:focus{background:", palette(typeStyles.bgColor, -1), ";border-color:", typeStyles.hoverBorderColor, ";color:", typeStyles.color, ";}&:active{background:", palette(typeStyles.bgColor, 1), ";border-color:", palette(typeStyles.borderColor, 1), ";}}");
227
- }), "&.k-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}}&.k-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";}}&.k-disabled{&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.k-none,&.k-link{&,&:hover{border:none;background:transparent;}&.k-active{color:", theme.color.primary, ";}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
241
+ }), "&.k-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}}&.k-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";background:", link.hoverBgColor, ";}}&.k-disabled{&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.k-none,&.k-link{background:transparent;&,&:hover{border:none;}&.k-active{color:", theme.color.primary, ";}}&.k-none:hover{background:", button.none.hoverBgColor, ";}", _mapInstanceProperty(sizes).call(sizes, function (size) {
228
242
  var styles = button[size];
229
243
  return /*#__PURE__*/css("&.k-", size, "{font-size:", styles.fontSize, ";height:", styles.height, ";padding:", styles.padding, ";&.k-btn-icon{width:", styles.height, ";}}");
230
244
  }), "&.k-btn-icon{width:", button.height, ";padding:0;.k-icon{margin:0;}}&.k-fluid{width:100%;padding:0;}&.k-circle{border-radius:calc(", button.large.height, " / 2);}&.k-loading{", _mapInstanceProperty(types).call(types, function (type) {
@@ -5,7 +5,7 @@ import '../../styles/global';
5
5
  var defaults = {
6
6
  border: '1px solid #e5e5e5',
7
7
  padding: '16px',
8
- boxShadow: '0 0 20px 0 rgba(0, 0, 0, .06)',
8
+ boxShadow: '0 0 8px 0 rgba(0, 0, 0, .05)',
9
9
  headerHeight: '48px',
10
10
  headerFontSize: '14px',
11
11
  bgColor: '#fff'
@@ -3,7 +3,10 @@ import { theme, setDefault } from '../../styles/theme';
3
3
  import { deepDefaults } from '../../styles/utils';
4
4
  import '../../styles/global';
5
5
  var defaults = {
6
- transition: ".5s ease",
6
+ get transition() {
7
+ return theme.transition.large;
8
+ },
9
+
7
10
  height: "300px",
8
11
  indicator: {
9
12
  bottom: "8px",
@@ -48,7 +48,7 @@ export function useSlide(getItems, getItemsWithCloned) {
48
48
 
49
49
  function _translateToItem() {
50
50
  _translateToItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(item, oldIndex, newIndex, keepDirection) {
51
- var itemsWithCloned, length;
51
+ var itemsWithCloned, length, lengthWithCloned;
52
52
  return _regeneratorRuntime.wrap(function _callee$(_context) {
53
53
  while (1) {
54
54
  switch (_context.prev = _context.next) {
@@ -62,7 +62,7 @@ export function useSlide(getItems, getItemsWithCloned) {
62
62
 
63
63
  case 2:
64
64
  if (!keepDirection) {
65
- _context.next = 13;
65
+ _context.next = 14;
66
66
  break;
67
67
  }
68
68
 
@@ -75,25 +75,26 @@ export function useSlide(getItems, getItemsWithCloned) {
75
75
  }
76
76
 
77
77
  _context.next = 8;
78
- return setTranslate(itemsWithCloned[0], false);
78
+ return setTranslate(itemsWithCloned[(itemsWithCloned.length - length) / 2 - 1], false);
79
79
 
80
80
  case 8:
81
- _context.next = 13;
81
+ _context.next = 14;
82
82
  break;
83
83
 
84
84
  case 10:
85
85
  if (!(oldIndex === 0 && newIndex === length - 1)) {
86
- _context.next = 13;
86
+ _context.next = 14;
87
87
  break;
88
88
  }
89
89
 
90
- _context.next = 13;
91
- return setTranslate(itemsWithCloned[itemsWithCloned.length - 1], false);
90
+ lengthWithCloned = itemsWithCloned.length;
91
+ _context.next = 14;
92
+ return setTranslate(itemsWithCloned[lengthWithCloned - (lengthWithCloned - length) / 2], false);
92
93
 
93
- case 13:
94
+ case 14:
94
95
  setTranslate(item, true);
95
96
 
96
- case 14:
97
+ case 15:
97
98
  case "end":
98
99
  return _context.stop();
99
100
  }