@kizmann/nano-ui 0.8.37 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/bun.lockb +0 -0
  2. package/demos/overview.html +5 -15
  3. package/demos/select.html +164 -0
  4. package/dist/nano-ui.css +1 -1
  5. package/dist/nano-ui.js +2 -2
  6. package/dist/nano-ui.js.map +1 -1
  7. package/dist/themes/light.css +1 -1
  8. package/docs/README.md +1 -2
  9. package/docs/_sidebar.md +19 -21
  10. package/docs/dist/docs.css +2 -0
  11. package/docs/{data → files/data}/table.md +40 -14
  12. package/docs/files/form/button.md +122 -0
  13. package/docs/{form → files/form}/form.md +14 -0
  14. package/docs/files/form/input.md +90 -0
  15. package/docs/files/form/switch.md +92 -0
  16. package/docs/index.html +163 -44
  17. package/docs/src/scss/docsify/basic/_layout.sass +3 -6
  18. package/docs/src/scss/docsify/syntax.scss +139 -0
  19. package/docs/src/scss/docsify/vue.sass +2 -15
  20. package/docs/src/scss/index.scss +428 -16
  21. package/package.json +1 -1
  22. package/src/button/src/button/button.js +1 -9
  23. package/src/mixins/src/ctor.js +0 -6
  24. package/src/popover/src/popover/popover.scss +4 -0
  25. package/src/radio/src/radio-group/radio-group.js +1 -1
  26. package/src/root/vars.scss +10 -10
  27. package/src/scrollbar/src/scrollbar/scrollbar.next.js +21 -1
  28. package/src/select/src/select/select.js +191 -78
  29. package/src/select/src/select/select.scss +4 -0
  30. package/src/select/src/select-option/select-option.js +6 -2
  31. package/src/table/src/table/table.scss +0 -1
  32. package/src/tags/src/tags-item/tags-item.js +17 -1
  33. package/src/virtualscroller/src/virtualscroller/virtualscroller.beta.js +12 -2
  34. package/themes/light/root/vars.scss +10 -10
  35. package/themes/light/switch/src/switch/switch.scss +1 -1
  36. package/themes/light/table/src/table/table.scss +1 -1
  37. package/themes/light/tags/src/tags-item/tags-item.scss +16 -0
  38. package/webpack.config.js +13 -13
  39. package/dist/themes/basic.css +0 -2029
  40. package/dist/themes/flat.css +0 -1806
  41. package/dist/themes/flat.dark.css +0 -1809
  42. package/docs/dist/index.css +0 -6977
  43. package/docs/form/button.md +0 -299
  44. package/docs/form/input.md +0 -205
  45. package/docs/form/switch.md +0 -166
  46. /package/docs/{data → files/data}/draggable.md +0 -0
  47. /package/docs/{data → files/data}/map.md +0 -0
  48. /package/docs/{data → files/data}/paginator.md +0 -0
  49. /package/docs/{data → files/data}/virtualscroller.md +0 -0
  50. /package/docs/{form → files/form}/cascader.md +0 -0
  51. /package/docs/{form → files/form}/checkbox.md +0 -0
  52. /package/docs/{form → files/form}/datepicker.md +0 -0
  53. /package/docs/{form → files/form}/radio.md +0 -0
  54. /package/docs/{form → files/form}/select.md +0 -0
  55. /package/docs/{form → files/form}/textarea.md +0 -0
  56. /package/docs/{form → files/form}/timepicker.md +0 -0
  57. /package/docs/{form → files/form}/transfer.md +0 -0
  58. /package/docs/{others → files/others}/config.md +0 -0
  59. /package/docs/{others → files/others}/confirm.md +0 -0
  60. /package/docs/{others → files/others}/loader.md +0 -0
  61. /package/docs/{others → files/others}/modal.md +0 -0
  62. /package/docs/{others → files/others}/notification.md +0 -0
  63. /package/docs/{others → files/others}/popover.md +0 -0
  64. /package/docs/{others → files/others}/resizer.md +0 -0
  65. /package/docs/{others → files/others}/scrollbar.md +0 -0
  66. /package/docs/{others → files/others}/tabs.md +0 -0
@@ -0,0 +1,92 @@
1
+ # Switch
2
+
3
+ The `<n-switch>` component is a customizable switch component with various options to control its appearance and behavior. Below is a detailed description of its props, methods, and usage.
4
+
5
+
6
+ ## Demo
7
+
8
+ ```js [demo]
9
+ pi.Obj.assign(window.VueData, {
10
+ switchBinds: {
11
+ size: 'md', disabled: false,
12
+ },
13
+ switchReact: {
14
+ model: 'foo'
15
+ }
16
+ });
17
+ ```
18
+
19
+ ```html [demo]
20
+ <n-form>
21
+ <div class="demo-options">
22
+ <div class="grid grid--row grid--wrap grid--20-20">
23
+ <n-form-item class="col--1-1 col--6-12@sm col--3-12@lg" label="Size">
24
+ <n-select v-model="switchBinds.size" :options="sizes" />
25
+ </n-form-item>
26
+ <n-form-item class="col--1-1 col--6-12@sm col--3-12@lg" label="Disabled">
27
+ <n-switch v-model="switchBinds.disabled">Activate disable state</n-switch>
28
+ </n-form-item>
29
+ </div>
30
+ </div>
31
+ <div class="demo-display">
32
+ <div class="grid grid--row grid--wrap grid--40-40 grid--middle">
33
+ <div class="col--auto">
34
+ <n-switch :model-value="true" v-bind="switchBinds" on-type="primary">Primary</n-switch>
35
+ </div>
36
+ <div class="col--auto">
37
+ <n-switch v-bind="switchBinds" on-type="secondary">Secondary</n-switch>
38
+ </div>
39
+ <div class="col--auto">
40
+ <n-switch :model-value="true" v-bind="switchBinds" on-type="success">Success</n-switch>
41
+ </div>
42
+ <div class="col--auto">
43
+ <n-switch v-bind="switchBinds" on-type="warning">Warning</n-switch>
44
+ </div>
45
+ <div class="col--auto">
46
+ <n-switch v-bind="switchBinds" on-type="danger">Danger</n-switch>
47
+ </div>
48
+ <div class="col--auto">
49
+ <n-switch v-bind="switchBinds" on-type="info">Info</n-switch>
50
+ </div>
51
+ </div>
52
+ <div class="grid grid--row grid--wrap grid--40-40 grid--middle">
53
+ <div class="col--auto">
54
+ <n-switch v-model="switchReact.model" v-bind="switchBinds" on-value="foo" off-value="bar">Switch between to strings</n-switch>
55
+ </div>
56
+ <div class="col--flex-1-1">
57
+ <code style="white-space: initial">{{ switchReact }}</code>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </n-form>
62
+ ```
63
+
64
+ ## Example
65
+
66
+ ```vue
67
+ <template>
68
+ <n-switch v-model="modelValue" on-value="yes" off-value="no" @click="window.alert('Switch toggled!')">
69
+ Toggle Switch
70
+ </n-switch>
71
+ </template>
72
+ <script>
73
+ export default {
74
+ data() {
75
+ return { modelValue: 'yes' };
76
+ }
77
+ }
78
+ </script>
79
+
80
+ ```
81
+
82
+ ## Properties
83
+
84
+ | **Prop** | **Type** | **Default** | **Description** |
85
+ |--------------|---------------------|-------------|--------------------------------------------------------------------------------------------------|
86
+ | `modelValue` | `Boolean` | `false` | The current value of the switch. |
87
+ | `onValue` | `Any` | `true` | The value when the switch is turned on. |
88
+ | `offValue` | `Any` | `false` | The value when the switch is turned off. |
89
+ | `onType` | `String` | `'primary'` | The style type when the switch is on (e.g., 'primary', 'secondary'). |
90
+ | `offType` | `String` | `'default'` | The style type when the switch is off. |
91
+ | `size` | `String` | `'md'` | Sets the size of the switch (e.g., 'sm', 'md', 'lg'). |
92
+ | `disabled` | `Boolean` | `false` | If true, disables the switch. |
package/docs/index.html CHANGED
@@ -1,57 +1,176 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <meta charset="UTF-8">
5
- <title>nano.ui</title>
6
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7
- <meta name="description" content="Description">
8
- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
9
- <link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap">
10
- <link rel="stylesheet" href="//unpkg.com/backpack.css@2.0.0/lib/backpack.css">
11
- <link rel="stylesheet" href="./dist/index.css">
12
- <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css">
13
- <link rel="stylesheet" href="../dist/nano-ui.css">
4
+ <meta charset="UTF-8">
5
+ <title>nano.ui</title>
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7
+ <meta name="description" content="Description">
8
+ <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
9
+ <link rel="preconnect" href="https://fonts.googleapis.com">
10
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
+ <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700&display=swap" rel="stylesheet">
12
+ <link rel="stylesheet" href="//unpkg.com/backpack.css@2.0.0/lib/backpack.css">
13
+ <link rel="stylesheet" href="//unpkg.com/@fortawesome/fontawesome-free/css/all.min.css">
14
+ <link rel="stylesheet" href="../dist/nano-ui.css">
15
+ <link rel="stylesheet" href="../dist/themes/light.css">
16
+ <link rel="stylesheet" href="./dist/docs.css">
14
17
  </head>
15
18
  <body>
16
- <div id="app"></div>
17
- <script src="//unpkg.com/babel-standalone@6/babel.min.js"></script>
18
- <script src="//unpkg.com/vue/dist/vue.js"></script>
19
- <script src="//vankizmann.github.io/@kizmann/pico-js/dist/@kizmann/pico-js.js"></script>
20
- <script src="../dist/nano-ui.js"></script>
21
-
22
- <script src="//unpkg.com/docsify-demo-box-vue@1.1.0/dist/docsify-demo-box-vue.min.js"></script>
23
- <script>
24
-
25
- var jsResources = [
26
- '<scr' + 'ipt src="//unpkg.com/babel-standalone@6/babel.min.js"></scr' + 'ipt>',
27
- '<scr' + 'ipt src="//unpkg.com/vue/dist/vue.js"></scr' + 'ipt>',
28
- '<scr' + 'ipt src="//vankizmann.github.io/@kizmann/pico-js/dist/@kizmann/pico-js.js"></scr' + 'ipt>',
29
- '<scr' + 'ipt src="//vankizmann.github.io/@kizmann/pico-js/dist/nano-ui.js"></scr' + 'ipt>'
30
- ];
19
+ <header>
20
+ <div class="wrapper">
21
+ <div class="logo">
22
+ <a href="./#/README">
23
+ <img src="../nano.svg" alt="nano-ui">
24
+ </a>
25
+ </div>
26
+ <div class="social">
27
+ <a href="https://www.paypal.com/paypalme/vankizmann" target="_blank">
28
+ <i class="fab fa-paypal"></i> Donate
29
+ </a>
30
+ </div>
31
+ <div class="social blue">
32
+ <a href="https://github.com/vankizmann/nano-ui" target="_blank">
33
+ <i class="fab fa-github"></i> Github
34
+ </a>
35
+ </div>
36
+ </div>
37
+ </header>
38
+ <div id="app">
39
+ <!-- Docs -->
40
+ </div>
41
+
42
+ <script src="//unpkg.com/vue@3/dist/vue.global.js"></script>
43
+ <script src="//unpkg.com/babel-standalone@6/babel.min.js"></script>
44
+ <script src="//unpkg.com/moment@2.30.1/min/moment.min.js"></script>
45
+ <script src="//unpkg.com/@kizmann/pico-js/dist/pico-js.js"></script>
46
+ <script src="../dist/nano-ui.js"></script>
47
+
48
+ <script>
49
+
50
+ var GenerateItems = function (count, loop) {
51
+ return pi.Arr.each(pi.Arr.make(count), (index) => {
52
+
53
+ var item = {
54
+ id: 'item-' + pi.UUID(), label: 'Item ' + index, image: 'https://picsum.photos/260/160.jpg?' + pi.UUID(), date: new Date,
55
+ }
56
+
57
+ if ( loop > 1 ) {
58
+ item.children = GenerateItems(10, loop-1)
59
+ }
60
+
61
+ return item;
62
+ });
63
+ };
64
+
65
+ let DemoPlugin = function (hook, vm) {
66
+
67
+ // Global vue data
68
+ window.VueData = window.DefaultVueData = {
69
+ itemsMini: GenerateItems(50, 1),
70
+ itemsMidi: GenerateItems(500, 1),
71
+ itemsMaxi: GenerateItems(1000, 2),
72
+ };
73
+
74
+ window.DefaultVueData.types = {
75
+ 'primary': 'Primary',
76
+ 'secondary': 'Secondary',
77
+ 'success': 'Success',
78
+ 'warning': 'Warning',
79
+ 'danger': 'Danger',
80
+ 'info': 'Info',
81
+ };
82
+
83
+ window.DefaultVueData.sizes = {
84
+ 'xs': 'Mini',
85
+ 'sm': 'Small',
86
+ 'md': 'Medium',
87
+ 'lg': 'Large'
88
+ };
89
+
90
+ window.DefaultVueData.icons = {
91
+ 'fa fa-search': 'Search',
92
+ 'fa fa-star': 'Star',
93
+ 'fa fa-check': 'Check',
94
+ 'fa fa-trash': 'Trash'
95
+ },
96
+
97
+ // Remote vue app
98
+ window.VueRemote = null;
99
+
100
+ hook.beforeEach(function (markdown) {
101
+
102
+ pi.Dom.find('#temp-script').each(function (el) {
103
+ el.remove();
104
+ });
31
105
 
32
- jsResources = jsResources.join("\n");
106
+ if ( ! pi.Any.isEmpty(window.VueData) ) {
107
+ window.VueData = pi.Obj.assign({}, window.DefaultVueData);
108
+ }
33
109
 
110
+ if ( ! pi.Any.isEmpty(window.VueRemote) ) {
111
+ window.VueRemote.unmount();
112
+ }
34
113
 
35
- var cssResources = '@import url("//cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css");';
36
- var bootCode = "var foo = 'bar'";
114
+ let pattern = /```js\s\[demo]([^`]*)```/gm;
37
115
 
38
- var basePath = window.location.href.match(/github/) ? '/nano-ui/docs/' : '/docs/';
116
+ let globaljs = pi.Arr.each(markdown.match(pattern) || [], (text) => {
117
+ return text.replace(pattern, "$1");
118
+ });
39
119
 
40
- window.$docsify = {
41
- name: 'nano.ui',
42
- repo: 'https://github.com/vankizmann/nano-ui',
43
- logo: 'https://vankizmann.github.io/nano-ui/nano.png',
44
- basePath: basePath,
45
- relativePath: false,
46
- themeColor: '#2877FA',
47
- autoHeader: true,
48
- loadSidebar: true,
49
- plugins: [
50
- DemoBoxVue.create(jsResources, cssResources, bootCode)
51
- ]
120
+ pi.Dom.make('script', { id: "temp-script", innerHTML: globaljs.join("\n")})
121
+ .appendTo(document.body)
122
+
123
+ markdown = markdown.replace(/```html\s\[demo]([^`]*)```/gm,
124
+ '<div class="demo-wrapper">$1</div>');
125
+
126
+ return markdown.replace(/```[a-z]+\s\[demo][^`]*```/gm, '');
127
+ });
128
+
129
+ hook.afterEach(function (html) {
130
+
131
+ html = html.replace(/<code>(String|Boolean|Array|Object)<\/code>/gm,
132
+ '<code data-type="$1">$1</code>');
133
+
134
+ return '<div id="vue-remote">' + html + '</div>';
135
+ });
136
+
137
+ hook.doneEach(function () {
138
+
139
+ let options = {
140
+ data: function () {
141
+ return window.VueData;
142
+ }
143
+ };
144
+
145
+ // Create vue instance
146
+ window.VueRemote = window.Vue
147
+ .createApp(options);
148
+
149
+ window.VueRemote
150
+ .use(window.nano.Install);
151
+
152
+ window.VueRemote.mount('#main');
153
+ });
154
+
155
+ console.log('DemoPlugin done!');
156
+ }
157
+
158
+ let options = {
159
+ name: 'nano.ui', loadSidebar: true, search: 'auto', depth: 2, subMaxLevel: 2, topMargin: 90
52
160
  };
53
- </script>
54
- <script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
55
- <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
161
+
162
+ options.plugins = [
163
+ DemoPlugin
164
+ ];
165
+
166
+ if ( pi.Any.isEmpty(options) ) {
167
+ options.repo = 'https://github.com/vankizmann/nano-ui'
168
+ }
169
+
170
+ window.$docsify = options;
171
+ </script>
172
+ <script src="//unpkg.com/docsify@4.12.1/lib/docsify.min.js"></script>
173
+ <script src="//unpkg.com/docsify@4.12.1/lib/plugins/search.min.js"></script>
174
+ <script src="//unpkg.com/docsify@4.12.1/lib/plugins/emoji.min.js"></script>
56
175
  </body>
57
176
  </html>
@@ -14,7 +14,6 @@ body:not(.ready)
14
14
 
15
15
  div#app
16
16
  font-size: 30px
17
- font-weight: lighter
18
17
  margin: 40vh auto
19
18
  text-align: center
20
19
 
@@ -48,8 +47,6 @@ html, body
48
47
  height: 100%
49
48
 
50
49
  body
51
- -moz-osx-font-smoothing: grayscale
52
- -webkit-font-smoothing: antialiased
53
50
  color: $color-black
54
51
  font-family: $font-family
55
52
  font-size: 15px
@@ -295,7 +292,7 @@ main.hidden
295
292
 
296
293
  body.sticky
297
294
  .sidebar, .sidebar-toggle
298
- position: fixed
295
+ //position: fixed
299
296
 
300
297
  /* main content */
301
298
  .content
@@ -310,7 +307,7 @@ body.sticky
310
307
  /* markdown content found on pages */
311
308
  .markdown-section
312
309
  margin: 0 auto
313
- max-width: 80%
310
+ max-width: 960px
314
311
  padding: 30px 15px 40px 15px
315
312
  position: relative
316
313
 
@@ -410,7 +407,7 @@ body.close
410
407
 
411
408
  @media screen and (max-width: 768px)
412
409
  .github-corner, .sidebar-toggle, .sidebar
413
- position: fixed
410
+ //position: fixed
414
411
 
415
412
  .app-nav
416
413
  margin-top: 16px
@@ -0,0 +1,139 @@
1
+
2
+ .markdown-section pre {
3
+ border-radius: $lg-radius;
4
+ background-color: $color-gray-90;
5
+ font-family: 'Roboto Mono', Monaco, courier, monospace;
6
+ overflow: auto;
7
+ padding: 0;
8
+ position: relative;
9
+ word-wrap: normal;
10
+ margin-bottom: 30px;
11
+ }
12
+
13
+ .markdown-section pre > code {
14
+ padding: 25px 30px !important;
15
+ }
16
+
17
+ .markdown-section pre,
18
+ .markdown-section pre code {
19
+ font-size: 14px;
20
+ line-height: 1.6rem;
21
+ }
22
+
23
+ /* code highlight */
24
+ .token.comment, .token.prolog, .token.doctype, .token.cdata {
25
+ color: $color-gray-55;
26
+ }
27
+
28
+ .token.namespace {
29
+ opacity: 0.7;
30
+ }
31
+
32
+ .token.boolean, .token.number {
33
+ color: #c76b29;
34
+ }
35
+
36
+ .token.punctuation {
37
+ color: $color-gray-40;
38
+ }
39
+
40
+ .token.property {
41
+ color: mix($color-gray-25, $color-warning, 15%);
42
+ }
43
+
44
+ .token.tag {
45
+ color: mix($color-gray-25, $color-primary, 15%);
46
+ }
47
+
48
+ .token.string {
49
+ color: mix($color-gray-25, $color-info, 15%);
50
+ }
51
+
52
+ .token.selector {
53
+ color: #6679cc;
54
+ }
55
+
56
+ .token.attr-name {
57
+ color: mix($color-gray-25, $color-success, 15%);
58
+ }
59
+
60
+ .token.entity, .token.url, .language-css .token.string, .style .token.string {
61
+ color: #22a2c9;
62
+ }
63
+
64
+ .token.attr-value, .token.control, .token.directive, .token.unit {
65
+ color: mix($color-gray-25, $color-danger, 15%);
66
+ }
67
+
68
+ .token.keyword, .token.function {
69
+ color: mix($color-gray-25, $color-warning, 15%);
70
+ }
71
+
72
+ .token.statement, .token.regex, .token.atrule {
73
+ color: #22a2c9;
74
+ }
75
+
76
+ .token.placeholder, .token.variable {
77
+ color: #3d8fd1;
78
+ }
79
+
80
+ .token.deleted {
81
+ text-decoration: line-through;
82
+ }
83
+
84
+ .token.inserted {
85
+ border-bottom: 1px dotted #202746;
86
+ text-decoration: none;
87
+ }
88
+
89
+ .token.italic {
90
+ font-style: italic;
91
+ }
92
+
93
+ .token.important, .token.bold {
94
+ font-weight: bold;
95
+ }
96
+
97
+ .token.important {
98
+ color: #c94922;
99
+ }
100
+
101
+ .token.entity {
102
+ cursor: help;
103
+ }
104
+
105
+ .markdown-section pre > code {
106
+ background-color: transparent;
107
+ color: $color-gray-10;
108
+ display: block;
109
+ line-height: inherit;
110
+ margin: 0 2px;
111
+ max-width: inherit;
112
+ overflow: inherit;
113
+ padding: 2.2em 5px;
114
+ white-space: inherit;
115
+ }
116
+
117
+ .markdown-section code::after, .markdown-section code::before {
118
+ letter-spacing: 0.05rem;
119
+ }
120
+
121
+ code .token {
122
+ min-height: 1.5rem;
123
+ position: relative;
124
+ left: auto;
125
+ }
126
+
127
+ pre::after {
128
+ color: $color-gray-50;
129
+ content: attr(data-lang);
130
+ font-size: 12px;
131
+ font-weight: 600;
132
+ height: 15px;
133
+ line-height: 15px;
134
+ padding: 5px 10px 0;
135
+ position: absolute;
136
+ right: 0;
137
+ text-align: right;
138
+ top: 0;
139
+ }
@@ -1,22 +1,9 @@
1
1
 
2
- $font-family: 'Inter', 'Helvetica', 'Arial', sans-serif !default
2
+ $font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif !default
3
3
  $sidebar-width: 320px !default
4
4
 
5
5
  @import 'basic/_layout'
6
- //@import 'basic/_coverpage'
7
-
8
- .demo-block
9
- border-color: $color-gray-10 !important
10
- box-shadow: 0 1px 3px rgba($color-black, 0.05) !important
11
-
12
- &:hover
13
- box-shadow: 0 1px 10px rgba($color-black, 0.05) !important
14
-
15
- .demo-block-control span
16
- color: var(--theme-color, $color-primary) !important
17
-
18
- .description button
19
- background: var(--theme-color, $color-primary) !important
6
+ @import 'basic/_coverpage'
20
7
 
21
8
  body
22
9
  background-color: $color-white