@frollo/frollo-web-ui 0.0.7 → 0.0.8

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,181 @@
1
+ import { u as styleInject } from './style-inject.es-da8f7768.js';
2
+ import { defineComponent, ref, computed, openBlock, createBlock, resolveDynamicComponent, normalizeClass, withCtx, renderSlot } from 'vue';
3
+
4
+ var script = defineComponent({
5
+ name: 'FwButton',
6
+ emits: ['click', 'mouseover', 'mouseout', 'focusin', 'focusout'],
7
+ props: {
8
+ /**
9
+ * A `router-link` path or object
10
+ */
11
+ to: {
12
+ type: [String, Object]
13
+ },
14
+
15
+ /**
16
+ * A URL to link to using a native anchor element
17
+ */
18
+ href: String,
19
+
20
+ /**
21
+ * The size of the button. Accepts: 'sm', 'md', 'lg', 'xl', '2xl'
22
+ */
23
+ size: {
24
+ type: String,
25
+ "default": 'lg',
26
+ validator: function validator(value) {
27
+ return ['sm', 'md', 'lg', 'xl', '2xl'].includes(value);
28
+ }
29
+ },
30
+
31
+ /**
32
+ * The colour variant of the button.
33
+ * Accepts 'primary', 'secondary', 'tertiary', 'error', 'success'
34
+ */
35
+ variant: {
36
+ type: String,
37
+ "default": 'primary',
38
+ validator: function validator(value) {
39
+ return ['primary', 'secondary', 'tertiary', 'error', 'success', 'text'].includes(value);
40
+ }
41
+ }
42
+ },
43
+ setup: function setup(props, ctx) {
44
+ var buttonClasses = ref({
45
+ primary: {
46
+ text: 'text-tertiary hover:text-primary active:text-primary',
47
+ background: 'bg-primary hover:bg-tertiary active:bg-tertiary',
48
+ border: 'border-primary focus:ring-primary'
49
+ },
50
+ secondary: {
51
+ text: 'text-primary hover:text-tertiary active:text-tertiary',
52
+ background: 'bg-tertiary hover:bg-primary active:bg-primary',
53
+ border: 'border-primary focus:ring-primary'
54
+ },
55
+ tertiary: {
56
+ text: 'text-tertiary hover:text-secondary active:text-secondary',
57
+ background: 'bg-secondary hover:bg-tertiary active:bg-tertiary',
58
+ border: 'border-tertiary focus:ring-tertiary'
59
+ },
60
+ success: {
61
+ text: 'text-white hover:text-success active:text-success',
62
+ background: 'bg-success hover:bg-white active:bg-white',
63
+ border: 'border-success focus:ring-success'
64
+ },
65
+ error: {
66
+ text: 'text-white hover:text-error active:text-error',
67
+ background: 'bg-error hover:bg-white active:bg-white',
68
+ border: 'border-error focus:ring-error'
69
+ },
70
+ text: {
71
+ text: 'text-body font-medium hover:text-white active:text-white',
72
+ background: 'bg-white hover:bg-body active:bg-body',
73
+ border: 'border-transparent focus:ring-body'
74
+ }
75
+ });
76
+ var sizes = ref({
77
+ sm: 'px-2 py-0.5 text-sm',
78
+ md: 'px-6 py-1 text-md',
79
+ lg: 'px-10 py-2 text-lg',
80
+ xl: 'px-12 py-3 text-xl',
81
+ '2xl': 'px-16 py-4 text-2xl'
82
+ });
83
+ var textColorClass = computed(function () {
84
+ return buttonClasses.value[props.variant].text;
85
+ });
86
+ var bgColorClass = computed(function () {
87
+ return buttonClasses.value[props.variant].background;
88
+ });
89
+ var sizeClass = computed(function () {
90
+ return sizes.value[props.size];
91
+ });
92
+ var borderClass = computed(function () {
93
+ return buttonClasses.value[props.variant].border;
94
+ });
95
+ /**
96
+ * @event Click - Native click
97
+ */
98
+
99
+ var onClick = function onClick(e) {
100
+ return ctx.emit('click', e);
101
+ };
102
+ /**
103
+ * @event mouseover - Native hover
104
+ */
105
+
106
+
107
+ var onMouseover = function onMouseover(e) {
108
+ return ctx.emit('mouseover', e);
109
+ };
110
+ /**
111
+ * @event mouseout - Native hover out
112
+ */
113
+
114
+
115
+ var onMouseout = function onMouseout(e) {
116
+ return ctx.emit('mouseout', e);
117
+ };
118
+ /**
119
+ * @event focusin - Native focusin
120
+ */
121
+
122
+
123
+ var onFocusin = function onFocusin(e) {
124
+ return ctx.emit('focusin', e);
125
+ };
126
+ /**
127
+ * @event focusout - Native focusout
128
+ */
129
+
130
+
131
+ var onFocusout = function onFocusout(e) {
132
+ return ctx.emit('focusout', e);
133
+ };
134
+
135
+ var tagName = computed(function () {
136
+ if (props.to) return 'router-link';
137
+ if (props.href) return 'a';
138
+ return 'button';
139
+ });
140
+ return {
141
+ textColorClass: textColorClass,
142
+ bgColorClass: bgColorClass,
143
+ sizeClass: sizeClass,
144
+ borderClass: borderClass,
145
+ onClick: onClick,
146
+ onMouseover: onMouseover,
147
+ onMouseout: onMouseout,
148
+ onFocusin: onFocusin,
149
+ onFocusout: onFocusout,
150
+ tagName: tagName
151
+ };
152
+ }
153
+ });
154
+
155
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
156
+ return openBlock(), createBlock(resolveDynamicComponent(_ctx.tagName), {
157
+ "class": normalizeClass(["fw-button font-bold cursor-pointer whitespace-nowrap rounded-full border-2 focus:outline-none ring-offset-2 focus:ring", [_ctx.textColorClass, _ctx.bgColorClass, _ctx.sizeClass, _ctx.borderClass]]),
158
+ type: _ctx.tagName === 'button' ? _ctx.tagName : null,
159
+ to: _ctx.to ? _ctx.to : null,
160
+ href: _ctx.href ? _ctx.href : null,
161
+ tabindex: _ctx.to ? 0 : null,
162
+ onClick: _ctx.onClick,
163
+ onFocusin: _ctx.onFocusin,
164
+ onFocusout: _ctx.onFocusout,
165
+ onMouseover: _ctx.onMouseover,
166
+ onMouseout: _ctx.onMouseout
167
+ }, {
168
+ "default": withCtx(function () {
169
+ return [renderSlot(_ctx.$slots, "default")];
170
+ }),
171
+ _: 3
172
+ }, 8, ["class", "type", "to", "href", "tabindex", "onClick", "onFocusin", "onFocusout", "onMouseover", "onMouseout"]);
173
+ }
174
+
175
+ var css_248z = ".fw-button{-webkit-transition:all .25s ease-in;-o-transition:all .25s ease-in;transition:all .25s ease-in}";
176
+ var stylesheet = ".fw-button{-webkit-transition:all .25s ease-in;-o-transition:all .25s ease-in;transition:all .25s ease-in}";
177
+ styleInject(css_248z);
178
+
179
+ script.render = render;
180
+
181
+ export { script as s };
package/esm/fw-button.js CHANGED
@@ -1,2 +1,3 @@
1
- export { u as FwButton } from './fw-button-6d5a9671.js';
1
+ export { s as FwButton } from './fw-button-02fc3f47.js';
2
+ import './style-inject.es-da8f7768.js';
2
3
  import 'vue';
package/esm/fw-card.js CHANGED
@@ -60,13 +60,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
60
60
  return openBlock(), createBlock(resolveDynamicComponent(_ctx.componentName), {
61
61
  to: _ctx.to ? _ctx.to : null,
62
62
  href: _ctx.href ? _ctx.href : null,
63
- "class": normalizeClass(["fw-card shadow-card rounded-lg", _ctx.to || _ctx.href ? 'block focus:outline-none ring-offset-3 focus:ring focus:ring-primary transform-none transition-transform hover:-translate-y-1' : ''])
63
+ tabindex: _ctx.to ? 0 : null,
64
+ "class": normalizeClass(["fw-card shadow-card rounded-lg", _ctx.to || _ctx.href ? 'block cursor-pointer focus:outline-none ring-offset-3 focus:ring focus:ring-primary transform-none transition-transform hover:-translate-y-1' : ''])
64
65
  }, {
65
66
  "default": withCtx(function () {
66
67
  return [_ctx.title || _ctx.prefixTitle ? (openBlock(), createElementBlock("h4", _hoisted_1, [_ctx.prefixTitle ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(_ctx.prefixTitle), 1)) : createCommentVNode("", true), _ctx.title ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true)])) : createCommentVNode("", true), _ctx.$slots["default"] ? (openBlock(), createElementBlock("div", _hoisted_4, [renderSlot(_ctx.$slots, "default")])) : createCommentVNode("", true)];
67
68
  }),
68
69
  _: 3
69
- }, 8, ["to", "href", "class"]);
70
+ }, 8, ["to", "href", "tabindex", "class"]);
70
71
  }
71
72
 
72
73
  script.render = render;