@rancher/shell 1.2.0 → 1.2.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 (57) hide show
  1. package/package.json +1 -1
  2. package/rancher-components/BadgeState/BadgeState.vue +3 -3
  3. package/rancher-components/Banner/Banner.test.ts +5 -1
  4. package/rancher-components/Banner/Banner.vue +2 -2
  5. package/rancher-components/Card/Card.vue +4 -4
  6. package/rancher-components/Form/Checkbox/Checkbox.vue +3 -4
  7. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +1 -18
  8. package/rancher-components/Form/LabeledInput/LabeledInput.vue +37 -65
  9. package/rancher-components/Form/Radio/RadioButton.test.ts +3 -1
  10. package/rancher-components/Form/Radio/RadioButton.vue +7 -13
  11. package/rancher-components/Form/Radio/RadioGroup.vue +3 -4
  12. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +4 -6
  13. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +4 -7
  14. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +4 -9
  15. package/rancher-components/StringList/StringList.test.ts +0 -270
  16. package/rancher-components/StringList/StringList.vue +26 -65
  17. package/scripts/publish-shell.sh +1 -0
  18. package/types/shell/index.d.ts +5 -5
  19. package/rancher-components/Accordion/Accordion.test.ts +0 -45
  20. package/rancher-components/Accordion/Accordion.vue +0 -86
  21. package/rancher-components/Accordion/index.ts +0 -1
  22. package/rancher-components/BadgeState/BadgeState.test.ts +0 -12
  23. package/rancher-components/components/Accordion/Accordion.test.ts +0 -45
  24. package/rancher-components/components/Accordion/Accordion.vue +0 -86
  25. package/rancher-components/components/Accordion/index.ts +0 -1
  26. package/rancher-components/components/BadgeState/BadgeState.test.ts +0 -12
  27. package/rancher-components/components/BadgeState/BadgeState.vue +0 -111
  28. package/rancher-components/components/BadgeState/index.ts +0 -1
  29. package/rancher-components/components/Banner/Banner.test.ts +0 -63
  30. package/rancher-components/components/Banner/Banner.vue +0 -244
  31. package/rancher-components/components/Banner/index.ts +0 -1
  32. package/rancher-components/components/Card/Card.test.ts +0 -37
  33. package/rancher-components/components/Card/Card.vue +0 -167
  34. package/rancher-components/components/Card/index.ts +0 -1
  35. package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +0 -68
  36. package/rancher-components/components/Form/Checkbox/Checkbox.vue +0 -420
  37. package/rancher-components/components/Form/Checkbox/index.ts +0 -1
  38. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +0 -23
  39. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +0 -369
  40. package/rancher-components/components/Form/LabeledInput/index.ts +0 -1
  41. package/rancher-components/components/Form/Radio/RadioButton.test.ts +0 -35
  42. package/rancher-components/components/Form/Radio/RadioButton.vue +0 -287
  43. package/rancher-components/components/Form/Radio/RadioGroup.test.ts +0 -30
  44. package/rancher-components/components/Form/Radio/RadioGroup.vue +0 -258
  45. package/rancher-components/components/Form/Radio/index.ts +0 -2
  46. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +0 -170
  47. package/rancher-components/components/Form/TextArea/index.ts +0 -1
  48. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +0 -94
  49. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +0 -149
  50. package/rancher-components/components/Form/ToggleSwitch/index.ts +0 -1
  51. package/rancher-components/components/Form/index.ts +0 -5
  52. package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +0 -151
  53. package/rancher-components/components/LabeledTooltip/index.ts +0 -1
  54. package/rancher-components/components/StringList/StringList.test.ts +0 -484
  55. package/rancher-components/components/StringList/StringList.vue +0 -611
  56. package/rancher-components/components/StringList/index.ts +0 -1
  57. /package/rancher-components/{components/BadgeState → BadgeState}/BadgeState.spec.ts +0 -0
@@ -1,86 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent } from 'vue';
3
- import { mapGetters } from 'vuex';
4
-
5
- export default defineComponent({
6
- props: {
7
- title: {
8
- type: String,
9
- default: ''
10
- },
11
-
12
- titleKey: {
13
- type: String,
14
- default: null
15
- },
16
-
17
- openInitially: {
18
- type: Boolean,
19
- default: false
20
- }
21
- },
22
-
23
- data() {
24
- return { isOpen: this.openInitially };
25
- },
26
-
27
- computed: { ...mapGetters({ t: 'i18n/t' }) },
28
-
29
- methods: {
30
- toggle() {
31
- this.isOpen = !this.isOpen;
32
- }
33
- }
34
- });
35
- </script>
36
-
37
- <template>
38
- <div class="accordion-container">
39
- <div
40
- class="accordion-header"
41
- data-testid="accordion-header"
42
- @click="toggle"
43
- >
44
- <i
45
- class="icon text-primary"
46
- :class="{'icon-chevron-down':isOpen, 'icon-chevron-up':!isOpen}"
47
- data-testid="accordion-chevron"
48
- />
49
- <slot name="header">
50
- <h4
51
- data-testid="accordion-title-slot-content"
52
- class="mb-0"
53
- >
54
- {{ titleKey ? t(titleKey) : title }}
55
- </h4>
56
- </slot>
57
- </div>
58
- <div
59
- v-show="isOpen"
60
- class="accordion-body"
61
- data-testid="accordion-body"
62
- >
63
- <slot />
64
- </div>
65
- </div>
66
- </template>
67
-
68
- <style lang="scss" scoped>
69
- .accordion-container {
70
- border: 1px solid var(--border)
71
- }
72
- .accordion-header {
73
- padding: 5px;
74
- display: flex;
75
- align-items: center;
76
- &>*{
77
- padding: 5px 0px 5px 0px;
78
- }
79
- I {
80
- margin: 0px 10px 0px 10px;
81
- }
82
- }
83
- .accordion-body {
84
- padding: 10px;
85
- }
86
- </style>
@@ -1 +0,0 @@
1
- export { default as Accordion } from './Accordion.vue';
@@ -1,12 +0,0 @@
1
- import { shallowMount } from '@vue/test-utils';
2
- import { BadgeState } from './index';
3
-
4
- describe('BadgeState.vue', () => {
5
- it('renders props.msg when passed', () => {
6
- const label = 'Hello, World!';
7
-
8
- const wrapper = shallowMount(BadgeState, { propsData: { label } });
9
-
10
- expect(wrapper.find('span').text()).toMatch(label);
11
- });
12
- });
@@ -1,111 +0,0 @@
1
- <script lang="ts">
2
- import Vue, { PropType } from 'vue';
3
-
4
- interface Badge {
5
- stateBackground: string;
6
- stateDisplay: string;
7
- }
8
-
9
- /**
10
- * Badge state component.
11
- * <p>Represents a badge whose label and color is either taken from the value property or
12
- * from the label and color properties. The state property takes precedence.</p>
13
- */
14
- export default Vue.extend({
15
- props: {
16
- /**
17
- * A value having the properties `stateBackground` and `stateDisplay`
18
- */
19
- value: {
20
- type: Object as PropType<Badge>,
21
- default: null
22
- },
23
-
24
- /**
25
- * Badge color. `stateBackground` of the value property takes precedence if supplied
26
- */
27
- color: {
28
- type: String,
29
- default: null
30
- },
31
-
32
- /**
33
- * Optional icon to be shown before the label
34
- */
35
- icon: {
36
- type: String,
37
- default: null
38
- },
39
-
40
- /**
41
- * Label to display in the badge. `stateDisplay` of the value property takes precedence if supplied
42
- */
43
- label: {
44
- type: String,
45
- default: null
46
- }
47
- },
48
-
49
- computed: {
50
- bg(): string | null {
51
- return this.value?.stateBackground || this.color;
52
- },
53
-
54
- msg(): string | null {
55
- return this.value?.stateDisplay || this.label;
56
- }
57
- }
58
- });
59
- </script>
60
-
61
- <template>
62
- <span :class="{'badge-state': true, [bg]: true}">
63
- <i
64
- v-if="icon"
65
- class="icon"
66
- :class="{[icon]: true, 'mr-5': !!msg}"
67
- />{{ msg }}
68
- </span>
69
- </template>
70
-
71
- <style lang="scss" scoped>
72
- .badge-state {
73
- align-items: center;
74
- display: inline-flex;
75
- padding: 2px 10px;
76
- border: 1px solid transparent;
77
- border-radius: 20px;
78
-
79
- &.bg-info {
80
- border-color: var(--primary);
81
- }
82
-
83
- &.bg-error {
84
- border-color: var(--error);
85
- }
86
-
87
- &.bg-warning {
88
- border-color: var(--warning);
89
- }
90
-
91
- // Successful states are de-emphasized by using [text-]color instead of background-color
92
- &.bg-success {
93
- color: var(--success);
94
- background: transparent;
95
- border-color: var(--success);
96
- }
97
- }
98
- </style>
99
- <style lang="scss">
100
- // TODO: #6005
101
- // Investigate why this is here.. I don't think that styles for sortable table should belong here
102
- .sortable-table TD .badge-state {
103
- @include clip;
104
- display: inline-block;
105
- max-width: 100%;
106
- position: relative;
107
- max-width: 110px;
108
- font-size: .85em;
109
- vertical-align: middle;
110
- }
111
- </style>
@@ -1 +0,0 @@
1
- export { default as BadgeState } from './BadgeState.vue';
@@ -1,63 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { Banner } from './index';
3
- import { cleanHtmlDirective } from '@shell/plugins/clean-html-directive';
4
-
5
- describe('component: Banner', () => {
6
- it('should display text based on label', () => {
7
- const label = 'test';
8
- const wrapper = mount(
9
- Banner,
10
- {
11
- directives: { cleanHtmlDirective },
12
- propsData: { label }
13
- });
14
-
15
- const element = wrapper.find('span').element;
16
-
17
- expect(element.textContent).toBe(label);
18
- });
19
-
20
- it('should display an icon', () => {
21
- const icon = 'my-icon';
22
- const wrapper = mount(Banner, { propsData: { icon } });
23
-
24
- const element = wrapper.find(`.${ icon }`).element;
25
-
26
- expect(element.classList).toContain(icon);
27
- });
28
-
29
- it('should not display an icon', () => {
30
- const wrapper = mount(Banner);
31
-
32
- const element = wrapper.find(`[data-testid="banner-icon"]`).element;
33
-
34
- expect(element).not.toBeDefined();
35
- });
36
-
37
- it('should emit close event', () => {
38
- const wrapper = mount(Banner, { propsData: { closable: true } });
39
- const element = wrapper.find(`[data-testid="banner-close"]`).element;
40
-
41
- element.click();
42
-
43
- expect(wrapper.emitted('close')).toHaveLength(1);
44
- });
45
-
46
- it('should add the right color', () => {
47
- const color = 'red';
48
- const wrapper = mount(Banner, { propsData: { color } });
49
-
50
- const element = wrapper.element;
51
-
52
- expect(element.classList).toContain(color);
53
- });
54
-
55
- it('should stack the banner messages', () => {
56
- const stacked = true;
57
- const wrapper = mount(Banner, { propsData: { stacked } });
58
-
59
- const element = wrapper.find(`[data-testid="banner-content"]`).element;
60
-
61
- expect(element.classList).toContain('stacked');
62
- });
63
- });
@@ -1,244 +0,0 @@
1
- <script lang="ts">
2
- import Vue from 'vue';
3
- import { nlToBr } from '@shell/utils/string';
4
- import { stringify } from '@shell/utils/error';
5
-
6
- export default Vue.extend({
7
- props: {
8
- /**
9
- * A color class that represents the color of the banner.
10
- * @values primary, secondary, success, warning, error, info
11
- */
12
- color: {
13
- type: String,
14
- default: 'secondary'
15
- },
16
- /**
17
- * The label to display as the banner's default content.
18
- */
19
- label: {
20
- type: [String, Error, Object],
21
- default: null
22
- },
23
- /**
24
- * The i18n key for the label to display as the banner's default content.
25
- */
26
- labelKey: {
27
- type: String,
28
- default: null
29
- },
30
- /**
31
- * Add icon for the banner
32
- */
33
- icon: {
34
- type: String,
35
- default: null
36
- },
37
- /**
38
- * Toggles the banner's close button.
39
- */
40
- closable: {
41
- type: Boolean,
42
- default: false
43
- },
44
- /**
45
- * Toggles the stacked class for the banner.
46
- */
47
- stacked: {
48
- type: Boolean,
49
- default: false
50
- }
51
- },
52
- computed: {
53
- /**
54
- * Return message text as label.
55
- */
56
- messageLabel(): string | void {
57
- return !(typeof this.label === 'string') ? stringify(this.label) : undefined;
58
- }
59
- },
60
- methods: { nlToBr }
61
- });
62
- </script>
63
- <template>
64
- <div
65
- class="banner"
66
- :class="{
67
- [color]: true,
68
- }"
69
- >
70
- <div
71
- v-if="icon"
72
- class="banner__icon"
73
- data-testid="banner-icon"
74
- >
75
- <i
76
- class="icon icon-2x"
77
- :class="icon"
78
- />
79
- </div>
80
- <div
81
- class="banner__content"
82
- data-testid="banner-content"
83
- :class="{
84
- closable,
85
- stacked,
86
- icon
87
- }"
88
- >
89
- <slot>
90
- <t
91
- v-if="labelKey"
92
- :k="labelKey"
93
- :raw="true"
94
- />
95
- <span v-else-if="messageLabel">{{ messageLabel }}</span>
96
- <span
97
- v-else
98
- v-clean-html="nlToBr(label)"
99
- />
100
- </slot>
101
- <div
102
- v-if="closable"
103
- class="banner__content__closer"
104
- @click="$emit('close')"
105
- >
106
- <i
107
- data-testid="banner-close"
108
- class="icon icon-close closer-icon"
109
- />
110
- </div>
111
- </div>
112
- </div>
113
- </template>
114
-
115
- <style lang="scss" scoped>
116
- $left-border-size: 4px;
117
- $icon-size: 24px;
118
-
119
- .banner {
120
- display: flex;
121
- margin: 15px 0;
122
- position: relative;
123
- width: 100%;
124
- color: var(--body-text);
125
-
126
- &__icon {
127
- width: $icon-size * 2;
128
- flex-grow: 1;
129
- display: flex;
130
- justify-content: center;
131
- align-items: center;
132
- box-sizing: content-box;
133
-
134
- .primary & {
135
- background: var(--primary);
136
- }
137
-
138
- .secondary & {
139
- background: var(--default);
140
- }
141
-
142
- .success & {
143
- background: var(--success);
144
- }
145
-
146
- .info & {
147
- background: var(--info);
148
- }
149
-
150
- .warning & {
151
- background: var(--warning);
152
- }
153
-
154
- .error & {
155
- background: var(--error);
156
- color: var(--primary-text);
157
- }
158
- }
159
-
160
- &__content {
161
- padding: 10px;
162
- transition: all 0.2s ease;
163
- line-height: 20px;
164
- width: 100%;
165
- border-left: solid $left-border-size transparent;
166
- display: flex;
167
- gap: 3px;
168
-
169
- .primary & {
170
- background: var(--primary);
171
- border-color: var(--primary);
172
- }
173
-
174
- .secondary & {
175
- background: var(--default-banner-bg);
176
- border-color: var(--default);
177
- }
178
-
179
- .success & {
180
- background: var(--success-banner-bg);
181
- border-color: var(--success);
182
- }
183
-
184
- .info & {
185
- background: var(--info-banner-bg);
186
- border-color: var(--info);
187
- }
188
-
189
- .warning & {
190
- background: var(--warning-banner-bg);
191
- border-color: var(--warning);
192
- }
193
-
194
- .error & {
195
- background: var(--error-banner-bg);
196
- border-color: var(--error);
197
- color: var(--error);
198
- }
199
-
200
- &.stacked {
201
- padding: 0 10px;
202
- margin: 0;
203
- transition: none;
204
- &:first-child {
205
- padding-top: 10px;
206
- }
207
- &:last-child {
208
- padding-bottom: 10px;
209
- }
210
- }
211
-
212
- &.closable {
213
- padding-right: $icon-size * 2;
214
- }
215
-
216
- &__closer {
217
- display: flex;
218
- align-items: center;
219
-
220
- cursor: pointer;
221
- position: absolute;
222
- top: 0;
223
- right: 0;
224
- bottom: 0;
225
- width: $icon-size;
226
- line-height: $icon-size;
227
- text-align: center;
228
-
229
- .closer-icon {
230
- opacity: 0.7;
231
-
232
- &:hover {
233
- opacity: 1;
234
- color: var(--link);
235
- }
236
- }
237
- }
238
-
239
- &.icon {
240
- border-left: none;
241
- }
242
- }
243
- }
244
- </style>
@@ -1 +0,0 @@
1
- export { default as Banner } from './Banner.vue';
@@ -1,37 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { Card } from './index';
3
-
4
- describe('component: Card', () => {
5
- const title = 'Card title';
6
- const body = 'Card body';
7
-
8
- it('should have a card title', () => {
9
- const wrapper = mount(Card, {
10
- propsData: { title },
11
- slots: { title: '<div>Card title</div>' }
12
- });
13
-
14
- const element = wrapper.find('[data-testid="card-title-slot"]');
15
-
16
- expect(element.exists()).toBe(true);
17
- expect(element.text()).toBe(title);
18
- });
19
-
20
- it('should have a card body', () => {
21
- const wrapper = mount(Card, {
22
- propsData: { body },
23
- slots: { body: '<div>Card body</div>' }
24
- });
25
- const element = wrapper.find('[data-testid="card-body-slot"]');
26
-
27
- expect(element.exists()).toBe(true);
28
- expect(element.text()).toBe(body);
29
- });
30
-
31
- it('should display the default card actions', () => {
32
- const wrapper = mount(Card);
33
- const element = wrapper.find('[data-testid="card-actions-slot"]');
34
-
35
- expect(element.exists()).toBe(true);
36
- });
37
- });