@baklavue/ui 1.0.0-preview.2

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 (83) hide show
  1. package/.releaserc.json +14 -0
  2. package/CHANGELOG.md +40 -0
  3. package/README.md +15 -0
  4. package/index.ts +1 -0
  5. package/package.json +45 -0
  6. package/src/accordion/Accordion.vue +206 -0
  7. package/src/accordion/accordion.types.ts +109 -0
  8. package/src/accordion/index.ts +3 -0
  9. package/src/alert/Alert.vue +199 -0
  10. package/src/alert/alert.types.ts +58 -0
  11. package/src/alert/index.ts +2 -0
  12. package/src/badge/Badge.vue +20 -0
  13. package/src/badge/badge.types.ts +7 -0
  14. package/src/badge/index.ts +2 -0
  15. package/src/button/Button.vue +45 -0
  16. package/src/button/button.types.ts +30 -0
  17. package/src/button/index.ts +3 -0
  18. package/src/checkbox/Checkbox.vue +148 -0
  19. package/src/checkbox/checkbox.types.ts +108 -0
  20. package/src/checkbox/index.ts +2 -0
  21. package/src/datepicker/Datepicker.vue +172 -0
  22. package/src/datepicker/datepicker.types.ts +39 -0
  23. package/src/datepicker/index.ts +2 -0
  24. package/src/dialog/Dialog.vue +178 -0
  25. package/src/dialog/dialog.types.ts +17 -0
  26. package/src/dialog/index.ts +2 -0
  27. package/src/drawer/Drawer.vue +162 -0
  28. package/src/drawer/drawer.types.ts +17 -0
  29. package/src/drawer/index.ts +2 -0
  30. package/src/dropdown/Dropdown.vue +231 -0
  31. package/src/dropdown/dropdown.types.ts +110 -0
  32. package/src/dropdown/index.ts +2 -0
  33. package/src/icon/Icon.vue +102 -0
  34. package/src/icon/icon.types.ts +25 -0
  35. package/src/icon/index.ts +2 -0
  36. package/src/index.ts +37 -0
  37. package/src/input/Input.vue +148 -0
  38. package/src/input/index.ts +3 -0
  39. package/src/input/input.types.ts +156 -0
  40. package/src/link/Link.vue +133 -0
  41. package/src/link/index.ts +2 -0
  42. package/src/link/link.types.ts +42 -0
  43. package/src/notification/Notification.vue +57 -0
  44. package/src/notification/index.ts +2 -0
  45. package/src/notification/notification.types.ts +25 -0
  46. package/src/pagination/Pagination.vue +137 -0
  47. package/src/pagination/index.ts +2 -0
  48. package/src/pagination/pagination.types.ts +61 -0
  49. package/src/radio/Radio.vue +205 -0
  50. package/src/radio/index.ts +2 -0
  51. package/src/radio/radio.types.ts +95 -0
  52. package/src/select/Select.vue +147 -0
  53. package/src/select/index.ts +2 -0
  54. package/src/select/select.types.ts +53 -0
  55. package/src/spinner/Spinner.vue +49 -0
  56. package/src/spinner/index.ts +2 -0
  57. package/src/spinner/spinner.types.ts +11 -0
  58. package/src/split-button/SplitButton.vue +73 -0
  59. package/src/split-button/index.ts +2 -0
  60. package/src/split-button/split-button.types.ts +19 -0
  61. package/src/stepper/Stepper.vue +100 -0
  62. package/src/stepper/index.ts +2 -0
  63. package/src/stepper/stepper.types.ts +29 -0
  64. package/src/switch/Switch.vue +80 -0
  65. package/src/switch/index.ts +2 -0
  66. package/src/switch/switch.types.ts +13 -0
  67. package/src/tab/Tab.vue +99 -0
  68. package/src/tab/index.ts +2 -0
  69. package/src/tab/tab.types.ts +17 -0
  70. package/src/table/Table.vue +264 -0
  71. package/src/table/index.ts +7 -0
  72. package/src/table/table.types.ts +62 -0
  73. package/src/tag/Tag.vue +83 -0
  74. package/src/tag/index.ts +2 -0
  75. package/src/tag/tag.types.ts +24 -0
  76. package/src/textarea/Textarea.vue +84 -0
  77. package/src/textarea/index.ts +2 -0
  78. package/src/textarea/textarea.types.ts +37 -0
  79. package/src/tooltip/Tooltip.vue +81 -0
  80. package/src/tooltip/index.ts +3 -0
  81. package/src/tooltip/tooltip.types.ts +29 -0
  82. package/src/utils/loadBaklavaResources.ts +24 -0
  83. package/tsconfig.json +28 -0
@@ -0,0 +1,110 @@
1
+ import type { BaklavaIcon } from "@trendyol/baklava-icons";
2
+ import type {
3
+ ButtonKind,
4
+ ButtonSize,
5
+ ButtonVariant,
6
+ } from "@trendyol/baklava/dist/components/button/bl-button";
7
+
8
+ /**
9
+ * Properties for a dropdown item when used in items mode.
10
+ *
11
+ * @interface DropdownItem
12
+ */
13
+ export interface DropdownItem {
14
+ /**
15
+ * The caption text displayed for the item.
16
+ */
17
+ caption?: string;
18
+
19
+ /**
20
+ * Icon name for the item. Shows icon with bl-icon component.
21
+ */
22
+ icon?: BaklavaIcon;
23
+
24
+ /**
25
+ * Whether the item is disabled.
26
+ *
27
+ * @default false
28
+ */
29
+ disabled?: boolean;
30
+
31
+ /**
32
+ * Optional group caption. Items with the same groupCaption are rendered
33
+ * inside a bl-dropdown-group with that caption.
34
+ */
35
+ groupCaption?: string;
36
+
37
+ /**
38
+ * Additional custom data for use in the #item scoped slot.
39
+ */
40
+ [key: string]: unknown;
41
+ }
42
+
43
+ /**
44
+ * Props for the Dropdown component.
45
+ *
46
+ * When `items` prop is provided, the component acts in items mode using
47
+ * bl-dropdown-group and bl-dropdown-item. Otherwise, it uses slots for
48
+ * trigger and content.
49
+ *
50
+ * @interface DropdownProps
51
+ */
52
+ export interface DropdownProps {
53
+ /**
54
+ * Whether the dropdown is open.
55
+ *
56
+ * @default false
57
+ */
58
+ open?: boolean;
59
+
60
+ /**
61
+ * Placement of the dropdown popover relative to the trigger.
62
+ * Maps to bl-popover placement.
63
+ */
64
+ placement?: string;
65
+
66
+ /**
67
+ * Whether the dropdown trigger is disabled.
68
+ *
69
+ * @default false
70
+ */
71
+ disabled?: boolean;
72
+
73
+ /**
74
+ * Reserved for custom trigger configuration.
75
+ */
76
+ trigger?: string;
77
+
78
+ /**
79
+ * Label for the built-in dropdown button.
80
+ * Used when in items mode or when not using trigger slot.
81
+ */
82
+ label?: string;
83
+
84
+ /**
85
+ * Button variant for the built-in dropdown button.
86
+ */
87
+ variant?: ButtonVariant;
88
+
89
+ /**
90
+ * Button kind for the built-in dropdown button.
91
+ */
92
+ kind?: ButtonKind;
93
+
94
+ /**
95
+ * Button size for the built-in dropdown button.
96
+ */
97
+ size?: ButtonSize;
98
+
99
+ /**
100
+ * Icon name for the built-in dropdown button.
101
+ */
102
+ icon?: string;
103
+
104
+ /**
105
+ * Array of dropdown items to render when in items mode.
106
+ * Each item will be rendered as a bl-dropdown-item (optionally grouped
107
+ * via bl-dropdown-group). Content for each item is provided via the #item slot.
108
+ */
109
+ items?: DropdownItem[];
110
+ }
@@ -0,0 +1,2 @@
1
+ export { default as BvDropdown } from "./Dropdown.vue";
2
+ export type { DropdownProps, DropdownItem } from "./dropdown.types";
@@ -0,0 +1,102 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Icon Component
4
+ *
5
+ * A Vue UI kit component for Baklava's `bl-icon` web component.
6
+ * Provides icon display with support for name, size, color, and custom slot content.
7
+ * Size and color are applied via CSS (font-size, color) as per Baklava's API.
8
+ *
9
+ * @component
10
+ * @example
11
+ * ```vue
12
+ * <!-- Basic usage -->
13
+ * <template>
14
+ * <BvIcon name="home" />
15
+ * </template>
16
+ * ```
17
+ *
18
+ * @example
19
+ * ```vue
20
+ * <!-- With size -->
21
+ * <template>
22
+ * <BvIcon name="settings" size="24px" />
23
+ * </template>
24
+ * ```
25
+ *
26
+ * @example
27
+ * ```vue
28
+ * <!-- With color -->
29
+ * <template>
30
+ * <BvIcon name="info" color="#0066cc" />
31
+ * </template>
32
+ * ```
33
+ *
34
+ * @example
35
+ * ```vue
36
+ * <!-- Custom slot for custom SVG -->
37
+ * <template>
38
+ * <BvIcon>
39
+ * <svg>...</svg>
40
+ * </BvIcon>
41
+ * </template>
42
+ * ```
43
+ */
44
+ import { computed, onMounted } from "vue";
45
+ import { loadBaklavaResources } from "../utils/loadBaklavaResources";
46
+ import type { IconProps } from "./icon.types";
47
+
48
+ /**
49
+ * Component props with default values.
50
+ */
51
+ const props = withDefaults(defineProps<IconProps>(), {
52
+ name: undefined,
53
+ size: undefined,
54
+ color: undefined,
55
+ });
56
+
57
+ /**
58
+ * Component events.
59
+ */
60
+ const emit = defineEmits<{
61
+ /**
62
+ * Emitted when the SVG icon has loaded.
63
+ *
64
+ * @param {string} detail - Event detail from bl-load.
65
+ */
66
+ load: [detail: string];
67
+ /**
68
+ * Emitted when the SVG icon failed to load.
69
+ *
70
+ * @param {string} detail - Event detail from bl-error.
71
+ */
72
+ error: [detail: string];
73
+ }>();
74
+
75
+ /**
76
+ * Computed style object for size and color.
77
+ * Maps to Baklava's font-size and color CSS properties.
78
+ */
79
+ const iconStyle = computed(() => ({
80
+ ...(props.size && { fontSize: props.size }),
81
+ ...(props.color && { color: props.color }),
82
+ }));
83
+
84
+ /**
85
+ * Lifecycle hook: Component mounted.
86
+ * Loads Baklava resources (icons, styles).
87
+ */
88
+ onMounted(() => {
89
+ loadBaklavaResources();
90
+ });
91
+ </script>
92
+
93
+ <template>
94
+ <bl-icon
95
+ :name="props.name"
96
+ :style="iconStyle"
97
+ @bl-load="emit('load', ($event as CustomEvent<string>).detail)"
98
+ @bl-error="emit('error', ($event as CustomEvent<string>).detail)"
99
+ >
100
+ <slot />
101
+ </bl-icon>
102
+ </template>
@@ -0,0 +1,25 @@
1
+ import type { BaklavaIcon } from "@trendyol/baklava-icons";
2
+
3
+ /**
4
+ * Props for the Icon component.
5
+ * Wraps Baklava's bl-icon web component with Vue-friendly props.
6
+ */
7
+ export interface IconProps {
8
+ /**
9
+ * Icon name from Baklava icons set.
10
+ * @see https://baklava.trendyol.com for available icons.
11
+ */
12
+ name?: BaklavaIcon;
13
+
14
+ /**
15
+ * Icon size as a CSS value (e.g. `"24px"`, `"1.5rem"`).
16
+ * Maps to the `font-size` CSS property on bl-icon.
17
+ */
18
+ size?: string;
19
+
20
+ /**
21
+ * Icon color as a CSS value (e.g. `"#0066cc"`, `"red"`, `"currentColor"`).
22
+ * Maps to the `color` CSS property on bl-icon.
23
+ */
24
+ color?: string;
25
+ }
@@ -0,0 +1,2 @@
1
+ export { default as BvIcon } from "./Icon.vue";
2
+ export type { IconProps } from "./icon.types";
package/src/index.ts ADDED
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Component Exports
3
+ *
4
+ * IMPORTANT: All components MUST be exported with the "Bv-" prefix.
5
+ * Example: BvButton, BvInput, BvBadge, etc.
6
+ *
7
+ * This convention ensures consistency and prevents naming conflicts.
8
+ * Each component's index.ts file should export: export { default as Bv[ComponentName] } from "./[ComponentName].vue";
9
+ */
10
+
11
+ export * from "./accordion";
12
+ export * from "./alert";
13
+ export * from "./badge";
14
+ export * from "./button";
15
+ export * from "./checkbox";
16
+ export * from "./datepicker";
17
+ export * from "./dialog";
18
+ export * from "./drawer";
19
+ export * from "./dropdown";
20
+ export * from "./icon";
21
+ export * from "./input";
22
+ export * from "./link";
23
+ export * from "./notification";
24
+ export * from "./pagination";
25
+ export * from "./radio";
26
+ export * from "./select";
27
+ export * from "./spinner";
28
+ export * from "./split-button";
29
+ export * from "./stepper";
30
+ export * from "./switch";
31
+ export * from "./tab";
32
+ export * from "./table";
33
+ export * from "./tag";
34
+ export * from "./textarea";
35
+ export * from "./tooltip";
36
+
37
+ export { loadBaklavaResources } from "./utils/loadBaklavaResources";
@@ -0,0 +1,148 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Input Component
4
+ *
5
+ * A Vue UI kit component for Baklava's `bl-input` web component with full v-model support
6
+ * and TypeScript types. Supports text, email, password, number, date, time, and
7
+ * other input types with validation, help text, loading state, and icons.
8
+ *
9
+ * @component
10
+ * @example
11
+ * ```vue
12
+ * <!-- Basic usage -->
13
+ * <template>
14
+ * <BvInput v-model="value" label="Email" placeholder="Enter your email" />
15
+ * </template>
16
+ * ```
17
+ *
18
+ * @example
19
+ * ```vue
20
+ * <!-- With validation -->
21
+ * <template>
22
+ * <BvInput
23
+ * v-model="email"
24
+ * type="email"
25
+ * label="Email"
26
+ * required
27
+ * :invalid-text="emailError"
28
+ * @invalid="handleInvalid"
29
+ * />
30
+ * </template>
31
+ * ```
32
+ *
33
+ * @example
34
+ * ```vue
35
+ * <!-- With icon -->
36
+ * <template>
37
+ * <BvInput v-model="search" label="Search" icon="search" />
38
+ * </template>
39
+ * ```
40
+ */
41
+ import { onMounted } from "vue";
42
+ import { loadBaklavaResources } from "../utils/loadBaklavaResources";
43
+ import type { InputProps } from "./input.types";
44
+
45
+ /**
46
+ * Component props with default values.
47
+ */
48
+ const props = withDefaults(defineProps<InputProps>(), {
49
+ modelValue: undefined,
50
+ name: undefined,
51
+ type: "text",
52
+ label: undefined,
53
+ placeholder: undefined,
54
+ required: undefined,
55
+ minlength: undefined,
56
+ maxlength: undefined,
57
+ min: undefined,
58
+ max: undefined,
59
+ pattern: undefined,
60
+ step: undefined,
61
+ autocomplete: undefined,
62
+ inputmode: undefined,
63
+ autofocus: undefined,
64
+ icon: undefined,
65
+ size: "medium",
66
+ disabled: undefined,
67
+ readonly: undefined,
68
+ invalidText: undefined,
69
+ labelFixed: true,
70
+ helpText: undefined,
71
+ loading: undefined,
72
+ suffixText: undefined,
73
+ });
74
+
75
+ /**
76
+ * Component events.
77
+ */
78
+ const emit = defineEmits<{
79
+ /**
80
+ * Emitted when the input value changes. Use with v-model.
81
+ *
82
+ * @param {string | number | null} value - The new input value.
83
+ */
84
+ "update:modelValue": [value: string | number | null];
85
+ /**
86
+ * Emitted when validation fails.
87
+ *
88
+ * @param {ValidityState} state - The native ValidityState object.
89
+ */
90
+ invalid: [state: ValidityState];
91
+ /**
92
+ * Emitted when the input receives focus.
93
+ *
94
+ * @param {FocusEvent} event - The native focus event.
95
+ */
96
+ focus: [event: FocusEvent];
97
+ /**
98
+ * Emitted when the input loses focus.
99
+ *
100
+ * @param {FocusEvent} event - The native focus event.
101
+ */
102
+ blur: [event: FocusEvent];
103
+ }>();
104
+
105
+ /**
106
+ * Triggers the native date/time picker for inputs with type="date", "time",
107
+ * "datetime-local", etc. Called on click to ensure the picker opens when
108
+ * the user clicks the input.
109
+ *
110
+ * @param {Event} event - The click event.
111
+ */
112
+ const showPicker = ({ currentTarget }: Event) =>
113
+ (currentTarget as HTMLInputElement)?.showPicker();
114
+
115
+ /**
116
+ * Lifecycle hook: Component mounted.
117
+ *
118
+ * Loads Baklava resources when the component is mounted.
119
+ */
120
+ onMounted(() => {
121
+ loadBaklavaResources();
122
+ });
123
+ </script>
124
+
125
+ <template>
126
+ <bl-input
127
+ v-bind="{
128
+ ...props,
129
+ 'label-fixed': props.labelFixed === true ? true : undefined,
130
+ 'help-text': props.helpText ? props.helpText : undefined,
131
+ 'invalid-text': props.invalidText ? props.invalidText : undefined,
132
+ loading: props.loading ? props.loading : undefined,
133
+ placeholder: props.placeholder ? props.placeholder : props.label,
134
+ }"
135
+ :value="props.modelValue"
136
+ @bl-input="
137
+ emit('update:modelValue', ($event.target as HTMLInputElement)?.value)
138
+ "
139
+ @bl-invalid="emit('invalid', $event)"
140
+ @focus="emit('focus', $event)"
141
+ @blur="emit('blur', $event)"
142
+ @click="showPicker"
143
+ >
144
+ <span v-if="props.suffixText" slot="icon">
145
+ {{ props.suffixText }}
146
+ </span>
147
+ </bl-input>
148
+ </template>
@@ -0,0 +1,3 @@
1
+ // Component exports must use the "Bv-" prefix
2
+ export { default as BvInput } from "./Input.vue";
3
+ export type { InputProps } from "./input.types";
@@ -0,0 +1,156 @@
1
+ import type { BaklavaIcon } from "@trendyol/baklava-icons";
2
+ import type {
3
+ InputSize,
4
+ InputType,
5
+ } from "@trendyol/baklava/dist/components/input/bl-input";
6
+
7
+ /**
8
+ * Input mode hint for virtual keyboards.
9
+ *
10
+ * @typedef InputMode
11
+ */
12
+ type InputMode =
13
+ | "none"
14
+ | "text"
15
+ | "decimal"
16
+ | "numeric"
17
+ | "tel"
18
+ | "search"
19
+ | "email"
20
+ | "url";
21
+
22
+ /**
23
+ * Props for the Input component.
24
+ *
25
+ * A Vue UI kit component for Baklava's bl-input web component with full v-model support
26
+ * and TypeScript types.
27
+ *
28
+ * @interface InputProps
29
+ */
30
+ export interface InputProps {
31
+ /**
32
+ * Input value (v-model).
33
+ */
34
+ modelValue?: string | number | null;
35
+
36
+ /**
37
+ * Input name attribute for form submission.
38
+ */
39
+ name?: string;
40
+
41
+ /**
42
+ * Input type (text, email, password, number, date, time, etc.).
43
+ *
44
+ * @default "text"
45
+ */
46
+ type?: InputType;
47
+
48
+ /**
49
+ * Input label displayed above or beside the input.
50
+ */
51
+ label?: string;
52
+
53
+ /**
54
+ * Placeholder text when the input is empty.
55
+ */
56
+ placeholder?: string;
57
+
58
+ /**
59
+ * Whether the input is required for form validation.
60
+ */
61
+ required?: boolean;
62
+
63
+ /**
64
+ * Minimum character length for validation.
65
+ */
66
+ minlength?: number;
67
+
68
+ /**
69
+ * Maximum character length for validation.
70
+ */
71
+ maxlength?: number;
72
+
73
+ /**
74
+ * Minimum value for number/date inputs.
75
+ */
76
+ min?: number | string;
77
+
78
+ /**
79
+ * Maximum value for number/date inputs.
80
+ */
81
+ max?: number | string;
82
+
83
+ /**
84
+ * RegExp pattern for validation.
85
+ */
86
+ pattern?: string;
87
+
88
+ /**
89
+ * Step value for number inputs.
90
+ */
91
+ step?: number;
92
+
93
+ /**
94
+ * Autocomplete attribute for the input.
95
+ */
96
+ autocomplete?: string;
97
+
98
+ /**
99
+ * Input mode hint for virtual keyboards.
100
+ */
101
+ inputmode?: InputMode;
102
+
103
+ /**
104
+ * Whether the input should receive focus on mount.
105
+ */
106
+ autofocus?: boolean;
107
+
108
+ /**
109
+ * Baklava icon name to display in the input.
110
+ */
111
+ icon?: BaklavaIcon;
112
+
113
+ /**
114
+ * Input size (small, medium, large).
115
+ *
116
+ * @default "medium"
117
+ */
118
+ size?: InputSize;
119
+
120
+ /**
121
+ * Whether the input is disabled.
122
+ */
123
+ disabled?: boolean;
124
+
125
+ /**
126
+ * Whether the input is readonly.
127
+ */
128
+ readonly?: boolean;
129
+
130
+ /**
131
+ * Whether the label has fixed position.
132
+ *
133
+ * @default true
134
+ */
135
+ labelFixed?: boolean;
136
+
137
+ /**
138
+ * Error message text displayed when validation fails.
139
+ */
140
+ invalidText?: string;
141
+
142
+ /**
143
+ * Helper text displayed below the input.
144
+ */
145
+ helpText?: string;
146
+
147
+ /**
148
+ * Whether to show loading indicator.
149
+ */
150
+ loading?: boolean;
151
+
152
+ /**
153
+ * Suffix text displayed in the icon slot.
154
+ */
155
+ suffixText?: string;
156
+ }