@frontile/buttons 0.17.0-alpha.0 → 0.17.0-alpha.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/declarations/components/chip.d.ts +54 -0
- package/declarations/components/chip.d.ts.map +1 -0
- package/declarations/template-registry.d.ts +2 -0
- package/declarations/template-registry.d.ts.map +1 -1
- package/dist/_app_/components/chip.js +1 -0
- package/dist/components/chip.js +44 -0
- package/dist/components/chip.js.map +1 -0
- package/package.json +6 -4
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
export interface ChipArgs {
|
|
3
|
+
/**
|
|
4
|
+
* The chip appearance
|
|
5
|
+
*
|
|
6
|
+
* @defaultValue 'default'
|
|
7
|
+
*/
|
|
8
|
+
appearance?: 'default' | 'outlined' | 'faded';
|
|
9
|
+
/**
|
|
10
|
+
* The intent of the chip
|
|
11
|
+
*/
|
|
12
|
+
intent?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
|
|
13
|
+
/**
|
|
14
|
+
* The size of the chip
|
|
15
|
+
*/
|
|
16
|
+
size?: 'sm' | 'md' | 'lg';
|
|
17
|
+
/**
|
|
18
|
+
* The radius the chip
|
|
19
|
+
*/
|
|
20
|
+
radius?: 'none' | 'sm' | 'lg' | 'full';
|
|
21
|
+
/**
|
|
22
|
+
* Option to add dot to the chip
|
|
23
|
+
*/
|
|
24
|
+
withDot?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Function to be called when clicking on the close button.
|
|
27
|
+
* If you pass this argument, the close button will be visible.
|
|
28
|
+
*/
|
|
29
|
+
onClose?: () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Disables the clip and disables the close button if any.
|
|
32
|
+
*/
|
|
33
|
+
isDisabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Custom class name, it will override the default ones using Tailwind Merge library.
|
|
36
|
+
*/
|
|
37
|
+
class?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ChipSignature {
|
|
40
|
+
Args: ChipArgs;
|
|
41
|
+
Blocks: {
|
|
42
|
+
default: [];
|
|
43
|
+
};
|
|
44
|
+
Element: HTMLDivElement;
|
|
45
|
+
}
|
|
46
|
+
export default class Chip extends Component<ChipSignature> {
|
|
47
|
+
get classNames(): {
|
|
48
|
+
base: string;
|
|
49
|
+
content: string;
|
|
50
|
+
dot: string;
|
|
51
|
+
closeButton: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=chip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../src/components/chip.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;IAE9C;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAElE;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IAEvC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,CAAC;KACb,CAAC;IACF,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,SAAS,CAAC,aAAa,CAAC;IACxD,IAAI,UAAU;;;;;MAiBb;CAmCF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-registry.d.ts","sourceRoot":"","sources":["../src/template-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"template-registry.d.ts","sourceRoot":"","sources":["../src/template-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAE1C,MAAM,CAAC,OAAO,WAAW,QAAQ;IAC/B,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,IAAI,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/buttons/components/chip";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { useStyles } from '@frontile/theme';
|
|
3
|
+
import CloseButton from '@frontile/core/components/close-button';
|
|
4
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
5
|
+
import { setComponentTemplate } from '@ember/component';
|
|
6
|
+
|
|
7
|
+
var _class;
|
|
8
|
+
class Chip extends Component {
|
|
9
|
+
get classNames() {
|
|
10
|
+
const {
|
|
11
|
+
chip: chip1
|
|
12
|
+
} = useStyles();
|
|
13
|
+
const {
|
|
14
|
+
base: base1,
|
|
15
|
+
content: content1,
|
|
16
|
+
dot: dot1,
|
|
17
|
+
closeButton: closeButton1
|
|
18
|
+
} = chip1({
|
|
19
|
+
intent: this.args.intent || 'default',
|
|
20
|
+
size: this.args.size,
|
|
21
|
+
appearance: this.args.appearance || 'default',
|
|
22
|
+
radius: this.args.radius,
|
|
23
|
+
isDisabled: this.args.isDisabled
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
base: base1({
|
|
27
|
+
class: this.args.class
|
|
28
|
+
}),
|
|
29
|
+
content: content1(),
|
|
30
|
+
dot: dot1(),
|
|
31
|
+
closeButton: closeButton1()
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
_class = Chip;
|
|
36
|
+
setComponentTemplate(precompileTemplate("\n <div class={{this.classNames.base}} ...attributes>\n {{#if @withDot}}\n <span class={{this.classNames.dot}}></span>\n {{/if}}\n <span class={{this.classNames.content}}>\n {{yield}}\n </span>\n {{#if @onClose}}\n <CloseButton @class={{this.classNames.closeButton}} @onClick={{@onClose}} disabled={{@isDisabled}} />\n {{/if}}\n </div>\n ", {
|
|
37
|
+
scope: () => ({
|
|
38
|
+
CloseButton
|
|
39
|
+
}),
|
|
40
|
+
strictMode: true
|
|
41
|
+
}), _class);
|
|
42
|
+
|
|
43
|
+
export { Chip as default };
|
|
44
|
+
//# sourceMappingURL=chip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.js","sources":["../../src/components/chip.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { useStyles } from '@frontile/theme';\nimport CloseButton from '@frontile/core/components/close-button';\nexport interface ChipArgs {\n /**\n * The chip appearance\n *\n * @defaultValue 'default'\n */ appearance?: 'default' | 'outlined' | 'faded';\n /**\n * The intent of the chip\n */ intent?: 'default' | 'primary' | 'success' | 'warning' | 'danger';\n /**\n * The size of the chip\n */ size?: 'sm' | 'md' | 'lg';\n /**\n * The radius the chip\n */ radius?: 'none' | 'sm' | 'lg' | 'full';\n /**\n * Option to add dot to the chip\n */ withDot?: boolean;\n /**\n * Function to be called when clicking on the close button.\n * If you pass this argument, the close button will be visible.\n */ onClose?: () => void;\n /**\n * Disables the clip and disables the close button if any.\n */ isDisabled?: boolean;\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */ class?: string;\n}\nexport interface ChipSignature {\n Args: ChipArgs;\n Blocks: {\n default: [];\n };\n Element: HTMLDivElement;\n}\nexport default class Chip extends Component<ChipSignature> {\n get classNames() {\n const { chip: chip1 } = useStyles();\n const { base: base1, content: content1, dot: dot1, closeButton: closeButton1 } = chip1({\n intent: this.args.intent || 'default',\n size: this.args.size,\n appearance: this.args.appearance || 'default',\n radius: this.args.radius,\n isDisabled: this.args.isDisabled\n });\n return {\n base: base1({\n class: this.args.class\n }),\n content: content1(),\n dot: dot1(),\n closeButton: closeButton1()\n };\n }\n static{\n template(`\n <div class={{this.classNames.base}} ...attributes>\n {{#if @withDot}}\n <span class={{this.classNames.dot}}></span>\n {{/if}}\n <span class={{this.classNames.content}}>\n {{yield}}\n </span>\n {{#if @onClose}}\n <CloseButton\n @class={{this.classNames.closeButton}}\n @onClick={{@onClose}}\n disabled={{@isDisabled}}\n />\n {{/if}}\n </div>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["Chip","Component","classNames","chip","chip1","useStyles","base","base1","content","content1","dot","dot1","closeButton","closeButton1","intent","args","size","appearance","radius","isDisabled","class","_class","setComponentTemplate","precompileTemplate","scope","CloseButton","strictMode"],"mappings":";;;;;;;AAwCe,MAAMA,IAAI,SAASC,SAAS,CAAgB;EACvD,IAAIC,UAAUA,GAAG;IACb,MAAM;AAAEC,MAAAA,IAAI,EAAEC,KAAAA;KAAO,GAAGC,SAAS,EAAE,CAAA;IACnC,MAAM;AAAEC,MAAAA,IAAI,EAAEC,KAAK;AAAEC,MAAAA,OAAO,EAAEC,QAAQ;AAAEC,MAAAA,GAAG,EAAEC,IAAI;AAAEC,MAAAA,WAAW,EAAEC,YAAAA;KAAc,GAAGT,KAAK,CAAC;AACnFU,MAAAA,MAAM,EAAE,IAAI,CAACC,IAAI,CAACD,MAAM,IAAI,SAAS;AACrCE,MAAAA,IAAI,EAAE,IAAI,CAACD,IAAI,CAACC,IAAI;AACpBC,MAAAA,UAAU,EAAE,IAAI,CAACF,IAAI,CAACE,UAAU,IAAI,SAAS;AAC7CC,MAAAA,MAAM,EAAE,IAAI,CAACH,IAAI,CAACG,MAAM;AACxBC,MAAAA,UAAU,EAAE,IAAI,CAACJ,IAAI,CAACI,UAAAA;AAC1B,KAAC,CAAC,CAAA;IACF,OAAO;MACHb,IAAI,EAAEC,KAAK,CAAC;AACRa,QAAAA,KAAK,EAAE,IAAI,CAACL,IAAI,CAACK,KAAAA;AACrB,OAAC,CAAC;MACFZ,OAAO,EAAEC,QAAQ,EAAE;MACnBC,GAAG,EAAEC,IAAI,EAAE;MACXC,WAAW,EAAEC,YAAY,EAAC;KAC7B,CAAA;AACL,GAAA;AAyBJ,CAAA;AAACQ,MAAA,GA3CoBrB,IAAI,CAAA;AAoBjBsB,oBAAA,CAAAC,kBAAA,CAgBH,8YAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA,WAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAL,MAAA,CAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontile/buttons",
|
|
3
|
-
"version": "0.17.0-alpha.
|
|
3
|
+
"version": "0.17.0-alpha.2",
|
|
4
4
|
"description": "Component Library for Ember Octane apps: Buttons",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@embroider/addon-shim": "^1.8.7",
|
|
44
|
-
"@frontile/
|
|
44
|
+
"@frontile/core": "^0.17.0-alpha.2",
|
|
45
|
+
"@frontile/theme": "^0.17.0-alpha.2"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@babel/core": "7.23.6",
|
|
@@ -80,7 +81,8 @@
|
|
|
80
81
|
"type": "addon",
|
|
81
82
|
"main": "addon-main.js",
|
|
82
83
|
"app-js": {
|
|
83
|
-
"./components/button.js": "./dist/_app_/components/button.js"
|
|
84
|
+
"./components/button.js": "./dist/_app_/components/button.js",
|
|
85
|
+
"./components/chip.js": "./dist/_app_/components/chip.js"
|
|
84
86
|
}
|
|
85
87
|
},
|
|
86
88
|
"exports": {
|
|
@@ -101,5 +103,5 @@
|
|
|
101
103
|
]
|
|
102
104
|
}
|
|
103
105
|
},
|
|
104
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "d5fbed6f98dc1b5d3f099ab0e16197e83a1f58fd"
|
|
105
107
|
}
|