@purpurds/label 4.6.0 → 5.0.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/label.cjs.js +2 -2
- package/dist/label.cjs.js.map +1 -1
- package/dist/label.d.ts +2 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.es.js +47 -42
- package/dist/label.es.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/src/label.module.scss +4 -0
- package/src/label.stories.tsx +10 -6
- package/src/label.tsx +6 -1
package/dist/label.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),s=require("react");require("react-dom");function p(){return p=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},p.apply(this,arguments)}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},i.apply(this,arguments)}function h(e,r){typeof e=="function"?e(r):e!=null&&(e.current=r)}function y(...e){return r=>e.forEach(t=>h(t,r))}const b=s.forwardRef((e,r)=>{const{children:t,...l}=e,a=s.Children.toArray(t),n=a.find(g);if(n){const o=n.props.children,c=a.map(m=>m===n?s.Children.count(o)>1?s.Children.only(null):s.isValidElement(o)?o.props.children:null:m);return s.createElement(d,i({},l,{ref:r}),s.isValidElement(o)?s.cloneElement(o,void 0,c):null)}return s.createElement(d,i({},l,{ref:r}),t)});b.displayName="Slot";const d=s.forwardRef((e,r)=>{const{children:t,...l}=e;return s.isValidElement(t)?s.cloneElement(t,{...O(l,t.props),ref:r?y(r,t.ref):t.ref}):s.Children.count(t)>1?s.Children.only(null):null});d.displayName="SlotClone";const E=({children:e})=>s.createElement(s.Fragment,null,e);function g(e){return s.isValidElement(e)&&e.type===E}function O(e,r){const t={...r};for(const l in r){const a=e[l],n=r[l];/^on[A-Z]/.test(l)?a&&n?t[l]=(...c)=>{n(...c),a(...c)}:a&&(t[l]=a):l==="style"?t[l]={...a,...n}:l==="className"&&(t[l]=[a,n].filter(Boolean).join(" "))}return{...e,...t}}const j=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],w=j.reduce((e,r)=>{const t=s.forwardRef((l,a)=>{const{asChild:n,...o}=l,c=n?b:r;return s.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),s.createElement(c,i({},o,{ref:a}))});return t.displayName=`Primitive.${r}`,{...e,[r]:t}},{}),_=s.forwardRef((e,r)=>s.createElement(w.label,p({},e,{ref:r,onMouseDown:t=>{var l;(l=e.onMouseDown)===null||l===void 0||l.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault()}}))),x=_;function S(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $={exports:{}};/*!
|
|
2
2
|
Copyright (c) 2018 Jed Watson.
|
|
3
3
|
Licensed under the MIT License (MIT), see
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
|
-
*/(function(e){(function(){var r={}.hasOwnProperty;function t(){for(var n="",
|
|
5
|
+
*/(function(e){(function(){var r={}.hasOwnProperty;function t(){for(var n="",o=0;o<arguments.length;o++){var c=arguments[o];c&&(n=a(n,l(c)))}return n}function l(n){if(typeof n=="string"||typeof n=="number")return n;if(typeof n!="object")return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var o="";for(var c in n)r.call(n,c)&&n[c]&&(o=a(o,c));return o}function a(n,o){return o?n?n+" "+o:n+o:n}e.exports?(t.default=t,e.exports=t):window.classNames=t})()})($);var C=$.exports;const N=S(C),f={"purpur-label":"_purpur-label_12cfi_1","purpur-label--negative":"_purpur-label--negative_12cfi_9","purpur-label--disabled":"_purpur-label--disabled_12cfi_12"},u="purpur-label",P=({children:e,className:r,htmlFor:t,"data-testid":l,disabled:a,negative:n=!1,...o})=>{const c=N([r,f[u],{[f[`${u}--disabled`]]:a,[f[`${u}--negative`]]:n}]);return v.jsx(x,{className:c,"data-testid":l,htmlFor:t,...o,children:e})};exports.Label=P;
|
|
6
6
|
//# sourceMappingURL=label.cjs.js.map
|
package/dist/label.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.cjs.js","sources":["../../../common/temp/node_modules/.pnpm/@babel+runtime@7.22.15/node_modules/@babel/runtime/helpers/esm/extends.js","../../../common/temp/node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/extends.js","../../../common/temp/node_modules/.pnpm/@radix-ui+react-compose-refs@1.0.1_@types+react@18.3.1_react@18.3.1/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-slot@1.0.2_@types+react@18.3.1_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-primitive@1.0.3_@types+react-dom@18.3.0_@types+react@18.3.1_react-dom@18.3.1_react@18.3.1/node_modules/@radix-ui/react-primitive/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-label@2.0.2_@types+react-dom@18.3.0_@types+react@18.3.1_react-dom@18.3.1_react@18.3.1/node_modules/@radix-ui/react-label/dist/index.mjs","../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/label.tsx"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","import {useCallback as $3vqmr$useCallback} from \"react\";\n\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$var$setRef(ref, value) {\n if (typeof ref === 'function') ref(value);\n else if (ref !== null && ref !== undefined) ref.current = value;\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {\n return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)\n )\n ;\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return $3vqmr$useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);\n}\n\n\n\n\nexport {$6ed0406888f73fc4$export$43e446d32b3d21af as composeRefs, $6ed0406888f73fc4$export$c7b2cbe3552a0d05 as useComposedRefs};\n//# sourceMappingURL=index.mjs.map\n","import $9IrjX$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $9IrjX$forwardRef, Children as $9IrjX$Children, isValidElement as $9IrjX$isValidElement, createElement as $9IrjX$createElement, cloneElement as $9IrjX$cloneElement, Fragment as $9IrjX$Fragment} from \"react\";\nimport {composeRefs as $9IrjX$composeRefs} from \"@radix-ui/react-compose-refs\";\n\n\n\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ $9IrjX$forwardRef((props, forwardedRef)=>{\n const { children: children , ...slotProps } = props;\n const childrenArray = $9IrjX$Children.toArray(children);\n const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child)=>{\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if ($9IrjX$Children.count(newElement) > 1) return $9IrjX$Children.only(null);\n return /*#__PURE__*/ $9IrjX$isValidElement(newElement) ? newElement.props.children : null;\n } else return child;\n });\n return /*#__PURE__*/ $9IrjX$createElement($5e63c961fc1ce211$var$SlotClone, $9IrjX$babelruntimehelpersesmextends({}, slotProps, {\n ref: forwardedRef\n }), /*#__PURE__*/ $9IrjX$isValidElement(newElement) ? /*#__PURE__*/ $9IrjX$cloneElement(newElement, undefined, newChildren) : null);\n }\n return /*#__PURE__*/ $9IrjX$createElement($5e63c961fc1ce211$var$SlotClone, $9IrjX$babelruntimehelpersesmextends({}, slotProps, {\n ref: forwardedRef\n }), children);\n});\n$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot';\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ $9IrjX$forwardRef((props, forwardedRef)=>{\n const { children: children , ...slotProps } = props;\n if (/*#__PURE__*/ $9IrjX$isValidElement(children)) return /*#__PURE__*/ $9IrjX$cloneElement(children, {\n ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),\n ref: forwardedRef ? $9IrjX$composeRefs(forwardedRef, children.ref) : children.ref\n });\n return $9IrjX$Children.count(children) > 1 ? $9IrjX$Children.only(null) : null;\n});\n$5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone';\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{\n return /*#__PURE__*/ $9IrjX$createElement($9IrjX$Fragment, null, children);\n};\n/* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) {\n return /*#__PURE__*/ $9IrjX$isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;\n}\nfunction $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {\n // all child props should override\n const overrideProps = {\n ...childProps\n };\n for(const propName in childProps){\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) overrideProps[propName] = (...args)=>{\n childPropValue(...args);\n slotPropValue(...args);\n };\n else if (slotPropValue) overrideProps[propName] = slotPropValue;\n } else if (propName === 'style') overrideProps[propName] = {\n ...slotPropValue,\n ...childPropValue\n };\n else if (propName === 'className') overrideProps[propName] = [\n slotPropValue,\n childPropValue\n ].filter(Boolean).join(' ');\n }\n return {\n ...slotProps,\n ...overrideProps\n };\n}\nconst $5e63c961fc1ce211$export$be92b6f5f03c0fe9 = $5e63c961fc1ce211$export$8c6ed5c666ac1360;\n\n\n\n\nexport {$5e63c961fc1ce211$export$8c6ed5c666ac1360 as Slot, $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 as Slottable, $5e63c961fc1ce211$export$be92b6f5f03c0fe9 as Root};\n//# sourceMappingURL=index.mjs.map\n","import $4q5Fq$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $4q5Fq$forwardRef, useEffect as $4q5Fq$useEffect, createElement as $4q5Fq$createElement} from \"react\";\nimport {flushSync as $4q5Fq$flushSync} from \"react-dom\";\nimport {Slot as $4q5Fq$Slot} from \"@radix-ui/react-slot\";\n\n\n\n\n\nconst $8927f6f2acc4f386$var$NODES = [\n 'a',\n 'button',\n 'div',\n 'form',\n 'h2',\n 'h3',\n 'img',\n 'input',\n 'label',\n 'li',\n 'nav',\n 'ol',\n 'p',\n 'span',\n 'svg',\n 'ul'\n]; // Temporary while we await merge of this fix:\n// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396\n// prettier-ignore\n/* -------------------------------------------------------------------------------------------------\n * Primitive\n * -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{\n const Node = /*#__PURE__*/ $4q5Fq$forwardRef((props, forwardedRef)=>{\n const { asChild: asChild , ...primitiveProps } = props;\n const Comp = asChild ? $4q5Fq$Slot : node;\n $4q5Fq$useEffect(()=>{\n window[Symbol.for('radix-ui')] = true;\n }, []);\n return /*#__PURE__*/ $4q5Fq$createElement(Comp, $4q5Fq$babelruntimehelpersesmextends({}, primitiveProps, {\n ref: forwardedRef\n }));\n });\n Node.displayName = `Primitive.${node}`;\n return {\n ...primitive,\n [node]: Node\n };\n}, {});\n/* -------------------------------------------------------------------------------------------------\n * Utils\n * -----------------------------------------------------------------------------------------------*/ /**\n * Flush custom event dispatch\n * https://github.com/radix-ui/primitives/pull/1378\n *\n * React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.\n *\n * Internally, React prioritises events in the following order:\n * - discrete\n * - continuous\n * - default\n *\n * https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350\n *\n * `discrete` is an important distinction as updates within these events are applied immediately.\n * React however, is not able to infer the priority of custom event types due to how they are detected internally.\n * Because of this, it's possible for updates from custom events to be unexpectedly batched when\n * dispatched by another `discrete` event.\n *\n * In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.\n * This utility should be used when dispatching a custom event from within another `discrete` event, this utility\n * is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.\n * For example:\n *\n * dispatching a known click 👎\n * target.dispatchEvent(new Event(‘click’))\n *\n * dispatching a custom type within a non-discrete event 👎\n * onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}\n *\n * dispatching a custom type within a `discrete` event 👍\n * onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}\n *\n * Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use\n * this utility with them. This is because it's possible for those handlers to be called implicitly during render\n * e.g. when focus is within a component as it is unmounted, or when managing focus on mount.\n */ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {\n if (target) $4q5Fq$flushSync(()=>target.dispatchEvent(event)\n );\n}\n/* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$be92b6f5f03c0fe9 = $8927f6f2acc4f386$export$250ffa63cdc0d034;\n\n\n\n\nexport {$8927f6f2acc4f386$export$250ffa63cdc0d034 as Primitive, $8927f6f2acc4f386$export$be92b6f5f03c0fe9 as Root, $8927f6f2acc4f386$export$6d1a0317bde7de7f as dispatchDiscreteCustomEvent};\n//# sourceMappingURL=index.mjs.map\n","import $7V4JZ$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $7V4JZ$forwardRef, createElement as $7V4JZ$createElement} from \"react\";\nimport {Primitive as $7V4JZ$Primitive} from \"@radix-ui/react-primitive\";\n\n\n\n\n/* -------------------------------------------------------------------------------------------------\n * Label\n * -----------------------------------------------------------------------------------------------*/ const $b73a6c6685e72184$var$NAME = 'Label';\nconst $b73a6c6685e72184$export$b04be29aa201d4f5 = /*#__PURE__*/ $7V4JZ$forwardRef((props, forwardedRef)=>{\n return /*#__PURE__*/ $7V4JZ$createElement($7V4JZ$Primitive.label, $7V4JZ$babelruntimehelpersesmextends({}, props, {\n ref: forwardedRef,\n onMouseDown: (event)=>{\n var _props$onMouseDown;\n (_props$onMouseDown = props.onMouseDown) === null || _props$onMouseDown === void 0 || _props$onMouseDown.call(props, event); // prevent text selection when double clicking label\n if (!event.defaultPrevented && event.detail > 1) event.preventDefault();\n }\n }));\n});\n/*#__PURE__*/ Object.assign($b73a6c6685e72184$export$b04be29aa201d4f5, {\n displayName: $b73a6c6685e72184$var$NAME\n});\n/* -----------------------------------------------------------------------------------------------*/ const $b73a6c6685e72184$export$be92b6f5f03c0fe9 = $b73a6c6685e72184$export$b04be29aa201d4f5;\n\n\n\n\nexport {$b73a6c6685e72184$export$b04be29aa201d4f5 as Label, $b73a6c6685e72184$export$be92b6f5f03c0fe9 as Root};\n//# sourceMappingURL=index.mjs.map\n","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React, { ReactNode } from \"react\";\nimport * as RadixLabel from \"@radix-ui/react-label\";\nimport c from \"classnames\";\n\nimport styles from \"./label.module.scss\";\n\nconst rootClassName = \"purpur-label\";\n\nexport type LabelProps = {\n \"data-testid\"?: string;\n children: ReactNode;\n className?: string;\n htmlFor: string;\n disabled?: boolean;\n};\nexport const Label = ({\n children,\n className,\n htmlFor,\n \"data-testid\": dataTestId,\n disabled,\n ...props\n}: LabelProps) => {\n const classes = c([\n className,\n styles[rootClassName],\n { [styles[`${rootClassName}--disabled`]]: disabled },\n ]);\n\n return (\n <RadixLabel.Root className={classes} data-testid={dataTestId} htmlFor={htmlFor} {...props}>\n {children}\n </RadixLabel.Root>\n );\n};\n"],"names":["_extends","target","i","source","key","$6ed0406888f73fc4$var$setRef","ref","value","$6ed0406888f73fc4$export$43e446d32b3d21af","refs","node","$5e63c961fc1ce211$export$8c6ed5c666ac1360","$9IrjX$forwardRef","props","forwardedRef","children","slotProps","childrenArray","$9IrjX$Children","slottable","$5e63c961fc1ce211$var$isSlottable","newElement","newChildren","child","$9IrjX$isValidElement","$9IrjX$createElement","$5e63c961fc1ce211$var$SlotClone","$9IrjX$babelruntimehelpersesmextends","$9IrjX$cloneElement","$5e63c961fc1ce211$var$mergeProps","$9IrjX$composeRefs","$5e63c961fc1ce211$export$d9f1ccf0bdb05d45","$9IrjX$Fragment","childProps","overrideProps","propName","slotPropValue","childPropValue","args","$8927f6f2acc4f386$var$NODES","$8927f6f2acc4f386$export$250ffa63cdc0d034","primitive","Node","$4q5Fq$forwardRef","asChild","primitiveProps","Comp","$4q5Fq$Slot","$4q5Fq$useEffect","$4q5Fq$createElement","$4q5Fq$babelruntimehelpersesmextends","$b73a6c6685e72184$export$b04be29aa201d4f5","$7V4JZ$forwardRef","$7V4JZ$createElement","$7V4JZ$Primitive","$7V4JZ$babelruntimehelpersesmextends","event","_props$onMouseDown","$b73a6c6685e72184$export$be92b6f5f03c0fe9","hasOwn","classNames","classes","arg","appendClass","parseValue","newClass","module","rootClassName","Label","className","htmlFor","dataTestId","disabled","c","styles","jsx","RadixLabel.Root"],"mappings":"6JAAe,SAASA,GAAW,CACjCA,OAAAA,EAAW,OAAO,OAAS,OAAO,OAAO,KAAI,EAAK,SAAUC,EAAQ,CAClE,QAASC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CACzC,IAAIC,EAAS,UAAUD,CAAC,EACxB,QAASE,KAAOD,EACV,OAAO,UAAU,eAAe,KAAKA,EAAQC,CAAG,IAClDH,EAAOG,CAAG,EAAID,EAAOC,CAAG,EAG7B,CACD,OAAOH,CACX,EACSD,EAAS,MAAM,KAAM,SAAS,CACvC,CCbe,SAASA,GAAW,CACjC,OAAAA,EAAW,OAAO,OAAS,OAAO,OAAO,KAAI,EAAK,SAAUC,EAAQ,CAClE,QAASC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CACzC,IAAIC,EAAS,UAAUD,CAAC,EACxB,QAASE,KAAOD,EACV,OAAO,UAAU,eAAe,KAAKA,EAAQC,CAAG,IAClDH,EAAOG,CAAG,EAAID,EAAOC,CAAG,EAG7B,CACD,OAAOH,CACX,EACSD,EAAS,MAAM,KAAM,SAAS,CACvC,CCPI,SAASK,EAA6BC,EAAKC,EAAO,CAC9C,OAAOD,GAAQ,WAAYA,EAAIC,CAAK,EAC/BD,GAAQ,OAA2BA,EAAI,QAAUC,EAC9D,CAII,SAASC,KAA6CC,EAAM,CAC5D,OAAQC,GAAOD,EAAK,QAASH,GAAMD,EAA6BC,EAAKI,CAAI,CACpE,CAET,CCRqG,MAAMC,EAA0DC,EAAAA,WAAkB,CAACC,EAAOC,IAAe,CAC1M,KAAM,CAAE,SAAUC,EAAW,G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,SAAArD,EACA,UAAAsD,EACA,QAAAC,EACA,cAAeC,EACf,SAAAC,EACA,GAAG3D,CACL,IAAkB,CAChB,MAAMgD,EAAUY,EAAE,CAChBJ,EACAK,EAAOP,CAAa,EACpB,CAAE,CAACO,EAAO,GAAGP,CAAa,YAAY,CAAC,EAAGK,CAAS,CAAA,CACpD,EAGC,OAAAG,MAACC,EAAA,CAAgB,UAAWf,EAAS,cAAaU,EAAY,QAAAD,EAAmB,GAAGzD,EACjF,SAAAE,CACH,CAAA,CAEJ","x_google_ignoreList":[0,1,2,3,4,5,6]}
|
|
1
|
+
{"version":3,"file":"label.cjs.js","sources":["../../../common/temp/node_modules/.pnpm/@babel+runtime@7.22.15/node_modules/@babel/runtime/helpers/esm/extends.js","../../../common/temp/node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/extends.js","../../../common/temp/node_modules/.pnpm/@radix-ui+react-compose-refs@1.0.1_@types+react@18.3.1_react@18.3.1/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-slot@1.0.2_@types+react@18.3.1_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-primitive@1.0.3_@types+react-dom@18.3.0_@types+react@18.3.1_react-dom@18.3.1_react@18.3.1/node_modules/@radix-ui/react-primitive/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-label@2.0.2_@types+react-dom@18.3.0_@types+react@18.3.1_react-dom@18.3.1_react@18.3.1/node_modules/@radix-ui/react-label/dist/index.mjs","../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/label.tsx"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","import {useCallback as $3vqmr$useCallback} from \"react\";\n\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$var$setRef(ref, value) {\n if (typeof ref === 'function') ref(value);\n else if (ref !== null && ref !== undefined) ref.current = value;\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {\n return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)\n )\n ;\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return $3vqmr$useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);\n}\n\n\n\n\nexport {$6ed0406888f73fc4$export$43e446d32b3d21af as composeRefs, $6ed0406888f73fc4$export$c7b2cbe3552a0d05 as useComposedRefs};\n//# sourceMappingURL=index.mjs.map\n","import $9IrjX$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $9IrjX$forwardRef, Children as $9IrjX$Children, isValidElement as $9IrjX$isValidElement, createElement as $9IrjX$createElement, cloneElement as $9IrjX$cloneElement, Fragment as $9IrjX$Fragment} from \"react\";\nimport {composeRefs as $9IrjX$composeRefs} from \"@radix-ui/react-compose-refs\";\n\n\n\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ $9IrjX$forwardRef((props, forwardedRef)=>{\n const { children: children , ...slotProps } = props;\n const childrenArray = $9IrjX$Children.toArray(children);\n const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child)=>{\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if ($9IrjX$Children.count(newElement) > 1) return $9IrjX$Children.only(null);\n return /*#__PURE__*/ $9IrjX$isValidElement(newElement) ? newElement.props.children : null;\n } else return child;\n });\n return /*#__PURE__*/ $9IrjX$createElement($5e63c961fc1ce211$var$SlotClone, $9IrjX$babelruntimehelpersesmextends({}, slotProps, {\n ref: forwardedRef\n }), /*#__PURE__*/ $9IrjX$isValidElement(newElement) ? /*#__PURE__*/ $9IrjX$cloneElement(newElement, undefined, newChildren) : null);\n }\n return /*#__PURE__*/ $9IrjX$createElement($5e63c961fc1ce211$var$SlotClone, $9IrjX$babelruntimehelpersesmextends({}, slotProps, {\n ref: forwardedRef\n }), children);\n});\n$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot';\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ $9IrjX$forwardRef((props, forwardedRef)=>{\n const { children: children , ...slotProps } = props;\n if (/*#__PURE__*/ $9IrjX$isValidElement(children)) return /*#__PURE__*/ $9IrjX$cloneElement(children, {\n ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),\n ref: forwardedRef ? $9IrjX$composeRefs(forwardedRef, children.ref) : children.ref\n });\n return $9IrjX$Children.count(children) > 1 ? $9IrjX$Children.only(null) : null;\n});\n$5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone';\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{\n return /*#__PURE__*/ $9IrjX$createElement($9IrjX$Fragment, null, children);\n};\n/* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) {\n return /*#__PURE__*/ $9IrjX$isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;\n}\nfunction $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {\n // all child props should override\n const overrideProps = {\n ...childProps\n };\n for(const propName in childProps){\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) overrideProps[propName] = (...args)=>{\n childPropValue(...args);\n slotPropValue(...args);\n };\n else if (slotPropValue) overrideProps[propName] = slotPropValue;\n } else if (propName === 'style') overrideProps[propName] = {\n ...slotPropValue,\n ...childPropValue\n };\n else if (propName === 'className') overrideProps[propName] = [\n slotPropValue,\n childPropValue\n ].filter(Boolean).join(' ');\n }\n return {\n ...slotProps,\n ...overrideProps\n };\n}\nconst $5e63c961fc1ce211$export$be92b6f5f03c0fe9 = $5e63c961fc1ce211$export$8c6ed5c666ac1360;\n\n\n\n\nexport {$5e63c961fc1ce211$export$8c6ed5c666ac1360 as Slot, $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 as Slottable, $5e63c961fc1ce211$export$be92b6f5f03c0fe9 as Root};\n//# sourceMappingURL=index.mjs.map\n","import $4q5Fq$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $4q5Fq$forwardRef, useEffect as $4q5Fq$useEffect, createElement as $4q5Fq$createElement} from \"react\";\nimport {flushSync as $4q5Fq$flushSync} from \"react-dom\";\nimport {Slot as $4q5Fq$Slot} from \"@radix-ui/react-slot\";\n\n\n\n\n\nconst $8927f6f2acc4f386$var$NODES = [\n 'a',\n 'button',\n 'div',\n 'form',\n 'h2',\n 'h3',\n 'img',\n 'input',\n 'label',\n 'li',\n 'nav',\n 'ol',\n 'p',\n 'span',\n 'svg',\n 'ul'\n]; // Temporary while we await merge of this fix:\n// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396\n// prettier-ignore\n/* -------------------------------------------------------------------------------------------------\n * Primitive\n * -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{\n const Node = /*#__PURE__*/ $4q5Fq$forwardRef((props, forwardedRef)=>{\n const { asChild: asChild , ...primitiveProps } = props;\n const Comp = asChild ? $4q5Fq$Slot : node;\n $4q5Fq$useEffect(()=>{\n window[Symbol.for('radix-ui')] = true;\n }, []);\n return /*#__PURE__*/ $4q5Fq$createElement(Comp, $4q5Fq$babelruntimehelpersesmextends({}, primitiveProps, {\n ref: forwardedRef\n }));\n });\n Node.displayName = `Primitive.${node}`;\n return {\n ...primitive,\n [node]: Node\n };\n}, {});\n/* -------------------------------------------------------------------------------------------------\n * Utils\n * -----------------------------------------------------------------------------------------------*/ /**\n * Flush custom event dispatch\n * https://github.com/radix-ui/primitives/pull/1378\n *\n * React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.\n *\n * Internally, React prioritises events in the following order:\n * - discrete\n * - continuous\n * - default\n *\n * https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350\n *\n * `discrete` is an important distinction as updates within these events are applied immediately.\n * React however, is not able to infer the priority of custom event types due to how they are detected internally.\n * Because of this, it's possible for updates from custom events to be unexpectedly batched when\n * dispatched by another `discrete` event.\n *\n * In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.\n * This utility should be used when dispatching a custom event from within another `discrete` event, this utility\n * is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.\n * For example:\n *\n * dispatching a known click 👎\n * target.dispatchEvent(new Event(‘click’))\n *\n * dispatching a custom type within a non-discrete event 👎\n * onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}\n *\n * dispatching a custom type within a `discrete` event 👍\n * onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}\n *\n * Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use\n * this utility with them. This is because it's possible for those handlers to be called implicitly during render\n * e.g. when focus is within a component as it is unmounted, or when managing focus on mount.\n */ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {\n if (target) $4q5Fq$flushSync(()=>target.dispatchEvent(event)\n );\n}\n/* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$be92b6f5f03c0fe9 = $8927f6f2acc4f386$export$250ffa63cdc0d034;\n\n\n\n\nexport {$8927f6f2acc4f386$export$250ffa63cdc0d034 as Primitive, $8927f6f2acc4f386$export$be92b6f5f03c0fe9 as Root, $8927f6f2acc4f386$export$6d1a0317bde7de7f as dispatchDiscreteCustomEvent};\n//# sourceMappingURL=index.mjs.map\n","import $7V4JZ$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $7V4JZ$forwardRef, createElement as $7V4JZ$createElement} from \"react\";\nimport {Primitive as $7V4JZ$Primitive} from \"@radix-ui/react-primitive\";\n\n\n\n\n/* -------------------------------------------------------------------------------------------------\n * Label\n * -----------------------------------------------------------------------------------------------*/ const $b73a6c6685e72184$var$NAME = 'Label';\nconst $b73a6c6685e72184$export$b04be29aa201d4f5 = /*#__PURE__*/ $7V4JZ$forwardRef((props, forwardedRef)=>{\n return /*#__PURE__*/ $7V4JZ$createElement($7V4JZ$Primitive.label, $7V4JZ$babelruntimehelpersesmextends({}, props, {\n ref: forwardedRef,\n onMouseDown: (event)=>{\n var _props$onMouseDown;\n (_props$onMouseDown = props.onMouseDown) === null || _props$onMouseDown === void 0 || _props$onMouseDown.call(props, event); // prevent text selection when double clicking label\n if (!event.defaultPrevented && event.detail > 1) event.preventDefault();\n }\n }));\n});\n/*#__PURE__*/ Object.assign($b73a6c6685e72184$export$b04be29aa201d4f5, {\n displayName: $b73a6c6685e72184$var$NAME\n});\n/* -----------------------------------------------------------------------------------------------*/ const $b73a6c6685e72184$export$be92b6f5f03c0fe9 = $b73a6c6685e72184$export$b04be29aa201d4f5;\n\n\n\n\nexport {$b73a6c6685e72184$export$b04be29aa201d4f5 as Label, $b73a6c6685e72184$export$be92b6f5f03c0fe9 as Root};\n//# sourceMappingURL=index.mjs.map\n","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React, { ReactNode } from \"react\";\nimport * as RadixLabel from \"@radix-ui/react-label\";\nimport c from \"classnames\";\n\nimport styles from \"./label.module.scss\";\n\nconst rootClassName = \"purpur-label\";\n\nexport type LabelProps = {\n \"data-testid\"?: string;\n children: ReactNode;\n className?: string;\n htmlFor: string;\n disabled?: boolean;\n negative?: boolean;\n};\nexport const Label = ({\n children,\n className,\n htmlFor,\n \"data-testid\": dataTestId,\n disabled,\n negative = false,\n ...props\n}: LabelProps) => {\n const classes = c([\n className,\n styles[rootClassName],\n {\n [styles[`${rootClassName}--disabled`]]: disabled,\n [styles[`${rootClassName}--negative`]]: negative,\n },\n ]);\n\n return (\n <RadixLabel.Root className={classes} data-testid={dataTestId} htmlFor={htmlFor} {...props}>\n {children}\n </RadixLabel.Root>\n );\n};\n"],"names":["_extends","target","i","source","key","$6ed0406888f73fc4$var$setRef","ref","value","$6ed0406888f73fc4$export$43e446d32b3d21af","refs","node","$5e63c961fc1ce211$export$8c6ed5c666ac1360","$9IrjX$forwardRef","props","forwardedRef","children","slotProps","childrenArray","$9IrjX$Children","slottable","$5e63c961fc1ce211$var$isSlottable","newElement","newChildren","child","$9IrjX$isValidElement","$9IrjX$createElement","$5e63c961fc1ce211$var$SlotClone","$9IrjX$babelruntimehelpersesmextends","$9IrjX$cloneElement","$5e63c961fc1ce211$var$mergeProps","$9IrjX$composeRefs","$5e63c961fc1ce211$export$d9f1ccf0bdb05d45","$9IrjX$Fragment","childProps","overrideProps","propName","slotPropValue","childPropValue","args","$8927f6f2acc4f386$var$NODES","$8927f6f2acc4f386$export$250ffa63cdc0d034","primitive","Node","$4q5Fq$forwardRef","asChild","primitiveProps","Comp","$4q5Fq$Slot","$4q5Fq$useEffect","$4q5Fq$createElement","$4q5Fq$babelruntimehelpersesmextends","$b73a6c6685e72184$export$b04be29aa201d4f5","$7V4JZ$forwardRef","$7V4JZ$createElement","$7V4JZ$Primitive","$7V4JZ$babelruntimehelpersesmextends","event","_props$onMouseDown","$b73a6c6685e72184$export$be92b6f5f03c0fe9","hasOwn","classNames","classes","arg","appendClass","parseValue","newClass","module","rootClassName","Label","className","htmlFor","dataTestId","disabled","negative","c","styles","jsx","RadixLabel.Root"],"mappings":"6JAAe,SAASA,GAAW,CACjCA,OAAAA,EAAW,OAAO,OAAS,OAAO,OAAO,KAAI,EAAK,SAAUC,EAAQ,CAClE,QAASC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CACzC,IAAIC,EAAS,UAAUD,CAAC,EACxB,QAASE,KAAOD,EACV,OAAO,UAAU,eAAe,KAAKA,EAAQC,CAAG,IAClDH,EAAOG,CAAG,EAAID,EAAOC,CAAG,EAG7B,CACD,OAAOH,CACX,EACSD,EAAS,MAAM,KAAM,SAAS,CACvC,CCbe,SAASA,GAAW,CACjC,OAAAA,EAAW,OAAO,OAAS,OAAO,OAAO,KAAI,EAAK,SAAUC,EAAQ,CAClE,QAASC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CACzC,IAAIC,EAAS,UAAUD,CAAC,EACxB,QAASE,KAAOD,EACV,OAAO,UAAU,eAAe,KAAKA,EAAQC,CAAG,IAClDH,EAAOG,CAAG,EAAID,EAAOC,CAAG,EAG7B,CACD,OAAOH,CACX,EACSD,EAAS,MAAM,KAAM,SAAS,CACvC,CCPI,SAASK,EAA6BC,EAAKC,EAAO,CAC9C,OAAOD,GAAQ,WAAYA,EAAIC,CAAK,EAC/BD,GAAQ,OAA2BA,EAAI,QAAUC,EAC9D,CAII,SAASC,KAA6CC,EAAM,CAC5D,OAAQC,GAAOD,EAAK,QAASH,GAAMD,EAA6BC,EAAKI,CAAI,CACpE,CAET,CCRqG,MAAMC,EAA0DC,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AOjB,OAAO,WAAaA,CAEtB,yMCtEMO,EAAgB,eAUTC,EAAQ,CAAC,CACpB,SAAArD,EACA,UAAAsD,EACA,QAAAC,EACA,cAAeC,EACf,SAAAC,EACA,SAAAC,EAAW,GACX,GAAG5D,CACL,IAAkB,CAChB,MAAMgD,EAAUa,EAAE,CAChBL,EACAM,EAAOR,CAAa,EACpB,CACE,CAACQ,EAAO,GAAGR,CAAa,YAAY,CAAC,EAAGK,EACxC,CAACG,EAAO,GAAGR,CAAa,YAAY,CAAC,EAAGM,CAC1C,CAAA,CACD,EAGC,OAAAG,MAACC,EAAA,CAAgB,UAAWhB,EAAS,cAAaU,EAAY,QAAAD,EAAmB,GAAGzD,EACjF,SAAAE,CACH,CAAA,CAEJ","x_google_ignoreList":[0,1,2,3,4,5,6]}
|
package/dist/label.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type LabelProps = {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
htmlFor: string;
|
|
8
8
|
disabled?: boolean;
|
|
9
|
+
negative?: boolean;
|
|
9
10
|
};
|
|
10
|
-
export declare const Label: ({ children, className, htmlFor, "data-testid": dataTestId, disabled, ...props }: LabelProps) => React.JSX.Element;
|
|
11
|
+
export declare const Label: ({ children, className, htmlFor, "data-testid": dataTestId, disabled, negative, ...props }: LabelProps) => React.JSX.Element;
|
|
11
12
|
//# sourceMappingURL=label.d.ts.map
|
package/dist/label.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../src/label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQzC,MAAM,MAAM,UAAU,GAAG;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../src/label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQzC,MAAM,MAAM,UAAU,GAAG;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,eAAO,MAAM,KAAK,8FAQf,UAAU,sBAeZ,CAAC"}
|
package/dist/label.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as p, Children as
|
|
1
|
+
import { jsx as O } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as p, Children as c, isValidElement as u, createElement as i, cloneElement as h, Fragment as _, useEffect as x } from "react";
|
|
3
3
|
import "react-dom";
|
|
4
|
-
function
|
|
5
|
-
return
|
|
4
|
+
function m() {
|
|
5
|
+
return m = Object.assign ? Object.assign.bind() : function(e) {
|
|
6
6
|
for (var r = 1; r < arguments.length; r++) {
|
|
7
7
|
var t = arguments[r];
|
|
8
8
|
for (var o in t)
|
|
9
9
|
Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
|
|
10
10
|
}
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
12
|
+
}, m.apply(this, arguments);
|
|
13
13
|
}
|
|
14
14
|
function f() {
|
|
15
15
|
return f = Object.assign ? Object.assign.bind() : function(e) {
|
|
@@ -21,38 +21,38 @@ function f() {
|
|
|
21
21
|
return e;
|
|
22
22
|
}, f.apply(this, arguments);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function j(e, r) {
|
|
25
25
|
typeof e == "function" ? e(r) : e != null && (e.current = r);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function w(...e) {
|
|
28
28
|
return (r) => e.forEach(
|
|
29
|
-
(t) =>
|
|
29
|
+
(t) => j(t, r)
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
const y = /* @__PURE__ */ p((e, r) => {
|
|
33
|
-
const { children: t, ...o } = e, l =
|
|
33
|
+
const { children: t, ...o } = e, l = c.toArray(t), n = l.find(S);
|
|
34
34
|
if (n) {
|
|
35
|
-
const s = n.props.children,
|
|
36
|
-
return /* @__PURE__ */ i(
|
|
35
|
+
const s = n.props.children, a = l.map((v) => v === n ? c.count(s) > 1 ? c.only(null) : /* @__PURE__ */ u(s) ? s.props.children : null : v);
|
|
36
|
+
return /* @__PURE__ */ i($, f({}, o, {
|
|
37
37
|
ref: r
|
|
38
|
-
}), /* @__PURE__ */ u(s) ? /* @__PURE__ */ h(s, void 0,
|
|
38
|
+
}), /* @__PURE__ */ u(s) ? /* @__PURE__ */ h(s, void 0, a) : null);
|
|
39
39
|
}
|
|
40
|
-
return /* @__PURE__ */ i(
|
|
40
|
+
return /* @__PURE__ */ i($, f({}, o, {
|
|
41
41
|
ref: r
|
|
42
42
|
}), t);
|
|
43
43
|
});
|
|
44
44
|
y.displayName = "Slot";
|
|
45
|
-
const
|
|
45
|
+
const $ = /* @__PURE__ */ p((e, r) => {
|
|
46
46
|
const { children: t, ...o } = e;
|
|
47
47
|
return /* @__PURE__ */ u(t) ? /* @__PURE__ */ h(t, {
|
|
48
48
|
...P(o, t.props),
|
|
49
|
-
ref: r ?
|
|
50
|
-
}) :
|
|
49
|
+
ref: r ? w(r, t.ref) : t.ref
|
|
50
|
+
}) : c.count(t) > 1 ? c.only(null) : null;
|
|
51
51
|
});
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
function
|
|
55
|
-
return /* @__PURE__ */ u(e) && e.type ===
|
|
52
|
+
$.displayName = "SlotClone";
|
|
53
|
+
const N = ({ children: e }) => /* @__PURE__ */ i(_, null, e);
|
|
54
|
+
function S(e) {
|
|
55
|
+
return /* @__PURE__ */ u(e) && e.type === N;
|
|
56
56
|
}
|
|
57
57
|
function P(e, r) {
|
|
58
58
|
const t = {
|
|
@@ -60,8 +60,8 @@ function P(e, r) {
|
|
|
60
60
|
};
|
|
61
61
|
for (const o in r) {
|
|
62
62
|
const l = e[o], n = r[o];
|
|
63
|
-
/^on[A-Z]/.test(o) ? l && n ? t[o] = (...
|
|
64
|
-
n(...
|
|
63
|
+
/^on[A-Z]/.test(o) ? l && n ? t[o] = (...a) => {
|
|
64
|
+
n(...a), l(...a);
|
|
65
65
|
} : l && (t[o] = l) : o === "style" ? t[o] = {
|
|
66
66
|
...l,
|
|
67
67
|
...n
|
|
@@ -94,10 +94,10 @@ const E = [
|
|
|
94
94
|
"ul"
|
|
95
95
|
], C = E.reduce((e, r) => {
|
|
96
96
|
const t = /* @__PURE__ */ p((o, l) => {
|
|
97
|
-
const { asChild: n, ...s } = o,
|
|
98
|
-
return
|
|
97
|
+
const { asChild: n, ...s } = o, a = n ? y : r;
|
|
98
|
+
return x(() => {
|
|
99
99
|
window[Symbol.for("radix-ui")] = !0;
|
|
100
|
-
}, []), /* @__PURE__ */ i(
|
|
100
|
+
}, []), /* @__PURE__ */ i(a, f({}, s, {
|
|
101
101
|
ref: l
|
|
102
102
|
}));
|
|
103
103
|
});
|
|
@@ -105,7 +105,7 @@ const E = [
|
|
|
105
105
|
...e,
|
|
106
106
|
[r]: t
|
|
107
107
|
};
|
|
108
|
-
}, {}), D = /* @__PURE__ */ p((e, r) => /* @__PURE__ */ i(C.label,
|
|
108
|
+
}, {}), D = /* @__PURE__ */ p((e, r) => /* @__PURE__ */ i(C.label, m({}, e, {
|
|
109
109
|
ref: r,
|
|
110
110
|
onMouseDown: (t) => {
|
|
111
111
|
var o;
|
|
@@ -115,7 +115,7 @@ const E = [
|
|
|
115
115
|
function M(e) {
|
|
116
116
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
117
117
|
}
|
|
118
|
-
var
|
|
118
|
+
var g = { exports: {} };
|
|
119
119
|
/*!
|
|
120
120
|
Copyright (c) 2018 Jed Watson.
|
|
121
121
|
Licensed under the MIT License (MIT), see
|
|
@@ -126,8 +126,8 @@ var O = { exports: {} };
|
|
|
126
126
|
var r = {}.hasOwnProperty;
|
|
127
127
|
function t() {
|
|
128
128
|
for (var n = "", s = 0; s < arguments.length; s++) {
|
|
129
|
-
var
|
|
130
|
-
|
|
129
|
+
var a = arguments[s];
|
|
130
|
+
a && (n = l(n, o(a)));
|
|
131
131
|
}
|
|
132
132
|
return n;
|
|
133
133
|
}
|
|
@@ -141,8 +141,8 @@ var O = { exports: {} };
|
|
|
141
141
|
if (n.toString !== Object.prototype.toString && !n.toString.toString().includes("[native code]"))
|
|
142
142
|
return n.toString();
|
|
143
143
|
var s = "";
|
|
144
|
-
for (var
|
|
145
|
-
r.call(n,
|
|
144
|
+
for (var a in n)
|
|
145
|
+
r.call(n, a) && n[a] && (s = l(s, a));
|
|
146
146
|
return s;
|
|
147
147
|
}
|
|
148
148
|
function l(n, s) {
|
|
@@ -150,25 +150,30 @@ var O = { exports: {} };
|
|
|
150
150
|
}
|
|
151
151
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
152
152
|
})();
|
|
153
|
-
})(
|
|
154
|
-
var V =
|
|
155
|
-
const F = /* @__PURE__ */ M(V),
|
|
156
|
-
"purpur-label": "_purpur-
|
|
157
|
-
"purpur-label--
|
|
158
|
-
|
|
153
|
+
})(g);
|
|
154
|
+
var V = g.exports;
|
|
155
|
+
const F = /* @__PURE__ */ M(V), d = {
|
|
156
|
+
"purpur-label": "_purpur-label_12cfi_1",
|
|
157
|
+
"purpur-label--negative": "_purpur-label--negative_12cfi_9",
|
|
158
|
+
"purpur-label--disabled": "_purpur-label--disabled_12cfi_12"
|
|
159
|
+
}, b = "purpur-label", Z = ({
|
|
159
160
|
children: e,
|
|
160
161
|
className: r,
|
|
161
162
|
htmlFor: t,
|
|
162
163
|
"data-testid": o,
|
|
163
164
|
disabled: l,
|
|
164
|
-
|
|
165
|
+
negative: n = !1,
|
|
166
|
+
...s
|
|
165
167
|
}) => {
|
|
166
|
-
const
|
|
168
|
+
const a = F([
|
|
167
169
|
r,
|
|
168
|
-
b
|
|
169
|
-
{
|
|
170
|
+
d[b],
|
|
171
|
+
{
|
|
172
|
+
[d[`${b}--disabled`]]: l,
|
|
173
|
+
[d[`${b}--negative`]]: n
|
|
174
|
+
}
|
|
170
175
|
]);
|
|
171
|
-
return /* @__PURE__ */
|
|
176
|
+
return /* @__PURE__ */ O(A, { className: a, "data-testid": o, htmlFor: t, ...s, children: e });
|
|
172
177
|
};
|
|
173
178
|
export {
|
|
174
179
|
Z as Label
|
package/dist/label.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.es.js","sources":["../../../common/temp/node_modules/.pnpm/@babel+runtime@7.22.15/node_modules/@babel/runtime/helpers/esm/extends.js","../../../common/temp/node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/extends.js","../../../common/temp/node_modules/.pnpm/@radix-ui+react-compose-refs@1.0.1_@types+react@18.3.1_react@18.3.1/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-slot@1.0.2_@types+react@18.3.1_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-primitive@1.0.3_@types+react-dom@18.3.0_@types+react@18.3.1_react-dom@18.3.1_react@18.3.1/node_modules/@radix-ui/react-primitive/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-label@2.0.2_@types+react-dom@18.3.0_@types+react@18.3.1_react-dom@18.3.1_react@18.3.1/node_modules/@radix-ui/react-label/dist/index.mjs","../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/label.tsx"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","import {useCallback as $3vqmr$useCallback} from \"react\";\n\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$var$setRef(ref, value) {\n if (typeof ref === 'function') ref(value);\n else if (ref !== null && ref !== undefined) ref.current = value;\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {\n return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)\n )\n ;\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return $3vqmr$useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);\n}\n\n\n\n\nexport {$6ed0406888f73fc4$export$43e446d32b3d21af as composeRefs, $6ed0406888f73fc4$export$c7b2cbe3552a0d05 as useComposedRefs};\n//# sourceMappingURL=index.mjs.map\n","import $9IrjX$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $9IrjX$forwardRef, Children as $9IrjX$Children, isValidElement as $9IrjX$isValidElement, createElement as $9IrjX$createElement, cloneElement as $9IrjX$cloneElement, Fragment as $9IrjX$Fragment} from \"react\";\nimport {composeRefs as $9IrjX$composeRefs} from \"@radix-ui/react-compose-refs\";\n\n\n\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ $9IrjX$forwardRef((props, forwardedRef)=>{\n const { children: children , ...slotProps } = props;\n const childrenArray = $9IrjX$Children.toArray(children);\n const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child)=>{\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if ($9IrjX$Children.count(newElement) > 1) return $9IrjX$Children.only(null);\n return /*#__PURE__*/ $9IrjX$isValidElement(newElement) ? newElement.props.children : null;\n } else return child;\n });\n return /*#__PURE__*/ $9IrjX$createElement($5e63c961fc1ce211$var$SlotClone, $9IrjX$babelruntimehelpersesmextends({}, slotProps, {\n ref: forwardedRef\n }), /*#__PURE__*/ $9IrjX$isValidElement(newElement) ? /*#__PURE__*/ $9IrjX$cloneElement(newElement, undefined, newChildren) : null);\n }\n return /*#__PURE__*/ $9IrjX$createElement($5e63c961fc1ce211$var$SlotClone, $9IrjX$babelruntimehelpersesmextends({}, slotProps, {\n ref: forwardedRef\n }), children);\n});\n$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot';\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ $9IrjX$forwardRef((props, forwardedRef)=>{\n const { children: children , ...slotProps } = props;\n if (/*#__PURE__*/ $9IrjX$isValidElement(children)) return /*#__PURE__*/ $9IrjX$cloneElement(children, {\n ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),\n ref: forwardedRef ? $9IrjX$composeRefs(forwardedRef, children.ref) : children.ref\n });\n return $9IrjX$Children.count(children) > 1 ? $9IrjX$Children.only(null) : null;\n});\n$5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone';\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{\n return /*#__PURE__*/ $9IrjX$createElement($9IrjX$Fragment, null, children);\n};\n/* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) {\n return /*#__PURE__*/ $9IrjX$isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;\n}\nfunction $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {\n // all child props should override\n const overrideProps = {\n ...childProps\n };\n for(const propName in childProps){\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) overrideProps[propName] = (...args)=>{\n childPropValue(...args);\n slotPropValue(...args);\n };\n else if (slotPropValue) overrideProps[propName] = slotPropValue;\n } else if (propName === 'style') overrideProps[propName] = {\n ...slotPropValue,\n ...childPropValue\n };\n else if (propName === 'className') overrideProps[propName] = [\n slotPropValue,\n childPropValue\n ].filter(Boolean).join(' ');\n }\n return {\n ...slotProps,\n ...overrideProps\n };\n}\nconst $5e63c961fc1ce211$export$be92b6f5f03c0fe9 = $5e63c961fc1ce211$export$8c6ed5c666ac1360;\n\n\n\n\nexport {$5e63c961fc1ce211$export$8c6ed5c666ac1360 as Slot, $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 as Slottable, $5e63c961fc1ce211$export$be92b6f5f03c0fe9 as Root};\n//# sourceMappingURL=index.mjs.map\n","import $4q5Fq$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $4q5Fq$forwardRef, useEffect as $4q5Fq$useEffect, createElement as $4q5Fq$createElement} from \"react\";\nimport {flushSync as $4q5Fq$flushSync} from \"react-dom\";\nimport {Slot as $4q5Fq$Slot} from \"@radix-ui/react-slot\";\n\n\n\n\n\nconst $8927f6f2acc4f386$var$NODES = [\n 'a',\n 'button',\n 'div',\n 'form',\n 'h2',\n 'h3',\n 'img',\n 'input',\n 'label',\n 'li',\n 'nav',\n 'ol',\n 'p',\n 'span',\n 'svg',\n 'ul'\n]; // Temporary while we await merge of this fix:\n// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396\n// prettier-ignore\n/* -------------------------------------------------------------------------------------------------\n * Primitive\n * -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{\n const Node = /*#__PURE__*/ $4q5Fq$forwardRef((props, forwardedRef)=>{\n const { asChild: asChild , ...primitiveProps } = props;\n const Comp = asChild ? $4q5Fq$Slot : node;\n $4q5Fq$useEffect(()=>{\n window[Symbol.for('radix-ui')] = true;\n }, []);\n return /*#__PURE__*/ $4q5Fq$createElement(Comp, $4q5Fq$babelruntimehelpersesmextends({}, primitiveProps, {\n ref: forwardedRef\n }));\n });\n Node.displayName = `Primitive.${node}`;\n return {\n ...primitive,\n [node]: Node\n };\n}, {});\n/* -------------------------------------------------------------------------------------------------\n * Utils\n * -----------------------------------------------------------------------------------------------*/ /**\n * Flush custom event dispatch\n * https://github.com/radix-ui/primitives/pull/1378\n *\n * React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.\n *\n * Internally, React prioritises events in the following order:\n * - discrete\n * - continuous\n * - default\n *\n * https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350\n *\n * `discrete` is an important distinction as updates within these events are applied immediately.\n * React however, is not able to infer the priority of custom event types due to how they are detected internally.\n * Because of this, it's possible for updates from custom events to be unexpectedly batched when\n * dispatched by another `discrete` event.\n *\n * In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.\n * This utility should be used when dispatching a custom event from within another `discrete` event, this utility\n * is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.\n * For example:\n *\n * dispatching a known click 👎\n * target.dispatchEvent(new Event(‘click’))\n *\n * dispatching a custom type within a non-discrete event 👎\n * onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}\n *\n * dispatching a custom type within a `discrete` event 👍\n * onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}\n *\n * Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use\n * this utility with them. This is because it's possible for those handlers to be called implicitly during render\n * e.g. when focus is within a component as it is unmounted, or when managing focus on mount.\n */ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {\n if (target) $4q5Fq$flushSync(()=>target.dispatchEvent(event)\n );\n}\n/* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$be92b6f5f03c0fe9 = $8927f6f2acc4f386$export$250ffa63cdc0d034;\n\n\n\n\nexport {$8927f6f2acc4f386$export$250ffa63cdc0d034 as Primitive, $8927f6f2acc4f386$export$be92b6f5f03c0fe9 as Root, $8927f6f2acc4f386$export$6d1a0317bde7de7f as dispatchDiscreteCustomEvent};\n//# sourceMappingURL=index.mjs.map\n","import $7V4JZ$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $7V4JZ$forwardRef, createElement as $7V4JZ$createElement} from \"react\";\nimport {Primitive as $7V4JZ$Primitive} from \"@radix-ui/react-primitive\";\n\n\n\n\n/* -------------------------------------------------------------------------------------------------\n * Label\n * -----------------------------------------------------------------------------------------------*/ const $b73a6c6685e72184$var$NAME = 'Label';\nconst $b73a6c6685e72184$export$b04be29aa201d4f5 = /*#__PURE__*/ $7V4JZ$forwardRef((props, forwardedRef)=>{\n return /*#__PURE__*/ $7V4JZ$createElement($7V4JZ$Primitive.label, $7V4JZ$babelruntimehelpersesmextends({}, props, {\n ref: forwardedRef,\n onMouseDown: (event)=>{\n var _props$onMouseDown;\n (_props$onMouseDown = props.onMouseDown) === null || _props$onMouseDown === void 0 || _props$onMouseDown.call(props, event); // prevent text selection when double clicking label\n if (!event.defaultPrevented && event.detail > 1) event.preventDefault();\n }\n }));\n});\n/*#__PURE__*/ Object.assign($b73a6c6685e72184$export$b04be29aa201d4f5, {\n displayName: $b73a6c6685e72184$var$NAME\n});\n/* -----------------------------------------------------------------------------------------------*/ const $b73a6c6685e72184$export$be92b6f5f03c0fe9 = $b73a6c6685e72184$export$b04be29aa201d4f5;\n\n\n\n\nexport {$b73a6c6685e72184$export$b04be29aa201d4f5 as Label, $b73a6c6685e72184$export$be92b6f5f03c0fe9 as Root};\n//# sourceMappingURL=index.mjs.map\n","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React, { ReactNode } from \"react\";\nimport * as RadixLabel from \"@radix-ui/react-label\";\nimport c from \"classnames\";\n\nimport styles from \"./label.module.scss\";\n\nconst rootClassName = \"purpur-label\";\n\nexport type LabelProps = {\n \"data-testid\"?: string;\n children: ReactNode;\n className?: string;\n htmlFor: string;\n disabled?: boolean;\n};\nexport const Label = ({\n children,\n className,\n htmlFor,\n \"data-testid\": dataTestId,\n disabled,\n ...props\n}: LabelProps) => {\n const classes = c([\n className,\n styles[rootClassName],\n { [styles[`${rootClassName}--disabled`]]: disabled },\n ]);\n\n return (\n <RadixLabel.Root className={classes} data-testid={dataTestId} htmlFor={htmlFor} {...props}>\n {children}\n </RadixLabel.Root>\n );\n};\n"],"names":["_extends","target","i","source","key","$6ed0406888f73fc4$var$setRef","ref","value","$6ed0406888f73fc4$export$43e446d32b3d21af","refs","node","$5e63c961fc1ce211$export$8c6ed5c666ac1360","$9IrjX$forwardRef","props","forwardedRef","children","slotProps","childrenArray","$9IrjX$Children","slottable","$5e63c961fc1ce211$var$isSlottable","newElement","newChildren","child","$9IrjX$isValidElement","$9IrjX$createElement","$5e63c961fc1ce211$var$SlotClone","$9IrjX$babelruntimehelpersesmextends","$9IrjX$cloneElement","$5e63c961fc1ce211$var$mergeProps","$9IrjX$composeRefs","$5e63c961fc1ce211$export$d9f1ccf0bdb05d45","$9IrjX$Fragment","childProps","overrideProps","propName","slotPropValue","childPropValue","args","$8927f6f2acc4f386$var$NODES","$8927f6f2acc4f386$export$250ffa63cdc0d034","primitive","Node","$4q5Fq$forwardRef","asChild","primitiveProps","Comp","$4q5Fq$Slot","$4q5Fq$useEffect","$4q5Fq$createElement","$4q5Fq$babelruntimehelpersesmextends","$b73a6c6685e72184$export$b04be29aa201d4f5","$7V4JZ$forwardRef","$7V4JZ$createElement","$7V4JZ$Primitive","$7V4JZ$babelruntimehelpersesmextends","event","_props$onMouseDown","$b73a6c6685e72184$export$be92b6f5f03c0fe9","hasOwn","classNames","classes","arg","appendClass","parseValue","newClass","module","rootClassName","Label","className","htmlFor","dataTestId","disabled","c","styles","jsx","RadixLabel.Root"],"mappings":";;;AAAe,SAASA,IAAW;AACjCA,SAAAA,IAAW,OAAO,SAAS,OAAO,OAAO,KAAI,IAAK,SAAUC,GAAQ;AAClE,aAASC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AACzC,UAAIC,IAAS,UAAUD,CAAC;AACxB,eAASE,KAAOD;AACd,QAAI,OAAO,UAAU,eAAe,KAAKA,GAAQC,CAAG,MAClDH,EAAOG,CAAG,IAAID,EAAOC,CAAG;AAAA,IAG7B;AACD,WAAOH;AAAA,EACX,GACSD,EAAS,MAAM,MAAM,SAAS;AACvC;ACbe,SAASA,IAAW;AACjC,SAAAA,IAAW,OAAO,SAAS,OAAO,OAAO,KAAI,IAAK,SAAUC,GAAQ;AAClE,aAASC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AACzC,UAAIC,IAAS,UAAUD,CAAC;AACxB,eAASE,KAAOD;AACd,QAAI,OAAO,UAAU,eAAe,KAAKA,GAAQC,CAAG,MAClDH,EAAOG,CAAG,IAAID,EAAOC,CAAG;AAAA,IAG7B;AACD,WAAOH;AAAA,EACX,GACSD,EAAS,MAAM,MAAM,SAAS;AACvC;ACPI,SAASK,EAA6BC,GAAKC,GAAO;AAClD,EAAI,OAAOD,KAAQ,aAA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eAAOA;AAGR,UAAI,OAAOA,KAAQ;AAClB,eAAO;AAGR,UAAI,MAAM,QAAQA,CAAG;AACpB,eAAOF,EAAW,MAAM,MAAME,CAAG;AAGlC,UAAIA,EAAI,aAAa,OAAO,UAAU,YAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe;AAClG,eAAOA,EAAI;AAGZ,UAAID,IAAU;AAEd,eAASzD,KAAO0D;AACf,QAAIH,EAAO,KAAKG,GAAK1D,CAAG,KAAK0D,EAAI1D,CAAG,MACnCyD,IAAUE,EAAYF,GAASzD,CAAG;AAIpC,aAAOyD;AAAA,IACP;AAED,aAASE,EAAaxD,GAAO0D,GAAU;AACtC,aAAKA,IAID1D,IACIA,IAAQ,MAAM0D,IAGf1D,IAAQ0D,IAPP1D;AAAA,IAQR;AAED,IAAqC2D,EAAO,WAC3CN,EAAW,UAAUA,GACrBM,EAAA,UAAiBN,KAOjB,OAAO,aAAaA;AAAA,EAEtB;;;;;;GCtEMO,IAAgB,gBASTC,IAAQ,CAAC;AAAA,EACpB,UAAArD;AAAA,EACA,WAAAsD;AAAA,EACA,SAAAC;AAAA,EACA,eAAeC;AAAA,EACf,UAAAC;AAAA,EACA,GAAG3D;AACL,MAAkB;AAChB,QAAMgD,IAAUY,EAAE;AAAA,IAChBJ;AAAA,IACAK,EAAOP,CAAa;AAAA,IACpB,EAAE,CAACO,EAAO,GAAGP,CAAa,YAAY,CAAC,GAAGK,EAAS;AAAA,EAAA,CACpD;AAGC,SAAA,gBAAAG,EAACC,GAAA,EAAgB,WAAWf,GAAS,eAAaU,GAAY,SAAAD,GAAmB,GAAGzD,GACjF,UAAAE,EACH,CAAA;AAEJ;","x_google_ignoreList":[0,1,2,3,4,5,6]}
|
|
1
|
+
{"version":3,"file":"label.es.js","sources":["../../../common/temp/node_modules/.pnpm/@babel+runtime@7.22.15/node_modules/@babel/runtime/helpers/esm/extends.js","../../../common/temp/node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/extends.js","../../../common/temp/node_modules/.pnpm/@radix-ui+react-compose-refs@1.0.1_@types+react@18.3.1_react@18.3.1/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-slot@1.0.2_@types+react@18.3.1_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-primitive@1.0.3_@types+react-dom@18.3.0_@types+react@18.3.1_react-dom@18.3.1_react@18.3.1/node_modules/@radix-ui/react-primitive/dist/index.mjs","../../../common/temp/node_modules/.pnpm/@radix-ui+react-label@2.0.2_@types+react-dom@18.3.0_@types+react@18.3.1_react-dom@18.3.1_react@18.3.1/node_modules/@radix-ui/react-label/dist/index.mjs","../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/label.tsx"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","import {useCallback as $3vqmr$useCallback} from \"react\";\n\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$var$setRef(ref, value) {\n if (typeof ref === 'function') ref(value);\n else if (ref !== null && ref !== undefined) ref.current = value;\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {\n return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)\n )\n ;\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return $3vqmr$useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);\n}\n\n\n\n\nexport {$6ed0406888f73fc4$export$43e446d32b3d21af as composeRefs, $6ed0406888f73fc4$export$c7b2cbe3552a0d05 as useComposedRefs};\n//# sourceMappingURL=index.mjs.map\n","import $9IrjX$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $9IrjX$forwardRef, Children as $9IrjX$Children, isValidElement as $9IrjX$isValidElement, createElement as $9IrjX$createElement, cloneElement as $9IrjX$cloneElement, Fragment as $9IrjX$Fragment} from \"react\";\nimport {composeRefs as $9IrjX$composeRefs} from \"@radix-ui/react-compose-refs\";\n\n\n\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ $9IrjX$forwardRef((props, forwardedRef)=>{\n const { children: children , ...slotProps } = props;\n const childrenArray = $9IrjX$Children.toArray(children);\n const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child)=>{\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if ($9IrjX$Children.count(newElement) > 1) return $9IrjX$Children.only(null);\n return /*#__PURE__*/ $9IrjX$isValidElement(newElement) ? newElement.props.children : null;\n } else return child;\n });\n return /*#__PURE__*/ $9IrjX$createElement($5e63c961fc1ce211$var$SlotClone, $9IrjX$babelruntimehelpersesmextends({}, slotProps, {\n ref: forwardedRef\n }), /*#__PURE__*/ $9IrjX$isValidElement(newElement) ? /*#__PURE__*/ $9IrjX$cloneElement(newElement, undefined, newChildren) : null);\n }\n return /*#__PURE__*/ $9IrjX$createElement($5e63c961fc1ce211$var$SlotClone, $9IrjX$babelruntimehelpersesmextends({}, slotProps, {\n ref: forwardedRef\n }), children);\n});\n$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot';\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ $9IrjX$forwardRef((props, forwardedRef)=>{\n const { children: children , ...slotProps } = props;\n if (/*#__PURE__*/ $9IrjX$isValidElement(children)) return /*#__PURE__*/ $9IrjX$cloneElement(children, {\n ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),\n ref: forwardedRef ? $9IrjX$composeRefs(forwardedRef, children.ref) : children.ref\n });\n return $9IrjX$Children.count(children) > 1 ? $9IrjX$Children.only(null) : null;\n});\n$5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone';\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{\n return /*#__PURE__*/ $9IrjX$createElement($9IrjX$Fragment, null, children);\n};\n/* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) {\n return /*#__PURE__*/ $9IrjX$isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;\n}\nfunction $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {\n // all child props should override\n const overrideProps = {\n ...childProps\n };\n for(const propName in childProps){\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) overrideProps[propName] = (...args)=>{\n childPropValue(...args);\n slotPropValue(...args);\n };\n else if (slotPropValue) overrideProps[propName] = slotPropValue;\n } else if (propName === 'style') overrideProps[propName] = {\n ...slotPropValue,\n ...childPropValue\n };\n else if (propName === 'className') overrideProps[propName] = [\n slotPropValue,\n childPropValue\n ].filter(Boolean).join(' ');\n }\n return {\n ...slotProps,\n ...overrideProps\n };\n}\nconst $5e63c961fc1ce211$export$be92b6f5f03c0fe9 = $5e63c961fc1ce211$export$8c6ed5c666ac1360;\n\n\n\n\nexport {$5e63c961fc1ce211$export$8c6ed5c666ac1360 as Slot, $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 as Slottable, $5e63c961fc1ce211$export$be92b6f5f03c0fe9 as Root};\n//# sourceMappingURL=index.mjs.map\n","import $4q5Fq$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $4q5Fq$forwardRef, useEffect as $4q5Fq$useEffect, createElement as $4q5Fq$createElement} from \"react\";\nimport {flushSync as $4q5Fq$flushSync} from \"react-dom\";\nimport {Slot as $4q5Fq$Slot} from \"@radix-ui/react-slot\";\n\n\n\n\n\nconst $8927f6f2acc4f386$var$NODES = [\n 'a',\n 'button',\n 'div',\n 'form',\n 'h2',\n 'h3',\n 'img',\n 'input',\n 'label',\n 'li',\n 'nav',\n 'ol',\n 'p',\n 'span',\n 'svg',\n 'ul'\n]; // Temporary while we await merge of this fix:\n// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396\n// prettier-ignore\n/* -------------------------------------------------------------------------------------------------\n * Primitive\n * -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{\n const Node = /*#__PURE__*/ $4q5Fq$forwardRef((props, forwardedRef)=>{\n const { asChild: asChild , ...primitiveProps } = props;\n const Comp = asChild ? $4q5Fq$Slot : node;\n $4q5Fq$useEffect(()=>{\n window[Symbol.for('radix-ui')] = true;\n }, []);\n return /*#__PURE__*/ $4q5Fq$createElement(Comp, $4q5Fq$babelruntimehelpersesmextends({}, primitiveProps, {\n ref: forwardedRef\n }));\n });\n Node.displayName = `Primitive.${node}`;\n return {\n ...primitive,\n [node]: Node\n };\n}, {});\n/* -------------------------------------------------------------------------------------------------\n * Utils\n * -----------------------------------------------------------------------------------------------*/ /**\n * Flush custom event dispatch\n * https://github.com/radix-ui/primitives/pull/1378\n *\n * React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.\n *\n * Internally, React prioritises events in the following order:\n * - discrete\n * - continuous\n * - default\n *\n * https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350\n *\n * `discrete` is an important distinction as updates within these events are applied immediately.\n * React however, is not able to infer the priority of custom event types due to how they are detected internally.\n * Because of this, it's possible for updates from custom events to be unexpectedly batched when\n * dispatched by another `discrete` event.\n *\n * In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.\n * This utility should be used when dispatching a custom event from within another `discrete` event, this utility\n * is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.\n * For example:\n *\n * dispatching a known click 👎\n * target.dispatchEvent(new Event(‘click’))\n *\n * dispatching a custom type within a non-discrete event 👎\n * onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}\n *\n * dispatching a custom type within a `discrete` event 👍\n * onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}\n *\n * Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use\n * this utility with them. This is because it's possible for those handlers to be called implicitly during render\n * e.g. when focus is within a component as it is unmounted, or when managing focus on mount.\n */ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {\n if (target) $4q5Fq$flushSync(()=>target.dispatchEvent(event)\n );\n}\n/* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$be92b6f5f03c0fe9 = $8927f6f2acc4f386$export$250ffa63cdc0d034;\n\n\n\n\nexport {$8927f6f2acc4f386$export$250ffa63cdc0d034 as Primitive, $8927f6f2acc4f386$export$be92b6f5f03c0fe9 as Root, $8927f6f2acc4f386$export$6d1a0317bde7de7f as dispatchDiscreteCustomEvent};\n//# sourceMappingURL=index.mjs.map\n","import $7V4JZ$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $7V4JZ$forwardRef, createElement as $7V4JZ$createElement} from \"react\";\nimport {Primitive as $7V4JZ$Primitive} from \"@radix-ui/react-primitive\";\n\n\n\n\n/* -------------------------------------------------------------------------------------------------\n * Label\n * -----------------------------------------------------------------------------------------------*/ const $b73a6c6685e72184$var$NAME = 'Label';\nconst $b73a6c6685e72184$export$b04be29aa201d4f5 = /*#__PURE__*/ $7V4JZ$forwardRef((props, forwardedRef)=>{\n return /*#__PURE__*/ $7V4JZ$createElement($7V4JZ$Primitive.label, $7V4JZ$babelruntimehelpersesmextends({}, props, {\n ref: forwardedRef,\n onMouseDown: (event)=>{\n var _props$onMouseDown;\n (_props$onMouseDown = props.onMouseDown) === null || _props$onMouseDown === void 0 || _props$onMouseDown.call(props, event); // prevent text selection when double clicking label\n if (!event.defaultPrevented && event.detail > 1) event.preventDefault();\n }\n }));\n});\n/*#__PURE__*/ Object.assign($b73a6c6685e72184$export$b04be29aa201d4f5, {\n displayName: $b73a6c6685e72184$var$NAME\n});\n/* -----------------------------------------------------------------------------------------------*/ const $b73a6c6685e72184$export$be92b6f5f03c0fe9 = $b73a6c6685e72184$export$b04be29aa201d4f5;\n\n\n\n\nexport {$b73a6c6685e72184$export$b04be29aa201d4f5 as Label, $b73a6c6685e72184$export$be92b6f5f03c0fe9 as Root};\n//# sourceMappingURL=index.mjs.map\n","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React, { ReactNode } from \"react\";\nimport * as RadixLabel from \"@radix-ui/react-label\";\nimport c from \"classnames\";\n\nimport styles from \"./label.module.scss\";\n\nconst rootClassName = \"purpur-label\";\n\nexport type LabelProps = {\n \"data-testid\"?: string;\n children: ReactNode;\n className?: string;\n htmlFor: string;\n disabled?: boolean;\n negative?: boolean;\n};\nexport const Label = ({\n children,\n className,\n htmlFor,\n \"data-testid\": dataTestId,\n disabled,\n negative = false,\n ...props\n}: LabelProps) => {\n const classes = c([\n className,\n styles[rootClassName],\n {\n [styles[`${rootClassName}--disabled`]]: disabled,\n [styles[`${rootClassName}--negative`]]: negative,\n },\n ]);\n\n return (\n <RadixLabel.Root className={classes} data-testid={dataTestId} htmlFor={htmlFor} {...props}>\n {children}\n </RadixLabel.Root>\n );\n};\n"],"names":["_extends","target","i","source","key","$6ed0406888f73fc4$var$setRef","ref","value","$6ed0406888f73fc4$export$43e446d32b3d21af","refs","node","$5e63c961fc1ce211$export$8c6ed5c666ac1360","$9IrjX$forwardRef","props","forwardedRef","children","slotProps","childrenArray","$9IrjX$Children","slottable","$5e63c961fc1ce211$var$isSlottable","newElement","newChildren","child","$9IrjX$isValidElement","$9IrjX$createElement","$5e63c961fc1ce211$var$SlotClone","$9IrjX$babelruntimehelpersesmextends","$9IrjX$cloneElement","$5e63c961fc1ce211$var$mergeProps","$9IrjX$composeRefs","$5e63c961fc1ce211$export$d9f1ccf0bdb05d45","$9IrjX$Fragment","childProps","overrideProps","propName","slotPropValue","childPropValue","args","$8927f6f2acc4f386$var$NODES","$8927f6f2acc4f386$export$250ffa63cdc0d034","primitive","Node","$4q5Fq$forwardRef","asChild","primitiveProps","Comp","$4q5Fq$Slot","$4q5Fq$useEffect","$4q5Fq$createElement","$4q5Fq$babelruntimehelpersesmextends","$b73a6c6685e72184$export$b04be29aa201d4f5","$7V4JZ$forwardRef","$7V4JZ$createElement","$7V4JZ$Primitive","$7V4JZ$babelruntimehelpersesmextends","event","_props$onMouseDown","$b73a6c6685e72184$export$be92b6f5f03c0fe9","hasOwn","classNames","classes","arg","appendClass","parseValue","newClass","module","rootClassName","Label","className","htmlFor","dataTestId","disabled","negative","c","styles","jsx","RadixLabel.Root"],"mappings":";;;AAAe,SAASA,IAAW;AACjCA,SAAAA,IAAW,OAAO,SAAS,OAAO,OAAO,KAAI,IAAK,SAAUC,GAAQ;AAClE,aAASC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AACzC,UAAIC,IAAS,UAAUD,CAAC;AACxB,eAASE,KAAOD;AACd,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D;AAAA,EACA,WAAAsD;AAAA,EACA,SAAAC;AAAA,EACA,eAAeC;AAAA,EACf,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,GAAG5D;AACL,MAAkB;AAChB,QAAMgD,IAAUa,EAAE;AAAA,IAChBL;AAAA,IACAM,EAAOR,CAAa;AAAA,IACpB;AAAA,MACE,CAACQ,EAAO,GAAGR,CAAa,YAAY,CAAC,GAAGK;AAAA,MACxC,CAACG,EAAO,GAAGR,CAAa,YAAY,CAAC,GAAGM;AAAA,IAC1C;AAAA,EAAA,CACD;AAGC,SAAA,gBAAAG,EAACC,GAAA,EAAgB,WAAWhB,GAAS,eAAaU,GAAY,SAAAD,GAAmB,GAAGzD,GACjF,UAAAE,EACH,CAAA;AAEJ;","x_google_ignoreList":[0,1,2,3,4,5,6]}
|
package/dist/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._purpur-
|
|
1
|
+
._purpur-label_12cfi_1{color:var(--purpur-color-text-default);font-family:var(--purpur-typography-family-default);font-weight:var(--purpur-typography-weight-medium);font-size:var(--purpur-typography-scale-100);line-height:var(--purpur-typography-line-height-default);cursor:pointer}._purpur-label--negative_12cfi_9{color:var(--purpur-color-text-default-negative)}._purpur-label--disabled_12cfi_12{color:var(--purpur-color-text-weak);cursor:default}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpurds/label",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "./dist/label.cjs.js",
|
|
6
6
|
"types": "./dist/label.d.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@radix-ui/react-label": "~2.0.2",
|
|
18
18
|
"classnames": "~2.5.0",
|
|
19
|
-
"@purpurds/icon": "
|
|
20
|
-
"@purpurds/tokens": "
|
|
19
|
+
"@purpurds/icon": "5.0.0",
|
|
20
|
+
"@purpurds/tokens": "5.0.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@rushstack/eslint-patch": "~1.10.0",
|
package/src/label.module.scss
CHANGED
package/src/label.stories.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { Label } from "./label";
|
|
4
3
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
4
|
|
|
5
|
+
import { Label } from "./label";
|
|
6
|
+
|
|
6
7
|
const meta: Meta<typeof Label> = {
|
|
7
8
|
title: "Components/Label",
|
|
8
9
|
component: Label,
|
|
@@ -46,12 +47,10 @@ const meta: Meta<typeof Label> = {
|
|
|
46
47
|
],
|
|
47
48
|
},
|
|
48
49
|
argTypes: {
|
|
49
|
-
["data-testid"]: { control: { type: "text" } },
|
|
50
50
|
htmlFor: { control: { type: "text" } },
|
|
51
|
-
className: { control: { type: "text" } },
|
|
52
51
|
children: { control: { type: "text" } },
|
|
53
|
-
disabled: { control: { type: "boolean" } },
|
|
54
52
|
},
|
|
53
|
+
args: { negative: false },
|
|
55
54
|
};
|
|
56
55
|
export default meta;
|
|
57
56
|
|
|
@@ -64,13 +63,18 @@ export const Showcase: Story = {
|
|
|
64
63
|
disabled: false,
|
|
65
64
|
},
|
|
66
65
|
render: ({ children, htmlFor, ...args }) => (
|
|
67
|
-
|
|
66
|
+
<div
|
|
67
|
+
style={{
|
|
68
|
+
padding: "var(--purpur-spacing-250)",
|
|
69
|
+
background: args.negative ? "var(--purpur-color-purple-900)" : "transparent",
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
68
72
|
<Label htmlFor={htmlFor} {...args}>
|
|
69
73
|
{children}
|
|
70
74
|
</Label>
|
|
71
75
|
<div>
|
|
72
76
|
<input type="text" id={htmlFor} defaultValue="Xavier" />
|
|
73
77
|
</div>
|
|
74
|
-
|
|
78
|
+
</div>
|
|
75
79
|
),
|
|
76
80
|
};
|
package/src/label.tsx
CHANGED
|
@@ -12,6 +12,7 @@ export type LabelProps = {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
htmlFor: string;
|
|
14
14
|
disabled?: boolean;
|
|
15
|
+
negative?: boolean;
|
|
15
16
|
};
|
|
16
17
|
export const Label = ({
|
|
17
18
|
children,
|
|
@@ -19,12 +20,16 @@ export const Label = ({
|
|
|
19
20
|
htmlFor,
|
|
20
21
|
"data-testid": dataTestId,
|
|
21
22
|
disabled,
|
|
23
|
+
negative = false,
|
|
22
24
|
...props
|
|
23
25
|
}: LabelProps) => {
|
|
24
26
|
const classes = c([
|
|
25
27
|
className,
|
|
26
28
|
styles[rootClassName],
|
|
27
|
-
{
|
|
29
|
+
{
|
|
30
|
+
[styles[`${rootClassName}--disabled`]]: disabled,
|
|
31
|
+
[styles[`${rootClassName}--negative`]]: negative,
|
|
32
|
+
},
|
|
28
33
|
]);
|
|
29
34
|
|
|
30
35
|
return (
|