UNPKG

react-winplaza-98

Version:

React components with a Win98 a e s t h e c t i c

3 lines (2 loc) 3.47 kB
"use strict";var e=require("react");function t(e){var a,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(a=0;a<e.length;a++)e[a]&&(n=t(e[a]))&&(r&&(r+=" "),r+=n);else for(a in e)e[a]&&(r&&(r+=" "),r+=a);return r}function a(){for(var e,a,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(a=t(e))&&(r&&(r+=" "),r+=a);return r}!function(e,t){void 0===t&&(t={});var a=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===a&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}("button.focused {\n outline: 1px dotted black;\n outline-offset: -4px;\n}\n\nbutton.active {\n box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a,\n inset -2px -2px #dfdfdf, inset 2px 2px #808080;\n}\n");const n=e.forwardRef((({name:t,label:a,...n},r)=>e.createElement(e.Fragment,null,e.createElement("input",{type:"checkbox",name:t,id:t,...n,ref:r}),e.createElement("label",{htmlFor:t},a)))),r=e.forwardRef((({name:t,label:a,children:n,...r},l)=>e.createElement("select",{ref:l,name:t,...r},n))),l=({label:t,children:a})=>e.createElement("fieldset",null,t&&e.createElement("legend",null,t),a);l.displayName="GroupBox";const o=e.createContext(void 0),c=e.forwardRef((({label:t,...a},n)=>{const r=e.useId(),{name:l,value:c,onChange:i,defaultValue:s}=(()=>{const t=e.useContext(o);if(void 0===t)throw new Error("The OptionButton compound components cannot be rendered outside the OptionGroup component");return t})();return e.createElement("div",{className:"field-row"},e.createElement("input",{id:r,type:"radio",name:l,...a,ref:n,defaultChecked:s?s===a.value:void 0,checked:c?c===a.value:void 0,onChange:e=>i?.(e.target.value)}),e.createElement("label",{htmlFor:r},t))})),i=e.forwardRef((({name:t,label:n,minLabel:r,maxLabel:l,min:o,max:c,className:i,boxIndicator:s=!1,vertical:d=!1,onChange:m,...f},u)=>{const p=e.useId();return e.createElement("div",{className:"field-row"},e.createElement("label",{htmlFor:`${p}-label`},n),r&&e.createElement("label",{htmlFor:p},r),e.createElement("div",{className:a(d&&"is-vertical")},e.createElement("input",{...f,ref:u,onChange:e=>{m?.(e,Number(e.target.value))},className:a(i,{"has-box-indicator":s}),id:p,name:t,type:"range",min:o,max:c})),l&&e.createElement("label",{htmlFor:`${p}-high`},l))})),s=e.forwardRef((({name:t,label:n,labelPosition:r="top",className:l,...o},c)=>{const i=e.useId();return e.createElement("div",{className:a(l,{"field-row":"left"===r,"field-row-stacked":"top"===r})},e.createElement("label",{htmlFor:i},n),e.createElement("textarea",{ref:c,id:i,name:t,...o}))})),d=e.forwardRef((function({type:t="text",name:n,label:r,labelPosition:l="left",className:o,...c},i){const s=e.useId();return e.createElement("div",{className:a(o,{"field-row":"left"===l,"field-row-stacked":"top"===l})},e.createElement("label",{htmlFor:s},r),e.createElement("input",{id:s,name:n,type:t,ref:i,...c}))}));exports.Button=({active:t,children:n,className:r,focused:l,...o})=>e.createElement("button",{...o,className:a(r,t&&"active",l&&"focused")},n),exports.Checkbox=n,exports.Dropdown=r,exports.GroupBox=l,exports.OptionButton=c,exports.OptionGroup=t=>e.createElement(o.Provider,{value:t},t.children),exports.Slider=i,exports.TextArea=s,exports.TextBox=d; //# sourceMappingURL=index.js.map