@htlkg/components 0.0.2 → 0.0.3

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.
@@ -0,0 +1,106 @@
1
+ # Data Module
2
+
3
+ Components for displaying and managing data.
4
+
5
+ ## Components
6
+
7
+ ### Table
8
+
9
+ Comprehensive data table with pagination, sorting, and filtering.
10
+
11
+ ```vue
12
+ <script setup>
13
+ import { ref } from 'vue';
14
+ import { Table } from '@htlkg/components/data';
15
+
16
+ const currentPage = ref(1);
17
+ const columns = [
18
+ { name: 'Name', value: 'name', sortable: true },
19
+ { name: 'Email', value: 'email' },
20
+ { name: 'Status', value: 'status' },
21
+ ];
22
+ </script>
23
+
24
+ <template>
25
+ <Table
26
+ v-model:currentPage="currentPage"
27
+ :items="users"
28
+ :columns="columns"
29
+ :loading="loading"
30
+ selectable
31
+ @row-click="handleRowClick"
32
+ @selection-change="handleSelection"
33
+ />
34
+ </template>
35
+ ```
36
+
37
+ ### DataList
38
+
39
+ Simple list component for displaying collections.
40
+
41
+ ```vue
42
+ <script setup>
43
+ import { DataList } from '@htlkg/components/data';
44
+ </script>
45
+
46
+ <template>
47
+ <DataList :items="items" :loading="loading">
48
+ <template #item="{ item }">
49
+ <div>{{ item.name }}</div>
50
+ </template>
51
+ <template #empty>
52
+ <p>No items found</p>
53
+ </template>
54
+ </DataList>
55
+ </template>
56
+ ```
57
+
58
+ ### SearchableSelect
59
+
60
+ Searchable dropdown with single/multiple selection.
61
+
62
+ ```vue
63
+ <script setup>
64
+ import { ref } from 'vue';
65
+ import { SearchableSelect } from '@htlkg/components/data';
66
+
67
+ const selected = ref(null);
68
+ const options = [
69
+ { value: '1', label: 'Option 1' },
70
+ { value: '2', label: 'Option 2' },
71
+ ];
72
+ </script>
73
+
74
+ <template>
75
+ <SearchableSelect
76
+ v-model="selected"
77
+ :options="options"
78
+ placeholder="Select..."
79
+ searchable
80
+ clearable
81
+ />
82
+ </template>
83
+ ```
84
+
85
+ ### Chart
86
+
87
+ Data visualization with multiple chart types.
88
+
89
+ ```vue
90
+ <script setup>
91
+ import { Chart } from '@htlkg/components/data';
92
+
93
+ const data = {
94
+ labels: ['Jan', 'Feb', 'Mar'],
95
+ datasets: [{ data: [10, 20, 30] }],
96
+ };
97
+ </script>
98
+
99
+ <template>
100
+ <Chart
101
+ type="line"
102
+ :data="data"
103
+ :options="{ responsive: true }"
104
+ />
105
+ </template>
106
+ ```
package/src/data/index.ts CHANGED
@@ -3,3 +3,23 @@ export { default as DataList } from './DataList.vue';
3
3
  export { default as SearchableSelect } from './SearchableSelect.vue';
4
4
  export { default as Chart } from './Chart.vue';
5
5
  export type { ChartSeries, ChartOptions, ChartDateRange, ChartAnnotation, NpsLiterals } from './Chart.vue';
6
+
7
+ // DataTable - Simplified table with automatic useTable integration
8
+ export { default as DataTable } from './DataTable.vue';
9
+ export type {
10
+ DataTableColumn,
11
+ DataTableFilter,
12
+ BulkAction,
13
+ RowAction,
14
+ NoResultsConfig,
15
+ } from './DataTable.vue';
16
+
17
+ // Column definition helpers
18
+ export {
19
+ columns,
20
+ statusColors,
21
+ getStatusColor,
22
+ createStatusColorFn,
23
+ type DateFormatOptions,
24
+ type TagColorFn,
25
+ } from './columnHelpers';
@@ -0,0 +1,102 @@
1
+ # Domain Module
2
+
3
+ Domain-specific components for the Hotelinking platform.
4
+
5
+ ## Components
6
+
7
+ ### BrandCard
8
+
9
+ Card component for displaying brand information.
10
+
11
+ ```vue
12
+ <script setup>
13
+ import { BrandCard } from '@htlkg/components/domain';
14
+ </script>
15
+
16
+ <template>
17
+ <BrandCard
18
+ :brand="brand"
19
+ :show-status="true"
20
+ @click="handleClick"
21
+ @edit="handleEdit"
22
+ />
23
+ </template>
24
+ ```
25
+
26
+ ### BrandSelector
27
+
28
+ Grid-based brand selection component.
29
+
30
+ ```vue
31
+ <script setup>
32
+ import { ref } from 'vue';
33
+ import { BrandSelector } from '@htlkg/components/domain';
34
+
35
+ const selectedBrand = ref(null);
36
+ </script>
37
+
38
+ <template>
39
+ <BrandSelector
40
+ v-model="selectedBrand"
41
+ :brands="brands"
42
+ :loading="loading"
43
+ searchable
44
+ />
45
+ </template>
46
+ ```
47
+
48
+ ### ProductBadge
49
+
50
+ Badge component for product status indicators.
51
+
52
+ ```vue
53
+ <script setup>
54
+ import { ProductBadge } from '@htlkg/components/domain';
55
+ </script>
56
+
57
+ <template>
58
+ <ProductBadge
59
+ :product="product"
60
+ :enabled="isEnabled"
61
+ size="sm"
62
+ />
63
+ </template>
64
+ ```
65
+
66
+ ### UserAvatar
67
+
68
+ User avatar with profile pictures or initials.
69
+
70
+ ```vue
71
+ <script setup>
72
+ import { UserAvatar } from '@htlkg/components/domain';
73
+ </script>
74
+
75
+ <template>
76
+ <UserAvatar
77
+ :user="user"
78
+ size="md"
79
+ :show-name="true"
80
+ :show-role="true"
81
+ />
82
+ </template>
83
+ ```
84
+
85
+ ## Props
86
+
87
+ ### BrandCard
88
+
89
+ | Prop | Type | Description |
90
+ |------|------|-------------|
91
+ | brand | Brand | Brand object |
92
+ | showStatus | boolean | Show status badge |
93
+ | clickable | boolean | Enable click handler |
94
+
95
+ ### BrandSelector
96
+
97
+ | Prop | Type | Description |
98
+ |------|------|-------------|
99
+ | brands | Brand[] | Available brands |
100
+ | modelValue | Brand | Selected brand (v-model) |
101
+ | searchable | boolean | Enable search |
102
+ | loading | boolean | Loading state |
@@ -0,0 +1,89 @@
1
+ # Forms Module
2
+
3
+ Components for form creation and validation.
4
+
5
+ ## Components
6
+
7
+ ### JsonSchemaForm
8
+
9
+ Dynamic form generator from JSON Schema with AJV validation.
10
+
11
+ ```vue
12
+ <script setup>
13
+ import { ref } from 'vue';
14
+ import { JsonSchemaForm } from '@htlkg/components/forms';
15
+
16
+ const formData = ref({});
17
+ const schema = {
18
+ type: 'object',
19
+ properties: {
20
+ name: { type: 'string', title: 'Name' },
21
+ email: { type: 'string', format: 'email', title: 'Email' },
22
+ age: { type: 'number', minimum: 0, title: 'Age' },
23
+ },
24
+ required: ['name', 'email'],
25
+ };
26
+
27
+ const uiSchema = {
28
+ name: { 'ui:placeholder': 'Enter name' },
29
+ email: { 'ui:widget': 'email' },
30
+ };
31
+ </script>
32
+
33
+ <template>
34
+ <JsonSchemaForm
35
+ v-model="formData"
36
+ :schema="schema"
37
+ :ui-schema="uiSchema"
38
+ @submit="handleSubmit"
39
+ @validation-error="handleError"
40
+ />
41
+ </template>
42
+ ```
43
+
44
+ ### DateRange
45
+
46
+ Date range selector with start/end dates.
47
+
48
+ ```vue
49
+ <script setup>
50
+ import { ref } from 'vue';
51
+ import { DateRange } from '@htlkg/components/forms';
52
+
53
+ const dateRange = ref({
54
+ start: null,
55
+ end: null,
56
+ });
57
+ </script>
58
+
59
+ <template>
60
+ <DateRange
61
+ v-model="dateRange"
62
+ :min-date="minDate"
63
+ :max-date="maxDate"
64
+ @search="handleSearch"
65
+ />
66
+ </template>
67
+ ```
68
+
69
+ ## Validation
70
+
71
+ JsonSchemaForm uses AJV for validation:
72
+
73
+ ```typescript
74
+ const schema = {
75
+ type: 'object',
76
+ properties: {
77
+ password: {
78
+ type: 'string',
79
+ minLength: 8,
80
+ pattern: '^(?=.*[A-Z])(?=.*[0-9])',
81
+ },
82
+ },
83
+ errorMessage: {
84
+ properties: {
85
+ password: 'Password must be 8+ chars with uppercase and number',
86
+ },
87
+ },
88
+ };
89
+ ```
package/src/index.ts CHANGED
@@ -13,8 +13,9 @@ export * from './overlays';
13
13
  // Domain components
14
14
  export * from './domain';
15
15
 
16
- // Composables
16
+ // Composables (includes page context with setUser, $user, etc.)
17
17
  export * from './composables';
18
18
 
19
- // Stores
20
- export * from './stores';
19
+ // Note: Stores are not re-exported here to avoid naming conflicts
20
+ // Use composables/usePageContext for page-level user state
21
+ // Import from '@htlkg/components/stores' for other store utilities
@@ -0,0 +1,80 @@
1
+ # Navigation Module
2
+
3
+ Components for navigation and page structure.
4
+
5
+ ## Components
6
+
7
+ ### Breadcrumbs
8
+
9
+ Hierarchical navigation showing current page location.
10
+
11
+ ```vue
12
+ <script setup>
13
+ import { Breadcrumbs } from '@htlkg/components/navigation';
14
+
15
+ const items = [
16
+ { label: 'Home', href: '/' },
17
+ { label: 'Brands', href: '/brands' },
18
+ { label: 'Brand Name' },
19
+ ];
20
+ </script>
21
+
22
+ <template>
23
+ <Breadcrumbs :items="items" />
24
+ </template>
25
+ ```
26
+
27
+ ### Stepper
28
+
29
+ Multi-step progress indicator for wizards and forms.
30
+
31
+ ```vue
32
+ <script setup>
33
+ import { ref } from 'vue';
34
+ import { Stepper } from '@htlkg/components/navigation';
35
+
36
+ const currentStep = ref(0);
37
+ const steps = [
38
+ { label: 'Account', valid: true },
39
+ { label: 'Profile', valid: false },
40
+ { label: 'Review', valid: false },
41
+ ];
42
+ </script>
43
+
44
+ <template>
45
+ <Stepper
46
+ v-model="currentStep"
47
+ :steps="steps"
48
+ @step-change="handleStepChange"
49
+ />
50
+ </template>
51
+ ```
52
+
53
+ ### Tabs
54
+
55
+ Tabbed interface for organizing content.
56
+
57
+ ```vue
58
+ <script setup>
59
+ import { ref } from 'vue';
60
+ import { Tabs } from '@htlkg/components/navigation';
61
+
62
+ const activeTab = ref('overview');
63
+ const tabs = [
64
+ { id: 'overview', label: 'Overview' },
65
+ { id: 'settings', label: 'Settings', count: 3 },
66
+ { id: 'users', label: 'Users', disabled: true },
67
+ ];
68
+ </script>
69
+
70
+ <template>
71
+ <Tabs v-model="activeTab" :tabs="tabs">
72
+ <template #overview>
73
+ <OverviewContent />
74
+ </template>
75
+ <template #settings>
76
+ <SettingsContent />
77
+ </template>
78
+ </Tabs>
79
+ </template>
80
+ ```
@@ -0,0 +1,86 @@
1
+ # Overlays Module
2
+
3
+ Modal dialogs, notifications, alerts, and drawers.
4
+
5
+ ## Components
6
+
7
+ ### Alert
8
+
9
+ Visual alerts for information, success, warnings, and errors.
10
+
11
+ ```vue
12
+ <script setup>
13
+ import { Alert } from '@htlkg/components/overlays';
14
+ </script>
15
+
16
+ <template>
17
+ <Alert
18
+ type="success"
19
+ title="Success!"
20
+ message="Operation completed."
21
+ dismissible
22
+ @dismiss="handleDismiss"
23
+ />
24
+ </template>
25
+ ```
26
+
27
+ ### Modal
28
+
29
+ Dialog overlays for confirmations, forms, and content.
30
+
31
+ ```vue
32
+ <script setup>
33
+ import { ref } from 'vue';
34
+ import { Modal } from '@htlkg/components/overlays';
35
+
36
+ const isOpen = ref(false);
37
+ </script>
38
+
39
+ <template>
40
+ <Modal v-model:open="isOpen" title="Confirm Action">
41
+ <p>Are you sure?</p>
42
+ <template #footer>
43
+ <button @click="isOpen = false">Cancel</button>
44
+ <button @click="confirm">Confirm</button>
45
+ </template>
46
+ </Modal>
47
+ </template>
48
+ ```
49
+
50
+ ### Notification
51
+
52
+ Toast-style notifications for temporary messages.
53
+
54
+ ```vue
55
+ <script setup>
56
+ import { Notification } from '@htlkg/components/overlays';
57
+ </script>
58
+
59
+ <template>
60
+ <Notification
61
+ type="info"
62
+ message="Changes saved"
63
+ :duration="3000"
64
+ position="top-right"
65
+ />
66
+ </template>
67
+ ```
68
+
69
+ ### Drawer
70
+
71
+ Side panel overlays for additional content.
72
+
73
+ ```vue
74
+ <script setup>
75
+ import { ref } from 'vue';
76
+ import { Drawer } from '@htlkg/components/overlays';
77
+
78
+ const isOpen = ref(false);
79
+ </script>
80
+
81
+ <template>
82
+ <Drawer v-model:open="isOpen" position="right" title="Details">
83
+ <DetailContent />
84
+ </Drawer>
85
+ </template>
86
+ ```
@@ -0,0 +1,82 @@
1
+ # Stores Module
2
+
3
+ Pinia stores for global component state.
4
+
5
+ ## Available Stores
6
+
7
+ ### useNotificationStore
8
+
9
+ Global notification state.
10
+
11
+ ```vue
12
+ <script setup>
13
+ import { useNotificationStore } from '@htlkg/components/stores';
14
+
15
+ const notifications = useNotificationStore();
16
+
17
+ notifications.add({
18
+ type: 'success',
19
+ message: 'Operation completed',
20
+ duration: 3000,
21
+ });
22
+
23
+ notifications.remove(id);
24
+ notifications.clear();
25
+ </script>
26
+ ```
27
+
28
+ ### useModalStore
29
+
30
+ Global modal state for managing multiple modals.
31
+
32
+ ```vue
33
+ <script setup>
34
+ import { useModalStore } from '@htlkg/components/stores';
35
+
36
+ const modals = useModalStore();
37
+
38
+ modals.open('confirm', { title: 'Confirm', message: 'Are you sure?' });
39
+ modals.close('confirm');
40
+ modals.isOpen('confirm'); // boolean
41
+ </script>
42
+ ```
43
+
44
+ ### useLoadingStore
45
+
46
+ Global loading state.
47
+
48
+ ```vue
49
+ <script setup>
50
+ import { useLoadingStore } from '@htlkg/components/stores';
51
+
52
+ const loading = useLoadingStore();
53
+
54
+ loading.start('fetchUsers');
55
+ loading.stop('fetchUsers');
56
+ loading.isLoading('fetchUsers'); // boolean
57
+ loading.anyLoading; // boolean - true if any loading
58
+ </script>
59
+ ```
60
+
61
+ ## Store Setup
62
+
63
+ Register stores in your app:
64
+
65
+ ```typescript
66
+ // main.ts
67
+ import { createPinia } from 'pinia';
68
+
69
+ const pinia = createPinia();
70
+ app.use(pinia);
71
+ ```
72
+
73
+ ## Astro Integration
74
+
75
+ Use with nanostores for Astro SSR:
76
+
77
+ ```typescript
78
+ import { useStore } from '@nanostores/vue';
79
+ import { notificationStore } from '@htlkg/components/stores';
80
+
81
+ const notifications = useStore(notificationStore);
82
+ ```