@redseed/redseed-ui-vue3 2.16.0 → 2.17.1

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/index.js CHANGED
@@ -11,6 +11,7 @@ export * from './src/components/Form'
11
11
  export * from './src/components/FormField'
12
12
  export * from './src/components/Image'
13
13
  export * from './src/components/Link'
14
+ export * from './src/components/LinkedList'
14
15
  export * from './src/components/List'
15
16
  export * from './src/components/Loader'
16
17
  export * from './src/components/Logo'
@@ -23,6 +24,6 @@ export * from './src/components/Progress'
23
24
  export * from './src/components/SectionHeading'
24
25
  export * from './src/components/Social'
25
26
  export * from './src/components/Sorting'
27
+ export * from './src/components/Switcher'
26
28
  export * from './src/components/Toggle'
27
- export * from './src/components/TwoColumnLayout'
28
- export * from './src/components/LinkedList'
29
+ export * from './src/components/TwoColumnLayout'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "2.16.0",
3
+ "version": "2.17.1",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,6 +13,8 @@ const { textarea, input } = useTextareaAutosize({ styleProp: 'minHeight' })
13
13
 
14
14
  const model = defineModel()
15
15
 
16
+ input.value = model.value
17
+
16
18
  function onInput(event) {
17
19
  model.value = input.value
18
20
  emit('input', event)
@@ -0,0 +1,58 @@
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+ import SwitcherItem from './SwitcherItem.vue'
4
+
5
+ const props = defineProps({
6
+ items: {
7
+ type: Array,
8
+ required: true,
9
+ },
10
+ full: {
11
+ type: Boolean,
12
+ default: false,
13
+ },
14
+ })
15
+
16
+ const emit = defineEmits(['change'])
17
+
18
+ const activeItem = ref(props.items.find(item => item.active) || props.items[0])
19
+
20
+ function setActiveItem(item) {
21
+ if (activeItem.value == item) return
22
+ activeItem.value = item
23
+ emit('change', item)
24
+ }
25
+ </script>
26
+ <template>
27
+ <div class="rsui-switcher"
28
+ :class="{
29
+ 'rsui-switcher--full': props.full,
30
+ }"
31
+ >
32
+ <SwitcherItem v-for="item in items"
33
+ :key="item.id"
34
+ :active="activeItem.id == item.id"
35
+ @click="setActiveItem(item)"
36
+ >
37
+ <component v-if="item.icon"
38
+ :is="item.icon"
39
+ ></component>
40
+ {{ item.label }}
41
+ </SwitcherItem>
42
+ </div>
43
+ </template>
44
+ <style lang="scss" scoped>
45
+ .rsui-switcher {
46
+ @apply w-fit flex flex-col sm:flex-row sm:items-center overflow-hidden;
47
+ @apply bg-rsui-grey-150 p-1 rounded-lg;
48
+ &--full {
49
+ @apply w-full;
50
+ :deep(.rsui-switcher-item) {
51
+ @apply flex-1;
52
+ }
53
+ }
54
+ :deep(.rsui-switcher-item) {
55
+ @apply w-full sm:w-fit;
56
+ }
57
+ }
58
+ </style>
@@ -0,0 +1,36 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ active: {
4
+ type: Boolean,
5
+ default: false,
6
+ }
7
+ })
8
+
9
+ defineEmits(['click'])
10
+ </script>
11
+ <template>
12
+ <div class="rsui-switcher-item"
13
+ :class="{
14
+ 'rsui-switcher-item--active': props.active,
15
+ }"
16
+ @click="$emit('click')"
17
+ >
18
+ <slot></slot>
19
+ </div>
20
+ </template>
21
+ <style lang="scss" scoped>
22
+ .rsui-switcher-item {
23
+ // default control
24
+ @apply h-fit inline-flex shrink-0 items-center justify-center select-none outline-none whitespace-nowrap will-change-transform cursor-pointer;
25
+ // default shape
26
+ @apply font-semibold gap-2 rounded-md border border-transparent transition;
27
+ // default size
28
+ @apply text-base px-3 py-2;
29
+ &--active {
30
+ @apply bg-white text-rsui-default border-rsui-grey-200;
31
+ }
32
+ :deep(svg) {
33
+ @apply size-6;
34
+ }
35
+ }
36
+ </style>
@@ -0,0 +1,7 @@
1
+ import Switcher from './Switcher.vue'
2
+ import SwitcherItem from './SwitcherItem.vue'
3
+
4
+ export {
5
+ Switcher,
6
+ SwitcherItem,
7
+ }