@avakhula/ui 0.0.29 → 0.0.30

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avakhula/ui",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.umd.cjs",
6
6
  "source": "src/index.js",
package/src/App.vue CHANGED
@@ -1,144 +1,32 @@
1
1
  <template>
2
- <ib-pagination
3
- current="1"
4
- countRows="222"
5
- limitSelector="25"
6
- labelInput="Go to:"
7
- labelSelect="Rows per page:"
8
- @select="() => console.log('paggination call emit select')"
9
- @set-limit="() => console.log('paggination call emit set limit')"
10
-
11
- />
12
-
13
- <ib-select
14
- v-model="test"
15
- :options="options"
16
- :is-required="true"
17
- :is-multiple="false"
18
- @close="onClose"
19
- />
20
-
21
- <button @click="changeValue">Change value</button>
22
- <button @click="changeValueInProps">Change value in props</button>
23
-
24
- <ib-checkbox @input="test1" class="hello" />
25
-
26
- <ib-button style="margin-bottom: 1020px;" v-tooltip="'test'" >HOVER ME</ib-button>
27
- <ib-button style="margin-bottom: 20px;" v-tooltip="'second test'" >HOVER ME</ib-button>
28
-
29
- <p class="test" v-TextOverflowTooltipTooltip="'test'">
30
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Earum inventore maxime porro exercitationem. Deserunt temporibus quasi rerum numquam tenetur dolor illum nemo
31
- </p>
32
-
2
+ test
3
+ <ib-panel>
4
+ <template #title>
5
+ Some title
6
+ </template>
7
+ <template #head-content>Some long long description</template>
8
+ <template #body>
9
+ <p>tests</p>
10
+ <p>tests</p>
11
+ <p>tests</p>
12
+ <p>tests</p>
13
+ <p>tests</p>
14
+ <p>tests</p>
15
+ <p>tests</p>
16
+ <p>tests</p>
17
+ <p>tests</p>
18
+ </template>
19
+ </ib-panel>
33
20
  </template>
34
21
 
35
22
  <script>
36
- import IbButton from "./components/Button/Button.vue"
37
- import { TooltipDirective as Tooltip} from "./directives/tooltip/tooltip"
38
- import { TextOverflowTooltipDirective as TextOverflowTooltipTooltip} from "./directives/tooltip/textOverflowTooltip"
39
-
40
- import IbSelect from "./components/TreeSelect/Select.vue";
41
- import IbCheckbox from "./components/Form/Checkbox/Checkbox.vue";
42
- import IbPagination from "./components/Pagination/Pagination.vue";
43
- const testData = [
44
- // {
45
- // id: "1",
46
- // title: "Education",
47
- // is_category: true,
48
- // initiallyVisible: true,
49
- // visible: true,
50
- // isDisabled: false,
51
- // checked: true,
52
- // isChildrenVisible: true,
53
- // },
54
- {
55
- id: 2,
56
- title: "test role",
57
- initiallyVisible: true,
58
- visible: true,
59
- isDisabled: false,
60
- checked: false,
61
- },
62
- // {
63
- // id: "2",
64
- // title: "Education 2",
65
- // is_category: true,
66
- // initiallyVisible: true,
67
- // visible: true,
68
- // isDisabled: false,
69
- // checked: false,
70
- // isChildrenVisible: true,
71
- // },
72
- // {
73
- // id: "3",
74
- // title: "Education 3",
75
- // is_category: true,
76
- // initiallyVisible: true,
77
- // visible: true,
78
- // isDisabled: false,
79
- // checked: false,
80
- // isChildrenVisible: true,
81
- // },
82
- // {
83
- // id: "4",
84
- // title: "Education 4",
85
- // is_category: true,
86
- // initiallyVisible: true,
87
- // visible: true,
88
- // isDisabled: false,
89
- // checked: false,
90
- // isChildrenVisible: true,
91
- // },
92
- ];
93
-
23
+ // import IbPanel from "./components/Panel/Panel.vue"
24
+ import { IbPanel } from "./index";
94
25
  export default {
95
- data() {
96
- return {
97
- options: testData,
98
- test: testData[0].id,
99
- };
100
- },
101
- directives: {
102
- Tooltip,
103
- TextOverflowTooltipTooltip,
104
- },
105
- watch: {
106
- test(val) {
107
- console.log("test", val);
108
- },
109
- },
110
26
  components: {
111
- IbButton,
112
- IbSelect,
113
- IbCheckbox,
114
- IbPagination,
115
- },
116
- methods: {
117
- test1() {
118
- console.log("test 1");
119
- },
120
-
121
- changeValue() {
122
- console.log("test");
123
- this.test = "";
124
- },
125
- changeValueInProps() {
126
- console.log("test");
127
- this.test = testData[0].id;
128
- },
129
- onClose(a) {
130
- console.log("onClose", a)
131
- }
27
+ IbPanel,
132
28
  },
133
29
  };
134
30
  </script>
135
-
136
- <style>
137
- .test {
138
- overflow: hidden;
139
- display: -webkit-box;
140
- -webkit-line-clamp: 1;
141
- -webkit-box-orient: vertical;
142
-
143
- }
31
+ <style lang="scss">
144
32
  </style>
@@ -20,10 +20,12 @@
20
20
  </template>
21
21
 
22
22
  <script>
23
+ import expandAnimation from "../../mixins/expandAnimation";
23
24
  import IbIcon from "../Icon.vue";
24
25
 
25
26
  export default {
26
27
  name: "IbAccordion",
28
+ mixins: [expandAnimation],
27
29
  props: {
28
30
  isOpen: {
29
31
  type: Boolean,
@@ -49,38 +51,6 @@ export default {
49
51
  this.$emit("close", this.isActive);
50
52
  }
51
53
  },
52
- enter(element) {
53
- const width = getComputedStyle(element).width;
54
-
55
- element.style.width = width;
56
- element.style.position = "absolute";
57
- element.style.visibility = "hidden";
58
- element.style.height = "auto";
59
-
60
- const height = getComputedStyle(element).height;
61
-
62
- element.style.width = null;
63
- element.style.position = null;
64
- element.style.visibility = null;
65
- element.style.height = 0;
66
- getComputedStyle(element).height;
67
- requestAnimationFrame(() => {
68
- element.style.height = height;
69
- });
70
- },
71
- afterEnter(element) {
72
- element.style.height = "auto";
73
- },
74
- leave(element) {
75
- const height = getComputedStyle(element).height;
76
-
77
- element.style.height = height;
78
- getComputedStyle(element).height;
79
-
80
- requestAnimationFrame(() => {
81
- element.style.height = 0;
82
- });
83
- },
84
54
  },
85
55
  components: {
86
56
  IbIcon,
@@ -1,4 +1,5 @@
1
1
  import IbModal from "./Modal.vue";
2
+ import { modalSizes } from "./constants";
2
3
  import IbButton from "../Button/Button.vue";
3
4
  import IbButtonGroup from "../ButtonGroup/ButtonGroup.vue";
4
5
  import readme from "./readme.mdx";
@@ -7,6 +8,10 @@ export default {
7
8
  title: "Modal",
8
9
  component: IbModal,
9
10
  argTypes: {
11
+ size: {
12
+ control: { type: "select" },
13
+ options: Object.values(modalSizes),
14
+ },
10
15
  onOpen: { action: "open" },
11
16
  onClose: { action: "close" },
12
17
  },
@@ -11,7 +11,7 @@
11
11
 
12
12
  <Teleport to="body">
13
13
  <div class="modal" :class="classList" v-show="isActive" ref="modal">
14
- <div class="modal-body" v-outside="clickOutside">
14
+ <div class="modal-body" :style="bodyStyles" v-outside="clickOutside">
15
15
  <ib-icon-button
16
16
  v-if="showCloseButton"
17
17
  class="modal-close-icon"
@@ -40,6 +40,7 @@
40
40
  <script>
41
41
  import IbIconButton from "../IconButton/IconButton.vue";
42
42
  import IbIcon from "../Icon.vue";
43
+ import { modalSizes } from "./constants";
43
44
  import { OutsideDirective as Outside } from "../../directives/outside/outside";
44
45
  import { ESC_KEY_CODE, TAB_KEY_CODE } from "../../constants/keyCodes";
45
46
 
@@ -67,6 +68,10 @@ export default {
67
68
  type: Boolean,
68
69
  default: true,
69
70
  },
71
+ size: {
72
+ type: String,
73
+ default: modalSizes.S,
74
+ },
70
75
  },
71
76
  watch: {
72
77
  active(val) {
@@ -139,6 +144,34 @@ export default {
139
144
  },
140
145
  },
141
146
  computed: {
147
+ bodyStyles() {
148
+ const styleList = {};
149
+
150
+ if (this.size === modalSizes.S) {
151
+ styleList.width = "380px";
152
+ styleList.minHeight = "160px";
153
+ styleList.maxHeight = "680px";
154
+ }
155
+
156
+ if (this.size === modalSizes.M) {
157
+ styleList.width = "600px";
158
+ styleList.minHeight = "260px";
159
+ styleList.maxHeight = "680px";
160
+ }
161
+
162
+ if (this.size === modalSizes.L) {
163
+ styleList.width = "850px";
164
+ styleList.minHeight = "400px";
165
+ styleList.maxHeight = "680px";
166
+ }
167
+
168
+ if (this.size === modalSizes.XL) {
169
+ styleList.width = "80vw";
170
+ styleList.maxWidth = "1400px";
171
+ }
172
+
173
+ return styleList;
174
+ },
142
175
  hasTrigger() {
143
176
  return !!this.$slots.trigger;
144
177
  },
@@ -198,11 +231,12 @@ body.modal-open {
198
231
  left: 50%;
199
232
  transform: translate(-50%, -50%);
200
233
  position: relative;
201
- width: fit-content;
202
234
  min-width: 380px;
203
235
  border-radius: 8px;
204
236
  max-width: calc(100% - 40px);
205
237
  box-shadow: $modal-shadow;
238
+ display: flex;
239
+ flex-direction: column;
206
240
 
207
241
  .modal-header {
208
242
  @include Ib-H2-medium;
@@ -226,7 +260,8 @@ body.modal-open {
226
260
  }
227
261
 
228
262
  .modal-footer {
229
- margin-top: 20px;
263
+ margin-top: auto;
264
+ padding-top: 20px;
230
265
  display: flex;
231
266
  justify-content: flex-end;
232
267
  }
@@ -0,0 +1,6 @@
1
+ export const modalSizes = {
2
+ S: "s",
3
+ M: "m",
4
+ L: "l",
5
+ XL: "xl",
6
+ };
@@ -41,6 +41,7 @@ Modal container is a flexible component and its sizing depends on specific useca
41
41
  | classList | String | "" | Classes for modal. |
42
42
  | stopPropagation | Boolean | false | Disable modal close on click outside and press ESC |
43
43
  | showCloseButton | Boolean | True | Whether is show close button |
44
+ | Size | String | s, m, l, xl | Determines the size of the modal body |
44
45
 
45
46
  ### Events
46
47
 
@@ -73,4 +74,4 @@ Modal content should never scroll horizontally; instead, use a larger size modal
73
74
 
74
75
  ### Default
75
76
 
76
- <Canvas of={Modal.Default}/>
77
+ <Canvas of={ModalStories.Default}/>
@@ -0,0 +1,43 @@
1
+ import IbPanel from "./Panel.vue";
2
+ import { panelVariant } from "./constants";
3
+
4
+ export default {
5
+ title: "Panel",
6
+ component: IbPanel,
7
+ argTypes: {
8
+ variant: {
9
+ control: { type: "select" },
10
+ options: Object.values(panelVariant),
11
+ },
12
+ },
13
+ };
14
+
15
+ const Template = (args) => ({
16
+ components: { IbPanel },
17
+ setup() {
18
+ return { args };
19
+ },
20
+ template: `
21
+ <ib-panel v-bind="args">
22
+ <template #title>
23
+ Some title
24
+ </template>
25
+ <template #head-content>
26
+ Some long long description
27
+ </template>
28
+ <template #body>
29
+ <p>item 1</p>
30
+ <p>item 2</p>
31
+ <p>item 3</p>
32
+ <p>item 4</p>
33
+ <p>item 5</p>
34
+ <p>item 6</p>
35
+ <p>item 7</p>
36
+ <p>item 8</p>
37
+ <p>item 9</p>
38
+ </template>
39
+ </ib-panel>
40
+ `,
41
+ });
42
+
43
+ export const Default = Template.bind({});
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div :class="classList">
3
+ <div class="panel-head">
4
+ <div class="head-title">
5
+ <slot name="title" />
6
+ </div>
7
+ <div class="divider"></div>
8
+ <div class="head-content">
9
+ <slot name="head-content" />
10
+ </div>
11
+ </div>
12
+ <Transition
13
+ name="expand"
14
+ @enter="enter"
15
+ @after-enter="afterEnter"
16
+ @leave="leave"
17
+ >
18
+ <div v-show="isOpen" class="panel-body">
19
+ <slot name="body"></slot>
20
+ </div>
21
+ </Transition>
22
+ </div>
23
+ </template>
24
+
25
+ <script>
26
+ import expandAnimation from "../../mixins/expandAnimation";
27
+ import { panelVariant } from "./constants";
28
+
29
+ export default {
30
+ name: "IbPanel",
31
+ mixins: [expandAnimation],
32
+ props: {
33
+ isOpen: {
34
+ type: Boolean,
35
+ default: true,
36
+ },
37
+ variant: {
38
+ type: String,
39
+ default: panelVariant.primary,
40
+ },
41
+ },
42
+ computed: {
43
+ classList() {
44
+ const classList = ["panel", `panel-${this.variant}`];
45
+
46
+ return classList;
47
+ },
48
+ },
49
+ };
50
+ </script>
51
+
52
+ <style lang="scss" scoped>
53
+ .expand-enter-active,
54
+ .expand-leave-active {
55
+ transition: height 1s ease-in-out;
56
+ overflow: hidden;
57
+ }
58
+
59
+ .expand-enter,
60
+ .expand-leave-to {
61
+ height: 0;
62
+ }
63
+
64
+ @import "../../assets/scss/variables/colors.scss";
65
+ @import "../../assets/scss/typography.scss";
66
+
67
+ $panel-border-color: $gray-200;
68
+ $panel-title-color: $neutral-900;
69
+ $panel-divider-color: $gray-200;
70
+ $description-color: $gray-600;
71
+ $panel-primary-body-bg: $gray-50;
72
+ $panel-secondary-body-bg: $white;
73
+
74
+ .panel {
75
+ border: 1px solid $panel-border-color;
76
+ border-radius: 4px;
77
+
78
+ .panel-head {
79
+ display: inline-flex;
80
+ width: 100%;
81
+ align-items: center;
82
+ padding: 15px;
83
+
84
+ .head-title {
85
+ @include Ib-H3-medium;
86
+ color: $panel-title-color;
87
+ flex: none;
88
+ }
89
+
90
+ .divider {
91
+ margin: 0 10px;
92
+ width: 1px;
93
+ height: 22px;
94
+ background-color: $panel-divider-color;
95
+ }
96
+
97
+ .head-content {
98
+ p {
99
+ @include Ib-H4-regular;
100
+ color: $description-color;
101
+ }
102
+ }
103
+ }
104
+ &.panel-primary {
105
+ .panel-body {
106
+ background-color: $panel-primary-body-bg;
107
+ }
108
+ }
109
+
110
+ &.panel-secondary {
111
+ .panel-body {
112
+ background-color: $panel-secondary-body-bg;
113
+ }
114
+ }
115
+ }
116
+ </style>
@@ -0,0 +1,4 @@
1
+ export const panelVariant = {
2
+ primary: "primary",
3
+ secondary: "secondary",
4
+ };
package/src/index.js CHANGED
@@ -24,6 +24,7 @@ export { default as IbPagination } from "./components/Pagination/Pagination.vue"
24
24
  export { default as IbLimitSelector } from "./components/Pagination/LimitSelector.vue";
25
25
  export { default as IbProgressBar } from "./components/ProgressBar/ProgressBar.vue";
26
26
  export { default as IbStatusIndicator } from "./components/StatusIndicator/StatusIndicator.vue";
27
+ export { default as IbPanel } from "./components/Panel/Panel.vue";
27
28
 
28
29
  // FORM
29
30
  export { default as IbInput } from "./components/Form/Input/Input.vue";
@@ -0,0 +1,38 @@
1
+ const expandAnimation = {
2
+ methods: {
3
+ enter(element) {
4
+ const width = getComputedStyle(element).width;
5
+
6
+ element.style.width = width;
7
+ element.style.position = "absolute";
8
+ element.style.visibility = "hidden";
9
+ element.style.height = "auto";
10
+
11
+ const height = getComputedStyle(element).height;
12
+
13
+ element.style.width = null;
14
+ element.style.position = null;
15
+ element.style.visibility = null;
16
+ element.style.height = 0;
17
+ getComputedStyle(element).height;
18
+ requestAnimationFrame(() => {
19
+ element.style.height = height;
20
+ });
21
+ },
22
+ afterEnter(element) {
23
+ element.style.height = "auto";
24
+ },
25
+ leave(element) {
26
+ const height = getComputedStyle(element).height;
27
+
28
+ element.style.height = height;
29
+ getComputedStyle(element).height;
30
+
31
+ requestAnimationFrame(() => {
32
+ element.style.height = 0;
33
+ });
34
+ },
35
+ },
36
+ };
37
+
38
+ export default expandAnimation;
@@ -1,7 +1,7 @@
1
1
  # IbLink
2
2
 
3
3
  import { Canvas } from "@storybook/addon-docs";
4
- import * as LinkStories from "./Link.stories";
4
+ import * as LinkStories from "./link.stories";
5
5
 
6
6
  ## Inline Link
7
7