@frontile/buttons 0.17.0 → 0.18.0-alpha.0
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.
|
@@ -12,11 +12,11 @@ export interface ButtonArgs {
|
|
|
12
12
|
*
|
|
13
13
|
* @defaultValue 'default'
|
|
14
14
|
*/
|
|
15
|
-
appearance?: 'default' | 'outlined' | 'minimal' | 'custom';
|
|
15
|
+
appearance?: 'default' | 'outlined' | 'minimal' | 'tonal' | 'custom';
|
|
16
16
|
/**
|
|
17
17
|
* The intent of the button
|
|
18
18
|
*/
|
|
19
|
-
intent?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
|
|
19
|
+
intent?: 'default' | 'primary' | 'accent' | 'success' | 'warning' | 'danger';
|
|
20
20
|
/**
|
|
21
21
|
* The size of the button
|
|
22
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../../src/components/button.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { tracked } from '@glimmer/tracking';\nimport { useStyles } from '@frontile/theme';\nimport { press, type PressEvent } from '@frontile/utilities';\n\nexport interface ButtonArgs {\n /**\n * The HTML type of the button\n *\n * @defaultValue 'button'\n */\n type?: 'button' | 'submit' | 'reset';\n\n /**\n * The button appearance\n *\n * @defaultValue 'default'\n */\n appearance?: 'default' | 'outlined' | 'minimal' | 'custom';\n\n /**\n * The intent of the button\n */\n intent?: 'default' | 'primary' | 'success' | 'warning' | 'danger';\n\n /**\n * The size of the button\n */\n size?: 'xs' | 'sm' | 'lg' | 'xl';\n\n /**\n * Disable rendering the button element. It yields an object with classNames instead.\n */\n isRenderless?: boolean;\n\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */\n class?: string;\n\n /**\n * If button is part of a group. Most of the time, this is automatically set\n * when using the ButtonGroup component.\n */\n isInGroup?: boolean;\n\n /**\n * Callback for when the button is pressed.\n */\n onPress?: (event: PressEvent) => void;\n}\n\ninterface ButtonSignature {\n Args: ButtonArgs;\n Blocks: {\n default: [{ classNames: string }];\n };\n Element: HTMLButtonElement;\n}\n\nclass Button extends Component<ButtonSignature> {\n @tracked isPressed = false;\n\n get type(): string {\n if (this.args.type) {\n return this.args.type;\n }\n return 'button';\n }\n\n get classNames(): string {\n const { button } = useStyles();\n\n return button({\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\n handlePressChange = (isPressed: boolean): void => {\n this.isPressed = isPressed;\n };\n\n onPress = (event: PressEvent) => {\n if (typeof this.args.onPress === 'function') {\n this.args.onPress(event);\n }\n };\n\n <template>\n {{#if @isRenderless}}\n {{yield (hash classNames=this.classNames)}}\n {{else}}\n <button\n type={{this.type}}\n class={{this.classNames}}\n data-pressed={{if this.isPressed \"true\"}}\n {{press this.onPress onPressChange=this.handlePressChange}}\n ...attributes\n >\n {{yield (hash classNames=this.classNames)}}\n </button>\n {{/if}}\n </template>\n}\n\nexport { Button, type ButtonSignature };\nexport default Button;\n"],"names":["Button","Component","g","prototype","tracked","i","void 0","type","args","classNames","button","useStyles","intent","size","appearance","isInGroup","class","handlePressChange","isPressed","onPress","event","setComponentTemplate","precompileTemplate","strictMode","scope","hash","press"],"mappings":";;;;;;;;;AA6DA,MAAMA,eAAeC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CAC5BC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;AAAA,EAAA,UAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAAC,MAAA;EAErB,IAAIC,IAAAA,GAAe;AACjB,IAAA,IAAI,IAAI,CAACC,IAAI,CAACD,IAAI,EAAE;AAClB,MAAA,OAAO,IAAI,CAACC,IAAI,CAACD,IAAI;AACvB,IAAA;AACA,IAAA,OAAO,QAAA;AACT,EAAA;EAEA,IAAIE,UAAAA,GAAqB;IACvB,MAAM;AAAEC,MAAAA;KAAQ,GAAGC,SAAA,EAAA;AAEnB,IAAA,OAAOD,MAAA,CAAO;AACZE,MAAAA,MAAA,EAAQ,IAAI,CAACJ,IAAI,CAACI,MAAM,IAAI,SAAA;AAC5BC,MAAAA,IAAA,EAAM,IAAI,CAACL,IAAI,CAACK,IAAI;AACpBC,MAAAA,UAAA,EAAY,IAAI,CAACN,IAAI,CAACM,UAAU,IAAI,SAAA;AACpCC,MAAAA,SAAA,EAAW,IAAI,CAACP,IAAI,CAACO,SAAS;AAC9BC,MAAAA,KAAA,EAAO,IAAI,CAACR,IAAI,CAACQ;AACnB,KAAA,CAAA;AACF,EAAA;EAEAC,iBAAA,GAAqBC,SAAkB,IAAO;IAC5C,IAAI,CAACA,SAAS,GAAGA,SAAA;EACnB,CAAA;EAEAC,OAAA,GAAWC,KAAO,IAAA;IAChB,IAAI,OAAO,IAAI,CAACZ,IAAI,CAACW,OAAO,KAAK,UAAA,EAAY;AAC3C,MAAA,IAAI,CAACX,IAAI,CAACW,OAAO,CAACC,KAAA,CAAA;AACpB,IAAA;EACF,CAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,wWAAA,EAcA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../../src/components/button.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { tracked } from '@glimmer/tracking';\nimport { useStyles } from '@frontile/theme';\nimport { press, type PressEvent } from '@frontile/utilities';\n\nexport interface ButtonArgs {\n /**\n * The HTML type of the button\n *\n * @defaultValue 'button'\n */\n type?: 'button' | 'submit' | 'reset';\n\n /**\n * The button appearance\n *\n * @defaultValue 'default'\n */\n appearance?: 'default' | 'outlined' | 'minimal' | 'tonal' | 'custom';\n\n /**\n * The intent of the button\n */\n intent?: 'default' | 'primary' | 'accent' | 'success' | 'warning' | 'danger';\n\n /**\n * The size of the button\n */\n size?: 'xs' | 'sm' | 'lg' | 'xl';\n\n /**\n * Disable rendering the button element. It yields an object with classNames instead.\n */\n isRenderless?: boolean;\n\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */\n class?: string;\n\n /**\n * If button is part of a group. Most of the time, this is automatically set\n * when using the ButtonGroup component.\n */\n isInGroup?: boolean;\n\n /**\n * Callback for when the button is pressed.\n */\n onPress?: (event: PressEvent) => void;\n}\n\ninterface ButtonSignature {\n Args: ButtonArgs;\n Blocks: {\n default: [{ classNames: string }];\n };\n Element: HTMLButtonElement;\n}\n\nclass Button extends Component<ButtonSignature> {\n @tracked isPressed = false;\n\n get type(): string {\n if (this.args.type) {\n return this.args.type;\n }\n return 'button';\n }\n\n get classNames(): string {\n const { button } = useStyles();\n\n return button({\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\n handlePressChange = (isPressed: boolean): void => {\n this.isPressed = isPressed;\n };\n\n onPress = (event: PressEvent) => {\n if (typeof this.args.onPress === 'function') {\n this.args.onPress(event);\n }\n };\n\n <template>\n {{#if @isRenderless}}\n {{yield (hash classNames=this.classNames)}}\n {{else}}\n <button\n type={{this.type}}\n class={{this.classNames}}\n data-pressed={{if this.isPressed \"true\"}}\n {{press this.onPress onPressChange=this.handlePressChange}}\n ...attributes\n >\n {{yield (hash classNames=this.classNames)}}\n </button>\n {{/if}}\n </template>\n}\n\nexport { Button, type ButtonSignature };\nexport default Button;\n"],"names":["Button","Component","g","prototype","tracked","i","void 0","type","args","classNames","button","useStyles","intent","size","appearance","isInGroup","class","handlePressChange","isPressed","onPress","event","setComponentTemplate","precompileTemplate","strictMode","sc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wWAAA,EAcA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chip.js","sources":["../../src/components/chip.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles } from '@frontile/theme';\nimport { CloseButton } from './close-button';\n\ninterface ChipSignature {\n Args: {\n /**\n * The chip appearance\n *\n * @defaultValue 'default'\n */\n appearance?: 'default' | 'outlined' | 'faded';\n\n /**\n * The intent of the chip\n */\n intent
|
|
1
|
+
{"version":3,"file":"chip.js","sources":["../../src/components/chip.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles } from '@frontile/theme';\nimport { CloseButton } from './close-button';\n\ninterface ChipSignature {\n Args: {\n /**\n * The chip appearance\n *\n * @defaultValue 'default'\n */\n appearance?: 'default' | 'outlined' | 'faded';\n\n /**\n * The intent of the chip\n */\n intent?:\n | 'default'\n | 'primary'\n | 'accent'\n | 'success'\n | 'warning'\n | 'danger';\n\n /**\n * The size of the chip\n */\n size?: 'sm' | 'md' | 'lg';\n\n /**\n * The radius the chip\n */\n radius?: 'none' | 'sm' | 'lg' | 'full';\n\n /**\n * Option to add dot to the chip\n */\n withDot?: boolean;\n\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 */\n onClose?: () => void;\n\n /**\n * Disables the clip and disables the close button if any.\n */\n isDisabled?: boolean;\n\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */\n class?: string;\n };\n Blocks: {\n default: [];\n };\n Element: HTMLDivElement;\n}\n\nclass Chip extends Component<ChipSignature> {\n get classNames() {\n const { chip } = useStyles();\n\n const { base, content, dot, closeButton } = chip({\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\n return {\n base: base({ class: this.args.class }),\n content: content(),\n dot: dot(),\n closeButton: closeButton()\n };\n }\n\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 </template>\n}\n\nexport { Chip, type ChipSignature };\nexport default Chip;\n"],"names":["Chip","Component","classNames","chip","useStyles","base","content","dot","closeButton","intent","args","size","appearance","radius","isDisabled","class","setComponentTemplate","precompileTemplate","strictMode","scope","CloseButton"],"mappings":";;;;;;AA6DA,MAAMA,aAAaC,SAAA,CAAU;EAC3B,IAAIC,UAAAA,GAAa;IACf,MAAM;AAAEC,MAAAA;KAAM,GAAGC,SAAA,EAAA;IAEjB,MAAM;MAAEC,IAAI;MAAEC,OAAO;MAAEC,GAAG;AAAEC,MAAAA;KAAa,GAAGL,IAAA,CAAK;AAC/CM,MAAAA,MAAA,EAAQ,IAAI,CAACC,IAAI,CAACD,MAAM,IAAI,SAAA;AAC5BE,MAAAA,IAAA,EAAM,IAAI,CAACD,IAAI,CAACC,IAAI;AACpBC,MAAAA,UAAA,EAAY,IAAI,CAACF,IAAI,CAACE,UAAU,IAAI,SAAA;AACpCC,MAAAA,MAAA,EAAQ,IAAI,CAACH,IAAI,CAACG,MAAM;AACxBC,MAAAA,UAAA,EAAY,IAAI,CAACJ,IAAI,CAACI;AACxB,KAAA,CAAA;IAEA,OAAO;MACLT,IAAA,EAAMA,IAAA,CAAK;AAAEU,QAAAA,KAAA,EAAO,IAAI,CAACL,IAAI,CAACK;AAAM,OAAA,CAAA;MACpCT,OAAA,EAASA,OAAA,EAAA;MACTC,GAAA,EAAKA,GAAA,EAAA;MACLC,WAAA,EAAaA,WAAA;KACf;AACF,EAAA;AAEA,EAAA;IAAAQ,oBAAA,CAAAC,kBAAA,CAAA,8YAAA,EAgBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontile/buttons",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0-alpha.0",
|
|
4
4
|
"description": "Component Library for Ember Octane apps: Buttons",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -36,25 +36,10 @@
|
|
|
36
36
|
"declarations",
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "rollup --config",
|
|
41
|
-
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
|
|
42
|
-
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
|
|
43
|
-
"lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
|
|
44
|
-
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
|
|
45
|
-
"lint:js": "eslint . --cache",
|
|
46
|
-
"lint:js:fix": "eslint . --fix",
|
|
47
|
-
"lint:types": "glint",
|
|
48
|
-
"prepack": "concurrently 'npm:build'",
|
|
49
|
-
"start": "concurrently 'npm:start:*'",
|
|
50
|
-
"start:js": "rollup --config --watch --no-watch.clearScreen",
|
|
51
|
-
"start:types": "glint -d --watch",
|
|
52
|
-
"test": "echo 'A v2 addon does not have tests, run tests in test-app'"
|
|
53
|
-
},
|
|
54
39
|
"dependencies": {
|
|
55
40
|
"@embroider/addon-shim": "^1.9.0",
|
|
56
|
-
"@frontile/theme": "0.
|
|
57
|
-
"@frontile/utilities": "0.
|
|
41
|
+
"@frontile/theme": "0.18.0-alpha.0",
|
|
42
|
+
"@frontile/utilities": "0.18.0-alpha.0"
|
|
58
43
|
},
|
|
59
44
|
"devDependencies": {
|
|
60
45
|
"@babel/core": "7.26.7",
|
|
@@ -104,5 +89,18 @@
|
|
|
104
89
|
"./components/toggle-button.js": "./dist/_app_/components/toggle-button.js"
|
|
105
90
|
}
|
|
106
91
|
},
|
|
107
|
-
"
|
|
108
|
-
|
|
92
|
+
"scripts": {
|
|
93
|
+
"build": "rollup --config",
|
|
94
|
+
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
|
|
95
|
+
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
|
|
96
|
+
"lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
|
|
97
|
+
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
|
|
98
|
+
"lint:js": "eslint . --cache",
|
|
99
|
+
"lint:js:fix": "eslint . --fix",
|
|
100
|
+
"lint:types": "glint",
|
|
101
|
+
"start": "concurrently 'npm:start:*'",
|
|
102
|
+
"start:js": "rollup --config --watch --no-watch.clearScreen",
|
|
103
|
+
"start:types": "glint -d --watch",
|
|
104
|
+
"test": "echo 'A v2 addon does not have tests, run tests in test-app'"
|
|
105
|
+
}
|
|
106
|
+
}
|