@radix-solid-js/label 0.1.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/dist/index.cjs +24 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var solidJs = require('solid-js');
|
|
4
|
+
var primitiveComponent = require('@radix-solid-js/primitive-component');
|
|
5
|
+
|
|
6
|
+
// src/label.tsx
|
|
7
|
+
function Label(props) {
|
|
8
|
+
const [local, rest] = solidJs.splitProps(props, ["onMouseDown"]);
|
|
9
|
+
const handleMouseDown = (event) => {
|
|
10
|
+
const target = event.target;
|
|
11
|
+
if (target.closest("button, input, select, textarea")) return;
|
|
12
|
+
if (typeof local.onMouseDown === "function") {
|
|
13
|
+
local.onMouseDown(event);
|
|
14
|
+
}
|
|
15
|
+
if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ React.createElement(primitiveComponent.Primitive.label, { ...rest, onMouseDown: handleMouseDown });
|
|
18
|
+
}
|
|
19
|
+
var Root = Label;
|
|
20
|
+
|
|
21
|
+
exports.Label = Label;
|
|
22
|
+
exports.Root = Root;
|
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
|
24
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/label.tsx"],"names":["splitProps","Primitive"],"mappings":";;;;;;AASA,SAAS,MAAM,KAAA,EAAmB;AAChC,EAAA,MAAM,CAAC,OAAO,IAAI,CAAA,GAAIA,mBAAW,KAAA,EAAO,CAAC,aAAa,CAAC,CAAA;AAEvD,EAAA,MAAM,eAAA,GAAkE,CAAC,KAAA,KAAU;AAEjF,IAAA,MAAM,SAAS,KAAA,CAAM,MAAA;AACrB,IAAA,IAAI,MAAA,CAAO,OAAA,CAAQ,iCAAiC,CAAA,EAAG;AAEvD,IAAA,IAAI,OAAO,KAAA,CAAM,WAAA,KAAgB,UAAA,EAAY;AAC3C,MAAA,KAAA,CAAM,YAAY,KAAK,CAAA;AAAA,IACzB;AAGA,IAAA,IAAI,CAAC,KAAA,CAAM,gBAAA,IAAoB,MAAM,MAAA,GAAS,CAAA,QAAS,cAAA,EAAe;AAAA,EACxE,CAAA;AAEA,EAAA,2CAAQC,4BAAA,CAAU,KAAA,EAAV,EAAiB,GAAG,IAAA,EAAM,aAAa,eAAA,EAAiB,CAAA;AAClE;AAIA,IAAM,IAAA,GAAO","file":"index.cjs","sourcesContent":["import { type JSX, splitProps } from 'solid-js';\nimport { Primitive, type PrimitiveProps } from '@radix-solid-js/primitive-component';\n\n/* -------------------------------------------------------------------------------------------------\n * Label\n * -----------------------------------------------------------------------------------------------*/\n\ninterface LabelProps extends PrimitiveProps<'label'> {}\n\nfunction Label(props: LabelProps) {\n const [local, rest] = splitProps(props, ['onMouseDown']);\n\n const handleMouseDown: JSX.EventHandler<HTMLLabelElement, MouseEvent> = (event) => {\n // only prevent text selection if clicking inside the label itself\n const target = event.target as HTMLElement;\n if (target.closest('button, input, select, textarea')) return;\n\n if (typeof local.onMouseDown === 'function') {\n local.onMouseDown(event);\n }\n\n // prevent text selection when double clicking label\n if (!event.defaultPrevented && event.detail > 1) event.preventDefault();\n };\n\n return <Primitive.label {...rest} onMouseDown={handleMouseDown} />;\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = Label;\n\nexport { Label, Root };\nexport type { LabelProps };\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { PrimitiveProps } from '@radix-solid-js/primitive-component';
|
|
3
|
+
|
|
4
|
+
interface LabelProps extends PrimitiveProps<'label'> {
|
|
5
|
+
}
|
|
6
|
+
declare function Label(props: LabelProps): JSX.Element;
|
|
7
|
+
declare const Root: typeof Label;
|
|
8
|
+
|
|
9
|
+
export { Label, type LabelProps, Root };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { PrimitiveProps } from '@radix-solid-js/primitive-component';
|
|
3
|
+
|
|
4
|
+
interface LabelProps extends PrimitiveProps<'label'> {
|
|
5
|
+
}
|
|
6
|
+
declare function Label(props: LabelProps): JSX.Element;
|
|
7
|
+
declare const Root: typeof Label;
|
|
8
|
+
|
|
9
|
+
export { Label, type LabelProps, Root };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { splitProps } from 'solid-js';
|
|
2
|
+
import { Primitive } from '@radix-solid-js/primitive-component';
|
|
3
|
+
|
|
4
|
+
// src/label.tsx
|
|
5
|
+
function Label(props) {
|
|
6
|
+
const [local, rest] = splitProps(props, ["onMouseDown"]);
|
|
7
|
+
const handleMouseDown = (event) => {
|
|
8
|
+
const target = event.target;
|
|
9
|
+
if (target.closest("button, input, select, textarea")) return;
|
|
10
|
+
if (typeof local.onMouseDown === "function") {
|
|
11
|
+
local.onMouseDown(event);
|
|
12
|
+
}
|
|
13
|
+
if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ React.createElement(Primitive.label, { ...rest, onMouseDown: handleMouseDown });
|
|
16
|
+
}
|
|
17
|
+
var Root = Label;
|
|
18
|
+
|
|
19
|
+
export { Label, Root };
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/label.tsx"],"names":[],"mappings":";;;;AASA,SAAS,MAAM,KAAA,EAAmB;AAChC,EAAA,MAAM,CAAC,OAAO,IAAI,CAAA,GAAI,WAAW,KAAA,EAAO,CAAC,aAAa,CAAC,CAAA;AAEvD,EAAA,MAAM,eAAA,GAAkE,CAAC,KAAA,KAAU;AAEjF,IAAA,MAAM,SAAS,KAAA,CAAM,MAAA;AACrB,IAAA,IAAI,MAAA,CAAO,OAAA,CAAQ,iCAAiC,CAAA,EAAG;AAEvD,IAAA,IAAI,OAAO,KAAA,CAAM,WAAA,KAAgB,UAAA,EAAY;AAC3C,MAAA,KAAA,CAAM,YAAY,KAAK,CAAA;AAAA,IACzB;AAGA,IAAA,IAAI,CAAC,KAAA,CAAM,gBAAA,IAAoB,MAAM,MAAA,GAAS,CAAA,QAAS,cAAA,EAAe;AAAA,EACxE,CAAA;AAEA,EAAA,2CAAQ,SAAA,CAAU,KAAA,EAAV,EAAiB,GAAG,IAAA,EAAM,aAAa,eAAA,EAAiB,CAAA;AAClE;AAIA,IAAM,IAAA,GAAO","file":"index.js","sourcesContent":["import { type JSX, splitProps } from 'solid-js';\nimport { Primitive, type PrimitiveProps } from '@radix-solid-js/primitive-component';\n\n/* -------------------------------------------------------------------------------------------------\n * Label\n * -----------------------------------------------------------------------------------------------*/\n\ninterface LabelProps extends PrimitiveProps<'label'> {}\n\nfunction Label(props: LabelProps) {\n const [local, rest] = splitProps(props, ['onMouseDown']);\n\n const handleMouseDown: JSX.EventHandler<HTMLLabelElement, MouseEvent> = (event) => {\n // only prevent text selection if clicking inside the label itself\n const target = event.target as HTMLElement;\n if (target.closest('button, input, select, textarea')) return;\n\n if (typeof local.onMouseDown === 'function') {\n local.onMouseDown(event);\n }\n\n // prevent text selection when double clicking label\n if (!event.defaultPrevented && event.detail > 1) event.preventDefault();\n };\n\n return <Primitive.label {...rest} onMouseDown={handleMouseDown} />;\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = Label;\n\nexport { Label, Root };\nexport type { LabelProps };\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@radix-solid-js/label",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup",
|
|
27
|
+
"clean": "rm -rf dist",
|
|
28
|
+
"typecheck": "tsc --noEmit",
|
|
29
|
+
"test": "vitest run"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@radix-solid-js/primitive-component": "workspace:*"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"solid-js": "^1.8.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@repo/tsconfig": "workspace:*",
|
|
39
|
+
"tsup": "^8.3.6",
|
|
40
|
+
"typescript": "^5.7.3",
|
|
41
|
+
"solid-js": "^1.9.3",
|
|
42
|
+
"vitest": "^2.1.8"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "https://github.com/ljho01/shadcn-solid-js.git",
|
|
50
|
+
"directory": "packages/solid/label"
|
|
51
|
+
}
|
|
52
|
+
}
|