vanilla-vue-ui 0.0.21 → 0.0.23

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.
@@ -27,3 +27,16 @@ export const Primary: Story = {
27
27
  `,
28
28
  }),
29
29
  };
30
+
31
+ export const None: Story = {
32
+ render: () => ({
33
+ components: { WHorizontalScroll },
34
+ template: `
35
+ <WHorizontalScroll :scrollbar-width="'none'">
36
+ <img src="/carousel-0.webp" alt="Slide 1">
37
+ <img src="/carousel-1.webp" alt="Slide 2">
38
+ <img src="/carousel-2.webp" alt="Slide 3">
39
+ </WHorizontalScroll>
40
+ `,
41
+ }),
42
+ };
@@ -0,0 +1,53 @@
1
+ // Replace vue3 with vue if you are using Storybook for Vue 2
2
+ import type { Meta, StoryObj } from '@storybook/vue3';
3
+ import WSegmentSelector from './WSegmentSelector.vue';
4
+ import Button from '../button/WButton.vue'
5
+ import { ref, watch } from 'vue';
6
+
7
+ type WSegmentSelectorProps = InstanceType<typeof WSegmentSelector>['$props']
8
+
9
+ const meta: Meta<typeof WSegmentSelector> = {
10
+ component: WSegmentSelector,
11
+ };
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof WSegmentSelector>;
15
+
16
+ /*
17
+ *👇 Render functions are a framework specific feature to allow you control on how the component renders.
18
+ * See https://storybook.js.org/docs/api/csf
19
+ * to learn how to use render functions.
20
+ */
21
+
22
+ export const Primary: Story = {
23
+ render: (args: WSegmentSelectorProps) => ({
24
+ setup() {
25
+ const value = ref(args.modelValue)
26
+
27
+ return {
28
+ args,
29
+ value,
30
+ }
31
+ },
32
+ components: { WSegmentSelector, Button },
33
+ template: `
34
+ <div class="space-y-4">
35
+ <WSegmentSelector
36
+ v-bind="args"
37
+ v-model="value"
38
+ />
39
+
40
+ <div class="text-sm">
41
+ selected: {{ value }}
42
+ </div>
43
+ </div>
44
+ `,
45
+ }),
46
+ args: {
47
+ modelValue: 'life',
48
+ options: [
49
+ { label: '暮らし', value: 'life' },
50
+ { label: 'プログラミング', value: 'programming' },
51
+ ],
52
+ },
53
+ };
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <div
3
+ class="inline-flex items-center rounded-full bg-white p-1 border-4"
4
+ >
5
+ <button
6
+ v-for="option in options"
7
+ :key="option.value"
8
+ @click="update(option.value)"
9
+ :class="[
10
+ 'px-5 py-2 rounded-full text-sm font-bold transition-all duration-200',
11
+ modelValue === option.value
12
+ ? activeClass
13
+ : inactiveClass
14
+ ]"
15
+ >
16
+ {{ option.label }}
17
+ </button>
18
+ </div>
19
+ </template>
20
+
21
+ <script setup lang="ts">
22
+ type Option = {
23
+ label: string
24
+ value: string
25
+ }
26
+
27
+ const props = withDefaults(defineProps<{
28
+ modelValue: string
29
+ options: Option[]
30
+ activeClass?: string
31
+ inactiveClass?: string
32
+ }>(), {
33
+ activeClass: 'bg-orange-200 text-black',
34
+ inactiveClass: 'text-black hover:bg-black/10',
35
+ })
36
+
37
+ const emit = defineEmits<{
38
+ (e: 'update:modelValue', value: string): void
39
+ }>()
40
+
41
+ const update = (value: string) => {
42
+ emit('update:modelValue', value)
43
+ }
44
+ </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-vue-ui",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [
@@ -0,0 +1,61 @@
1
+ // Replace vue3 with vue if you are using Storybook for Vue 2
2
+ import type { Meta, StoryObj } from '@storybook/vue3';
3
+ import WVerticalHorizontalText from './WVerticalHorizontalText.vue';
4
+ import {
5
+ HomeIcon,
6
+ BellAlertIcon,
7
+ ChatBubbleBottomCenterTextIcon,
8
+ Cog6ToothIcon,
9
+ CurrencyYenIcon,
10
+ CubeIcon,
11
+ BookOpenIcon,
12
+ MinusIcon
13
+ } from '@heroicons/vue/24/outline'
14
+
15
+ type WVerticalHorizontalTextProps = InstanceType<typeof WVerticalHorizontalText>['$props']
16
+
17
+ const meta: Meta<typeof WVerticalHorizontalText> = {
18
+ component: WVerticalHorizontalText,
19
+ };
20
+
21
+ export default meta;
22
+ type Story = StoryObj<typeof WVerticalHorizontalText>;
23
+
24
+ /*
25
+ *👇 Render functions are a framework specific feature to allow you control on how the component renders.
26
+ * See https://storybook.js.org/docs/api/csf
27
+ * to learn how to use render functions.
28
+ */
29
+ export const Horizontal: Story = {
30
+ render: (args: WVerticalHorizontalTextProps) => ({
31
+ setup() {
32
+ return {
33
+ ...args
34
+ }
35
+ },
36
+ components: { WVerticalHorizontalText },
37
+ template: '<WVerticalHorizontalText :text="text" :fontSize="fontSize" :isVertical="isVertical"></WVerticalHorizontalText>',
38
+ }),
39
+ args: {
40
+ text: 'Horizontal',
41
+ fontSize: 5,
42
+ isVertical: false,
43
+ }
44
+ };
45
+
46
+ export const Vertical: Story = {
47
+ render: (args: WVerticalHorizontalTextProps) => ({
48
+ setup() {
49
+ return {
50
+ ...args
51
+ }
52
+ },
53
+ components: { WVerticalHorizontalText },
54
+ template: '<WVerticalHorizontalText :text="text" :fontSize="fontSize" :isVertical="isVertical"></WVerticalHorizontalText>',
55
+ }),
56
+ args: {
57
+ text: 'Vertical',
58
+ fontSize: 5,
59
+ isVertical: true,
60
+ }
61
+ };
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <div>
3
+ <div
4
+ v-if="isVertical"
5
+ class="vertical-container"
6
+ >
7
+ <div
8
+ class="vertical-column"
9
+ :style="verticalColumnStyle"
10
+ >
11
+ <span
12
+ v-for="(char, index) in resultArray"
13
+ :key="index"
14
+ class="vertical-char"
15
+ >
16
+ {{ char }}
17
+ </span>
18
+ </div>
19
+ </div>
20
+
21
+ <div
22
+ v-else
23
+ class="horizontal-container"
24
+ >
25
+ <div class="horizontal-scroll">
26
+ <p :style="computedStyle">
27
+ {{ text }}
28
+ </p>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </template>
33
+
34
+ <script setup lang="ts">
35
+ import { defineProps, computed } from 'vue'
36
+
37
+ const props = defineProps({
38
+ text: {
39
+ type: String,
40
+ required: true,
41
+ },
42
+ fontSize: {
43
+ type: Number,
44
+ default: 4,
45
+ },
46
+ isVertical: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ })
51
+
52
+ const resultArray = computed(() => props.text.split(''))
53
+
54
+ const verticalColumnStyle = computed(() => ({
55
+ fontSize: `${props.fontSize}rem`,
56
+ lineHeight: '1.2',
57
+ }))
58
+
59
+ const computedStyle = computed(() => ({
60
+ fontSize: `${props.fontSize}rem`,
61
+ lineHeight: `${props.fontSize + 0.5}rem`,
62
+ }))
63
+ </script>
64
+
65
+ <style scoped>
66
+ .serif__app--result p {
67
+ line-height: 3.5rem;
68
+ font-size: 3rem;
69
+ }
70
+
71
+ .vertical-container {
72
+ writing-mode: initial !important;
73
+ display: flex; /* 中央寄せのために flex 化 */
74
+ justify-content: center; /* 左右中央 */
75
+ align-items: center; /* 上下中央 */
76
+ width: 100%; /* 全幅に広げる */
77
+ }
78
+
79
+ .vertical-column {
80
+ display: flex;
81
+ flex-direction: column;
82
+ align-items: center;
83
+ width: 1em;
84
+ }
85
+
86
+ .vertical-char {
87
+ font-size: inherit;
88
+ line-height: 1.2;
89
+ display: block;
90
+ }
91
+
92
+ .horizontal-container {
93
+ width: 100%;
94
+ overflow: hidden; /* 親は隠すだけ。スクロールは子が担当 */
95
+ }
96
+
97
+ .horizontal-scroll {
98
+ width: 100%;
99
+ overflow-x: auto;
100
+ overflow-y: hidden;
101
+ white-space: nowrap;
102
+ /* このコードをリリースする時にWebのCursiveとフォントチェッカーのコードを消す */
103
+ padding: 25px 15px;
104
+ scrollbar-width: thin;
105
+ }
106
+ </style>