@geckou/ui-vue 0.3.0 → 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 -310
  78. package/dist/components/ArticleList/Card/Entertainment.vue +0 -244
  79. package/dist/components/ArticleList/Card/Gallery.vue +0 -254
  80. package/dist/components/ArticleList/Card/Grid.vue +0 -247
  81. package/dist/components/ArticleList/Card/News.vue +0 -150
  82. package/dist/components/ArticleList/Card/Rounded.vue +0 -154
  83. package/dist/components/ArticleList/Card/Row.vue +0 -167
  84. package/dist/components/ArticleList/Card/Simple.vue +0 -232
  85. package/dist/components/ArticleList/Card/Standard.vue +0 -187
  86. package/dist/components/ArticleList/Card/Tile.vue +0 -171
  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 -100
  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 -36
  144. package/dist/types/custom.d.ts +0 -1
  145. package/dist/types/vue-shim.d.ts +0 -5
@@ -1,123 +0,0 @@
1
- <script setup lang="ts">
2
- import type { Ref } from 'vue'
3
- import { ref, onMounted, onUpdated, watch } from 'vue'
4
- import IconChevronDown from '../components/Icon/KeyboardArrowDownIcon.vue'
5
- const props = withDefaults(defineProps<{
6
- isOpened?: boolean | null
7
- isHiddenArrow?: boolean
8
- isDisabled?: boolean
9
- isDisableClickOutside?: boolean
10
- duration?: number
11
- }>(), {
12
- isOpened: null,
13
- duration: .3,
14
- })
15
-
16
- const isOpenedContents = ref(props.isOpened || false)
17
- const contents: Ref<HTMLElement | null> = ref(null)
18
- const contentsHeight = ref(0)
19
- const toggleBox = () => isOpenedContents.value = !isOpenedContents.value
20
-
21
- const closeDropDown = () => {
22
- if (!props.isDisableClickOutside) isOpenedContents.value = false
23
- }
24
-
25
- const updateContentsHeight = () => {
26
- const contentsValue = contents.value
27
- if (contentsValue) {
28
- contentsHeight.value = contentsValue.clientHeight
29
- }
30
- }
31
-
32
- onMounted(()=> updateContentsHeight())
33
- onUpdated(() => updateContentsHeight())
34
- watch(() => props.isOpened, newValue => {
35
- if (typeof newValue === 'boolean') isOpenedContents.value = newValue
36
- })
37
- defineExpose({ isOpenedContents })
38
- </script>
39
-
40
- <template>
41
- <div
42
- v-click-outside="closeDropDown"
43
- :class="{ [$style.opened]: isOpenedContents }"
44
- :style="{ '--accordion-toggle-duration': `${props.duration}s` }"
45
- >
46
- <button
47
- :class="$style.trigger"
48
- :disabled="isDisabled"
49
- type="button"
50
- @click.prevent="toggleBox"
51
- >
52
- <div class="width:100% text-align:left">
53
- <slot name="trigger" />
54
- </div>
55
- <IconChevronDown
56
- v-if="!isHiddenArrow"
57
- :class="$style.icon"
58
- />
59
- </button>
60
- <div
61
- :style="{ height: isOpenedContents ? `${contentsHeight}px` : 0 }"
62
- :class="$style.contents"
63
- >
64
- <div
65
- ref="contents"
66
- :class="$style.container"
67
- >
68
- <slot />
69
- </div>
70
- </div>
71
- </div>
72
- </template>
73
-
74
- <style lang="scss" module>
75
- @use '../assets/scss/mixin' as *;
76
-
77
- @keyframes overflow {
78
- 0% {
79
- overflow: hidden;
80
- }
81
-
82
- 99% {
83
- overflow: hidden;
84
- }
85
-
86
- 100% {
87
- overflow: visible;
88
- }
89
- }
90
-
91
- .trigger {
92
- display : grid;
93
- grid-template-columns: 1fr auto;
94
- align-items : center;
95
- inline-size : 100%;
96
- justify-items : start;
97
- cursor : pointer;
98
- position : relative;
99
- color : var(--link-color);
100
- }
101
-
102
- .icon {
103
- @include icon($color: var(--link-color));
104
- flex : 0 0 auto;
105
- transition: all .1s;
106
- }
107
-
108
- .contents {
109
- transition: height var(--accordion-toggle-duration);
110
- overflow : hidden;
111
- }
112
-
113
- .opened {
114
- .icon {
115
- transform: rotate(180deg);
116
- }
117
-
118
- .contents {
119
- animation : overflow var(--accordion-toggle-duration);
120
- animation-fill-mode: forwards;
121
- }
122
- }
123
- </style>
@@ -1,123 +0,0 @@
1
- <script setup lang="ts">
2
- import { ref } from 'vue'
3
- import { COLOR } from '../const'
4
-
5
- const props = withDefaults(defineProps<{
6
- tabs: {
7
- key: string
8
- label: string
9
- }[]
10
- color?: {
11
- active: string
12
- background: string
13
- text: string
14
- }
15
- cssStyle?: {
16
- textColor: string
17
- backgroundColor: string
18
- border: {
19
- color: string
20
- size: string
21
- radius: string
22
- }
23
- }
24
- type?: 'tab' | 'button' | 'border'
25
- initialIndex?: number
26
- }>(), {
27
- color : undefined,
28
- cssStyle : undefined,
29
- type : 'tab',
30
- initialIndex: 0,
31
- })
32
-
33
- const activeTab = ref(props.tabs[props.initialIndex].key)
34
- const tabRefs = ref<HTMLButtonElement[]>([])
35
- const changeTabs = (key: string) => activeTab.value = key
36
-
37
- const activateTab = (index: number) => {
38
- activeTab.value = props.tabs[index].key
39
- tabRefs.value[index]?.focus()
40
- }
41
-
42
- // 以前は window 全体に keydown を張っていたため、フォーカス位置と無関係にタブが
43
- // 切り替わり、1 画面に複数設置すると互いに競合した。
44
- // タブリストにフォーカスがあるときだけ矢印キーで移動する(WAI-ARIA Tabs パターン)
45
- const handleKeydown = (event: KeyboardEvent) => {
46
- if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return
47
-
48
- const currentIndex = props.tabs.findIndex(tab => tab.key === activeTab.value)
49
- if (currentIndex === -1) return
50
-
51
- event.preventDefault()
52
- const lastIndex = props.tabs.length - 1
53
-
54
- if (event.key === 'ArrowLeft') {
55
- activateTab(currentIndex > 0 ? currentIndex - 1 : lastIndex)
56
- } else {
57
- activateTab(currentIndex < lastIndex ? currentIndex + 1 : 0)
58
- }
59
- }
60
- </script>
61
-
62
- <template>
63
- <div>
64
- <div
65
- :class="$style.tabs"
66
- :style="{
67
- '--active-color': color?.active || COLOR.blue,
68
- '--background-color': color?.background || 'transparent',
69
- }"
70
- role="tablist"
71
- @keydown="handleKeydown"
72
- >
73
- <button
74
- v-for="(tab, index) in tabs"
75
- :id="tab.key"
76
- :key="tab.key"
77
- :ref="el => { if (el) tabRefs[index] = el as HTMLButtonElement }"
78
- role="tab"
79
- :aria-controls="`${tab.key}_${index}`"
80
- :aria-selected="activeTab === tab.key"
81
- :tabindex="activeTab === tab.key ? 0 : -1"
82
- :class="{ [$style.active]: activeTab === tab.key }"
83
- @click="changeTabs(tab.key)"
84
- >
85
- <slot :name="tab.key" />
86
- <template v-if="!$slots[tab.key]">
87
- {{ tab.label }}
88
- </template>
89
- </button>
90
- </div>
91
- <div
92
- v-for="(tab, index) in tabs"
93
- v-show="activeTab === tab.key"
94
- :id="`${tab.key}_${index}`"
95
- :key="`${tab.key}_panel`"
96
- role="tabpanel"
97
- :aria-labelledby="tab.key"
98
- >
99
- <slot :name="`${tab.key}Contents`" />
100
- </div>
101
- </div>
102
- </template>
103
-
104
- <style lang="scss" module>
105
- .tabs {
106
- display : flex;
107
- background-color: var(--background-color);
108
-
109
- > button {
110
- &[role="tab"] {
111
- border : none;
112
- background-color: transparent;
113
- font-size : 1rem;
114
- padding : .5rem 1rem;
115
- cursor : pointer;
116
-
117
- &.active {
118
- cursor: auto;
119
- }
120
- }
121
- }
122
- }
123
- </style>
@@ -1,115 +0,0 @@
1
- <script lang="ts" setup>
2
- import type {
3
- Validates,
4
- InputBoxStyleForEachStatus,
5
- } from '../types'
6
- import {
7
- ref,
8
- computed,
9
- watch,
10
- nextTick,
11
- onMounted,
12
- } from 'vue'
13
- import { isEmptyValue, validateInputValue } from '@geckou/ui-core'
14
- import InputBox from '../components/InputBox.vue'
15
- import ErrorMessage from '../components/ErrorMessage.vue'
16
-
17
- type InputValue = string | null
18
-
19
- const emit = defineEmits<{ (e: 'update:modelValue', newValue: InputValue): void }>()
20
-
21
- const props = withDefaults(defineProps<{
22
- name: string
23
- modelValue?: InputValue
24
- cssStyle?: InputBoxStyleForEachStatus | undefined
25
- placeholder?: string
26
- isDisabled? : boolean
27
- isRequired?: boolean
28
- rows?: number
29
- maxLength?: number
30
- autocomplete?: string
31
- validates?: Validates
32
- autoAdjustHeight?: boolean
33
- }>(), {
34
- modelValue : undefined,
35
- cssStyle : undefined,
36
- isRequired : false,
37
- placeholder : '入力してください',
38
- rows : undefined,
39
- maxLength : 100,
40
- isDisabled : false,
41
- autocomplete: 'off',
42
- validates : () => [],
43
- })
44
-
45
- const inputValue = computed<InputValue>({
46
- get: () => props.modelValue ?? '',
47
- set: (newValue: InputValue) => emit('update:modelValue', newValue),
48
- })
49
-
50
- const errorMessages = ref<string[]>([])
51
- const textareaRef = ref<HTMLTextAreaElement | null>(null)
52
-
53
- const validateValue = () => {
54
- errorMessages.value = validateInputValue(inputValue.value, {
55
- isRequired: props.isRequired,
56
- validates : props.validates,
57
- })
58
- }
59
-
60
- const adjustTextareaHeight = () => {
61
- if (!props.autoAdjustHeight) return
62
-
63
- nextTick(() => {
64
- if (textareaRef.value) {
65
- textareaRef.value.style.height = 'auto'
66
- textareaRef.value.style.height = `calc(${textareaRef.value.scrollHeight}px - 2rem)`
67
- }
68
- })
69
- }
70
-
71
- onMounted(adjustTextareaHeight)
72
-
73
- watch(inputValue, () => {
74
- validateValue()
75
- adjustTextareaHeight()
76
- },
77
- // 数値 0 も初期値として扱うため truthy 判定は使わない
78
- { immediate: !isEmptyValue(props.modelValue), flush: 'post' })
79
- </script>
80
-
81
- <template>
82
- <InputBox
83
- :cssStyle="cssStyle"
84
- :class="$style.text_area"
85
- :isErrored="!!errorMessages.length"
86
- :isDisabled="isDisabled"
87
- >
88
- <textarea
89
- ref="textareaRef"
90
- v-model="inputValue"
91
- :name="name"
92
- :required="isRequired"
93
- :placeholder="placeholder"
94
- :disabled="isDisabled"
95
- :autocomplete="autocomplete"
96
- :rows="rows"
97
- :maxlength="maxLength"
98
- :aria-invalid="!!errorMessages.length ? 'true' : undefined"
99
- @blur="validateValue()"
100
- />
101
- <ErrorMessage
102
- :errorMessages="errorMessages"
103
- :cssStyle="{
104
- textColor: cssStyle?.error?.backgroundColor,
105
- backgroundColor: cssStyle?.error?.textColor,
106
- }"
107
- />
108
- </InputBox>
109
- </template>
110
-
111
- <style module>
112
- :is(.text_area) {
113
- min-block-size: 4em;
114
- }
115
- </style>
@@ -1,111 +0,0 @@
1
- <script lang="ts" setup>
2
- import type {
3
- Validates,
4
- InputBoxStyleForEachStatus,
5
- } from '../types'
6
- import {
7
- ref,
8
- computed,
9
- watch,
10
- } from 'vue'
11
- import {
12
- convertFullWidthToHalfWidth,
13
- isEmptyValue,
14
- validateInputValue,
15
- } from '@geckou/ui-core'
16
- import InputBox from '../components/InputBox.vue'
17
- import ErrorMessage from '../components/ErrorMessage.vue'
18
-
19
- type InputValue = string | number
20
-
21
- const emit = defineEmits<{ (e: 'update:modelValue', newValue: InputValue): void }>()
22
-
23
- const props = withDefaults(defineProps<{
24
- name: string
25
- modelValue?: InputValue
26
- cssStyle?: InputBoxStyleForEachStatus | undefined
27
- inputType? : string
28
- placeholder?: string
29
- isDisabled? : boolean
30
- isRequired?: boolean
31
- maxLength?: number
32
- autocomplete?: string
33
- validates?: Validates
34
- }>(), {
35
- modelValue : undefined,
36
- cssStyle : undefined,
37
- inputType : 'text',
38
- placeholder : '入力してください',
39
- maxLength : 30,
40
- autocomplete: 'off',
41
- validates : () => [],
42
- })
43
-
44
- const errorMessages = ref<string[]>([])
45
-
46
- const inputValue = computed<InputValue>({
47
- get: () => props.modelValue ?? '',
48
- set: (newValue: InputValue) => {
49
- const convertedValue = typeof newValue === 'number'
50
- ? newValue
51
- : convertFullWidthToHalfWidth(String(newValue))
52
-
53
- emit('update:modelValue', convertedValue)
54
- },
55
- })
56
-
57
- const validateValue = () => {
58
- errorMessages.value = validateInputValue(inputValue.value, {
59
- isRequired: props.isRequired,
60
- validates : props.validates,
61
- })
62
- }
63
-
64
- // 初期値があるときはマウント時にも検証する。
65
- // 数値 0 も初期値として扱うため truthy 判定は使わない
66
- watch(inputValue, () => validateValue(), {
67
- immediate: !isEmptyValue(props.modelValue),
68
- flush : 'post',
69
- })
70
- </script>
71
-
72
- <template>
73
- <InputBox
74
- :cssStyle="cssStyle"
75
- :class="$style.text_box"
76
- :isErrored="!!errorMessages.length"
77
- :isDisabled="isDisabled"
78
- >
79
- <slot name="before" />
80
- <input
81
- v-model="inputValue"
82
- :type="inputType"
83
- :name="name"
84
- :required="isRequired"
85
- :placeholder="placeholder"
86
- :disabled="isDisabled"
87
- :autocomplete="autocomplete"
88
- :maxlength="maxLength"
89
- :aria-invalid="!!errorMessages.length ? 'true' : undefined"
90
- @blur="validateValue()"
91
- >
92
- <slot name="after" />
93
- <ErrorMessage
94
- :errorMessages="errorMessages"
95
- :cssStyle="{
96
- textColor: cssStyle?.error?.backgroundColor,
97
- backgroundColor: cssStyle?.error?.textColor,
98
- }"
99
- />
100
- </InputBox>
101
- </template>
102
-
103
- <style lang="scss" module>
104
- :is(.text_box) {
105
- display: inline-flex;
106
-
107
- > input {
108
- flex: 1 1 auto;
109
- }
110
- }
111
- </style>
@@ -1,47 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
- import { COLOR } from '../const'
4
-
5
- const props = withDefaults(defineProps<{
6
- text: string
7
- variant?: 'default' | 'caution'
8
- isDisabled?: boolean
9
- }>(), {
10
- variant : 'default',
11
- isDisabled: false,
12
- })
13
-
14
- const textColor = computed(() => props.variant === 'caution' ? COLOR.red : 'var(--link-color)')
15
- </script>
16
-
17
- <template>
18
- <button
19
- type="button"
20
- :class="$style.text_button"
21
- :disabled="isDisabled"
22
- :style="{ '--text-button-color': textColor }"
23
- >
24
- {{ text }}
25
- </button>
26
- </template>
27
-
28
- <style lang="scss" module>
29
- .text_button {
30
- padding : 0;
31
- border : none;
32
- background-color: transparent;
33
- color : var(--text-button-color);
34
- font-size : inherit;
35
- line-height : 1;
36
- cursor : pointer;
37
-
38
- &:hover:not(:disabled) {
39
- text-decoration: underline;
40
- }
41
-
42
- &:disabled {
43
- color : var(--disable-text-color);
44
- cursor: not-allowed;
45
- }
46
- }
47
- </style>
@@ -1,179 +0,0 @@
1
- <script setup lang="ts">
2
- import type {
3
- StateVariation,
4
- BaseStyle,
5
- } from '../types'
6
- import { computed } from 'vue'
7
- import { COLOR } from '../const'
8
-
9
- const emit = defineEmits<{ (e: 'update:modelValue', newValue: boolean): void }>()
10
-
11
- const props = withDefaults(defineProps<{
12
- name: string
13
- label?: Record<'on' | 'off', string>
14
- modelValue?: boolean
15
- isDisabled?: boolean
16
- cssStyle?: Record<StateVariation, {
17
- on: BaseStyle
18
- off: BaseStyle
19
- }>
20
- }>(), {
21
- label : () => ({ on: 'ON', off: 'OFF' }),
22
- cssStyle: undefined,
23
- })
24
-
25
- const isChecked = computed<boolean>({
26
- get: () => props.modelValue ?? false,
27
- set: (newValue: boolean) => emit('update:modelValue', newValue),
28
- })
29
-
30
- const maxTextLength = computed<number>(() => {
31
- const onLength = props.label.on.length
32
- const offLength = props.label.off.length
33
-
34
- return onLength > offLength ? onLength : offLength
35
- })
36
-
37
- const currentCssStyle = computed(() => {
38
- const cssStyle = props.isDisabled ? props.cssStyle?.disabled : props.cssStyle?.default
39
-
40
- return {
41
- on: {
42
- ...{
43
- textColor : props.isDisabled ? COLOR.lightGray : COLOR.white,
44
- backgroundColor: props.isDisabled ? COLOR.gray : COLOR.blue,
45
- border : {
46
- color : props.isDisabled ? COLOR.gray : COLOR.blue,
47
- size : '1px',
48
- radius: '.25rem',
49
- },
50
- boxShadow: '0 0 0 0 rgba(0, 0, 0, 0)',
51
- },
52
- ...cssStyle?.on,
53
- },
54
- off: {
55
- ...{
56
- textColor : props.isDisabled ? COLOR.gray : COLOR.white,
57
- backgroundColor: props.isDisabled ? COLOR.lightGray : COLOR.darkGray,
58
- border : {
59
- color : props.isDisabled ? COLOR.gray : COLOR.darkGray,
60
- size : '1px',
61
- radius: '.25rem',
62
- },
63
- boxShadow: '0 0 0 0 rgba(0, 0, 0, 0)',
64
- },
65
- ...cssStyle?.off,
66
- },
67
- }[isChecked.value ? 'on' : 'off']
68
- })
69
- </script>
70
-
71
- <template>
72
- <button
73
- :class="$style.toggle_button"
74
- :style="{
75
- '--text-color': currentCssStyle?.textColor,
76
- '--border-color': currentCssStyle?.border?.color,
77
- '--border-size' : currentCssStyle?.border?.size,
78
- '--radius-size': currentCssStyle?.border?.radius,
79
- '--background-color': currentCssStyle?.backgroundColor,
80
- '--box-shadow': currentCssStyle?.boxShadow,
81
- '--inline-size': `${maxTextLength * 2}ch`,
82
- }"
83
- type="button"
84
- :disabled="isDisabled"
85
- @click.stop="!isDisabled ? isChecked = !isChecked : null"
86
- >
87
- <input
88
- v-model="isChecked"
89
- type="checkbox"
90
- :name="name"
91
- :disabled="isDisabled"
92
- >
93
- <div
94
- :class="[$style.text, {[$style.on]: isChecked}]"
95
- :data-on="label.on"
96
- :data-off="label.off"
97
- />
98
- <div :class="$style.handle" />
99
- </button>
100
- </template>
101
-
102
- <style lang="scss" module>
103
- :is(.toggle_button) {
104
- --handle-size: 1.5rem;
105
- --padding-size: calc(var(--border-size) + 2px);
106
- --duration: .15s;
107
- inline-size: calc(var(--inline-size) + var(--handle-size) + (var(--padding-size) * 2));
108
- position: relative;
109
- display: inline-block;
110
- padding: var(--padding-size);
111
- background-color: var(--background-color);
112
- box-shadow:
113
- 0 0 0 var(--border-size) var(--border-color) inset,
114
- var(--box-shadow)
115
- ;
116
- border: none;
117
- border-radius: var(--radius-size);
118
- cursor: pointer;
119
-
120
- > input {
121
- display: none;
122
- }
123
- }
124
-
125
- :is(.text) {
126
- position: absolute;
127
- inline-size: 100%;
128
- block-size: 100%;
129
- text-transform: uppercase;
130
- color: var(--text-color);
131
- top: 0;
132
- left: 0;
133
-
134
- &::before,
135
- &::after {
136
- display: inline-flex;
137
- justify-content: center;
138
- align-items: center;
139
- block-size: 100%;
140
- inline-size: calc(100% - var(--handle-size) - var(--padding-size));
141
- margin: auto;
142
- line-height: 1;
143
- position: absolute;
144
- transition: opacity var(--duration) ease-out;
145
- }
146
-
147
- &::before {
148
- content: attr(data-off);
149
- right: 0;
150
- }
151
-
152
- &::after {
153
- content: attr(data-on);
154
- left: 0;
155
- opacity: 0;
156
- }
157
-
158
- &.on {
159
- &:before { opacity: 0; }
160
- &:after { opacity: 1; }
161
-
162
- + .handle {
163
- left: calc(100% - var(--handle-size));
164
- }
165
- }
166
- }
167
-
168
- :is(.handle) {
169
- inline-size: var(--handle-size);
170
- aspect-ratio: 1 / 1;
171
- margin: 0;
172
- background-color: var(--text-color);
173
- border-radius: calc(var(--radius-size) - (var(--padding-size) / 2));
174
- box-shadow: var(--box-shadow);
175
- position: relative;
176
- left: 0;
177
- transition: left var(--duration) ease-out;
178
- }
179
- </style>
@@ -1,2 +0,0 @@
1
- // 配色は @geckou/ui-core が正。Vue / React で共通のため再エクスポートのみ行う
2
- export { COLOR, BORDER, MESSAGES, INPUT_BOX_DEFAULT_STYLES } from '@geckou/ui-core'