@mgremy/ng-primitives 0.10.0 → 0.11.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.
- package/fesm2022/mgremy-ng-primitives-switch.mjs +58 -0
- package/fesm2022/mgremy-ng-primitives-switch.mjs.map +1 -0
- package/package.json +5 -1
- package/switch/README.md +4 -0
- package/theme/components/switch.css +44 -0
- package/theme/ngp_tw.css +1 -0
- package/types/mgremy-ng-primitives-switch.d.ts +17 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Directive } from '@angular/core';
|
|
3
|
+
import { NgpSwitch, NgpSwitchThumb } from 'ng-primitives/switch';
|
|
4
|
+
|
|
5
|
+
const options$1 = ['ngpSwitch'];
|
|
6
|
+
const error$1 = new Error(`MgnpSwitch must be used with ${options$1.join(' / ')}`);
|
|
7
|
+
class MgnpSwitch {
|
|
8
|
+
_ngpSwitch = inject(NgpSwitch, { optional: true });
|
|
9
|
+
constructor() {
|
|
10
|
+
if (!this._ngpSwitch) {
|
|
11
|
+
console.error(this);
|
|
12
|
+
throw error$1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MgnpSwitch, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
16
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: MgnpSwitch, isStandalone: true, selector: "[ngpSwitch][mgnpSwitch]", host: { attributes: { "data-mgnp-component": "mgnp-switch" } }, ngImport: i0 });
|
|
17
|
+
}
|
|
18
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MgnpSwitch, decorators: [{
|
|
19
|
+
type: Directive,
|
|
20
|
+
args: [{
|
|
21
|
+
selector: '[ngpSwitch][mgnpSwitch]',
|
|
22
|
+
standalone: true,
|
|
23
|
+
host: {
|
|
24
|
+
'data-mgnp-component': 'mgnp-switch',
|
|
25
|
+
},
|
|
26
|
+
}]
|
|
27
|
+
}], ctorParameters: () => [] });
|
|
28
|
+
|
|
29
|
+
const options = ['ngpSwitchThumb'];
|
|
30
|
+
const error = new Error(`MgnpSwitchThumb must be used with ${options.join(' / ')}`);
|
|
31
|
+
class MgnpSwitchThumb {
|
|
32
|
+
_ngpSwitchThumb = inject(NgpSwitchThumb, { optional: true });
|
|
33
|
+
constructor() {
|
|
34
|
+
if (!this._ngpSwitchThumb) {
|
|
35
|
+
console.error(this);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MgnpSwitchThumb, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
40
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: MgnpSwitchThumb, isStandalone: true, selector: "[ngpSwitchThumb][mgnpSwitchThumb]", host: { attributes: { "data-mgnp-component": "mgnp-switch-thumb" } }, ngImport: i0 });
|
|
41
|
+
}
|
|
42
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MgnpSwitchThumb, decorators: [{
|
|
43
|
+
type: Directive,
|
|
44
|
+
args: [{
|
|
45
|
+
selector: '[ngpSwitchThumb][mgnpSwitchThumb]',
|
|
46
|
+
standalone: true,
|
|
47
|
+
host: {
|
|
48
|
+
'data-mgnp-component': 'mgnp-switch-thumb',
|
|
49
|
+
},
|
|
50
|
+
}]
|
|
51
|
+
}], ctorParameters: () => [] });
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Generated bundle index. Do not edit.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
export { MgnpSwitch, MgnpSwitchThumb };
|
|
58
|
+
//# sourceMappingURL=mgremy-ng-primitives-switch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mgremy-ng-primitives-switch.mjs","sources":["../../../../libs/ng-primitives/switch/src/lib/mgnp-switch/mgnp-switch.directive.ts","../../../../libs/ng-primitives/switch/src/lib/mgnp-switch-thumb/mgnp-switch-thumb.directive.ts","../../../../libs/ng-primitives/switch/src/mgremy-ng-primitives-switch.ts"],"sourcesContent":["import { Directive, inject } from '@angular/core';\nimport { NgpSwitch } from 'ng-primitives/switch';\n\nconst options = ['ngpSwitch'];\n\nconst error = new Error(`MgnpSwitch must be used with ${options.join(' / ')}`);\n\n@Directive({\n selector: '[ngpSwitch][mgnpSwitch]',\n standalone: true,\n host: {\n 'data-mgnp-component': 'mgnp-switch',\n },\n})\nexport class MgnpSwitch {\n private readonly _ngpSwitch = inject(NgpSwitch, { optional: true });\n\n constructor() {\n if (!this._ngpSwitch) {\n console.error(this);\n throw error;\n }\n }\n}\n","import { Directive, inject } from '@angular/core';\nimport { NgpSwitchThumb } from 'ng-primitives/switch';\n\nconst options = ['ngpSwitchThumb'];\n\nconst error = new Error(`MgnpSwitchThumb must be used with ${options.join(' / ')}`);\n\n@Directive({\n selector: '[ngpSwitchThumb][mgnpSwitchThumb]',\n standalone: true,\n host: {\n 'data-mgnp-component': 'mgnp-switch-thumb',\n },\n})\nexport class MgnpSwitchThumb {\n private readonly _ngpSwitchThumb = inject(NgpSwitchThumb, { optional: true });\n\n constructor() {\n if (!this._ngpSwitchThumb) {\n console.error(this);\n throw error;\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["options","error"],"mappings":";;;;AAGA,MAAMA,SAAO,GAAG,CAAC,WAAW,CAAC;AAE7B,MAAMC,OAAK,GAAG,IAAI,KAAK,CAAC,CAAA,6BAAA,EAAgCD,SAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA,CAAE,CAAC;MASjE,UAAU,CAAA;IACJ,UAAU,GAAG,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f,eAAe,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mCAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,qBAAA,EAAA,mBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAP3B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mCAAmC;AAC7C,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACJ,wBAAA,qBAAqB,EAAE,mBAAmB;AAC3C,qBAAA;AACF,iBAAA;;;ACbD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgremy/ng-primitives",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://doc.mgremy.xyz/ng-primitives",
|
|
6
6
|
"publishConfig": {
|
|
@@ -57,6 +57,10 @@
|
|
|
57
57
|
"types": "./types/mgremy-ng-primitives-pagination.d.ts",
|
|
58
58
|
"default": "./fesm2022/mgremy-ng-primitives-pagination.mjs"
|
|
59
59
|
},
|
|
60
|
+
"./switch": {
|
|
61
|
+
"types": "./types/mgremy-ng-primitives-switch.d.ts",
|
|
62
|
+
"default": "./fesm2022/mgremy-ng-primitives-switch.mjs"
|
|
63
|
+
},
|
|
60
64
|
"./toast": {
|
|
61
65
|
"types": "./types/mgremy-ng-primitives-toast.d.ts",
|
|
62
66
|
"default": "./fesm2022/mgremy-ng-primitives-toast.mjs"
|
package/switch/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@utility mgnp-switch {
|
|
2
|
+
position: relative;
|
|
3
|
+
outline: none;
|
|
4
|
+
border-radius: calc(infinity* 1px);
|
|
5
|
+
background-color: var(--mg-background-ui-secondary);
|
|
6
|
+
border: 1px solid var(--mg-border-ui);
|
|
7
|
+
width: --spacing(10);
|
|
8
|
+
height: --spacing(6);
|
|
9
|
+
padding: --spacing(0);
|
|
10
|
+
|
|
11
|
+
@variant data-focus-visible {
|
|
12
|
+
outline: 2px solid var(--mg-ring-ui);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@variant data-checked {
|
|
16
|
+
background-color: var(--mg-background-ui-active);
|
|
17
|
+
border-color: var(--mg-border-ui-secondary);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@utility mgnp-switch-thumb {
|
|
22
|
+
display: block;
|
|
23
|
+
outline: none;
|
|
24
|
+
border-radius: calc(infinity* 1px);
|
|
25
|
+
background-color: var(--mg-background-ui);
|
|
26
|
+
box-shadow: var(--ngp-button-shadow);
|
|
27
|
+
width: --spacing(4);
|
|
28
|
+
height: --spacing(4);
|
|
29
|
+
margin-left: --spacing(1);
|
|
30
|
+
|
|
31
|
+
@variant data-checked {
|
|
32
|
+
transform: translateX(--spacing(4));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@layer base {
|
|
37
|
+
[mgnpSwitch][data-mgnp-component='mgnp-switch'] {
|
|
38
|
+
@apply mgnp-switch transition;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[mgnpSwitchThumb][data-mgnp-component='mgnp-switch-thumb'] {
|
|
42
|
+
@apply mgnp-switch-thumb transition;
|
|
43
|
+
}
|
|
44
|
+
}
|
package/theme/ngp_tw.css
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
|
|
3
|
+
declare class MgnpSwitch {
|
|
4
|
+
private readonly _ngpSwitch;
|
|
5
|
+
constructor();
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MgnpSwitch, never>;
|
|
7
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MgnpSwitch, "[ngpSwitch][mgnpSwitch]", never, {}, {}, never, never, true, never>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare class MgnpSwitchThumb {
|
|
11
|
+
private readonly _ngpSwitchThumb;
|
|
12
|
+
constructor();
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MgnpSwitchThumb, never>;
|
|
14
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MgnpSwitchThumb, "[ngpSwitchThumb][mgnpSwitchThumb]", never, {}, {}, never, never, true, never>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { MgnpSwitch, MgnpSwitchThumb };
|