@soave/ui 0.1.0 → 0.2.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 (74) hide show
  1. package/dist/adapters/css-variables.d.ts +2 -0
  2. package/dist/adapters/css-variables.mjs +228 -0
  3. package/dist/adapters/headless.d.ts +7 -0
  4. package/dist/adapters/headless.mjs +7 -0
  5. package/dist/adapters/index.d.ts +5 -0
  6. package/dist/adapters/index.mjs +11 -0
  7. package/dist/adapters/tailwind.d.ts +2 -0
  8. package/dist/adapters/tailwind.mjs +443 -0
  9. package/dist/adapters/types.d.ts +38 -0
  10. package/dist/adapters/types.mjs +10 -0
  11. package/dist/build.config.mjs +1 -1
  12. package/dist/components/ui/Alert.vue +18 -16
  13. package/dist/components/ui/AlertDescription.vue +13 -3
  14. package/dist/components/ui/AlertTitle.vue +13 -3
  15. package/dist/components/ui/Button.vue +30 -4
  16. package/dist/components/ui/Card.vue +27 -3
  17. package/dist/components/ui/CardContent.vue +13 -3
  18. package/dist/components/ui/CardDescription.vue +13 -3
  19. package/dist/components/ui/CardFooter.vue +13 -3
  20. package/dist/components/ui/CardHeader.vue +13 -3
  21. package/dist/components/ui/CardTitle.vue +13 -3
  22. package/dist/components/ui/Checkbox.vue +23 -2
  23. package/dist/components/ui/Dialog.vue +31 -9
  24. package/dist/components/ui/DialogDescription.vue +13 -3
  25. package/dist/components/ui/DialogFooter.vue +13 -3
  26. package/dist/components/ui/DialogHeader.vue +13 -3
  27. package/dist/components/ui/DialogTitle.vue +13 -3
  28. package/dist/components/ui/DropdownMenuContent.vue +16 -13
  29. package/dist/components/ui/DropdownMenuItem.vue +11 -17
  30. package/dist/components/ui/Input.vue +26 -3
  31. package/dist/components/ui/PopoverContent.vue +16 -12
  32. package/dist/components/ui/RadioGroup.vue +12 -7
  33. package/dist/components/ui/RadioItem.vue +31 -10
  34. package/dist/components/ui/Select.vue +8 -1
  35. package/dist/components/ui/SelectContent.vue +31 -5
  36. package/dist/components/ui/SelectItem.vue +20 -16
  37. package/dist/components/ui/SelectTrigger.vue +39 -7
  38. package/dist/components/ui/SelectValue.vue +13 -2
  39. package/dist/components/ui/Sheet.vue +32 -24
  40. package/dist/components/ui/SheetDescription.vue +13 -6
  41. package/dist/components/ui/SheetFooter.vue +13 -6
  42. package/dist/components/ui/SheetHeader.vue +13 -6
  43. package/dist/components/ui/SheetTitle.vue +13 -6
  44. package/dist/components/ui/Switch.vue +23 -3
  45. package/dist/components/ui/Textarea.vue +26 -3
  46. package/dist/components/ui/Toast.vue +38 -29
  47. package/dist/components/ui/Toaster.vue +12 -16
  48. package/dist/components/ui/TooltipContent.vue +18 -15
  49. package/dist/components/ui/UIProvider.vue +6 -2
  50. package/dist/composables/index.d.ts +1 -1
  51. package/dist/composables/index.mjs +1 -1
  52. package/dist/composables/useUIConfig.d.ts +16 -5
  53. package/dist/composables/useUIConfig.mjs +26 -9
  54. package/dist/index.d.ts +1 -0
  55. package/dist/index.mjs +1 -0
  56. package/dist/styles/css-variables.css +1 -0
  57. package/dist/styles/index.d.ts +1 -0
  58. package/dist/styles/index.mjs +1 -0
  59. package/dist/types/alert.d.ts +2 -0
  60. package/dist/types/card.d.ts +5 -0
  61. package/dist/types/composables.d.ts +122 -0
  62. package/dist/types/composables.mjs +0 -0
  63. package/dist/types/config.d.ts +8 -0
  64. package/dist/types/dialog.d.ts +7 -0
  65. package/dist/types/dropdown.d.ts +8 -0
  66. package/dist/types/index.d.ts +1 -0
  67. package/dist/types/index.mjs +1 -0
  68. package/dist/types/popover.d.ts +6 -0
  69. package/dist/types/radio.d.ts +4 -0
  70. package/dist/types/select.d.ts +21 -0
  71. package/dist/types/sheet.d.ts +19 -0
  72. package/dist/types/toast.d.ts +2 -0
  73. package/dist/types/tooltip.d.ts +6 -0
  74. package/package.json +9 -1
@@ -0,0 +1,2 @@
1
+ import type { StyleAdapter } from "./types";
2
+ export declare const cssVariablesAdapter: StyleAdapter;
@@ -0,0 +1,228 @@
1
+ export const cssVariablesAdapter = {
2
+ name: "css-variables",
3
+ description: "CSS Variables \u30D9\u30FC\u30B9\u306E\u30B9\u30BF\u30A4\u30EA\u30F3\u30B0\uFF08BEM\u547D\u540D\uFF09",
4
+ getClasses(component, state) {
5
+ switch (component) {
6
+ case "button":
7
+ return getCssVariablesButtonClasses(state);
8
+ case "input":
9
+ return getCssVariablesInputClasses(state);
10
+ case "card":
11
+ return getCssVariablesCardClasses(state);
12
+ case "dialog":
13
+ return getCssVariablesDialogClasses(state);
14
+ case "dialog-overlay":
15
+ return "dialog__overlay";
16
+ case "checkbox":
17
+ return getCssVariablesCheckboxClasses(state);
18
+ case "radio":
19
+ return getCssVariablesRadioClasses(state);
20
+ case "radio-group":
21
+ return getCssVariablesRadioGroupClasses(state);
22
+ case "radio-indicator":
23
+ return "radio__indicator";
24
+ case "switch":
25
+ return getCssVariablesSwitchClasses(state);
26
+ case "textarea":
27
+ return getCssVariablesTextareaClasses(state);
28
+ case "select":
29
+ return getCssVariablesSelectClasses(state);
30
+ case "select-content":
31
+ return "select__content";
32
+ case "select-item":
33
+ return "select__item";
34
+ case "select-value":
35
+ return getCssVariablesSelectValueClasses(state);
36
+ case "select-trigger-icon":
37
+ return "select__trigger-icon";
38
+ case "toast":
39
+ return getCssVariablesToastClasses(state);
40
+ case "toast-title":
41
+ return "toast__title";
42
+ case "toast-description":
43
+ return "toast__description";
44
+ case "toast-action":
45
+ return "toast__action";
46
+ case "toast-dismiss":
47
+ return "toast__dismiss";
48
+ case "toaster":
49
+ return getCssVariablesToasterClasses(state);
50
+ case "tooltip":
51
+ return getCssVariablesTooltipClasses(state);
52
+ case "popover":
53
+ return getCssVariablesPopoverClasses(state);
54
+ case "dropdown":
55
+ return getCssVariablesDropdownClasses(state);
56
+ case "dropdown-item":
57
+ return "dropdown__item";
58
+ case "sheet":
59
+ return getCssVariablesSheetClasses(state);
60
+ case "sheet-overlay":
61
+ return "sheet__overlay";
62
+ case "sheet-header":
63
+ return "sheet__header";
64
+ case "sheet-title":
65
+ return "sheet__title";
66
+ case "sheet-description":
67
+ return "sheet__description";
68
+ case "sheet-footer":
69
+ return "sheet__footer";
70
+ case "sheet-close":
71
+ return "sheet__close";
72
+ case "alert":
73
+ return getCssVariablesAlertClasses(state);
74
+ case "alert-title":
75
+ return "alert__title";
76
+ case "alert-description":
77
+ return "alert__description";
78
+ case "label":
79
+ return "label";
80
+ // Dialog sub-components
81
+ case "dialog-header":
82
+ return "dialog__header";
83
+ case "dialog-title":
84
+ return "dialog__title";
85
+ case "dialog-description":
86
+ return "dialog__description";
87
+ case "dialog-footer":
88
+ return "dialog__footer";
89
+ case "dialog-close":
90
+ return "dialog__close";
91
+ // Card sub-components
92
+ case "card-header":
93
+ return "card__header";
94
+ case "card-title":
95
+ return "card__title";
96
+ case "card-description":
97
+ return "card__description";
98
+ case "card-content":
99
+ return "card__content";
100
+ case "card-footer":
101
+ return "card__footer";
102
+ default:
103
+ return "";
104
+ }
105
+ }
106
+ };
107
+ function getCssVariablesButtonClasses(state) {
108
+ return [
109
+ "button",
110
+ `button--${state.variant}`,
111
+ `button--${state.size}`,
112
+ state.disabled && "button--disabled",
113
+ state.loading && "button--loading"
114
+ ].filter(Boolean).join(" ");
115
+ }
116
+ function getCssVariablesInputClasses(state) {
117
+ return [
118
+ "input",
119
+ `input--${state.size}`,
120
+ state.error && "input--error",
121
+ state.disabled && "input--disabled",
122
+ state.readonly && "input--readonly"
123
+ ].filter(Boolean).join(" ");
124
+ }
125
+ function getCssVariablesCardClasses(state) {
126
+ return [
127
+ "card",
128
+ state.padding !== "none" && `card--padding-${state.padding}`
129
+ ].filter(Boolean).join(" ");
130
+ }
131
+ function getCssVariablesDialogClasses(state) {
132
+ return [
133
+ "dialog",
134
+ state.is_open && "dialog--open"
135
+ ].filter(Boolean).join(" ");
136
+ }
137
+ function getCssVariablesCheckboxClasses(state) {
138
+ return [
139
+ "checkbox",
140
+ state.checked && "checkbox--checked",
141
+ state.indeterminate && "checkbox--indeterminate",
142
+ state.disabled && "checkbox--disabled"
143
+ ].filter(Boolean).join(" ");
144
+ }
145
+ function getCssVariablesRadioClasses(state) {
146
+ return [
147
+ "radio",
148
+ state.checked && "radio--checked",
149
+ state.disabled && "radio--disabled"
150
+ ].filter(Boolean).join(" ");
151
+ }
152
+ function getCssVariablesSwitchClasses(state) {
153
+ return [
154
+ "switch",
155
+ state.checked && "switch--checked",
156
+ state.disabled && "switch--disabled"
157
+ ].filter(Boolean).join(" ");
158
+ }
159
+ function getCssVariablesTextareaClasses(state) {
160
+ return [
161
+ "textarea",
162
+ `textarea--${state.size}`,
163
+ state.error && "textarea--error",
164
+ state.disabled && "textarea--disabled",
165
+ state.readonly && "textarea--readonly"
166
+ ].filter(Boolean).join(" ");
167
+ }
168
+ function getCssVariablesSelectClasses(state) {
169
+ return [
170
+ "select",
171
+ `select--${state.size}`,
172
+ state.is_open && "select--open",
173
+ state.disabled && "select--disabled"
174
+ ].filter(Boolean).join(" ");
175
+ }
176
+ function getCssVariablesToastClasses(state) {
177
+ return [
178
+ "toast",
179
+ `toast--${state.variant}`
180
+ ].filter(Boolean).join(" ");
181
+ }
182
+ function getCssVariablesTooltipClasses(state) {
183
+ return [
184
+ "tooltip",
185
+ state.is_open && "tooltip--open",
186
+ `tooltip--${state.side}`
187
+ ].filter(Boolean).join(" ");
188
+ }
189
+ function getCssVariablesPopoverClasses(state) {
190
+ return [
191
+ "popover",
192
+ state.is_open && "popover--open"
193
+ ].filter(Boolean).join(" ");
194
+ }
195
+ function getCssVariablesDropdownClasses(state) {
196
+ return [
197
+ "dropdown",
198
+ state.is_open && "dropdown--open"
199
+ ].filter(Boolean).join(" ");
200
+ }
201
+ function getCssVariablesSheetClasses(state) {
202
+ return [
203
+ "sheet",
204
+ state.is_open && "sheet--open",
205
+ `sheet--${state.side}`
206
+ ].filter(Boolean).join(" ");
207
+ }
208
+ function getCssVariablesAlertClasses(state) {
209
+ return ["alert", `alert--${state.variant}`].join(" ");
210
+ }
211
+ function getCssVariablesSelectValueClasses(state) {
212
+ return [
213
+ "select__value",
214
+ !state.hasValue && "select__value--placeholder"
215
+ ].filter(Boolean).join(" ");
216
+ }
217
+ function getCssVariablesToasterClasses(state) {
218
+ return [
219
+ "toaster",
220
+ `toaster--${state.position}`
221
+ ].join(" ");
222
+ }
223
+ function getCssVariablesRadioGroupClasses(state) {
224
+ return [
225
+ "radio-group",
226
+ `radio-group--${state.orientation}`
227
+ ].join(" ");
228
+ }
@@ -0,0 +1,7 @@
1
+ import type { StyleAdapter } from "./types";
2
+ /**
3
+ * Headless Adapter
4
+ * スタイル情報を一切返さない
5
+ * ユーザーが完全にカスタムスタイルを適用したい場合に使用
6
+ */
7
+ export declare const headlessAdapter: StyleAdapter;
@@ -0,0 +1,7 @@
1
+ export const headlessAdapter = {
2
+ name: "headless",
3
+ description: "Headless \u30E2\u30FC\u30C9\uFF08\u30B9\u30BF\u30A4\u30EB\u9069\u7528\u306A\u3057\uFF09",
4
+ getClasses(_component, _state) {
5
+ return "";
6
+ }
7
+ };
@@ -0,0 +1,5 @@
1
+ export type { StyleAdapter } from "./types";
2
+ export { registerAdapter, getAdapter, getRegisteredAdapters, ADAPTER_REGISTRY } from "./types";
3
+ export { tailwindAdapter } from "./tailwind";
4
+ export { cssVariablesAdapter } from "./css-variables";
5
+ export { headlessAdapter } from "./headless";
@@ -0,0 +1,11 @@
1
+ export { registerAdapter, getAdapter, getRegisteredAdapters, ADAPTER_REGISTRY } from "./types.mjs";
2
+ export { tailwindAdapter } from "./tailwind.mjs";
3
+ export { cssVariablesAdapter } from "./css-variables.mjs";
4
+ export { headlessAdapter } from "./headless.mjs";
5
+ import { registerAdapter as registerAdapter2 } from "./types.mjs";
6
+ import { tailwindAdapter as tailwindAdapter2 } from "./tailwind.mjs";
7
+ import { cssVariablesAdapter as cssVariablesAdapter2 } from "./css-variables.mjs";
8
+ import { headlessAdapter as headlessAdapter2 } from "./headless.mjs";
9
+ registerAdapter2(tailwindAdapter2);
10
+ registerAdapter2(cssVariablesAdapter2);
11
+ registerAdapter2(headlessAdapter2);
@@ -0,0 +1,2 @@
1
+ import type { StyleAdapter } from "./types";
2
+ export declare const tailwindAdapter: StyleAdapter;