@youcan/celeste 0.6.20 → 0.6.22
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/dist/celeste.css +346 -357
- package/dist/cjs/color-picker.js +1 -2
- package/dist/cjs/combobox-input.js +4 -8
- package/dist/cjs/combobox.js +29 -23
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/text-input-affix.js +1 -2
- package/dist/cjs/text-input-button.js +2 -3
- package/dist/cjs/text-input.js +81 -4
- package/dist/components/combobox/combobox.d.ts +1 -0
- package/dist/components/dropdown/dropdown.d.ts +1 -1
- package/dist/components/text-input/index.d.ts +0 -2
- package/dist/components/text-input/text-input-affix.d.ts +1 -4
- package/dist/components/text-input/text-input.d.ts +6 -1
- package/dist/es/color-picker.js +1 -2
- package/dist/es/combobox-input.js +5 -9
- package/dist/es/combobox.js +30 -24
- package/dist/es/index.js +3 -6
- package/dist/es/text-input-affix.js +1 -2
- package/dist/es/text-input-button.js +2 -3
- package/dist/es/text-input.js +82 -5
- package/package.json +3 -3
- package/src/components/combobox/combobox-input.vue +3 -2
- package/src/components/combobox/combobox.vue +9 -4
- package/src/components/text-input/index.ts +0 -3
- package/src/components/text-input/stories/text-input.stories.ts +142 -45
- package/src/components/text-input/text-input-affix.vue +5 -19
- package/src/components/text-input/text-input-button.vue +8 -3
- package/src/components/text-input/text-input.vue +133 -61
- package/dist/cjs/text-input-icon.js +0 -29
- package/dist/components/text-input/text-input-icon.d.ts +0 -10
- package/dist/es/text-input-icon.js +0 -30
- package/src/components/text-input/text-input-icon.vue +0 -37
package/dist/es/text-input.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { defineComponent, mergeModels, useModel, openBlock, createElementBlock, normalizeClass, unref, withDirectives, createElementVNode, mergeProps, vModelDynamic,
|
|
1
|
+
import { defineComponent, mergeModels, computed, useModel, openBlock, createElementBlock, normalizeClass, unref, createVNode, withCtx, renderSlot, withDirectives, createElementVNode, mergeProps, vModelDynamic, createBlock } from "vue";
|
|
2
|
+
import { uid } from "./crypto.js";
|
|
2
3
|
import { c as clsx } from "./chunks/clsx.js";
|
|
4
|
+
import { f as O } from "./chunks/index.js";
|
|
5
|
+
import TextInputButton from "./text-input-button.js";
|
|
3
6
|
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
4
|
-
const _hoisted_1 = ["size", "has-error"];
|
|
5
|
-
const _hoisted_2 = ["type"];
|
|
7
|
+
const _hoisted_1 = ["for", "size", "has-error"];
|
|
8
|
+
const _hoisted_2 = ["id", "type"];
|
|
6
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
10
|
__name: "text-input",
|
|
8
11
|
props: /* @__PURE__ */ mergeModels({
|
|
@@ -16,15 +19,52 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16
19
|
emits: ["update:modelValue"],
|
|
17
20
|
setup(__props) {
|
|
18
21
|
const props = __props;
|
|
22
|
+
const id = computed(() => props.id || uid());
|
|
19
23
|
const modelValue = useModel(__props, "modelValue");
|
|
24
|
+
const showClearButton = computed(() => {
|
|
25
|
+
return props.type === "search" && modelValue.value && String(modelValue.value).length > 0;
|
|
26
|
+
});
|
|
27
|
+
function clearInput() {
|
|
28
|
+
modelValue.value = "";
|
|
29
|
+
}
|
|
20
30
|
return (_ctx, _cache) => {
|
|
21
31
|
return openBlock(), createElementBlock("label", {
|
|
32
|
+
for: id.value,
|
|
22
33
|
size: _ctx.size,
|
|
23
34
|
role: "presentation",
|
|
24
35
|
"has-error": _ctx.hasError,
|
|
25
36
|
class: normalizeClass(unref(clsx)("celeste-text-input-wrapper", props.class))
|
|
26
37
|
}, [
|
|
38
|
+
createVNode(unref(O), {
|
|
39
|
+
"as-child": "",
|
|
40
|
+
class: "celeste-text-input-icon celeste-text-input-leading-icon"
|
|
41
|
+
}, {
|
|
42
|
+
default: withCtx(() => [
|
|
43
|
+
renderSlot(_ctx.$slots, "leadingIcon", {}, void 0, true)
|
|
44
|
+
]),
|
|
45
|
+
_: 3
|
|
46
|
+
}),
|
|
47
|
+
createVNode(unref(O), {
|
|
48
|
+
"as-child": "",
|
|
49
|
+
class: "celeste-text-input-node celeste-text-input-leading-node"
|
|
50
|
+
}, {
|
|
51
|
+
default: withCtx(() => [
|
|
52
|
+
renderSlot(_ctx.$slots, "leadingNode", {}, void 0, true)
|
|
53
|
+
]),
|
|
54
|
+
_: 3
|
|
55
|
+
}),
|
|
56
|
+
createVNode(unref(O), {
|
|
57
|
+
inline: "",
|
|
58
|
+
"as-child": "",
|
|
59
|
+
class: "celeste-text-input-inline-node celeste-text-input-leading-inline-node"
|
|
60
|
+
}, {
|
|
61
|
+
default: withCtx(() => [
|
|
62
|
+
renderSlot(_ctx.$slots, "leadingInlineNode", {}, void 0, true)
|
|
63
|
+
]),
|
|
64
|
+
_: 3
|
|
65
|
+
}),
|
|
27
66
|
withDirectives(createElementVNode("input", mergeProps({
|
|
67
|
+
id: id.value,
|
|
28
68
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)
|
|
29
69
|
}, _ctx.$attrs, {
|
|
30
70
|
type: _ctx.type,
|
|
@@ -32,12 +72,49 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
32
72
|
}), null, 16, _hoisted_2), [
|
|
33
73
|
[vModelDynamic, modelValue.value]
|
|
34
74
|
]),
|
|
35
|
-
|
|
75
|
+
createVNode(unref(O), {
|
|
76
|
+
"as-child": "",
|
|
77
|
+
class: "celeste-text-input-icon celeste-text-input-trailing-icon"
|
|
78
|
+
}, {
|
|
79
|
+
default: withCtx(() => [
|
|
80
|
+
renderSlot(_ctx.$slots, "trailingIcon", {}, void 0, true)
|
|
81
|
+
]),
|
|
82
|
+
_: 3
|
|
83
|
+
}),
|
|
84
|
+
createVNode(unref(O), {
|
|
85
|
+
"as-child": "",
|
|
86
|
+
class: "celeste-text-input-node celeste-text-input-trailing-node"
|
|
87
|
+
}, {
|
|
88
|
+
default: withCtx(() => [
|
|
89
|
+
renderSlot(_ctx.$slots, "trailingNode", {}, void 0, true)
|
|
90
|
+
]),
|
|
91
|
+
_: 3
|
|
92
|
+
}),
|
|
93
|
+
createVNode(unref(O), {
|
|
94
|
+
inline: "",
|
|
95
|
+
"as-child": "",
|
|
96
|
+
class: "celeste-text-input-inline-node celeste-text-input-trailing-inline-node"
|
|
97
|
+
}, {
|
|
98
|
+
default: withCtx(() => [
|
|
99
|
+
showClearButton.value ? (openBlock(), createBlock(TextInputButton, {
|
|
100
|
+
key: 0,
|
|
101
|
+
type: "button",
|
|
102
|
+
"aria-label": "Clear search",
|
|
103
|
+
onClick: clearInput
|
|
104
|
+
}, {
|
|
105
|
+
default: withCtx(() => _cache[1] || (_cache[1] = [
|
|
106
|
+
createElementVNode("i", { class: "i-celeste-close-line" }, null, -1)
|
|
107
|
+
])),
|
|
108
|
+
_: 1
|
|
109
|
+
})) : renderSlot(_ctx.$slots, "trailingInlineNode", { key: 1 }, void 0, true)
|
|
110
|
+
]),
|
|
111
|
+
_: 3
|
|
112
|
+
})
|
|
36
113
|
], 10, _hoisted_1);
|
|
37
114
|
};
|
|
38
115
|
}
|
|
39
116
|
});
|
|
40
|
-
const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
117
|
+
const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-db633aec"]]);
|
|
41
118
|
export {
|
|
42
119
|
TextInput as default
|
|
43
120
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@youcan/celeste",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.22",
|
|
5
5
|
"author": "YouCan <tech@youcan.shop>",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"youcan",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"clsx": "^2.1.1",
|
|
33
33
|
"radix-vue": "^1.9.12",
|
|
34
34
|
"tinycolor2": "^1.6.0",
|
|
35
|
-
"@youcan/celeste-icons": "0.6.
|
|
36
|
-
"@youcan/celeste-tokens": "0.6.
|
|
35
|
+
"@youcan/celeste-icons": "0.6.22",
|
|
36
|
+
"@youcan/celeste-tokens": "0.6.22"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@chromatic-com/storybook": "^4.0.0",
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { ComboboxInput, type ComboboxInputProps } from 'radix-vue';
|
|
4
4
|
import { computed, type HTMLAttributes } from 'vue';
|
|
5
|
-
import TextInputIcon from '../text-input/text-input-icon.vue';
|
|
6
5
|
import TextInput, { type TextInputProps } from '../text-input/text-input.vue';
|
|
7
6
|
|
|
8
7
|
const props = defineProps<ComboboxInputProps & {
|
|
@@ -41,7 +40,9 @@ const textInputProps = computed((): TextInputProps => {
|
|
|
41
40
|
:readonly="!props.searchable"
|
|
42
41
|
:style="!props.searchable ? 'opacity: 0; height: 1px; padding: 0; border: none;' : ''"
|
|
43
42
|
>
|
|
44
|
-
<
|
|
43
|
+
<template #leadingIcon>
|
|
44
|
+
<i i-celeste-search-2-line />
|
|
45
|
+
</template>
|
|
45
46
|
</TextInput>
|
|
46
47
|
</ComboboxInput>
|
|
47
48
|
</template>
|
|
@@ -18,7 +18,7 @@ import ComboboxTrigger from './combobox-trigger.vue';
|
|
|
18
18
|
|
|
19
19
|
const props = withDefaults(defineProps<ComboboxPropsType>(), {
|
|
20
20
|
placeholder: 'Select',
|
|
21
|
-
size: '
|
|
21
|
+
size: 'md',
|
|
22
22
|
});
|
|
23
23
|
const emits = defineEmits<ComboboxRootEmits>();
|
|
24
24
|
|
|
@@ -34,6 +34,7 @@ const delegatedProps = computed(() => {
|
|
|
34
34
|
emptyLabel,
|
|
35
35
|
badgeProps,
|
|
36
36
|
searchable,
|
|
37
|
+
class: _class,
|
|
37
38
|
...delegated
|
|
38
39
|
} = props;
|
|
39
40
|
|
|
@@ -101,6 +102,7 @@ export interface ComboboxPropsType extends ComboboxRootProps {
|
|
|
101
102
|
emptyLabel?: string;
|
|
102
103
|
badgeProps?: BadgeProps;
|
|
103
104
|
searchable?: boolean;
|
|
105
|
+
class?: string;
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
export default {
|
|
@@ -118,9 +120,10 @@ export default {
|
|
|
118
120
|
:type="type"
|
|
119
121
|
:filled="!!model"
|
|
120
122
|
:size="size"
|
|
123
|
+
:class="props.class"
|
|
121
124
|
>
|
|
122
|
-
<div class="celeste-dropdown-anchor-trigger-prefix">
|
|
123
|
-
<div
|
|
125
|
+
<div v-if="model && !Array.isArray(model) && (model.icon || model.image)" class="celeste-dropdown-anchor-trigger-prefix">
|
|
126
|
+
<div class="celeste-dropdown-anchor-trigger-prefix-selected">
|
|
124
127
|
<i v-if="model.icon" :class="model.icon" />
|
|
125
128
|
<div v-if="model.image">
|
|
126
129
|
<slot name="image" v-bind="{ selected: model }">
|
|
@@ -132,8 +135,10 @@ export default {
|
|
|
132
135
|
</slot>
|
|
133
136
|
</div>
|
|
134
137
|
</div>
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<div v-else-if="$slots.prefix" class="celeste-dropdown-anchor-trigger-prefix">
|
|
135
141
|
<slot
|
|
136
|
-
v-else
|
|
137
142
|
name="prefix"
|
|
138
143
|
class="celeste-dropdown-anchor-trigger-prefix-default"
|
|
139
144
|
/>
|
|
@@ -4,8 +4,5 @@ export { default as TextInputAffix } from './text-input-affix.vue';
|
|
|
4
4
|
export * from './text-input-button.vue';
|
|
5
5
|
export { default as TextInputButton } from './text-input-button.vue';
|
|
6
6
|
|
|
7
|
-
export * from './text-input-icon.vue';
|
|
8
|
-
export { default as TextInputIcon } from './text-input-icon.vue';
|
|
9
|
-
|
|
10
7
|
export * from './text-input.vue';
|
|
11
8
|
export { default as TextInput } from './text-input.vue';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
+
import Button from '@/components/button/button.vue';
|
|
3
|
+
import Combobox from '@/components/combobox/combobox.vue';
|
|
4
|
+
import { ref } from 'vue';
|
|
2
5
|
import TextInputAffix from '../text-input-affix.vue';
|
|
3
6
|
import TextInputButton from '../text-input-button.vue';
|
|
4
|
-
import TextInputIcon from '../text-input-icon.vue';
|
|
5
7
|
import TextInput from '../text-input.vue';
|
|
6
8
|
|
|
7
9
|
const meta: Meta<typeof TextInput> = {
|
|
@@ -18,7 +20,7 @@ export const Default: Story = {
|
|
|
18
20
|
},
|
|
19
21
|
|
|
20
22
|
render: args => ({
|
|
21
|
-
components: { TextInput, TextInputAffix,
|
|
23
|
+
components: { TextInput, TextInputAffix, TextInputButton },
|
|
22
24
|
setup() {
|
|
23
25
|
return { args };
|
|
24
26
|
},
|
|
@@ -36,17 +38,22 @@ export const Icon: Story = {
|
|
|
36
38
|
},
|
|
37
39
|
|
|
38
40
|
render: args => ({
|
|
39
|
-
components: { TextInput, TextInputAffix,
|
|
41
|
+
components: { TextInput, TextInputAffix, TextInputButton },
|
|
40
42
|
setup() {
|
|
41
43
|
return { args };
|
|
42
44
|
},
|
|
43
45
|
template: `
|
|
44
46
|
<div style="display: grid; gap: 20px; justify-content: center;">
|
|
45
47
|
<TextInput v-bind="args" style="width: 300px">
|
|
46
|
-
<
|
|
48
|
+
<template #leadingIcon>
|
|
49
|
+
<i class="i-celeste-user-6-line" />
|
|
50
|
+
</template>
|
|
47
51
|
</TextInput>
|
|
52
|
+
|
|
48
53
|
<TextInput v-bind="args" style="width: 300px">
|
|
49
|
-
<
|
|
54
|
+
<template #trailingIcon>
|
|
55
|
+
<i class="i-celeste-user-6-line" />
|
|
56
|
+
</template>
|
|
50
57
|
</TextInput>
|
|
51
58
|
</div>
|
|
52
59
|
`,
|
|
@@ -59,20 +66,22 @@ export const Size: Story = {
|
|
|
59
66
|
},
|
|
60
67
|
|
|
61
68
|
render: args => ({
|
|
62
|
-
components: { TextInput, TextInputAffix,
|
|
69
|
+
components: { TextInput, TextInputAffix, TextInputButton },
|
|
63
70
|
setup() {
|
|
64
71
|
return { args };
|
|
65
72
|
},
|
|
66
73
|
template: `
|
|
67
74
|
<div style="display: grid; gap: 20px; justify-content: center;">
|
|
68
75
|
<TextInput v-bind="args" style="width: 300px" size="md">
|
|
69
|
-
<
|
|
76
|
+
<i class="i-celeste-user-6-line" />
|
|
70
77
|
</TextInput>
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
|
|
79
|
+
<TextInput v-bind="args" style="width: 300px" size="sm">
|
|
80
|
+
<i class="i-celeste-user-6-line" />
|
|
73
81
|
</TextInput>
|
|
82
|
+
|
|
74
83
|
<TextInput v-bind="args" style="width: 300px" size="xs">
|
|
75
|
-
<
|
|
84
|
+
<i class="i-celeste-user-6-line" />
|
|
76
85
|
</TextInput>
|
|
77
86
|
</div>
|
|
78
87
|
`,
|
|
@@ -84,21 +93,22 @@ export const Affix: Story = {
|
|
|
84
93
|
},
|
|
85
94
|
|
|
86
95
|
render: args => ({
|
|
87
|
-
components: { TextInput, TextInputAffix,
|
|
96
|
+
components: { TextInput, TextInputAffix, TextInputButton },
|
|
88
97
|
setup() {
|
|
89
98
|
return { args };
|
|
90
99
|
},
|
|
91
100
|
template: `
|
|
92
101
|
<div style="display: grid; gap: 20px; justify-content: center;">
|
|
93
|
-
<TextInput v-bind="args"
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
</
|
|
102
|
+
<TextInput v-bind="args" placeholder="www.example.com">
|
|
103
|
+
<template #leadingNode>
|
|
104
|
+
<TextInputAffix>https://</TextInputAffix>
|
|
105
|
+
</template>
|
|
97
106
|
</TextInput>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
|
|
108
|
+
<TextInput v-bind="args" placeholder="example">
|
|
109
|
+
<template #trailingNode>
|
|
110
|
+
<TextInputAffix>@gmail.com</TextInputAffix>
|
|
111
|
+
</template>
|
|
102
112
|
</TextInput>
|
|
103
113
|
</div>
|
|
104
114
|
`,
|
|
@@ -110,21 +120,25 @@ export const InlineAffix: Story = {
|
|
|
110
120
|
},
|
|
111
121
|
|
|
112
122
|
render: args => ({
|
|
113
|
-
components: { TextInput, TextInputAffix,
|
|
123
|
+
components: { TextInput, TextInputAffix, TextInputButton },
|
|
114
124
|
setup() {
|
|
115
125
|
return { args };
|
|
116
126
|
},
|
|
117
127
|
template: `
|
|
118
128
|
<div style="display: grid; gap: 20px; justify-content: center;">
|
|
119
129
|
<TextInput v-bind="args" style="width: 300px" placeholder="0.00">
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
130
|
+
<template #leadingInlineNode>
|
|
131
|
+
<TextInputAffix inline>
|
|
132
|
+
€
|
|
133
|
+
</TextInputAffix>
|
|
134
|
+
</template>
|
|
123
135
|
</TextInput>
|
|
124
136
|
<TextInput v-bind="args" style="width: 300px" placeholder="0.00">
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
137
|
+
<template #trailingInlineNode>
|
|
138
|
+
<TextInputAffix inline>
|
|
139
|
+
€
|
|
140
|
+
</TextInputAffix>
|
|
141
|
+
</template>
|
|
128
142
|
</TextInput>
|
|
129
143
|
</div>
|
|
130
144
|
`,
|
|
@@ -137,17 +151,22 @@ export const WithKbd: Story = {
|
|
|
137
151
|
},
|
|
138
152
|
|
|
139
153
|
render: args => ({
|
|
140
|
-
components: { TextInput, TextInputAffix,
|
|
154
|
+
components: { TextInput, TextInputAffix, TextInputButton },
|
|
141
155
|
setup() {
|
|
142
156
|
return { args };
|
|
143
157
|
},
|
|
144
158
|
template: `
|
|
145
159
|
<div style="display: grid; gap: 20px; justify-content: center;">
|
|
146
160
|
<TextInput v-bind="args" style="width: 300px">
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
161
|
+
<template #leadingIcon>
|
|
162
|
+
<i class="i-celeste-search-2-line"/>
|
|
163
|
+
</template>
|
|
164
|
+
|
|
165
|
+
<template #trailingInlineNode>
|
|
166
|
+
<TextInputAffix asKbd>
|
|
167
|
+
⌘1
|
|
168
|
+
</TextInputAffix>
|
|
169
|
+
</template>
|
|
151
170
|
</TextInput>
|
|
152
171
|
</div>
|
|
153
172
|
`,
|
|
@@ -161,14 +180,16 @@ export const Disabled: Story = {
|
|
|
161
180
|
},
|
|
162
181
|
|
|
163
182
|
render: args => ({
|
|
164
|
-
components: { TextInput, TextInputAffix,
|
|
183
|
+
components: { TextInput, TextInputAffix, TextInputButton },
|
|
165
184
|
setup() {
|
|
166
185
|
return { args };
|
|
167
186
|
},
|
|
168
187
|
template: `
|
|
169
188
|
<div style="display: grid; gap: 20px; justify-content: center;">
|
|
170
189
|
<TextInput v-bind="args" style="width: 300px">
|
|
171
|
-
<
|
|
190
|
+
<template #leadingIcon>
|
|
191
|
+
<i class="i-celeste-user-6-line" />
|
|
192
|
+
</template>
|
|
172
193
|
</TextInput>
|
|
173
194
|
</div>
|
|
174
195
|
`,
|
|
@@ -182,14 +203,16 @@ export const HasError: Story = {
|
|
|
182
203
|
},
|
|
183
204
|
|
|
184
205
|
render: args => ({
|
|
185
|
-
components: { TextInput, TextInputAffix,
|
|
206
|
+
components: { TextInput, TextInputAffix, TextInputButton },
|
|
186
207
|
setup() {
|
|
187
208
|
return { args };
|
|
188
209
|
},
|
|
189
210
|
template: `
|
|
190
211
|
<div style="display: grid; gap: 20px; justify-content: center;">
|
|
191
212
|
<TextInput v-bind="args" style="width: 300px">
|
|
192
|
-
<
|
|
213
|
+
<template #leadingIcon>
|
|
214
|
+
<i class="i-celeste-user-6-line" />
|
|
215
|
+
</template>
|
|
193
216
|
</TextInput>
|
|
194
217
|
</div>
|
|
195
218
|
`,
|
|
@@ -202,17 +225,22 @@ export const WithButton: Story = {
|
|
|
202
225
|
},
|
|
203
226
|
|
|
204
227
|
render: args => ({
|
|
205
|
-
components: { TextInput, TextInputAffix,
|
|
228
|
+
components: { TextInput, TextInputAffix, TextInputButton, Button },
|
|
206
229
|
setup() {
|
|
207
230
|
return { args };
|
|
208
231
|
},
|
|
209
232
|
template: `
|
|
210
233
|
<div style="display: grid; gap: 20px; justify-content: center;">
|
|
211
234
|
<TextInput v-bind="args" style="width: 300px">
|
|
212
|
-
<
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
235
|
+
<template #leadingIcon>
|
|
236
|
+
<i class="i-celeste-links-line" />
|
|
237
|
+
</template>
|
|
238
|
+
|
|
239
|
+
<template #trailingNode>
|
|
240
|
+
<TextInputButton>
|
|
241
|
+
<i class="i-celeste-file-copy-line" />
|
|
242
|
+
</TextInputButton>
|
|
243
|
+
</template>
|
|
216
244
|
</TextInput>
|
|
217
245
|
</div>
|
|
218
246
|
`,
|
|
@@ -226,17 +254,86 @@ export const WithInlineButton: Story = {
|
|
|
226
254
|
},
|
|
227
255
|
|
|
228
256
|
render: args => ({
|
|
229
|
-
components: { TextInput, TextInputAffix,
|
|
257
|
+
components: { TextInput, TextInputAffix, TextInputButton },
|
|
230
258
|
setup() {
|
|
231
259
|
return { args };
|
|
232
260
|
},
|
|
233
261
|
template: `
|
|
234
262
|
<div style="display: grid; gap: 20px; justify-content: center;">
|
|
235
263
|
<TextInput v-bind="args" style="width: 300px">
|
|
236
|
-
<
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
264
|
+
<template #leadingIcon>
|
|
265
|
+
<i class="i-celeste-lock-2-line" />
|
|
266
|
+
</template>
|
|
267
|
+
|
|
268
|
+
<template #trailingInlineNode>
|
|
269
|
+
<TextInputButton>
|
|
270
|
+
<i class="i-celeste-eye-line" />
|
|
271
|
+
</TextInputButton>
|
|
272
|
+
</template>
|
|
273
|
+
</TextInput>
|
|
274
|
+
</div>
|
|
275
|
+
`,
|
|
276
|
+
}),
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const OPTIONS = [
|
|
280
|
+
{ value: { id: 1 }, label: 'MAD', icon: 'i-celeste-bank-card-2-line' },
|
|
281
|
+
{ value: { id: 2 }, label: 'EUR', icon: 'i-celeste-bank-card-2-line' },
|
|
282
|
+
{ value: { id: 3 }, label: 'USD', icon: 'i-celeste-bank-card-2-line' },
|
|
283
|
+
];
|
|
284
|
+
|
|
285
|
+
export const WithLeadingCombobox: Story = {
|
|
286
|
+
args: {
|
|
287
|
+
placeholder: 'Search...',
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
render: args => ({
|
|
291
|
+
components: { TextInput, TextInputAffix, TextInputButton, Combobox },
|
|
292
|
+
setup() {
|
|
293
|
+
const model = ref();
|
|
294
|
+
|
|
295
|
+
return { args, OPTIONS, model };
|
|
296
|
+
},
|
|
297
|
+
template: `
|
|
298
|
+
<div style="display: grid; gap: 20px; justify-content: center;">
|
|
299
|
+
<TextInput v-bind="args">
|
|
300
|
+
<template #trailingNode>
|
|
301
|
+
<Combobox
|
|
302
|
+
v-model="model"
|
|
303
|
+
type="compact-input"
|
|
304
|
+
:options="OPTIONS"
|
|
305
|
+
value-by="id"
|
|
306
|
+
/>
|
|
307
|
+
</template>
|
|
308
|
+
</TextInput>
|
|
309
|
+
</div>
|
|
310
|
+
`,
|
|
311
|
+
}),
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
export const WithTrailingCombobox: Story = {
|
|
315
|
+
args: {
|
|
316
|
+
placeholder: 'Search...',
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
render: args => ({
|
|
320
|
+
components: { TextInput, TextInputAffix, TextInputButton, Combobox },
|
|
321
|
+
setup() {
|
|
322
|
+
const model = ref();
|
|
323
|
+
|
|
324
|
+
return { args, OPTIONS, model };
|
|
325
|
+
},
|
|
326
|
+
template: `
|
|
327
|
+
<div style="display: grid; gap: 20px; justify-content: center;">
|
|
328
|
+
<TextInput v-bind="args">
|
|
329
|
+
<template #leadingNode>
|
|
330
|
+
<Combobox
|
|
331
|
+
v-model="model"
|
|
332
|
+
type="compact-input"
|
|
333
|
+
:options="OPTIONS"
|
|
334
|
+
value-by="id"
|
|
335
|
+
/>
|
|
336
|
+
</template>
|
|
240
337
|
</TextInput>
|
|
241
338
|
</div>
|
|
242
339
|
`,
|
|
@@ -3,14 +3,12 @@ import type { HTMLAttributes } from 'vue';
|
|
|
3
3
|
import { useDelegatedProps } from '@/composables/use-delegated-props';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
|
|
6
|
-
const props =
|
|
6
|
+
const props = defineProps<{
|
|
7
7
|
class?: HTMLAttributes['class'];
|
|
8
|
-
variant?: 'prefix' | 'suffix';
|
|
9
8
|
inline?: boolean;
|
|
10
9
|
asKbd?: boolean;
|
|
11
|
-
}>()
|
|
12
|
-
|
|
13
|
-
});
|
|
10
|
+
}>();
|
|
11
|
+
|
|
14
12
|
const delegatedProps = useDelegatedProps(props, 'class');
|
|
15
13
|
</script>
|
|
16
14
|
|
|
@@ -27,23 +25,11 @@ const delegatedProps = useDelegatedProps(props, 'class');
|
|
|
27
25
|
.celeste-text-input-affix {
|
|
28
26
|
display: flex;
|
|
29
27
|
align-items: center;
|
|
30
|
-
|
|
31
|
-
color: var(--color-text-sub-600);
|
|
32
|
-
|
|
33
|
-
&[variant='prefix'] {
|
|
34
|
-
order: -1;
|
|
35
|
-
border-end-start-radius: var(--input-radius);
|
|
36
|
-
border-start-start-radius: var(--input-radius);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&[variant='suffix'] {
|
|
40
|
-
border-end-end-radius: var(--input-radius);
|
|
41
|
-
border-start-end-radius: var(--input-radius);
|
|
42
|
-
}
|
|
28
|
+
color: var(--celeste-text-input-affix-color);
|
|
43
29
|
|
|
44
30
|
&[inline='false'] {
|
|
45
31
|
padding-inline: var(--spacing-10);
|
|
46
|
-
background-color: var(--
|
|
32
|
+
background-color: var(--celeste-text-input-affix-background-color);
|
|
47
33
|
}
|
|
48
34
|
|
|
49
35
|
&[askbd='true'] {
|
|
@@ -26,11 +26,16 @@ const delegatedProps = useDelegatedProps(props, 'class');
|
|
|
26
26
|
|
|
27
27
|
<style scoped lang="scss">
|
|
28
28
|
.celeste-text-input-button {
|
|
29
|
-
height: calc(var(--input-height) - var(--spacing-2));
|
|
30
29
|
border: none;
|
|
31
30
|
|
|
31
|
+
&:focus,
|
|
32
|
+
&:hover,
|
|
33
|
+
&:active {
|
|
34
|
+
box-shadow: none !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
&[inline='false'] {
|
|
33
|
-
padding: var(--spacing-
|
|
38
|
+
padding: var(--spacing-10);
|
|
34
39
|
border-end-start-radius: 0;
|
|
35
40
|
border-start-start-radius: 0;
|
|
36
41
|
|
|
@@ -46,7 +51,7 @@ const delegatedProps = useDelegatedProps(props, 'class');
|
|
|
46
51
|
&[inline='true'] {
|
|
47
52
|
width: 20px;
|
|
48
53
|
height: 20px;
|
|
49
|
-
|
|
54
|
+
color: var(--celeste-text-input-icon-color) !important;
|
|
50
55
|
|
|
51
56
|
&:hover {
|
|
52
57
|
background-color: transparent !important;
|