@superruudje/picobello 0.1.0-beta.2

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/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # Picobello
2
+
3
+ Picobello is a Vue 3 design system and component library.
4
+
5
+ ⚠️ **Status:** Beta
6
+ The API may change before a stable `1.0.0` release.
7
+
8
+ ---
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @rudihaamke/picobello@beta
14
+ ```
15
+
16
+ ---
17
+
18
+ ## Usage
19
+
20
+ ### Import styles (required)
21
+ Import the global styles once in your app entry:
22
+
23
+ ```ts
24
+ // main.ts
25
+ import "@rudihaamke/picobello/dist/style.css";
26
+ ```
27
+
28
+ ### Use components
29
+ ```vue
30
+ <script setup lang="ts">
31
+ import { Button, Heading, Flex } from "@rudihaamke/picobello";
32
+ </script>
33
+
34
+ <template>
35
+ <Heading :level="1" :visual="3">Dashboard</Heading>
36
+
37
+ <Flex gap="sm" align="center">
38
+ <Button label="Save" />
39
+ <Button label="Cancel" variant="secondary" />
40
+ </Flex>
41
+ </template>
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Components
47
+
48
+ Currently available (beta):
49
+
50
+ - Button
51
+ - Heading
52
+ - Flex
53
+ - Card
54
+ - NavigationCard
55
+ - Loader
56
+
57
+ More components will be added over time.
58
+
59
+ ---
60
+
61
+ ## Vue compatibility
62
+
63
+ - Vue 3.x
64
+ - Vue is a peer dependency and must be installed in the consuming project.
65
+
66
+ ---
67
+
68
+ ## Icons
69
+
70
+ Picobello uses Bootstrap Icons internally.
71
+ Icons are included via the library’s CSS and work out of the box.
72
+
73
+ All icon usage is overridable via slots.
74
+
75
+ ---
76
+
77
+ ## Development
78
+
79
+ ```bash
80
+ npm install
81
+ npm run storybook
82
+ ```
83
+
84
+ ---
85
+
86
+ ## License
87
+
88
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=["aria-hidden"],d=e.defineComponent({__name:"Icon",props:{name:{},size:{default:"1em"},title:{}},setup(t){return(l,o)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass(["bi",`bi-${t.name}`]),style:e.normalizeStyle({fontSize:typeof t.size=="number"?`${t.size}px`:t.size}),"aria-hidden":t.title?void 0:"true",role:"img"},null,14,r))}}),u={class:"alert__icon"},m={class:"alert__content"},f=e.defineComponent({__name:"Alert",props:{type:{default:"info"}},setup(t){const l=t,o=e.computed(()=>l.type==="warning"?"exclamation-circle-fill":l.type==="success"?"check-circle-fill":l.type==="info"?"info-circle-fill":l.type==="danger"?"x-circle-fill":"");return(n,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([`alert--${l.type}`,"alert"])},[e.createElementVNode("div",u,[e.renderSlot(n.$slots,"alert-icon",{},()=>[e.createVNode(d,{name:o.value},null,8,["name"])])]),e.createElementVNode("div",m,[e.renderSlot(n.$slots,"alert-content")])],2))}}),b={key:0,class:"btn__text"},h=e.defineComponent({__name:"Button",props:{label:{},variant:{default:"primary"},size:{default:"default"},disabled:{type:Boolean,default:!1},active:{type:Boolean,default:!1},as:{default:"button"},href:{},type:{default:"button"}},setup(t){const l=t,o=e.computed(()=>["btn",`btn--${l.variant}`,l.size==="small"&&"btn--small",l.disabled&&"btn--disabled",l.active&&"active"]),n=a=>{l.disabled&&(a.preventDefault(),a.stopImmediatePropagation())};return(a,s)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.as),{"aria-disabled":t.as!=="button"?t.disabled:void 0,class:e.normalizeClass(o.value),disabled:t.as==="button"?t.disabled:void 0,href:t.as==="a"&&!t.disabled?t.href:void 0,type:t.as==="button"?t.type:void 0,onClick:n},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"icon-left"),t.label?(e.openBlock(),e.createElementBlock("span",b,e.toDisplayString(t.label),1)):e.renderSlot(a.$slots,"default",{key:1}),e.renderSlot(a.$slots,"icon-right")]),_:3},8,["aria-disabled","class","disabled","href","type"]))}}),v={class:"card"},p={key:0,class:"card__header"},y={key:0,class:"card__title"},k=["aria-expanded"],B={key:1,class:"card__footer"},C={class:"card__footer-content"},$=e.defineComponent({__name:"Card",props:{title:{},collapsible:{type:Boolean,default:!1},defaultCollapsed:{type:Boolean,default:!1}},setup(t){const l=t,o=e.useSlots(),n=e.computed(()=>!!l.title||!!o["header-icon"]),a=e.computed(()=>!!o["footer-content"]),s=e.ref(l.defaultCollapsed);function i(){s.value=!s.value}return(c,S)=>(e.openBlock(),e.createElementBlock("div",v,[n.value?(e.openBlock(),e.createElementBlock("div",p,[e.renderSlot(c.$slots,"header-icon"),t.title?(e.openBlock(),e.createElementBlock("h3",y,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"header-buttons"),t.collapsible?(e.openBlock(),e.createElementBlock("button",{key:1,class:"card__collapse-toggle btn btn--small btn--secondary",type:"button",onClick:i,"aria-expanded":!s.value},[e.renderSlot(c.$slots,"collapse-indicator",{},()=>[e.createElementVNode("i",{class:e.normalizeClass(["bi bi-chevron-up",{"is-collapsed":s.value}])},null,2)])],8,k)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["card__body",{"with-header":n.value}])},[e.renderSlot(c.$slots,"card-body")],2),[[e.vShow,!s.value]]),a.value&&!s.value?(e.openBlock(),e.createElementBlock("div",B,[e.createElementVNode("div",C,[e.renderSlot(c.$slots,"footer-content")])])):e.createCommentVNode("",!0)]))}});exports.Alert=f;exports.Button=h;exports.Card=$;
@@ -0,0 +1,2 @@
1
+ export * from './src/index'
2
+ export {}
package/dist/index.mjs ADDED
@@ -0,0 +1,137 @@
1
+ import { defineComponent as h, createElementBlock as n, openBlock as s, normalizeStyle as y, normalizeClass as u, computed as b, createElementVNode as r, renderSlot as a, createVNode as $, createBlock as p, resolveDynamicComponent as _, withCtx as k, toDisplayString as m, useSlots as C, ref as g, createCommentVNode as f, withDirectives as z, vShow as B } from "vue";
2
+ const S = ["aria-hidden"], w = /* @__PURE__ */ h({
3
+ __name: "Icon",
4
+ props: {
5
+ name: {},
6
+ size: { default: "1em" },
7
+ title: {}
8
+ },
9
+ setup(e) {
10
+ return (t, o) => (s(), n("i", {
11
+ class: u(["bi", `bi-${e.name}`]),
12
+ style: y({ fontSize: typeof e.size == "number" ? `${e.size}px` : e.size }),
13
+ "aria-hidden": e.title ? void 0 : "true",
14
+ role: "img"
15
+ }, null, 14, S));
16
+ }
17
+ }), D = { class: "alert__icon" }, N = { class: "alert__content" }, q = /* @__PURE__ */ h({
18
+ __name: "Alert",
19
+ props: {
20
+ type: { default: "info" }
21
+ },
22
+ setup(e) {
23
+ const t = e, o = b(() => t.type === "warning" ? "exclamation-circle-fill" : t.type === "success" ? "check-circle-fill" : t.type === "info" ? "info-circle-fill" : t.type === "danger" ? "x-circle-fill" : "");
24
+ return (i, l) => (s(), n("div", {
25
+ class: u([`alert--${t.type}`, "alert"])
26
+ }, [
27
+ r("div", D, [
28
+ a(i.$slots, "alert-icon", {}, () => [
29
+ $(w, { name: o.value }, null, 8, ["name"])
30
+ ])
31
+ ]),
32
+ r("div", N, [
33
+ a(i.$slots, "alert-content")
34
+ ])
35
+ ], 2));
36
+ }
37
+ }), V = {
38
+ key: 0,
39
+ class: "btn__text"
40
+ }, G = /* @__PURE__ */ h({
41
+ __name: "Button",
42
+ props: {
43
+ label: {},
44
+ variant: { default: "primary" },
45
+ size: { default: "default" },
46
+ disabled: { type: Boolean, default: !1 },
47
+ active: { type: Boolean, default: !1 },
48
+ as: { default: "button" },
49
+ href: {},
50
+ type: { default: "button" }
51
+ },
52
+ setup(e) {
53
+ const t = e, o = b(() => [
54
+ "btn",
55
+ `btn--${t.variant}`,
56
+ t.size === "small" && "btn--small",
57
+ t.disabled && "btn--disabled",
58
+ t.active && "active"
59
+ ]), i = (l) => {
60
+ t.disabled && (l.preventDefault(), l.stopImmediatePropagation());
61
+ };
62
+ return (l, c) => (s(), p(_(e.as), {
63
+ "aria-disabled": e.as !== "button" ? e.disabled : void 0,
64
+ class: u(o.value),
65
+ disabled: e.as === "button" ? e.disabled : void 0,
66
+ href: e.as === "a" && !e.disabled ? e.href : void 0,
67
+ type: e.as === "button" ? e.type : void 0,
68
+ onClick: i
69
+ }, {
70
+ default: k(() => [
71
+ a(l.$slots, "icon-left"),
72
+ e.label ? (s(), n("span", V, m(e.label), 1)) : a(l.$slots, "default", { key: 1 }),
73
+ a(l.$slots, "icon-right")
74
+ ]),
75
+ _: 3
76
+ }, 8, ["aria-disabled", "class", "disabled", "href", "type"]));
77
+ }
78
+ }), x = { class: "card" }, A = {
79
+ key: 0,
80
+ class: "card__header"
81
+ }, E = {
82
+ key: 0,
83
+ class: "card__title"
84
+ }, I = ["aria-expanded"], F = {
85
+ key: 1,
86
+ class: "card__footer"
87
+ }, H = { class: "card__footer-content" }, J = /* @__PURE__ */ h({
88
+ __name: "Card",
89
+ props: {
90
+ title: {},
91
+ collapsible: { type: Boolean, default: !1 },
92
+ defaultCollapsed: { type: Boolean, default: !1 }
93
+ },
94
+ setup(e) {
95
+ const t = e, o = C(), i = b(() => !!t.title || !!o["header-icon"]), l = b(() => !!o["footer-content"]), c = g(t.defaultCollapsed);
96
+ function v() {
97
+ c.value = !c.value;
98
+ }
99
+ return (d, P) => (s(), n("div", x, [
100
+ i.value ? (s(), n("div", A, [
101
+ a(d.$slots, "header-icon"),
102
+ e.title ? (s(), n("h3", E, m(e.title), 1)) : f("", !0),
103
+ a(d.$slots, "header-buttons"),
104
+ e.collapsible ? (s(), n("button", {
105
+ key: 1,
106
+ class: "card__collapse-toggle btn btn--small btn--secondary",
107
+ type: "button",
108
+ onClick: v,
109
+ "aria-expanded": !c.value
110
+ }, [
111
+ a(d.$slots, "collapse-indicator", {}, () => [
112
+ r("i", {
113
+ class: u(["bi bi-chevron-up", { "is-collapsed": c.value }])
114
+ }, null, 2)
115
+ ])
116
+ ], 8, I)) : f("", !0)
117
+ ])) : f("", !0),
118
+ z(r("div", {
119
+ class: u(["card__body", { "with-header": i.value }])
120
+ }, [
121
+ a(d.$slots, "card-body")
122
+ ], 2), [
123
+ [B, !c.value]
124
+ ]),
125
+ l.value && !c.value ? (s(), n("div", F, [
126
+ r("div", H, [
127
+ a(d.$slots, "footer-content")
128
+ ])
129
+ ])) : f("", !0)
130
+ ]));
131
+ }
132
+ });
133
+ export {
134
+ q as Alert,
135
+ G as Button,
136
+ J as Card
137
+ };