Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 7d5a6d3

Browse files
committed
build: fix build types
1 parent f26fe51 commit 7d5a6d3

File tree

15 files changed

+8204
-531
lines changed

15 files changed

+8204
-531
lines changed

components.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* This is a generated file. Do not edit it's contents.
88
*
9-
* This file was generated on 2022-12-11T15:07:27.518Z
9+
* This file was generated on 2022-12-11T20:40:04.332Z
1010
*/
1111

1212
import { ChakraProps, chakra } from "@chakra-ui/vue-system"

packages/c-alert/src/index.ts

Lines changed: 225 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,225 @@
1-
export * from "./alert"
1+
import { defineComponent, computed, createVNode, mergeProps, isVNode, Fragment } from 'vue';
2+
import { createStylesContext, useMultiStyleConfig, chakra } from '@chakra-ui/vue-system';
3+
import { createContext, getValidChildren } from '@chakra-ui/vue-utils';
4+
import { createIconComponent } from '@chakra-ui/c-icon';
5+
6+
function _extends() {
7+
_extends = Object.assign ? Object.assign.bind() : function (target) {
8+
for (var i = 1; i < arguments.length; i++) {
9+
var source = arguments[i];
10+
11+
for (var key in source) {
12+
if (Object.prototype.hasOwnProperty.call(source, key)) {
13+
target[key] = source[key];
14+
}
15+
}
16+
}
17+
18+
return target;
19+
};
20+
return _extends.apply(this, arguments);
21+
}
22+
23+
var CInfoIcon = createIconComponent("info");
24+
var CCheckIcon = createIconComponent("check-circle");
25+
var CWarningIcon = createIconComponent("warning-alt");
26+
var CErrorIcon = createIconComponent("warning");
27+
28+
function _isSlot(s) {
29+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
30+
}
31+
32+
var STATUSES = {
33+
info: {
34+
colorScheme: "blue",
35+
icon: CInfoIcon
36+
},
37+
success: {
38+
colorScheme: "green",
39+
icon: CCheckIcon
40+
},
41+
warning: {
42+
colorScheme: "orange",
43+
icon: CWarningIcon
44+
},
45+
error: {
46+
colorScheme: "red",
47+
icon: CErrorIcon
48+
},
49+
loading: {
50+
icon: CInfoIcon,
51+
colorScheme: "blue"
52+
}
53+
};
54+
55+
var _createStylesContext = createStylesContext("Alert"),
56+
StylesProvider = _createStylesContext[0],
57+
useStyles = _createStylesContext[1];
58+
59+
var _createContext = createContext({
60+
name: "AlertContext",
61+
errorMessage: "useAlertContext: `context` is undefined. Seems you forgot to wrap alert components in `<c-alert />`"
62+
}),
63+
AlertProvider = _createContext[0],
64+
useAlertContext = _createContext[1];
65+
/**
66+
* CAlert component
67+
*
68+
* This is the container component for all Alert components.
69+
* It also provides state and context to it's compound components
70+
*/
71+
72+
73+
var CAlert = defineComponent({
74+
name: "CAlert",
75+
props: {
76+
as: {
77+
type: [String, Object],
78+
"default": "div"
79+
},
80+
status: {
81+
type: [String],
82+
"default": "info"
83+
},
84+
colorScheme: {
85+
type: [String]
86+
},
87+
styleConfig: {
88+
type: [Object]
89+
},
90+
variant: {
91+
type: [String],
92+
"default": "solid"
93+
}
94+
},
95+
setup: function setup(props, _ref) {
96+
var slots = _ref.slots,
97+
attrs = _ref.attrs;
98+
var colorScheme = computed(function () {
99+
var _STATUSES$props$statu;
100+
101+
return props.colorScheme || ((_STATUSES$props$statu = STATUSES[props == null ? void 0 : props.status]) == null ? void 0 : _STATUSES$props$statu.colorScheme);
102+
});
103+
var themingProps = computed(function () {
104+
return {
105+
colorScheme: colorScheme.value,
106+
variant: props.variant
107+
};
108+
});
109+
AlertProvider({
110+
status: computed(function () {
111+
return props.status;
112+
})
113+
});
114+
var styles = useMultiStyleConfig("Alert", themingProps);
115+
StylesProvider(styles);
116+
var alertStyles = computed(function () {
117+
return _extends({
118+
width: "100%",
119+
display: "flex",
120+
alignItems: "center",
121+
position: "relative",
122+
overflow: "hidden"
123+
}, styles.value.container);
124+
});
125+
return function () {
126+
return createVNode(chakra.div, mergeProps({
127+
"role": "alert",
128+
"__label": "alert",
129+
"__css": alertStyles.value
130+
}, attrs), {
131+
"default": function _default() {
132+
return getValidChildren(slots);
133+
}
134+
});
135+
};
136+
}
137+
});
138+
/**
139+
* CAlertTitle component
140+
*
141+
* The title component for alerts
142+
*/
143+
144+
var CAlertTitle = defineComponent({
145+
name: "CAlertTitle",
146+
setup: function setup(_, _ref2) {
147+
var attrs = _ref2.attrs,
148+
slots = _ref2.slots;
149+
var styles = useStyles();
150+
return function () {
151+
return createVNode(chakra.div, mergeProps({
152+
"__label": "alert__title",
153+
"__css": styles.value.title
154+
}, attrs), _isSlot(slots) ? slots : {
155+
"default": function _default() {
156+
return [slots];
157+
}
158+
});
159+
};
160+
}
161+
});
162+
/**«
163+
* CAlertDescription component
164+
*
165+
* The description component for alerts
166+
*/
167+
168+
var CAlertDescription = defineComponent({
169+
name: "CAlertDescription",
170+
setup: function setup(_, _ref3) {
171+
var attrs = _ref3.attrs,
172+
slots = _ref3.slots;
173+
var styles = useStyles();
174+
return function () {
175+
return createVNode(chakra.div, mergeProps({
176+
"__label": "alert__description",
177+
"__css": styles.value.description
178+
}, attrs), {
179+
"default": function _default() {
180+
return getValidChildren(slots);
181+
}
182+
});
183+
};
184+
}
185+
});
186+
/**
187+
* CAlertIcon component
188+
*
189+
* The Icon component for alerts
190+
*/
191+
192+
var CAlertIcon = defineComponent({
193+
name: "CAlertIcon",
194+
setup: function setup(_, _ref4) {
195+
var attrs = _ref4.attrs,
196+
slots = _ref4.slots;
197+
var styles = useStyles();
198+
199+
var _useAlertContext = useAlertContext(),
200+
status = _useAlertContext.status;
201+
202+
var BaseIcon = STATUSES[status.value].icon;
203+
var css = computed(function () {
204+
return status.value === "loading" ? styles.value.spinner : styles.value.icon;
205+
});
206+
return function () {
207+
var validChildren = getValidChildren(slots);
208+
return createVNode(chakra.span, mergeProps({
209+
"display": "inherit",
210+
"__label": "alert__icon"
211+
}, attrs, {
212+
"__css": css.value
213+
}), {
214+
"default": function _default() {
215+
return createVNode(Fragment, null, [validChildren.length ? slots : createVNode(BaseIcon, {
216+
"h": "100%",
217+
"w": "100%"
218+
}, null)]);
219+
}
220+
}); // return <icon {...styles.value.icon} {...attrs}></icon>
221+
};
222+
}
223+
});
224+
225+
export { CAlert, CAlertDescription, CAlertIcon, CAlertTitle };

0 commit comments

Comments
 (0)