@umbra.ui/core 0.4.2 → 0.4.4

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.
@@ -65,14 +65,6 @@
65
65
  margin: 0;
66
66
  }
67
67
 
68
- .tiptap p.is-editor-empty:first-child::before {
69
- color: var(--autogrow-placeholder-color);
70
- content: attr(data-placeholder);
71
- float: left;
72
- height: 0;
73
- pointer-events: none;
74
- }
75
-
76
68
  .tiptap.is-editor-empty::before {
77
69
  color: var(--autogrow-placeholder-color);
78
70
  content: attr(data-placeholder);
@@ -28,9 +28,11 @@ interface Day {
28
28
  // - Props
29
29
  export interface Props {
30
30
  date: Date;
31
+ label?: boolean;
31
32
  }
32
33
  const props = withDefaults(defineProps<Props>(), {
33
34
  date: () => new Date(),
35
+ label: true,
34
36
  });
35
37
  // - Emits
36
38
  const emits = defineEmits(["update:date"]);
@@ -384,9 +386,11 @@ const handleOverlayClick = () => {
384
386
  @click="togglePopover"
385
387
  ref="button"
386
388
  >
387
- <CalendarDaysIcon :size="16" />
388
- <p :class="['callout', $style.button_label]">{{ dateString }}</p>
389
- <p :class="['callout', $style.button_sublabel]">{{ yearString }}</p>
389
+ <slot v-if="label" name="label">
390
+ <CalendarDaysIcon :size="16" />
391
+ <p :class="['callout', $style.button_label]">{{ dateString }}</p>
392
+ <p :class="['callout', $style.button_sublabel]">{{ yearString }}</p>
393
+ </slot>
390
394
  </div>
391
395
 
392
396
  <!-- Teleport the overlay and picker to body -->
@@ -66,11 +66,64 @@ const handleDateChange = (date: Date) => {
66
66
  </style>
67
67
  ```
68
68
 
69
+ ## Custom Label Slot
70
+
71
+ ```vue
72
+ <script setup lang="ts">
73
+ import { ref, computed } from "vue";
74
+ import { DatePicker } from "@umbra-ui/core";
75
+ import { CalendarDaysIcon } from "@umbra-ui/icons";
76
+
77
+ const selectedDate = ref(new Date());
78
+ const formattedDate = computed(() =>
79
+ selectedDate.value.toLocaleDateString("en-US", {
80
+ month: "short",
81
+ day: "numeric",
82
+ })
83
+ );
84
+ </script>
85
+
86
+ <template>
87
+ <DatePicker v-model:date="selectedDate">
88
+ <template #label>
89
+ <span class="date-chip">
90
+ <CalendarDaysIcon :size="14" />
91
+ {{ formattedDate }}
92
+ </span>
93
+ </template>
94
+ </DatePicker>
95
+ </template>
96
+
97
+ <style module>
98
+ .date-chip {
99
+ display: inline-flex;
100
+ align-items: center;
101
+ gap: 0.353rem;
102
+ }
103
+ </style>
104
+ ```
105
+
106
+ ### Hiding the Label
107
+
108
+ ```vue
109
+ <script setup lang="ts">
110
+ import { ref } from "vue";
111
+ import { DatePicker } from "@umbra-ui/core";
112
+
113
+ const selectedDate = ref(new Date());
114
+ </script>
115
+
116
+ <template>
117
+ <DatePicker v-model:date="selectedDate" :label="false" />
118
+ </template>
119
+ ```
120
+
69
121
  ## Props
70
122
 
71
- | Prop Name | Type | Required | Default | Description |
72
- | --------- | ------ | -------- | ------------ | ----------------------- |
73
- | `date` | `Date` | Yes | `new Date()` | Currently selected date |
123
+ | Prop Name | Type | Required | Default | Description |
124
+ | --------- | --------- | -------- | ------------ | ------------------------------------- |
125
+ | `date` | `Date` | Yes | `new Date()` | Currently selected date |
126
+ | `label` | `boolean` | No | `true` | Show or hide the label content/slot |
74
127
 
75
128
  ## Events
76
129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbra.ui/core",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Core components for Umbra UI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -65,14 +65,6 @@
65
65
  margin: 0;
66
66
  }
67
67
 
68
- .tiptap p.is-editor-empty:first-child::before {
69
- color: var(--autogrow-placeholder-color);
70
- content: attr(data-placeholder);
71
- float: left;
72
- height: 0;
73
- pointer-events: none;
74
- }
75
-
76
68
  .tiptap.is-editor-empty::before {
77
69
  color: var(--autogrow-placeholder-color);
78
70
  content: attr(data-placeholder);
@@ -28,9 +28,11 @@ interface Day {
28
28
  // - Props
29
29
  export interface Props {
30
30
  date: Date;
31
+ label?: boolean;
31
32
  }
32
33
  const props = withDefaults(defineProps<Props>(), {
33
34
  date: () => new Date(),
35
+ label: true,
34
36
  });
35
37
  // - Emits
36
38
  const emits = defineEmits(["update:date"]);
@@ -384,9 +386,11 @@ const handleOverlayClick = () => {
384
386
  @click="togglePopover"
385
387
  ref="button"
386
388
  >
387
- <CalendarDaysIcon :size="16" />
388
- <p :class="['callout', $style.button_label]">{{ dateString }}</p>
389
- <p :class="['callout', $style.button_sublabel]">{{ yearString }}</p>
389
+ <slot v-if="label" name="label">
390
+ <CalendarDaysIcon :size="16" />
391
+ <p :class="['callout', $style.button_label]">{{ dateString }}</p>
392
+ <p :class="['callout', $style.button_sublabel]">{{ yearString }}</p>
393
+ </slot>
390
394
  </div>
391
395
 
392
396
  <!-- Teleport the overlay and picker to body -->
@@ -66,11 +66,64 @@ const handleDateChange = (date: Date) => {
66
66
  </style>
67
67
  ```
68
68
 
69
+ ## Custom Label Slot
70
+
71
+ ```vue
72
+ <script setup lang="ts">
73
+ import { ref, computed } from "vue";
74
+ import { DatePicker } from "@umbra-ui/core";
75
+ import { CalendarDaysIcon } from "@umbra-ui/icons";
76
+
77
+ const selectedDate = ref(new Date());
78
+ const formattedDate = computed(() =>
79
+ selectedDate.value.toLocaleDateString("en-US", {
80
+ month: "short",
81
+ day: "numeric",
82
+ })
83
+ );
84
+ </script>
85
+
86
+ <template>
87
+ <DatePicker v-model:date="selectedDate">
88
+ <template #label>
89
+ <span class="date-chip">
90
+ <CalendarDaysIcon :size="14" />
91
+ {{ formattedDate }}
92
+ </span>
93
+ </template>
94
+ </DatePicker>
95
+ </template>
96
+
97
+ <style module>
98
+ .date-chip {
99
+ display: inline-flex;
100
+ align-items: center;
101
+ gap: 0.353rem;
102
+ }
103
+ </style>
104
+ ```
105
+
106
+ ### Hiding the Label
107
+
108
+ ```vue
109
+ <script setup lang="ts">
110
+ import { ref } from "vue";
111
+ import { DatePicker } from "@umbra-ui/core";
112
+
113
+ const selectedDate = ref(new Date());
114
+ </script>
115
+
116
+ <template>
117
+ <DatePicker v-model:date="selectedDate" :label="false" />
118
+ </template>
119
+ ```
120
+
69
121
  ## Props
70
122
 
71
- | Prop Name | Type | Required | Default | Description |
72
- | --------- | ------ | -------- | ------------ | ----------------------- |
73
- | `date` | `Date` | Yes | `new Date()` | Currently selected date |
123
+ | Prop Name | Type | Required | Default | Description |
124
+ | --------- | --------- | -------- | ------------ | ------------------------------------- |
125
+ | `date` | `Date` | Yes | `new Date()` | Currently selected date |
126
+ | `label` | `boolean` | No | `true` | Show or hide the label content/slot |
74
127
 
75
128
  ## Events
76
129