@geckou/ui-vue 0.3.1 → 0.4.0

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 (145) hide show
  1. package/README.md +8 -1
  2. package/dist/components/ArticleList/Card/Artistic.vue.d.ts +10 -0
  3. package/dist/components/ArticleList/Card/Entertainment.vue.d.ts +10 -0
  4. package/dist/components/ArticleList/Card/Gallery.vue.d.ts +10 -0
  5. package/dist/components/ArticleList/Card/Grid.vue.d.ts +11 -0
  6. package/dist/components/ArticleList/Card/News.vue.d.ts +9 -0
  7. package/dist/components/ArticleList/Card/Rounded.vue.d.ts +10 -0
  8. package/dist/components/ArticleList/Card/Row.vue.d.ts +9 -0
  9. package/dist/components/ArticleList/Card/Simple.vue.d.ts +10 -0
  10. package/dist/components/ArticleList/Card/Standard.vue.d.ts +10 -0
  11. package/dist/components/ArticleList/Card/Tile.vue.d.ts +10 -0
  12. package/dist/components/ArticleList/GenericArticleList.vue.d.ts +11 -0
  13. package/dist/components/ArticleList/List/Artistic.vue.d.ts +8 -0
  14. package/dist/components/ArticleList/List/Entertainment.vue.d.ts +8 -0
  15. package/dist/components/ArticleList/List/Gallery.vue.d.ts +8 -0
  16. package/dist/components/ArticleList/List/Grid.vue.d.ts +11 -0
  17. package/dist/components/ArticleList/List/News.vue.d.ts +8 -0
  18. package/dist/components/ArticleList/List/Rounded.vue.d.ts +8 -0
  19. package/dist/components/ArticleList/List/Row.vue.d.ts +8 -0
  20. package/dist/components/ArticleList/List/Simple.vue.d.ts +8 -0
  21. package/dist/components/ArticleList/List/Standard.vue.d.ts +8 -0
  22. package/dist/components/ArticleList/List/Tile.vue.d.ts +8 -0
  23. package/dist/components/ArticleList/Parts/AuthorInfo.vue.d.ts +31 -0
  24. package/dist/components/ArticleList/Parts/CardContainer.vue.d.ts +20 -0
  25. package/dist/components/ArticleList/Parts/CardHeading.vue.d.ts +12 -0
  26. package/dist/components/ArticleList/Parts/CategoryList.vue.d.ts +19 -0
  27. package/dist/components/ArticleList/Parts/ExcerptText.vue.d.ts +12 -0
  28. package/dist/components/ArticleList/Parts/MetadataList.vue.d.ts +32 -0
  29. package/dist/components/ArticleList/Parts/NoImage.vue.d.ts +2 -0
  30. package/dist/components/ArticleList/Parts/PostedDate.vue.d.ts +14 -0
  31. package/dist/components/ArticleList/Parts/TagList.vue.d.ts +18 -0
  32. package/dist/components/ArticleList/Parts/ThumbnailImage.vue.d.ts +17 -0
  33. package/dist/components/BasicButton.vue.d.ts +26 -0
  34. package/dist/components/CheckBox.vue.d.ts +34 -0
  35. package/dist/components/CheckBoxes.vue.d.ts +18 -0
  36. package/dist/components/CheckButton.vue.d.ts +31 -0
  37. package/dist/components/DatePicker.vue.d.ts +27 -0
  38. package/dist/components/DateRangePicker.vue.d.ts +31 -0
  39. package/dist/components/DateSelector.vue.d.ts +17 -0
  40. package/dist/components/DropdownUi.vue.d.ts +37 -0
  41. package/dist/components/ErrorMessage.vue.d.ts +9 -0
  42. package/dist/components/Icon/CalendarIcon.vue.d.ts +2 -0
  43. package/dist/components/Icon/CheckIcon.vue.d.ts +2 -0
  44. package/dist/components/Icon/CloseIcon.vue.d.ts +2 -0
  45. package/dist/components/Icon/Folder.vue.d.ts +2 -0
  46. package/dist/components/Icon/Image.vue.d.ts +2 -0
  47. package/dist/components/Icon/KeyboardArrowDownIcon.vue.d.ts +2 -0
  48. package/dist/components/Icon/Tag.vue.d.ts +2 -0
  49. package/dist/components/InputBox.vue.d.ts +27 -0
  50. package/dist/components/InputGroup.vue.d.ts +17 -0
  51. package/dist/components/LabeledCheckbox.vue.d.ts +20 -0
  52. package/dist/components/LabeledFieldset.vue.d.ts +21 -0
  53. package/dist/components/LoadingSpinner.vue.d.ts +2 -0
  54. package/dist/components/ModalBox.vue.d.ts +27 -0
  55. package/dist/components/PopupBox.vue.d.ts +30 -0
  56. package/dist/components/RadioButtons.vue.d.ts +20 -0
  57. package/dist/components/SelectBox.vue.d.ts +37 -0
  58. package/dist/components/SlideDownUi.vue.d.ts +37 -0
  59. package/dist/components/TabUI.vue.d.ts +54 -0
  60. package/dist/components/TextArea.vue.d.ts +33 -0
  61. package/dist/components/TextBox.vue.d.ts +44 -0
  62. package/dist/components/TextButton.vue.d.ts +10 -0
  63. package/dist/components/ToggleButton.vue.d.ts +23 -0
  64. package/dist/const/index.d.ts +1 -0
  65. package/dist/const/list-theme.d.ts +62 -0
  66. package/dist/index.d.ts +43 -0
  67. package/dist/index.js +3519 -0
  68. package/dist/scripts/form-validation-manager.d.ts +30 -0
  69. package/dist/scripts/unique-id.d.ts +1 -0
  70. package/dist/scripts/use-click-outside.d.ts +13 -0
  71. package/dist/scripts/utils.d.ts +15 -0
  72. package/dist/style.css +1 -0
  73. package/dist/types/index.d.ts +48 -77
  74. package/package.json +16 -8
  75. package/dist/assets/scss/functions.scss +0 -6
  76. package/dist/assets/scss/mixin.scss +0 -33
  77. package/dist/components/ArticleList/Card/Artistic.vue +0 -311
  78. package/dist/components/ArticleList/Card/Entertainment.vue +0 -245
  79. package/dist/components/ArticleList/Card/Gallery.vue +0 -255
  80. package/dist/components/ArticleList/Card/Grid.vue +0 -248
  81. package/dist/components/ArticleList/Card/News.vue +0 -151
  82. package/dist/components/ArticleList/Card/Rounded.vue +0 -155
  83. package/dist/components/ArticleList/Card/Row.vue +0 -168
  84. package/dist/components/ArticleList/Card/Simple.vue +0 -233
  85. package/dist/components/ArticleList/Card/Standard.vue +0 -188
  86. package/dist/components/ArticleList/Card/Tile.vue +0 -172
  87. package/dist/components/ArticleList/GenericArticleList.vue +0 -143
  88. package/dist/components/ArticleList/List/Artistic.vue +0 -24
  89. package/dist/components/ArticleList/List/Entertainment.vue +0 -24
  90. package/dist/components/ArticleList/List/Gallery.vue +0 -24
  91. package/dist/components/ArticleList/List/Grid.vue +0 -216
  92. package/dist/components/ArticleList/List/News.vue +0 -24
  93. package/dist/components/ArticleList/List/Rounded.vue +0 -24
  94. package/dist/components/ArticleList/List/Row.vue +0 -24
  95. package/dist/components/ArticleList/List/Simple.vue +0 -24
  96. package/dist/components/ArticleList/List/Standard.vue +0 -24
  97. package/dist/components/ArticleList/List/Tile.vue +0 -24
  98. package/dist/components/ArticleList/Parts/AuthorInfo.vue +0 -100
  99. package/dist/components/ArticleList/Parts/CardContainer.vue +0 -23
  100. package/dist/components/ArticleList/Parts/CardHeading.vue +0 -43
  101. package/dist/components/ArticleList/Parts/CategoryList.vue +0 -41
  102. package/dist/components/ArticleList/Parts/ExcerptText.vue +0 -43
  103. package/dist/components/ArticleList/Parts/MetadataList.vue +0 -120
  104. package/dist/components/ArticleList/Parts/NoImage.vue +0 -36
  105. package/dist/components/ArticleList/Parts/PostedDate.vue +0 -41
  106. package/dist/components/ArticleList/Parts/TagList.vue +0 -41
  107. package/dist/components/ArticleList/Parts/ThumbnailImage.vue +0 -85
  108. package/dist/components/BasicButton.vue +0 -143
  109. package/dist/components/CheckBox.vue +0 -140
  110. package/dist/components/CheckBoxes.vue +0 -101
  111. package/dist/components/CheckButton.vue +0 -127
  112. package/dist/components/DatePicker.vue +0 -234
  113. package/dist/components/DateRangePicker.vue +0 -85
  114. package/dist/components/DateSelector.vue +0 -273
  115. package/dist/components/DropdownUi.vue +0 -118
  116. package/dist/components/ErrorMessage.vue +0 -61
  117. package/dist/components/Icon/CalendarIcon.vue +0 -8
  118. package/dist/components/Icon/CheckIcon.vue +0 -8
  119. package/dist/components/Icon/CloseIcon.vue +0 -8
  120. package/dist/components/Icon/Folder.vue +0 -8
  121. package/dist/components/Icon/Image.vue +0 -14
  122. package/dist/components/Icon/KeyboardArrowDownIcon.vue +0 -8
  123. package/dist/components/Icon/Tag.vue +0 -8
  124. package/dist/components/InputBox.vue +0 -134
  125. package/dist/components/InputGroup.vue +0 -41
  126. package/dist/components/LabeledCheckbox.vue +0 -82
  127. package/dist/components/LabeledFieldset.vue +0 -41
  128. package/dist/components/LoadingSpinner.vue +0 -56
  129. package/dist/components/ModalBox.vue +0 -192
  130. package/dist/components/PopupBox.vue +0 -93
  131. package/dist/components/RadioButtons.vue +0 -163
  132. package/dist/components/SelectBox.vue +0 -166
  133. package/dist/components/SlideDownUi.vue +0 -123
  134. package/dist/components/TabUI.vue +0 -123
  135. package/dist/components/TextArea.vue +0 -115
  136. package/dist/components/TextBox.vue +0 -111
  137. package/dist/components/TextButton.vue +0 -47
  138. package/dist/components/ToggleButton.vue +0 -179
  139. package/dist/const/index.ts +0 -2
  140. package/dist/const/list-theme.ts +0 -62
  141. package/dist/index.ts +0 -126
  142. package/dist/scripts/form-validation-manager.ts +0 -63
  143. package/dist/scripts/utils.ts +0 -44
  144. package/dist/types/custom.d.ts +0 -1
  145. package/dist/types/vue-shim.d.ts +0 -5
@@ -1,120 +0,0 @@
1
- <script setup lang="ts">
2
- import FolderIcon from '../../../components/Icon/Folder.vue'
3
- import TagIcon from '../../../components/Icon/Tag.vue'
4
-
5
- const props = withDefaults(defineProps<{
6
- metadata: string[]
7
- icon?: {
8
- name?: 'FolderIcon' | 'TagIcon' | null
9
- color?: string
10
- size?: 'small' | 'medium'
11
- }
12
- label?: {
13
- backgroundColor?: string
14
- color?: string
15
- fontSize?: string
16
- fontWeight?: string
17
- shape?: | 'square' | 'rounded'
18
- }
19
- delimiter?: string
20
- }>(), {
21
- icon: () => ({
22
- name : null,
23
- color: 'var(--disable-text-color)',
24
- size : 'medium',
25
- }),
26
- label: () => ({
27
- backgroundColor: 'transparent',
28
- color : 'var(--text-color)',
29
- fontSize : 'var(--fs-small)',
30
- fontWeight : 'normal',
31
- shape : 'square',
32
- }),
33
- delimiter: '',
34
- })
35
-
36
- const iconName = props.icon.name === 'FolderIcon' ? FolderIcon : TagIcon
37
- </script>
38
-
39
- <template>
40
- <div
41
- v-if="metadata.length"
42
- :class="$style.metadata_list"
43
- :style="{ '--icon-color': icon.color }"
44
- >
45
- <component
46
- :is="iconName"
47
- v-if="icon.name"
48
- :class="$style.icon"
49
- :style="{
50
- '--icon-color': icon.color,
51
- '--icon-size' : icon.size === 'small' ? 'var(--small-icon-size)' : 'var(--medium-icon-size)',
52
- }"
53
- />
54
- <ul :class="$style.list">
55
- <li
56
- v-for="item in metadata"
57
- :key="item"
58
- :class="[
59
- $style.list_item,
60
- $style[label.shape ?? 'square'],
61
- { [$style.delimiter]: delimiter },
62
- ]"
63
- :style="{
64
- '--label-padding' : !label.backgroundColor || label.backgroundColor === 'transparent' ? '0px': 'var(--sp-min) var(--sp-small)',
65
- '--label-background-color': label.backgroundColor ?? 'transparent',
66
- '--label-color' : label.color ?? 'var(--text-color)',
67
- '--label-font-size' : label.fontSize ?? 'var(--fs-small)',
68
- '--label-font-weight' : label.fontWeight ?? 'normal',
69
- }"
70
- :data-delimiter="delimiter"
71
- >
72
- {{ item }}
73
- </li>
74
- </ul>
75
- </div>
76
- </template>
77
-
78
- <style lang="scss" module>
79
- @use '../../../assets/scss/mixin' as *;
80
-
81
- .metadata_list {
82
- --icon-color: var(--disable-text-color);
83
- display : flex;
84
- align-items: center;
85
- gap : var(--sp-small);
86
- }
87
-
88
- .icon {
89
- flex: 0 0 var(--icon-size);
90
- @include icon($size: var(--icon-size), $color: var(--icon-color));
91
- }
92
-
93
- .list {
94
- display : flex;
95
- flex-wrap: wrap;
96
- gap : var(--sp-small) var(--sp-medium);
97
-
98
- .list_item {
99
- line-height : 1;
100
- background-color: var(--label-background-color);
101
- padding : var(--label-padding);
102
- color : var(--label-color);
103
- font-size : var(--label-font-size);
104
- font-weight : var(--label-font-weight);
105
-
106
- &.rounded {
107
- border-radius: calc(var(--bv) / 2);
108
- }
109
-
110
- &.delimiter {
111
- &:not(:last-child) {
112
- &::after {
113
- content: attr(data-delimiter);
114
- margin-inline-start: var(--sp-medium);
115
- }
116
- }
117
- }
118
- }
119
- }
120
- </style>
@@ -1,36 +0,0 @@
1
- <script setup lang="ts">
2
- import ImageIcon from '../../../components/Icon/Image.vue'
3
- </script>
4
-
5
- <template>
6
- <div
7
- :class="$style.no_image"
8
- >
9
- <ImageIcon />
10
- <span>No Image</span>
11
- </div>
12
- </template>
13
-
14
-
15
- <style lang="scss" module>
16
- .no_image {
17
- display : flex;
18
- justify-content : center;
19
- align-items : center;
20
- gap : var(--sp-small);
21
- width : 100%;
22
- height : 100%;
23
- background-color: var(--light-gray);
24
- font-size : large;
25
-
26
- > svg {
27
- width : var(--sp-large);
28
- height: var(--sp-large);
29
- fill : var(--gray);
30
- }
31
-
32
- > span {
33
- color: var(--gray);
34
- }
35
- }
36
- </style>
@@ -1,41 +0,0 @@
1
- <script setup lang="ts">
2
- import { format, parseISO } from 'date-fns'
3
-
4
- const props = withDefaults(defineProps<{
5
- date: string
6
- formatString?: string
7
- color?: string
8
- fontSize?: string
9
- fontWeight?: string
10
- }>(), {
11
- formatString: 'yyyy/mm/dd',
12
- color : 'var(--text-color)',
13
- fontSize : 'small',
14
- fontWeight : 'normal',
15
- })
16
-
17
- const parsedDate = parseISO(props.date)
18
- </script>
19
-
20
- <template>
21
- <time
22
- :class="$style.posted_date"
23
- :style="{
24
- '--date-color' : color,
25
- '--date-font-size' : fontSize,
26
- '--date-font-weight': fontWeight,
27
- }"
28
- >
29
- {{ format(parsedDate, formatString) }}
30
- </time>
31
- </template>
32
-
33
- <style lang="scss" module>
34
- .posted_date {
35
- display : inline-flex;
36
- align-items: flex-end;
37
- color : var(--date-color);
38
- font-size : var(--date-font-size);
39
- font-weight: var(--date-font-weight);
40
- }
41
- </style>
@@ -1,41 +0,0 @@
1
- <script setup lang="ts">
2
- import type {
3
- Article,
4
- } from '../../../types'
5
- import type { ComputedRef } from 'vue'
6
- import { computed } from 'vue'
7
- import MetadataList from '../../../components/ArticleList/Parts/MetadataList.vue'
8
- import { returnTagList } from '../../../scripts/utils'
9
-
10
- const props = defineProps<{
11
- article: Article
12
- icon?: {
13
- color?: string
14
- size?: 'small' | 'medium'
15
- }
16
- label?: {
17
- backgroundColor?: string
18
- color?: string
19
- fontSize?: string
20
- fontWeight?: string
21
- shape?: | 'square' | 'rounded'
22
- }
23
- delimiter?: string
24
- }>()
25
-
26
- const tags: ComputedRef<string[]> = computed(() => returnTagList(props.article))
27
- </script>
28
-
29
- <template>
30
- <MetadataList
31
- v-if="tags.length"
32
- :metadata="tags"
33
- :icon="{
34
- name : icon?.color ? 'TagIcon' : null,
35
- color: icon?.color,
36
- size : icon?.size,
37
- }"
38
- :label="label"
39
- :delimiter="delimiter"
40
- />
41
- </template>
@@ -1,85 +0,0 @@
1
- <script setup lang="ts">
2
- import type {
3
- Article,
4
- } from '../../../types'
5
- import { computed } from 'vue'
6
- import NoImage from '../../../components/ArticleList/Parts/NoImage.vue'
7
-
8
- const props = withDefaults(defineProps<{
9
- article: Article
10
- aspectRatio?: {
11
- desktop?: string
12
- tablet?: string
13
- mobile?: string
14
- }
15
- }>(), {
16
- aspectRatio: () => ({
17
- desktop: '4/3',
18
- tablet : '4/3',
19
- mobile : '4/3',
20
- }),
21
- })
22
-
23
- const thumbnailSrcset = computed(() => `${returnThumbnailSrc('full')} 1024w, ${returnThumbnailSrc('thumbnail')} 640w`)
24
- const articleMedia = computed(() => props.article?.['_embedded']?.['wp:featuredmedia']?.[0] || {})
25
- const returnThumbnailSrc = (type: 'full' | 'thumbnail') => articleMedia.value.media_details?.sizes?.[type].source_url ?? ''
26
- </script>
27
-
28
- <template>
29
- <div
30
- :style="{
31
- '--desktop-aspect--ratio': aspectRatio.desktop,
32
- '--tablet-aspect--ratio': aspectRatio.tablet,
33
- '--mobile-aspect--ratio': aspectRatio.mobile,
34
- }"
35
- :class="$style.container"
36
- >
37
- <img
38
- v-if="returnThumbnailSrc('full')"
39
- :srcset="thumbnailSrcset"
40
- sizes="(min-width: 640px) 50vw, 100vw"
41
- :alt="articleMedia?.alt_text ?? '記事サムネイル'"
42
- loading="lazy"
43
- :class="$style.image"
44
- >
45
- <NoImage v-else />
46
- </div>
47
- </template>
48
-
49
- <style lang="scss" module>
50
- @use '../../../assets/scss/mixin' as *;
51
-
52
- .container {
53
- width: 100%;
54
-
55
- @include media('mobile') {
56
- aspect-ratio: var(--mobile-aspect--ratio);
57
- }
58
-
59
- @include media('tablet') {
60
- aspect-ratio: var(--tablet-aspect--ratio);
61
- }
62
-
63
- @include media('desktop') {
64
- aspect-ratio: var(--desktop-aspect--ratio);
65
- }
66
-
67
- > img {
68
- width : 100%;
69
- height : 100%;
70
- object-fit: cover;
71
-
72
- @include media('mobile') {
73
- aspect-ratio: var(--mobile-aspect--ratio);
74
- }
75
-
76
- @include media('tablet') {
77
- aspect-ratio: var(--tablet-aspect--ratio);
78
- }
79
-
80
- @include media('desktop') {
81
- aspect-ratio: var(--desktop-aspect--ratio);
82
- }
83
- }
84
- }
85
- </style>
@@ -1,143 +0,0 @@
1
- <script setup lang="ts">
2
- import type { ButtonStyleForEachStatus } from '../types'
3
- import { computed } from 'vue'
4
- import LoadingSpinner from '../components/LoadingSpinner.vue'
5
- import { COLOR } from '../const'
6
-
7
- const props = defineProps<{
8
- cssStyle?: ButtonStyleForEachStatus
9
- duration?: number
10
- isLoading?: boolean
11
- isDisabled?: boolean
12
- buttonType?: 'button' | 'submit' | 'reset'
13
- }>()
14
-
15
- const currentCssStyle = computed(() => {
16
- const cssStyle = props.isDisabled ? props.cssStyle?.disabled : props.cssStyle?.default
17
-
18
- return {
19
- ...{
20
- textColor : COLOR.white,
21
- backgroundColor: props.isDisabled ? COLOR.darkGray : COLOR.blue,
22
- backgroundImage: 'none',
23
- border : {
24
- color : props.isDisabled ? COLOR.darkGray : COLOR.blue,
25
- size : '1px',
26
- radius: '.25rem',
27
- },
28
- boxShadow: '0 0 0 0 transparent',
29
- },
30
- ...cssStyle,
31
- }
32
- })
33
-
34
- const hoverStyle = props.cssStyle?.hover || {}
35
- </script>
36
-
37
- <template>
38
- <button
39
- :class="[
40
- $style.button,
41
- { [$style.loading] : isLoading },
42
- ]"
43
- :style="{
44
- '--text-color': currentCssStyle?.textColor,
45
- '--background-color': currentCssStyle?.backgroundColor,
46
- '--background-image': currentCssStyle?.backgroundImage,
47
- '--border-color': currentCssStyle?.border?.color,
48
- '--border-size': currentCssStyle?.border?.size,
49
- '--radius-size': currentCssStyle?.border?.radius,
50
- '--box-shadow': currentCssStyle?.boxShadow,
51
- '--hover-text-color': hoverStyle?.textColor || currentCssStyle?.textColor,
52
- '--hover-background-color': hoverStyle?.backgroundColor || currentCssStyle?.backgroundColor && `${currentCssStyle?.backgroundColor}cc`,
53
- '--hover-background-image': hoverStyle?.backgroundImage || currentCssStyle?.backgroundImage,
54
- '--hover-border-color': hoverStyle?.border?.color || currentCssStyle?.border?.color,
55
- '--hover-border-size': hoverStyle?.border?.size || currentCssStyle?.border?.size,
56
- '--hover-radius-size': hoverStyle?.border?.radius || currentCssStyle?.border?.radius,
57
- '--hover-box-shadow': hoverStyle?.boxShadow || currentCssStyle?.boxShadow,
58
- '--duration': `${duration || .3}s`,
59
- }"
60
- :type="buttonType || 'button'"
61
- :disabled="isDisabled || isLoading"
62
- >
63
- <div
64
- v-show="isLoading"
65
- :class="$style.loading_animation"
66
- >
67
- <slot
68
- v-if="$slots.loading"
69
- name="loading"
70
- />
71
- <LoadingSpinner v-else />
72
- </div>
73
- <div>
74
- <slot />
75
- </div>
76
- </button>
77
- </template>
78
-
79
- <style lang="scss" module>
80
- :is(.button) {
81
- display : inline-flex;
82
- justify-content : center;
83
- align-items : center;
84
- inline-size : max-content;
85
- padding : 1rem 2rem;
86
- background-color: var(--background-color);
87
- box-shadow :
88
- 0 0 0 var(--border-size) var(--border-color) inset,
89
- var(--box-shadow);
90
- border : none;
91
- border-radius : var(--radius-size);
92
- color : var(--text-color);
93
- line-height : 1;
94
- transition : all var(--duration);
95
- position : relative;
96
- cursor : pointer;
97
-
98
- @media (hover: hover) {
99
- &:where(:any-link, :enabled, summary):hover {
100
- background-color: var(--hover-background-color);
101
- box-shadow :
102
- 0 0 0 var(--hover-border-size) var(--hover-border-color) inset,
103
- var(--hover-box-shadow);
104
- border-radius : var(--hover-radius-size);
105
- color : var(--hover-text-color);
106
- }
107
- }
108
-
109
- &.loading,
110
- &:disabled {
111
- pointer-events: none !important;
112
-
113
- &::before {
114
- content : '';
115
- position : absolute;
116
- inset : 0;
117
- pointer-events: all;
118
- cursor : not-allowed !important;
119
- }
120
- }
121
-
122
- &.loading {
123
- > *:not(:is(.loading_animation)) {
124
- visibility: hidden;
125
- }
126
- }
127
- }
128
-
129
- :is(.loading_animation) {
130
- max-block-size: calc(100% - 1.5rem);
131
- color : currentColor;
132
- fill : currentColor;
133
- position : absolute;
134
- margin : auto;
135
- inset : 0;
136
-
137
- * {
138
- max-block-size: 100%;
139
- color : currentColor;
140
- fill : currentColor;
141
- }
142
- }
143
- </style>
@@ -1,140 +0,0 @@
1
- <script setup lang="ts">
2
- import type { CheckBoxStyleForEachStatus } from '../types'
3
- import { computed } from 'vue'
4
- import CheckIcon from '../components/Icon/CheckIcon.vue'
5
- import { COLOR } from '../const'
6
-
7
- const emit = defineEmits<{ (e: 'update:modelValue', newValue: boolean): void }>()
8
-
9
- const props = withDefaults(defineProps<{
10
- name: string
11
- modelValue?: boolean
12
- isDisabled?: boolean
13
- cssStyle?: CheckBoxStyleForEachStatus
14
- isDisableAnimation?: boolean
15
- }>(), {
16
- cssStyle: undefined,
17
- })
18
-
19
- const isChecked = computed<boolean>({
20
- get: () => props.modelValue ?? false,
21
- set: (newValue: boolean) => emit('update:modelValue', newValue),
22
- })
23
-
24
- const currentCssStyle = computed(() => {
25
- const cssStyle = props.isDisabled ? props.cssStyle?.disabled : props.cssStyle?.default
26
-
27
- return {
28
- ...{
29
- textColor : props.isDisabled ? COLOR.darkGray : COLOR.blue,
30
- backgroundColor: props.isDisabled ? COLOR.lightGray : COLOR.white,
31
- border : {
32
- color : props.isDisabled ? COLOR.darkGray : COLOR.blue,
33
- size : '1px',
34
- radius: '.25rem',
35
- },
36
- },
37
- ...cssStyle,
38
- }
39
- })
40
- </script>
41
-
42
- <template>
43
- <button
44
- :class="$style.check_box"
45
- :style="{
46
- '--text-color': currentCssStyle?.textColor,
47
- '--border-color': currentCssStyle?.border?.color,
48
- '--border-size' : currentCssStyle?.border?.size,
49
- '--radius-size': currentCssStyle?.border?.radius,
50
- '--background-color': currentCssStyle?.backgroundColor,
51
- '--duration': isDisableAnimation ? '0s' : '.3s',
52
- }"
53
- type="button"
54
- @click.stop="!isDisabled ? isChecked = !isChecked : null"
55
- >
56
- <input
57
- v-model="isChecked"
58
- type="checkbox"
59
- :name="name"
60
- :disabled="isDisabled"
61
- >
62
- <div :class="$style.check_container">
63
- <slot name="check" />
64
- <CheckIcon v-if="!$slots.check" />
65
- </div>
66
- </button>
67
- </template>
68
-
69
- <style lang="scss" module>
70
- @keyframes pop {
71
- 0% {
72
- scale : 1;
73
- }
74
-
75
- 10% {
76
- scale : .8;
77
- }
78
-
79
- 50% {
80
- scale : 1.1;
81
- }
82
-
83
- 100% {
84
- scale: 1;
85
- }
86
- }
87
-
88
- :is(.check_box) {
89
- display: flex;
90
- align-items: center;
91
- justify-content: center;
92
- width: 1.5rem;
93
- height: 1.5rem;
94
- border: none;
95
- box-shadow: 0 0 0 var(--border-size) var(--border-color) inset;
96
- border-radius: var(--radius-size);
97
- background-color: var(--background-color);
98
- cursor: pointer;
99
-
100
- > input {
101
- display: none;
102
- }
103
-
104
- &:has(input:disabled) {
105
- pointer-events: none !important;
106
- position: relative;
107
-
108
- &::before {
109
- content: '';
110
- position: absolute;
111
- inset: 0;
112
- pointer-events: all;
113
- cursor: not-allowed !important;
114
- }
115
- }
116
-
117
- &:has(input:checked) {
118
- background-color: var(--border-color);
119
- animation: pop var(--duration) ease-out;
120
-
121
- :is(.check_container) {
122
- color: var(--background-color);
123
- }
124
- }
125
- }
126
-
127
- :is(.check_container) {
128
- display: flex;
129
- align-items: center;
130
- justify-content: center;
131
- width: 1rem;
132
- height: 1rem;
133
- color: var(--border-color);
134
-
135
- > * {
136
- color: currentColor;
137
- fill: currentColor;
138
- }
139
- }
140
- </style>
@@ -1,101 +0,0 @@
1
- <script setup lang="ts">
2
- import type {
3
- Option,
4
- SelectValue,
5
- CheckBoxStyleForEachStatus,
6
- } from '../types'
7
- import {
8
- computed,
9
- ref,
10
- watch,
11
- } from 'vue'
12
- import LabeledCheckbox from '../components/LabeledCheckbox.vue'
13
- import ErrorMessage from '../components/ErrorMessage.vue'
14
- import { COLOR } from '../const'
15
-
16
- const emit = defineEmits<{ (e: 'update:modelValue', newValue: SelectValue[]): void }>()
17
-
18
- const props = withDefaults(defineProps<{
19
- name : string
20
- options: Array<Option>
21
- modelValue?: SelectValue[]
22
- isDisabled? : boolean
23
- isRequired?: boolean
24
- cssStyle?: CheckBoxStyleForEachStatus
25
- }>(), {
26
- modelValue: undefined,
27
- cssStyle : undefined,
28
- })
29
-
30
- const checkBoxes = ref(props.options.map(option => ({
31
- value : option.value,
32
- label : option.label,
33
- checked: props.modelValue?.includes(option.value) || false,
34
- })))
35
-
36
- const checkedValues = computed<SelectValue[]>(() => checkBoxes.value.filter(checkBox => checkBox.checked).map(checkBox => checkBox.value))
37
- const errorMessage = ref('')
38
- const validateInput = () => errorMessage.value = props.isRequired && checkedValues.value.length === 0 ? '必須項目です' : ''
39
-
40
- watch(checkedValues, (newValue, oldValue) => {
41
- const isArraysEqual = (a: SelectValue[], b: SelectValue[]): boolean => a.length === b.length && a.every((val, index) => val === b[index])
42
- if (oldValue && isArraysEqual(newValue, oldValue)) return
43
- validateInput()
44
- emit('update:modelValue', newValue)
45
- }, {
46
- deep : true,
47
- immediate: !!props.modelValue?.length,
48
- })
49
-
50
- watch(() => props.modelValue, newValue => {
51
- if (!newValue) return
52
- checkBoxes.value.forEach(checkBox => checkBox.checked = newValue.includes(checkBox.value))
53
- }, {
54
- deep : true,
55
- immediate: true,
56
- })
57
-
58
- const errorColor = {
59
- ...(props.cssStyle?.error ?? {}),
60
- textColor : COLOR.white,
61
- backgroundColor: COLOR.red,
62
- border : {
63
- color : COLOR.red,
64
- size : '1px',
65
- radius: '.25rem',
66
- },
67
- }
68
- </script>
69
-
70
- <template>
71
- <div :class="$style.check_boxes">
72
- <template
73
- v-for="(checkBox, index) in checkBoxes"
74
- :key="checkBox.label"
75
- >
76
- <LabeledCheckbox
77
- v-model="checkBoxes[index].checked"
78
- :name="checkBox.label"
79
- :label="checkBox.label"
80
- :isDisabled="props.isDisabled"
81
- :cssStyle="props.cssStyle"
82
- />
83
- </template>
84
- <ErrorMessage
85
- :errorMessages="errorMessage ? [errorMessage] : []"
86
- :cssStyle="{
87
- textColor: errorColor.textColor,
88
- backgroundColor: errorColor.backgroundColor,
89
- }"
90
- />
91
- </div>
92
- </template>
93
-
94
- <style lang="scss" module>
95
- .check_boxes {
96
- display : flex;
97
- flex-wrap: wrap;
98
- gap : 1rem 1.5rem;
99
- position : relative;
100
- }
101
- </style>