@purpurds/label 7.14.0 → 8.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.es.js +7 -7
- package/dist/styles.css +1 -1
- package/package.json +4 -4
- package/src/label.module.scss +5 -0
- package/src/label.stories.tsx +2 -7
package/dist/label.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),v=require("react");require("react-dom");function g(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const s=g(v);function b(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function j(...e){return n=>{let t=!1;const o=e.map(i=>{const r=b(i,n);return!t&&typeof r=="function"&&(t=!0),r});if(t)return()=>{for(let i=0;i<o.length;i++){const r=o[i];typeof r=="function"?r():b(e[i],null)}}}}var y=s.forwardRef((e,n)=>{const{children:t,...o}=e,i=s.Children.toArray(t),r=i.find(w);if(r){const l=r.props.children,a=i.map(d=>d===r?s.Children.count(l)>1?s.Children.only(null):s.isValidElement(l)?l.props.children:null:d);return u.jsx(p,{...o,ref:n,children:s.isValidElement(l)?s.cloneElement(l,void 0,a):null})}return u.jsx(p,{...o,ref:n,children:t})});y.displayName="Slot";var p=s.forwardRef((e,n)=>{const{children:t,...o}=e;if(s.isValidElement(t)){const i=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),v=require("react");require("react-dom");function g(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const s=g(v);function b(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function j(...e){return n=>{let t=!1;const o=e.map(i=>{const r=b(i,n);return!t&&typeof r=="function"&&(t=!0),r});if(t)return()=>{for(let i=0;i<o.length;i++){const r=o[i];typeof r=="function"?r():b(e[i],null)}}}}var y=s.forwardRef((e,n)=>{const{children:t,...o}=e,i=s.Children.toArray(t),r=i.find(w);if(r){const l=r.props.children,a=i.map(d=>d===r?s.Children.count(l)>1?s.Children.only(null):s.isValidElement(l)?l.props.children:null:d);return u.jsx(p,{...o,ref:n,children:s.isValidElement(l)?s.cloneElement(l,void 0,a):null})}return u.jsx(p,{...o,ref:n,children:t})});y.displayName="Slot";var p=s.forwardRef((e,n)=>{const{children:t,...o}=e;if(s.isValidElement(t)){const i=O(t),r=x(o,t.props);return t.type!==s.Fragment&&(r.ref=n?j(n,i):i),s.cloneElement(t,r)}return s.Children.count(t)>1?s.Children.only(null):null});p.displayName="SlotClone";var S=({children:e})=>u.jsx(u.Fragment,{children:e});function w(e){return s.isValidElement(e)&&e.type===S}function x(e,n){const t={...n};for(const o in n){const i=e[o],r=n[o];/^on[A-Z]/.test(o)?i&&r?t[o]=(...a)=>{r(...a),i(...a)}:i&&(t[o]=i):o==="style"?t[o]={...i,...r}:o==="className"&&(t[o]=[i,r].filter(Boolean).join(" "))}return{...e,...t}}function O(e){var o,i;let n=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var R=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],N=R.reduce((e,n)=>{const t=s.forwardRef((o,i)=>{const{asChild:r,...l}=o,a=r?y:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(a,{...l,ref:i})});return t.displayName=`Primitive.${n}`,{...e,[n]:t}},{}),P="Label",h=s.forwardRef((e,n)=>u.jsx(N.label,{...e,ref:n,onMouseDown:t=>{var i;t.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));h.displayName=P;var _=h;function C(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c={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
|
-
*/var m;function E(){return m||(m=1,function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",l=0;l<arguments.length;l++){var a=arguments[l];a&&(r=i(r,o.call(this,a)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var l="";for(var a in r)n.call(r,a)&&r[a]&&(l=i(l,this&&this[a]||a));return l}function i(r,l){return l?r?r+" "+l:r+l:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()}(c)),c.exports}var D=E();const V=C(D),A={"purpur-label":"_purpur-
|
|
5
|
+
*/var m;function E(){return m||(m=1,function(e){(function(){var n={}.hasOwnProperty;function t(){for(var r="",l=0;l<arguments.length;l++){var a=arguments[l];a&&(r=i(r,o.call(this,a)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var l="";for(var a in r)n.call(r,a)&&r[a]&&(l=i(l,this&&this[a]||a));return l}function i(r,l){return l?r?r+" "+l:r+l:r}e.exports?(t.default=t,e.exports=t):window.classNames=t})()}(c)),c.exports}var D=E();const V=C(D),A={"purpur-label":"_purpur-label_1x80u_1","purpur-label--negative":"_purpur-label--negative_1x80u_8","purpur-label--disabled":"_purpur-label--disabled_1x80u_11"},M=V.bind(A),f="purpur-label",q=({children:e,className:n,disabled:t,negative:o=!1,...i})=>{const r=M(n,f,{[`${f}--disabled`]:t,[`${f}--negative`]:o});return u.jsx(_,{className:r,...i,children:e})};exports.Label=q;
|
|
6
6
|
//# sourceMappingURL=label.cjs.js.map
|
package/dist/label.es.js
CHANGED
|
@@ -82,7 +82,7 @@ var C = [
|
|
|
82
82
|
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u(a, { ...l, ref: i });
|
|
83
83
|
});
|
|
84
84
|
return r.displayName = `Primitive.${n}`, { ...e, [n]: r };
|
|
85
|
-
}, {}),
|
|
85
|
+
}, {}), x = "Label", h = s.forwardRef((e, n) => /* @__PURE__ */ u(
|
|
86
86
|
E.label,
|
|
87
87
|
{
|
|
88
88
|
...e,
|
|
@@ -93,7 +93,7 @@ var C = [
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
));
|
|
96
|
-
h.displayName =
|
|
96
|
+
h.displayName = x;
|
|
97
97
|
var P = h;
|
|
98
98
|
function _(e) {
|
|
99
99
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
@@ -137,11 +137,11 @@ function O() {
|
|
|
137
137
|
})();
|
|
138
138
|
}(f)), f.exports;
|
|
139
139
|
}
|
|
140
|
-
var
|
|
141
|
-
const D = /* @__PURE__ */ _(
|
|
142
|
-
"purpur-label": "_purpur-
|
|
143
|
-
"purpur-label--negative": "_purpur-label--
|
|
144
|
-
"purpur-label--disabled": "_purpur-label--
|
|
140
|
+
var j = O();
|
|
141
|
+
const D = /* @__PURE__ */ _(j), V = {
|
|
142
|
+
"purpur-label": "_purpur-label_1x80u_1",
|
|
143
|
+
"purpur-label--negative": "_purpur-label--negative_1x80u_8",
|
|
144
|
+
"purpur-label--disabled": "_purpur-label--disabled_1x80u_11"
|
|
145
145
|
}, A = D.bind(V), c = "purpur-label", $ = ({
|
|
146
146
|
children: e,
|
|
147
147
|
className: n,
|
package/dist/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._purpur-
|
|
1
|
+
._purpur-label_1x80u_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)}._purpur-label--negative_1x80u_8{color:var(--purpur-color-text-default-negative)}._purpur-label--disabled_1x80u_11{color:var(--purpur-color-text-weak);cursor:default}._purpur-label_1x80u_1._purpur-label--negative_1x80u_8._purpur-label--disabled_1x80u_11{color:var(--purpur-color-text-weak-negative)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpurds/label",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "./dist/label.cjs.js",
|
|
6
6
|
"types": "./dist/label.d.ts",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@radix-ui/react-label": "~2.1.2",
|
|
19
19
|
"classnames": "~2.5.0",
|
|
20
|
-
"@purpurds/
|
|
21
|
-
"@purpurds/
|
|
22
|
-
"@purpurds/
|
|
20
|
+
"@purpurds/tokens": "8.0.0",
|
|
21
|
+
"@purpurds/common-types": "8.0.0",
|
|
22
|
+
"@purpurds/icon": "8.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@storybook/react-vite": "^9.0.18",
|
package/src/label.module.scss
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.purpur-label {
|
|
2
|
+
$root: &;
|
|
2
3
|
color: var(--purpur-color-text-default);
|
|
3
4
|
font-family: var(--purpur-typography-family-default);
|
|
4
5
|
font-weight: var(--purpur-typography-weight-medium);
|
|
@@ -13,4 +14,8 @@
|
|
|
13
14
|
color: var(--purpur-color-text-weak);
|
|
14
15
|
cursor: default;
|
|
15
16
|
}
|
|
17
|
+
|
|
18
|
+
&#{$root}--negative#{$root}--disabled {
|
|
19
|
+
color: var(--purpur-color-text-weak-negative);
|
|
20
|
+
}
|
|
16
21
|
}
|
package/src/label.stories.tsx
CHANGED
|
@@ -63,17 +63,12 @@ type Story = StoryObj<typeof Label>;
|
|
|
63
63
|
|
|
64
64
|
export const Showcase: Story = {
|
|
65
65
|
render: ({ children, htmlFor, ...args }) => (
|
|
66
|
-
|
|
67
|
-
style={{
|
|
68
|
-
padding: "var(--purpur-spacing-250)",
|
|
69
|
-
background: args.negative ? "var(--purpur-color-purple-900)" : "transparent",
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
66
|
+
<>
|
|
72
67
|
<Label {...args}>{children}</Label>
|
|
73
68
|
<div>
|
|
74
69
|
<input type="text" id={htmlFor} defaultValue="Xavier" />
|
|
75
70
|
</div>
|
|
76
|
-
|
|
71
|
+
</>
|
|
77
72
|
),
|
|
78
73
|
tags: ["visual:check"],
|
|
79
74
|
};
|