@huin-core/react-label 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { Primitive } from '@huin-core/react-primitive';
3
+
4
+ type PrimitiveLabelProps = React.ComponentPropsWithoutRef<typeof Primitive.label>;
5
+ interface LabelProps extends PrimitiveLabelProps {
6
+ }
7
+ declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
8
+ declare const Root: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
9
+
10
+ export { Label, type LabelProps, Root };
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { Primitive } from '@huin-core/react-primitive';
3
+
4
+ type PrimitiveLabelProps = React.ComponentPropsWithoutRef<typeof Primitive.label>;
5
+ interface LabelProps extends PrimitiveLabelProps {
6
+ }
7
+ declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
8
+ declare const Root: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
9
+
10
+ export { Label, type LabelProps, Root };
package/dist/index.js ADDED
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // packages/react/label/src/index.ts
32
+ var src_exports = {};
33
+ __export(src_exports, {
34
+ Label: () => Label,
35
+ Root: () => Root
36
+ });
37
+ module.exports = __toCommonJS(src_exports);
38
+
39
+ // packages/react/label/src/Label.tsx
40
+ var React = __toESM(require("react"));
41
+ var import_react_primitive = require("@huin-core/react-primitive");
42
+ var import_jsx_runtime = require("react/jsx-runtime");
43
+ var NAME = "Label";
44
+ var Label = React.forwardRef(
45
+ ({ ...props }, forwardedRef) => {
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
47
+ import_react_primitive.Primitive.label,
48
+ {
49
+ ...props,
50
+ ref: forwardedRef,
51
+ onMouseDown: (event) => {
52
+ const target = event.target;
53
+ if (target.closest("button, input, select, textarea")) return;
54
+ props.onMouseDown?.(event);
55
+ if (!event.defaultPrevented && event.detail > 1)
56
+ event.preventDefault();
57
+ }
58
+ }
59
+ );
60
+ }
61
+ );
62
+ Label.displayName = NAME;
63
+ var Root = Label;
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts", "../src/Label.tsx"],
4
+ "sourcesContent": ["'use client';\nexport {\n Label,\n //\n Root,\n} from './Label';\nexport type { LabelProps } from './Label';\n", "import * as React from \"react\";\nimport { Primitive } from \"@huin-core/react-primitive\";\n\n/* -------------------------------------------------------------------------------------------------\n * Label\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = \"Label\";\n\ntype LabelElement = React.ElementRef<typeof Primitive.label>;\ntype PrimitiveLabelProps = React.ComponentPropsWithoutRef<\n typeof Primitive.label\n>;\ninterface LabelProps extends PrimitiveLabelProps {}\n\nconst Label = React.forwardRef<LabelElement, LabelProps>(\n ({ ...props }, forwardedRef) => {\n return (\n <Primitive.label\n {...props}\n ref={forwardedRef}\n onMouseDown={(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 props.onMouseDown?.(event);\n // prevent text selection when double clicking label\n if (!event.defaultPrevented && event.detail > 1)\n event.preventDefault();\n }}\n />\n );\n }\n);\n\nLabel.displayName = NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = Label;\n\nexport {\n Label,\n //\n Root,\n};\nexport type { LabelProps };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,6BAA0B;AAiBpB;AAXN,IAAM,OAAO;AAQb,IAAM,QAAc;AAAA,EAClB,CAAC,EAAE,GAAG,MAAM,GAAG,iBAAiB;AAC9B,WACE;AAAA,MAAC,iCAAU;AAAA,MAAV;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,aAAa,CAAC,UAAU;AAEtB,gBAAM,SAAS,MAAM;AACrB,cAAI,OAAO,QAAQ,iCAAiC,EAAG;AAEvD,gBAAM,cAAc,KAAK;AAEzB,cAAI,CAAC,MAAM,oBAAoB,MAAM,SAAS;AAC5C,kBAAM,eAAe;AAAA,QACzB;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,MAAM,cAAc;AAIpB,IAAM,OAAO;",
6
+ "names": []
7
+ }
package/dist/index.mjs ADDED
@@ -0,0 +1,32 @@
1
+ "use client";
2
+
3
+ // packages/react/label/src/Label.tsx
4
+ import * as React from "react";
5
+ import { Primitive } from "@huin-core/react-primitive";
6
+ import { jsx } from "react/jsx-runtime";
7
+ var NAME = "Label";
8
+ var Label = React.forwardRef(
9
+ ({ ...props }, forwardedRef) => {
10
+ return /* @__PURE__ */ jsx(
11
+ Primitive.label,
12
+ {
13
+ ...props,
14
+ ref: forwardedRef,
15
+ onMouseDown: (event) => {
16
+ const target = event.target;
17
+ if (target.closest("button, input, select, textarea")) return;
18
+ props.onMouseDown?.(event);
19
+ if (!event.defaultPrevented && event.detail > 1)
20
+ event.preventDefault();
21
+ }
22
+ }
23
+ );
24
+ }
25
+ );
26
+ Label.displayName = NAME;
27
+ var Root = Label;
28
+ export {
29
+ Label,
30
+ Root
31
+ };
32
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Label.tsx"],
4
+ "sourcesContent": ["import * as React from \"react\";\nimport { Primitive } from \"@huin-core/react-primitive\";\n\n/* -------------------------------------------------------------------------------------------------\n * Label\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = \"Label\";\n\ntype LabelElement = React.ElementRef<typeof Primitive.label>;\ntype PrimitiveLabelProps = React.ComponentPropsWithoutRef<\n typeof Primitive.label\n>;\ninterface LabelProps extends PrimitiveLabelProps {}\n\nconst Label = React.forwardRef<LabelElement, LabelProps>(\n ({ ...props }, forwardedRef) => {\n return (\n <Primitive.label\n {...props}\n ref={forwardedRef}\n onMouseDown={(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 props.onMouseDown?.(event);\n // prevent text selection when double clicking label\n if (!event.defaultPrevented && event.detail > 1)\n event.preventDefault();\n }}\n />\n );\n }\n);\n\nLabel.displayName = NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = Label;\n\nexport {\n Label,\n //\n Root,\n};\nexport type { LabelProps };\n"],
5
+ "mappings": ";;;AAAA,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAiBpB;AAXN,IAAM,OAAO;AAQb,IAAM,QAAc;AAAA,EAClB,CAAC,EAAE,GAAG,MAAM,GAAG,iBAAiB;AAC9B,WACE;AAAA,MAAC,UAAU;AAAA,MAAV;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,aAAa,CAAC,UAAU;AAEtB,gBAAM,SAAS,MAAM;AACrB,cAAI,OAAO,QAAQ,iCAAiC,EAAG;AAEvD,gBAAM,cAAc,KAAK;AAEzB,cAAI,CAAC,MAAM,oBAAoB,MAAM,SAAS;AAC5C,kBAAM,eAAe;AAAA,QACzB;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,MAAM,cAAc;AAIpB,IAAM,OAAO;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huin-core/react-label",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -28,7 +28,7 @@
28
28
  "version": "yarn version"
29
29
  },
30
30
  "dependencies": {
31
- "@huin-core/react-primitive": "workspace:*"
31
+ "@huin-core/react-primitive": "latest"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@types/react": "*",