@frontile/buttons 0.17.0-alpha.1 → 0.17.0-alpha.3
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/button-group.d.ts +23 -0
- package/declarations/components/button-group.d.ts.map +1 -0
- package/declarations/components/button.d.ts +4 -0
- package/declarations/components/button.d.ts.map +1 -1
- package/declarations/components/chip.d.ts +54 -0
- package/declarations/components/chip.d.ts.map +1 -0
- package/declarations/components/toggle-button.d.ts +27 -0
- package/declarations/components/toggle-button.d.ts.map +1 -0
- package/declarations/index.d.ts +5 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/template-registry.d.ts +6 -0
- package/declarations/template-registry.d.ts.map +1 -1
- package/dist/_app_/components/button-group.js +1 -0
- package/dist/_app_/components/chip.js +1 -0
- package/dist/_app_/components/toggle-button.js +1 -0
- package/dist/components/button-group.js +31 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/button.js +1 -0
- package/dist/components/button.js.map +1 -1
- package/dist/components/chip.js +44 -0
- package/dist/components/chip.js.map +1 -0
- package/dist/components/toggle-button.js +44 -0
- package/dist/components/toggle-button.js.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/package.json +8 -4
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import Button from './button';
|
|
3
|
+
import type { ButtonArgs } from './button';
|
|
4
|
+
import ToggleButton from './toggle-button';
|
|
5
|
+
import type { WithBoundArgs } from '@glint/template';
|
|
6
|
+
export interface ButtonGroupArgs extends Pick<ButtonArgs, 'appearance' | 'intent' | 'size' | 'class'> {
|
|
7
|
+
}
|
|
8
|
+
export interface ButtonGroupSignature {
|
|
9
|
+
Args: ButtonGroupArgs;
|
|
10
|
+
Blocks: {
|
|
11
|
+
default: [
|
|
12
|
+
{
|
|
13
|
+
Button: WithBoundArgs<typeof Button, 'isInGroup'>;
|
|
14
|
+
ToggleButton: WithBoundArgs<typeof ToggleButton, 'isInGroup'>;
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
};
|
|
18
|
+
Element: HTMLDivElement;
|
|
19
|
+
}
|
|
20
|
+
export default class ButtonGroup extends Component<ButtonGroupSignature> {
|
|
21
|
+
get classNames(): string;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=button-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-group.d.ts","sourceRoot":"","sources":["../../src/components/button-group.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAG3C,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,UAAU,EAAE,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;CAAG;AAEzE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE;QACN,OAAO,EAAE;YACP;gBACE,MAAM,EAAE,aAAa,CAAC,OAAO,MAAM,EAAE,WAAW,CAAC,CAAC;gBAClD,YAAY,EAAE,aAAa,CAAC,OAAO,YAAY,EAAE,WAAW,CAAC,CAAC;aAC/D;SACF,CAAC;KACH,CAAC;IACF,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IACtE,IAAI,UAAU,IAAI,MAAM,CAMvB;CAiBF"}
|
|
@@ -28,6 +28,10 @@ export interface ButtonArgs {
|
|
|
28
28
|
* Custom class name, it will override the default ones using Tailwind Merge library.
|
|
29
29
|
*/
|
|
30
30
|
class?: string;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
isInGroup?: boolean;
|
|
31
35
|
}
|
|
32
36
|
export interface ButtonSignature {
|
|
33
37
|
Args: ButtonArgs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components/button.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IAErC;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;IAE3D;;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,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components/button.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IAErC;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;IAE3D;;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,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE;QACN,OAAO,EAAE,CAAC;YAAE,UAAU,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACnC,CAAC;IACF,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC5D,IAAI,IAAI,IAAI,MAAM,CAKjB;IAED,IAAI,UAAU,IAAI,MAAM,CAUvB;CAsBF"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { ButtonArgs } from './button';
|
|
3
|
+
export interface ToggleButtonArgs extends Pick<ButtonArgs, 'intent' | 'size' | 'class' | 'isInGroup'> {
|
|
4
|
+
/**
|
|
5
|
+
* If the button is currently selected
|
|
6
|
+
*
|
|
7
|
+
* @defaultValue false
|
|
8
|
+
*/
|
|
9
|
+
isSelected?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Callback when the buttle is toggled
|
|
12
|
+
*/
|
|
13
|
+
onChange?: (isSelected: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface ToggleButtonSignature {
|
|
16
|
+
Args: ToggleButtonArgs;
|
|
17
|
+
Blocks: {
|
|
18
|
+
default: [];
|
|
19
|
+
};
|
|
20
|
+
Element: HTMLButtonElement;
|
|
21
|
+
}
|
|
22
|
+
export default class ToggleButton extends Component<ToggleButtonSignature> {
|
|
23
|
+
get classNames(): string;
|
|
24
|
+
get isSelected(): boolean;
|
|
25
|
+
onChange: () => void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=toggle-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle-button.d.ts","sourceRoot":"","sources":["../../src/components/toggle-button.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAG3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;IACnE;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,CAAC;KACb,CAAC;IACF,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,SAAS,CAAC,qBAAqB,CAAC;IACxE,IAAI,UAAU,IAAI,MAAM,CAWvB;IAED,IAAI,UAAU,YAEb;IAED,QAAQ,aAIN;CAgBH"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Button } from './components/button';
|
|
2
|
+
export { default as Chip } from './components/chip';
|
|
3
|
+
export { default as ToggleButton } from './components/toggle-button';
|
|
4
|
+
export { default as ButtonGroup } from './components/button-group';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type Button from './components/button';
|
|
2
|
+
import type Chip from './components/chip';
|
|
3
|
+
import type ToggleButton from './components/toggle-button';
|
|
4
|
+
import type ButtonGroup from './components/button-group';
|
|
2
5
|
export default interface Registry {
|
|
3
6
|
Button: typeof Button;
|
|
7
|
+
Chip: typeof Chip;
|
|
8
|
+
ToggleButton: typeof ToggleButton;
|
|
9
|
+
ButtonGroup: typeof ButtonGroup;
|
|
4
10
|
}
|
|
5
11
|
//# sourceMappingURL=template-registry.d.ts.map
|
|
@@ -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;AAC1C,OAAO,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAEzD,MAAM,CAAC,OAAO,WAAW,QAAQ;IAC/B,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,WAAW,EAAE,OAAO,WAAW,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/buttons/components/button-group";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/buttons/components/chip";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/buttons/components/toggle-button";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { hash } from '@ember/helper';
|
|
3
|
+
import { useStyles } from '@frontile/theme';
|
|
4
|
+
import Button from './button.js';
|
|
5
|
+
import ToggleButton from './toggle-button.js';
|
|
6
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
|
+
import { setComponentTemplate } from '@ember/component';
|
|
8
|
+
|
|
9
|
+
var _class;
|
|
10
|
+
class ButtonGroup extends Component {
|
|
11
|
+
get classNames() {
|
|
12
|
+
const {
|
|
13
|
+
buttonGroup: buttonGroup1
|
|
14
|
+
} = useStyles();
|
|
15
|
+
return buttonGroup1({
|
|
16
|
+
class: this.args.class
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
_class = ButtonGroup;
|
|
21
|
+
setComponentTemplate(precompileTemplate("\n <div class={{this.classNames}} role=\"group\" ...attributes>\n {{yield (hash Button=(component Button isInGroup=true appearance=@appearance intent=@intent size=@size) ToggleButton=(component ToggleButton isInGroup=true intent=@intent size=@size))}}\n </div>\n ", {
|
|
22
|
+
scope: () => ({
|
|
23
|
+
hash,
|
|
24
|
+
Button,
|
|
25
|
+
ToggleButton
|
|
26
|
+
}),
|
|
27
|
+
strictMode: true
|
|
28
|
+
}), _class);
|
|
29
|
+
|
|
30
|
+
export { ButtonGroup as default };
|
|
31
|
+
//# sourceMappingURL=button-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-group.js","sources":["../../src/components/button-group.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { useStyles } from '@frontile/theme';\nimport Button from './button';\nimport type { ButtonArgs } from './button';\nimport ToggleButton from './toggle-button';\nimport type { WithBoundArgs } from '@glint/template';\nexport interface ButtonGroupArgs extends Pick<ButtonArgs, 'appearance' | 'intent' | 'size' | 'class'> {\n}\nexport interface ButtonGroupSignature {\n Args: ButtonGroupArgs;\n Blocks: {\n default: [{\n Button: WithBoundArgs<typeof Button, 'isInGroup'>;\n ToggleButton: WithBoundArgs<typeof ToggleButton, 'isInGroup'>;\n }];\n };\n Element: HTMLDivElement;\n}\nexport default class ButtonGroup extends Component<ButtonGroupSignature> {\n get classNames(): string {\n const { buttonGroup: buttonGroup1 } = useStyles();\n return buttonGroup1({\n class: this.args.class\n });\n }\n static{\n template(`\n <div class={{this.classNames}} role=\"group\" ...attributes>\n {{yield (hash\n Button=(component Button isInGroup=true appearance=@appearance intent=@intent size=@size)\n ToggleButton=(component ToggleButton isInGroup=true intent=@intent size=@size)\n )\n }}\n </div>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["ButtonGroup","Component","classNames","buttonGroup","buttonGroup1","useStyles","class","args","_class","setComponentTemplate","precompileTemplate","scope","hash","Button","ToggleButton","strictMode"],"mappings":";;;;;;;;;AAoBe,MAAMA,WAAW,SAASC,SAAS,CAAuB;EACrE,IAAIC,UAAUA,GAAW;IACrB,MAAM;AAAEC,MAAAA,WAAW,EAAEC,YAAAA;KAAc,GAAGC,SAAS,EAAE,CAAA;AACjD,IAAA,OAAOD,YAAY,CAAC;AAChBE,MAAAA,KAAK,EAAE,IAAI,CAACC,IAAI,CAACD,KAAAA;AACrB,KAAC,CAAC,CAAA;AACN,GAAA;AAiBJ,CAAA;AAACE,MAAA,GAvBoBR,WAAW,CAAA;AAQxBS,oBAAA,CAAAC,kBAAA,CAQH,qRAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,IAAA;IAAAC,MAAA;AAAAC,IAAAA,YAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAP,MAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../../src/components/button.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { useStyles } from '@frontile/theme';\nexport interface ButtonArgs {\n /**\n * The HTML type of the button\n *\n * @defaultValue 'button'\n */ type?: 'button' | 'submit' | 'reset';\n /**\n * The button appearance\n *\n * @defaultValue 'default'\n */ appearance?: 'default' | 'outlined' | 'minimal' | 'custom';\n /**\n * The intent of the button\n */ intent?: 'default' | 'primary' | 'success' | 'warning' | 'danger';\n /**\n * The size of the button\n */ size?: 'xs' | 'sm' | 'lg' | 'xl';\n /**\n * Disable rendering the button element. It yields an object with classNames instead.\n */ isRenderless?: boolean;\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */ class?: string;\n}\nexport interface ButtonSignature {\n Args: ButtonArgs;\n Blocks: {\n default: [{\n classNames: string;\n }];\n };\n Element: HTMLButtonElement;\n}\nexport default class Button extends Component<ButtonSignature> {\n get type(): string {\n if (this.args.type) {\n return this.args.type;\n }\n return 'button';\n }\n get classNames(): string {\n const { button: button1 } = useStyles();\n return button1({\n intent: this.args.intent || 'default',\n size: this.args.size,\n appearance: this.args.appearance || 'default',\n class: this.args.class\n });\n }\n static{\n template(`\n {{#if @isRenderless}}\n {{yield (hash classNames=this.classNames)}}\n {{else}}\n <button type={{this.type}} class={{this.classNames}} ...attributes>\n {{yield (hash classNames=this.classNames)}}\n </button>\n {{/if}}\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["Button","Component","type","args","classNames","button","button1","useStyles","intent","size","appearance","class","_class","setComponentTemplate","precompileTemplate","scope","hash","strictMode"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../../src/components/button.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { useStyles } from '@frontile/theme';\nexport interface ButtonArgs {\n /**\n * The HTML type of the button\n *\n * @defaultValue 'button'\n */ type?: 'button' | 'submit' | 'reset';\n /**\n * The button appearance\n *\n * @defaultValue 'default'\n */ appearance?: 'default' | 'outlined' | 'minimal' | 'custom';\n /**\n * The intent of the button\n */ intent?: 'default' | 'primary' | 'success' | 'warning' | 'danger';\n /**\n * The size of the button\n */ size?: 'xs' | 'sm' | 'lg' | 'xl';\n /**\n * Disable rendering the button element. It yields an object with classNames instead.\n */ isRenderless?: boolean;\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */ class?: string;\n /**\n * @internal\n */ isInGroup?: boolean;\n}\nexport interface ButtonSignature {\n Args: ButtonArgs;\n Blocks: {\n default: [{\n classNames: string;\n }];\n };\n Element: HTMLButtonElement;\n}\nexport default class Button extends Component<ButtonSignature> {\n get type(): string {\n if (this.args.type) {\n return this.args.type;\n }\n return 'button';\n }\n get classNames(): string {\n const { button: button1 } = useStyles();\n return button1({\n intent: this.args.intent || 'default',\n size: this.args.size,\n appearance: this.args.appearance || 'default',\n isInGroup: this.args.isInGroup,\n class: this.args.class\n });\n }\n static{\n template(`\n {{#if @isRenderless}}\n {{yield (hash classNames=this.classNames)}}\n {{else}}\n <button type={{this.type}} class={{this.classNames}} ...attributes>\n {{yield (hash classNames=this.classNames)}}\n </button>\n {{/if}}\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["Button","Component","type","args","classNames","button","button1","useStyles","intent","size","appearance","isInGroup","class","_class","setComponentTemplate","precompileTemplate","scope","hash","strictMode"],"mappings":";;;;;;;AAwCe,MAAMA,MAAM,SAASC,SAAS,CAAkB;EAC3D,IAAIC,IAAIA,GAAW;AACf,IAAA,IAAI,IAAI,CAACC,IAAI,CAACD,IAAI,EAAE;AAChB,MAAA,OAAO,IAAI,CAACC,IAAI,CAACD,IAAI,CAAA;AACzB,KAAA;AACA,IAAA,OAAO,QAAQ,CAAA;AACnB,GAAA;EACA,IAAIE,UAAUA,GAAW;IACrB,MAAM;AAAEC,MAAAA,MAAM,EAAEC,OAAAA;KAAS,GAAGC,SAAS,EAAE,CAAA;AACvC,IAAA,OAAOD,OAAO,CAAC;AACXE,MAAAA,MAAM,EAAE,IAAI,CAACL,IAAI,CAACK,MAAM,IAAI,SAAS;AACrCC,MAAAA,IAAI,EAAE,IAAI,CAACN,IAAI,CAACM,IAAI;AACpBC,MAAAA,UAAU,EAAE,IAAI,CAACP,IAAI,CAACO,UAAU,IAAI,SAAS;AAC7CC,MAAAA,SAAS,EAAE,IAAI,CAACR,IAAI,CAACQ,SAAS;AAC9BC,MAAAA,KAAK,EAAE,IAAI,CAACT,IAAI,CAACS,KAAAA;AACrB,KAAC,CAAC,CAAA;AACN,GAAA;AAiBJ,CAAA;AAACC,MAAA,GAjCoBb,MAAM,CAAA;AAkBnBc,oBAAA,CAAAC,kBAAA,CAQH,gQAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA,IAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAL,MAAA,CAAA;;;;"}
|
|
@@ -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;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { on } from '@ember/modifier';
|
|
4
|
+
import { useStyles } from '@frontile/theme';
|
|
5
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
6
|
+
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
|
|
8
|
+
var _class;
|
|
9
|
+
class ToggleButton extends Component {
|
|
10
|
+
constructor(...args) {
|
|
11
|
+
super(...args);
|
|
12
|
+
_defineProperty(this, "onChange", () => {
|
|
13
|
+
if (typeof this.args.onChange === 'function') {
|
|
14
|
+
this.args.onChange(!this.isSelected);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
get classNames() {
|
|
19
|
+
const {
|
|
20
|
+
toggleButton: toggleButton1
|
|
21
|
+
} = useStyles();
|
|
22
|
+
return toggleButton1({
|
|
23
|
+
intent: this.args.intent || 'default',
|
|
24
|
+
size: this.args.size,
|
|
25
|
+
appearance: 'outlined',
|
|
26
|
+
isSelected: this.isSelected,
|
|
27
|
+
isInGroup: this.args.isInGroup,
|
|
28
|
+
class: this.args.class
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
get isSelected() {
|
|
32
|
+
return !!this.args.isSelected;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
_class = ToggleButton;
|
|
36
|
+
setComponentTemplate(precompileTemplate("\n <button type=\"button\" {{on \"click\" this.onChange}} class={{this.classNames}} aria-pressed=\"{{this.isSelected}}\" ...attributes>\n {{yield}}\n </button>\n ", {
|
|
37
|
+
scope: () => ({
|
|
38
|
+
on
|
|
39
|
+
}),
|
|
40
|
+
strictMode: true
|
|
41
|
+
}), _class);
|
|
42
|
+
|
|
43
|
+
export { ToggleButton as default };
|
|
44
|
+
//# sourceMappingURL=toggle-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle-button.js","sources":["../../src/components/toggle-button.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { on } from '@ember/modifier';\nimport { useStyles } from '@frontile/theme';\nimport type { ButtonArgs } from './button';\nexport interface ToggleButtonArgs extends Pick<ButtonArgs, 'intent' | 'size' | 'class' | 'isInGroup'> {\n /**\n * If the button is currently selected\n *\n * @defaultValue false\n */ isSelected?: boolean;\n /**\n * Callback when the buttle is toggled\n */ onChange?: (isSelected: boolean) => void;\n}\nexport interface ToggleButtonSignature {\n Args: ToggleButtonArgs;\n Blocks: {\n default: [];\n };\n Element: HTMLButtonElement;\n}\nexport default class ToggleButton extends Component<ToggleButtonSignature> {\n get classNames(): string {\n const { toggleButton: toggleButton1 } = useStyles();\n return toggleButton1({\n intent: this.args.intent || 'default',\n size: this.args.size,\n appearance: 'outlined',\n isSelected: this.isSelected,\n isInGroup: this.args.isInGroup,\n class: this.args.class\n });\n }\n get isSelected() {\n return !!this.args.isSelected;\n }\n onChange = ()=>{\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(!this.isSelected);\n }\n };\n static{\n template(`\n <button\n type=\"button\"\n {{on 'click' this.onChange}}\n class={{this.classNames}}\n aria-pressed=\"{{this.isSelected}}\"\n ...attributes\n >\n {{yield}}\n </button>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["ToggleButton","Component","constructor","args","_defineProperty","onChange","isSelected","classNames","toggleButton","toggleButton1","useStyles","intent","size","appearance","isInGroup","class","_class","setComponentTemplate","precompileTemplate","scope","on","strictMode"],"mappings":";;;;;;;;AAsBe,MAAMA,YAAY,SAASC,SAAS,CAAwB;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,eAAA,mBAe5D,MAAI;MACX,IAAI,OAAO,IAAI,CAACD,IAAI,CAACE,QAAQ,KAAK,UAAU,EAAE;QAC1C,IAAI,CAACF,IAAI,CAACE,QAAQ,CAAC,CAAC,IAAI,CAACC,UAAU,CAAC,CAAA;AACxC,OAAA;KACH,CAAA,CAAA;AAAA,GAAA;EAlBD,IAAIC,UAAUA,GAAW;IACrB,MAAM;AAAEC,MAAAA,YAAY,EAAEC,aAAAA;KAAe,GAAGC,SAAS,EAAE,CAAA;AACnD,IAAA,OAAOD,aAAa,CAAC;AACjBE,MAAAA,MAAM,EAAE,IAAI,CAACR,IAAI,CAACQ,MAAM,IAAI,SAAS;AACrCC,MAAAA,IAAI,EAAE,IAAI,CAACT,IAAI,CAACS,IAAI;AACpBC,MAAAA,UAAU,EAAE,UAAU;MACtBP,UAAU,EAAE,IAAI,CAACA,UAAU;AAC3BQ,MAAAA,SAAS,EAAE,IAAI,CAACX,IAAI,CAACW,SAAS;AAC9BC,MAAAA,KAAK,EAAE,IAAI,CAACZ,IAAI,CAACY,KAAAA;AACrB,KAAC,CAAC,CAAA;AACN,GAAA;EACA,IAAIT,UAAUA,GAAG;AACb,IAAA,OAAO,CAAC,CAAC,IAAI,CAACH,IAAI,CAACG,UAAU,CAAA;AACjC,GAAA;AAwBJ,CAAA;AAACU,MAAA,GAtCoBhB,YAAY,CAAA;AAqBzBiB,oBAAA,CAAAC,kBAAA,CAUH,gLAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA,EAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAL,MAAA,CAAA;;;;"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Button } from './components/button.js';
|
|
2
|
+
export { default as Chip } from './components/chip.js';
|
|
3
|
+
export { default as ToggleButton } from './components/toggle-button.js';
|
|
4
|
+
export { default as ButtonGroup } from './components/button-group.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
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.3",
|
|
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.3",
|
|
45
|
+
"@frontile/theme": "^0.17.0-alpha.3"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@babel/core": "7.23.6",
|
|
@@ -80,7 +81,10 @@
|
|
|
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-group.js": "./dist/_app_/components/button-group.js",
|
|
85
|
+
"./components/button.js": "./dist/_app_/components/button.js",
|
|
86
|
+
"./components/chip.js": "./dist/_app_/components/chip.js",
|
|
87
|
+
"./components/toggle-button.js": "./dist/_app_/components/toggle-button.js"
|
|
84
88
|
}
|
|
85
89
|
},
|
|
86
90
|
"exports": {
|
|
@@ -101,5 +105,5 @@
|
|
|
101
105
|
]
|
|
102
106
|
}
|
|
103
107
|
},
|
|
104
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "cbbf2e3bd1777b38e3da69cfe32f903bb1a05827"
|
|
105
109
|
}
|