classcard-ui 0.2.896 → 0.2.897

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "classcard-ui",
3
- "version": "0.2.896",
3
+ "version": "0.2.897",
4
4
  "main": "dist/classcard-ui.umd.min.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -0,0 +1,82 @@
1
+ <template>
2
+ <div>
3
+ <nav
4
+ class="group flex rounded-lg bg-gray-100 p-0.5 hover:bg-gray-200"
5
+ aria-label="Tabs"
6
+ >
7
+ <button
8
+ v-for="(tabOption, index) in tabOptions"
9
+ :key="tabOption.label"
10
+ x-ref="dates"
11
+ class="focus:outline-none flex min-w-0 flex-grow rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-100"
12
+ :tabindex="currentTab === tabOption.label ? '0' : '-1'"
13
+ @keydown.arrow-left="
14
+ $emit(
15
+ 'update-tab',
16
+ index === 0 ? tabOption.label : tabOptions[index - 1].label
17
+ )
18
+ "
19
+ @keydown.arrow-right="
20
+ $emit(
21
+ 'update-tab',
22
+ index === 0
23
+ ? tabOptions.find((tab) => tab.label !== tabOption.label).label
24
+ : tabOptions[index - 1].label
25
+ )
26
+ "
27
+ @click="$emit('update-tab', tabOption.label)"
28
+ >
29
+ <span
30
+ x-show="true"
31
+ class="flex min-w-0 flex-grow items-center justify-center space-x-2 rounded-md p-1.5 text-sm font-medium lg:pl-2.5 lg:pr-3.5"
32
+ :class="
33
+ currentTab === tabOption.label
34
+ ? 'ring-black bg-white shadow-sm ring-1 ring-opacity-5'
35
+ : ''
36
+ "
37
+ >
38
+ <c-icon
39
+ :type="tabOption.icon.type"
40
+ :class="
41
+ currentTab === tabOption.label
42
+ ? 'text-indigo-700'
43
+ : 'text-gray-400'
44
+ "
45
+ class="h-5 w-5"
46
+ :name="tabOption.icon.name"
47
+ :viewBox="tabOption.icon.viewBox"
48
+ ></c-icon>
49
+ <span
50
+ :class="`${
51
+ currentTab === tabOption.label
52
+ ? 'text-gray-900'
53
+ : 'text-gray-600 group-hover:text-gray-900'
54
+ } `"
55
+ >{{ tabOption.label }}</span
56
+ >
57
+ </span>
58
+ </button>
59
+ </nav>
60
+ </div>
61
+ </template>
62
+
63
+ <script>
64
+ import CIcon from "../CIcon/CIcon.vue";
65
+
66
+ export default {
67
+ name: "CInsetTabs",
68
+ components: {
69
+ CIcon,
70
+ },
71
+ props: {
72
+ currentTab: {
73
+ type: String,
74
+ },
75
+ tabOptions: {
76
+ type: Array,
77
+ },
78
+ },
79
+ };
80
+ </script>
81
+
82
+ <style></style>
@@ -0,0 +1,38 @@
1
+ import CInsetTabs from "../components/CInsetTabs/CInsetTabs.vue";
2
+
3
+ export default {
4
+ title: "CInsetTabs",
5
+ components: CInsetTabs,
6
+ argTypes: {
7
+ currentTab: String,
8
+ tabOptions: Array,
9
+ },
10
+ };
11
+ const Template = (args, { argTypes }) => ({
12
+ props: Object.keys(argTypes),
13
+ components: { CInsetTabs },
14
+ template: '<c-the-tabs v-bind="$props" />',
15
+ });
16
+
17
+ export const Default = Template.bind({});
18
+ Default.args = {
19
+ currentTab: "Dates",
20
+ tabOptions: [
21
+ {
22
+ label: "Dates",
23
+ icon: {
24
+ type: "solid",
25
+ name: "calendar-solid",
26
+ viewBox: "0 0 20 20",
27
+ },
28
+ },
29
+ {
30
+ label: "Days",
31
+ icon: {
32
+ type: "solid",
33
+ name: "calendar-solid",
34
+ viewBox: "0 0 20 20",
35
+ },
36
+ },
37
+ ],
38
+ };