@fvc/label 1.0.1
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.
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import e from"react";function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var r,n={exports:{}};
|
|
2
|
+
/*!
|
|
3
|
+
Copyright (c) 2018 Jed Watson.
|
|
4
|
+
Licensed under the MIT License (MIT), see
|
|
5
|
+
http://jedwatson.github.io/classnames
|
|
6
|
+
*/var o,l=(r||(r=1,o=n,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var o=arguments[t];o&&(e=n(e,r(o)))}return e}function r(r){if("string"==typeof r||"number"==typeof r)return r;if("object"!=typeof r)return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var o="";for(var l in r)e.call(r,l)&&r[l]&&(o=n(o,l));return o}function n(e,t){return t?e?e+" "+t:e+t:e}o.exports?(t.default=t,o.exports=t):window.classNames=t}()),n.exports),a=t(l);!function(e,t){void 0===t&&(t={});var r=t.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}('.fvc-label {\n display: block;\n width: auto;\n margin: 6px;\n margin-left: 0;\n color: var(--black-1000);\n font-weight: 500;\n font-size: 14px;\n font-family: "Roboto", sans-serif;\n line-height: 16px;\n}\n.fvc-label-error {\n color: var(--warning-text-color-800);\n}\n.fvc-label-disabled {\n color: var(--blue-gray-300);\n cursor: not-allowed;\n}');const i="fvc-label",c=t=>{var{children:r,required:n=!1,htmlFor:o,for:l,elementType:c="label",onClick:s,className:d,disabled:f=!1,error:p,testId:u}=t,y=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(t,["children","required","htmlFor","for","elementType","onClick","className","disabled","error","testId"]);const m=n?"*":null,b=a(i,{[`${i}-error`]:!!p,[`${i}-disabled`]:f},d);return e.createElement(c,Object.assign({},y,{"data-testid":u,onClick:s,className:b,htmlFor:"label"===c?l||o:void 0}),p||r,m)};export{c as Label};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Label.scss';
|
|
3
|
+
import { LabelProps } from './types';
|
|
4
|
+
export declare const Label: ({ children, required, htmlFor, for: labelFor, elementType: ElementType, onClick, className, disabled, error, testId, ...props }: LabelProps) => React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Label } from './Label';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type LabelPosition = 'top' | 'side' | 'inside';
|
|
3
|
+
export type Alignment = 'start' | 'end';
|
|
4
|
+
export type LabelProps = HTMLAttributes<HTMLElement> & {
|
|
5
|
+
labelPosition?: LabelPosition;
|
|
6
|
+
labelAlign?: Alignment;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
htmlFor?: string;
|
|
12
|
+
for?: string;
|
|
13
|
+
elementType?: ElementType;
|
|
14
|
+
testId?: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Label.types';
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fvc/label",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"main": "./dist/lib/index.js",
|
|
5
|
+
"types": "./dist/lib/label/src/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/lib/index.js",
|
|
8
|
+
"dist/lib/label",
|
|
9
|
+
"package.json"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/lib/index.js",
|
|
14
|
+
"types": "./dist/lib/label/src/index.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./types": {
|
|
17
|
+
"types": "./dist/lib/label/src/types/index.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "rollup -c ./rollup.config.mjs",
|
|
22
|
+
"clean": "rm -rf dist && rm -rf .rollup.cache && rm -rf .turbo",
|
|
23
|
+
"lint": "eslint --config ../../eslint.config.js \"src/**/*.{ts,tsx}\"",
|
|
24
|
+
"lint:fix": "eslint --config ../../eslint.config.js \"src/**/*.{ts,tsx}\" --fix",
|
|
25
|
+
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
26
|
+
"type-check": "tsc --noEmit",
|
|
27
|
+
"test": "bun test --preload ../../tests/happydom.ts --preload ../../tests/testing-library.tsx"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"react": "^18.0.0",
|
|
31
|
+
"antd": "^5.0.0"
|
|
32
|
+
}
|
|
33
|
+
}
|