@pindoba/core-checkbox 0.0.0-alpha-20260320034942
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/LICENSE +12 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/src/connect-checkbox.d.ts +12 -0
- package/dist/src/connect-checkbox.d.ts.map +1 -0
- package/dist/src/connect-checkbox.js +42 -0
- package/dist/src/connect-checkbox.js.map +1 -0
- package/dist/src/types.d.ts +40 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +1 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright 2025 Eduardo Lopes
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
8
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
9
|
+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
|
10
|
+
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
11
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
12
|
+
DEALINGS IN THE SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CheckboxApi, CheckboxBaseProps, CheckboxInputProps, CheckboxPassThrough, CheckboxRootProps, ConnectCheckboxOptions, ElementAttributes } from "./src/types.js";
|
|
2
|
+
import { checkboxDefaults, connectCheckbox } from "./src/connect-checkbox.js";
|
|
3
|
+
export { type CheckboxApi, type CheckboxBaseProps, type CheckboxInputProps, type CheckboxPassThrough, type CheckboxRootProps, type ConnectCheckboxOptions, type ElementAttributes, checkboxDefaults, connectCheckbox };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CheckboxApi, ConnectCheckboxOptions } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/connect-checkbox.d.ts
|
|
4
|
+
declare const checkboxDefaults: {
|
|
5
|
+
readonly appearance: "checkbox";
|
|
6
|
+
readonly size: "md";
|
|
7
|
+
readonly feedback: "primary";
|
|
8
|
+
};
|
|
9
|
+
declare function connectCheckbox(options: ConnectCheckboxOptions): CheckboxApi;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { checkboxDefaults, connectCheckbox };
|
|
12
|
+
//# sourceMappingURL=connect-checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-checkbox.d.ts","names":[],"sources":["../../src/connect-checkbox.ts"],"mappings":";;;cAUa,gBAAA;EAAA;;;;iBAMG,eAAA,CAAgB,OAAA,EAAS,sBAAA,GAAyB,WAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { css } from "@pindoba/styled-system/css";
|
|
2
|
+
import { checkboxStyles } from "@pindoba/styles-checkbox";
|
|
3
|
+
//#region src/connect-checkbox.ts
|
|
4
|
+
const checkboxDefaults = {
|
|
5
|
+
appearance: "checkbox",
|
|
6
|
+
size: "md",
|
|
7
|
+
feedback: "primary"
|
|
8
|
+
};
|
|
9
|
+
function connectCheckbox(options) {
|
|
10
|
+
const { appearance = checkboxDefaults.appearance, size = checkboxDefaults.size, fullWidth, background, feedback: feedbackProp, passThrough, class: className, id, disabled, required, checked, ...restProps } = options;
|
|
11
|
+
const resolvedFeedback = feedbackProp ?? checkboxDefaults.feedback;
|
|
12
|
+
const classes = checkboxStyles.raw({
|
|
13
|
+
appearance,
|
|
14
|
+
size,
|
|
15
|
+
fullWidth,
|
|
16
|
+
background,
|
|
17
|
+
feedback: resolvedFeedback
|
|
18
|
+
});
|
|
19
|
+
const rootGeneratedClass = css(classes.root, passThrough?.root?.style);
|
|
20
|
+
const userClass = className != null ? String(className) : void 0;
|
|
21
|
+
return {
|
|
22
|
+
rootProps: {
|
|
23
|
+
...restProps,
|
|
24
|
+
...passThrough?.root?.props,
|
|
25
|
+
"data-component": "checkbox",
|
|
26
|
+
class: userClass ? `${rootGeneratedClass} ${userClass}` : rootGeneratedClass
|
|
27
|
+
},
|
|
28
|
+
inputProps: {
|
|
29
|
+
id,
|
|
30
|
+
disabled,
|
|
31
|
+
required,
|
|
32
|
+
checked,
|
|
33
|
+
...passThrough?.input?.props,
|
|
34
|
+
class: css(classes.input, passThrough?.input?.style)
|
|
35
|
+
},
|
|
36
|
+
id
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { checkboxDefaults, connectCheckbox };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=connect-checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-checkbox.js","names":[],"sources":["../../src/connect-checkbox.ts"],"sourcesContent":["import { css } from \"@pindoba/styled-system/css\";\nimport { checkboxStyles } from \"@pindoba/styles-checkbox\";\nimport type {\n ConnectCheckboxOptions,\n CheckboxApi,\n CheckboxRootProps,\n CheckboxInputProps,\n CheckboxBaseProps,\n} from \"./types.js\";\n\nexport const checkboxDefaults = {\n appearance: \"checkbox\",\n size: \"md\",\n feedback: \"primary\",\n} as const satisfies Partial<CheckboxBaseProps>;\n\nexport function connectCheckbox(options: ConnectCheckboxOptions): CheckboxApi {\n const {\n appearance = checkboxDefaults.appearance,\n size = checkboxDefaults.size,\n fullWidth,\n background,\n feedback: feedbackProp,\n passThrough,\n class: className,\n id,\n // Input-specific attributes — must go on <input>, not <label>\n disabled,\n required,\n checked,\n ...restProps\n } = options;\n\n const resolvedFeedback = feedbackProp ?? checkboxDefaults.feedback;\n\n const classes = checkboxStyles.raw({\n appearance,\n size,\n fullWidth,\n background,\n feedback: resolvedFeedback,\n });\n\n const rootGeneratedClass = css(classes.root, passThrough?.root?.style);\n const userClass = className != null ? String(className) : undefined;\n\n const rootProps: CheckboxRootProps = {\n ...restProps,\n ...passThrough?.root?.props,\n \"data-component\": \"checkbox\",\n class: userClass\n ? `${rootGeneratedClass} ${userClass}`\n : rootGeneratedClass,\n };\n\n const inputProps: CheckboxInputProps = {\n id,\n disabled,\n required,\n checked,\n ...passThrough?.input?.props,\n class: css(classes.input, passThrough?.input?.style),\n };\n\n return { rootProps, inputProps, id };\n}\n"],"mappings":";;;AAUA,MAAa,mBAAmB;CAC9B,YAAY;CACZ,MAAM;CACN,UAAU;CACX;AAED,SAAgB,gBAAgB,SAA8C;CAC5E,MAAM,EACJ,aAAa,iBAAiB,YAC9B,OAAO,iBAAiB,MACxB,WACA,YACA,UAAU,cACV,aACA,OAAO,WACP,IAEA,UACA,UACA,SACA,GAAG,cACD;CAEJ,MAAM,mBAAmB,gBAAgB,iBAAiB;CAE1D,MAAM,UAAU,eAAe,IAAI;EACjC;EACA;EACA;EACA;EACA,UAAU;EACX,CAAC;CAEF,MAAM,qBAAqB,IAAI,QAAQ,MAAM,aAAa,MAAM,MAAM;CACtE,MAAM,YAAY,aAAa,OAAO,OAAO,UAAU,GAAG,KAAA;AAoB1D,QAAO;EAAE,WAlB4B;GACnC,GAAG;GACH,GAAG,aAAa,MAAM;GACtB,kBAAkB;GAClB,OAAO,YACH,GAAG,mBAAmB,GAAG,cACzB;GACL;EAWmB,YATmB;GACrC;GACA;GACA;GACA;GACA,GAAG,aAAa,OAAO;GACvB,OAAO,IAAI,QAAQ,OAAO,aAAa,OAAO,MAAM;GACrD;EAE+B;EAAI"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CheckboxStyleProps } from "@pindoba/styles-checkbox";
|
|
2
|
+
import { SystemStyleObject } from "@pindoba/styled-system/types";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
type ElementAttributes = Partial<Record<string, unknown>>;
|
|
6
|
+
interface CheckboxSlotPassThrough<T = ElementAttributes> {
|
|
7
|
+
style?: SystemStyleObject;
|
|
8
|
+
props?: T;
|
|
9
|
+
}
|
|
10
|
+
interface CheckboxPassThrough<RootElementAttributes = ElementAttributes, InputElementAttributes = ElementAttributes> {
|
|
11
|
+
root?: CheckboxSlotPassThrough<RootElementAttributes>;
|
|
12
|
+
input?: CheckboxSlotPassThrough<InputElementAttributes>;
|
|
13
|
+
}
|
|
14
|
+
interface CheckboxBaseProps<RootElementAttributes = ElementAttributes, InputElementAttributes = ElementAttributes> extends CheckboxStyleProps {
|
|
15
|
+
passThrough?: CheckboxPassThrough<RootElementAttributes, InputElementAttributes>;
|
|
16
|
+
}
|
|
17
|
+
interface ConnectCheckboxOptions extends Partial<CheckboxBaseProps<object, object>> {
|
|
18
|
+
class?: unknown;
|
|
19
|
+
id?: string | null;
|
|
20
|
+
checked?: boolean | string | null;
|
|
21
|
+
disabled?: boolean | string | null;
|
|
22
|
+
required?: boolean | string | null;
|
|
23
|
+
}
|
|
24
|
+
interface CheckboxRootProps {
|
|
25
|
+
class: string;
|
|
26
|
+
"data-component": "checkbox";
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
interface CheckboxInputProps {
|
|
30
|
+
class: string;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
}
|
|
33
|
+
interface CheckboxApi {
|
|
34
|
+
rootProps: CheckboxRootProps;
|
|
35
|
+
inputProps: CheckboxInputProps;
|
|
36
|
+
id: string | null | undefined;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { CheckboxApi, CheckboxBaseProps, CheckboxInputProps, CheckboxPassThrough, CheckboxRootProps, ConnectCheckboxOptions, ElementAttributes };
|
|
40
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;KAKY,iBAAA,GAAoB,OAAA,CAAQ,MAAA;AAAA,UAI9B,uBAAA,KAA4B,iBAAA;EACpC,KAAA,GAAQ,iBAAA;EACR,KAAA,GAAQ,CAAA;AAAA;AAAA,UAGO,mBAAA,yBACS,iBAAA,2BACC,iBAAA;EAEzB,IAAA,GAAO,uBAAA,CAAwB,qBAAA;EAC/B,KAAA,GAAQ,uBAAA,CAAwB,sBAAA;AAAA;AAAA,UAKjB,iBAAA,yBACS,iBAAA,2BACC,iBAAA,UACjB,kBAAA;EACR,WAAA,GAAc,mBAAA,CACZ,qBAAA,EACA,sBAAA;AAAA;AAAA,UAMa,sBAAA,SAA+B,OAAA,CAC9C,iBAAA;EAEA,KAAA;EACA,EAAA;EACA,OAAA;EACA,QAAA;EACA,QAAA;AAAA;AAAA,UAGe,iBAAA;EACf,KAAA;EACA,gBAAA;EAAA,CACC,GAAA;AAAA;AAAA,UAGc,kBAAA;EACf,KAAA;EAAA,CACC,GAAA;AAAA;AAAA,UAGc,WAAA;EACf,SAAA,EAAW,iBAAA;EACX,UAAA,EAAY,kBAAA;EACZ,EAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pindoba/core-checkbox",
|
|
3
|
+
"version": "0.0.0-alpha-20260320034942",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./*": {
|
|
15
|
+
"types": "./dist/src/*.d.ts",
|
|
16
|
+
"import": "./dist/src/*.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@pindoba/styled-system": "0.0.0-alpha-20260320034942",
|
|
24
|
+
"@pindoba/styles-checkbox": "0.0.0-alpha-20260320034942"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "^5.9.3",
|
|
28
|
+
"tsdown": "^0.21.2"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsdown",
|
|
32
|
+
"dev": "tsdown --watch",
|
|
33
|
+
"clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo"
|
|
34
|
+
}
|
|
35
|
+
}
|