najwer23morsels 0.1.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # najwer23morsels
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Slider without styles for arrows
8
+
9
+ ## 0.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - TextBox
14
+
3
15
  ## 0.0.1
4
16
 
5
17
  ### Patch Changes
package/lib/Slider.js ADDED
@@ -0,0 +1 @@
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import r,{useState as n,useRef as l,useEffect as i,useCallback as s}from"react";import{s as o}from"./style-inject.es-BnTDb6vU.js";var a="Slider-module_sliderContainer__o7YCe",d="Slider-module_slideWrapper__Jll6Y",c="Slider-module_slide__G9U2-",m="Slider-module_sliderBtnControl__dtMGL",f="Slider-module_btn__FGB-r";o("@layer najwer23morselsSlider{.Slider-module_sliderContainer__o7YCe{display:flex;flex-direction:column;gap:10px;height:100%;position:relative;user-select:none;width:100%}.Slider-module_slideWrapper__Jll6Y{height:100%;overflow:hidden;position:relative;width:100%;will-change:transform}.Slider-module_slide__G9U2-{height:calc(100% - 2px);overflow:hidden;position:absolute;top:0;width:calc(100% - 100px);will-change:transform;&>*{height:100%;width:100%}}.Slider-module_sliderBtnControl__dtMGL{align-items:center;display:flex;font-size:20px;height:100%;justify-content:space-between;left:0;padding:0 20px;pointer-events:none;position:absolute;right:0;z-index:100}.Slider-module_btn__FGB-r{background-color:#1f487e;border:1px solid #fff;border-radius:5px;color:#fff;cursor:pointer;left:50%;padding:10px 30px;pointer-events:auto;user-select:none}}");const p=(e,t,n=!1)=>(n?e.slice(0,t):e.slice(-t)).map((e,t)=>r.cloneElement(e,{key:`${n?"clone-first":"clone-last"}-${t}`,className:e.props.className})),h=({isCircular:o=!1,children:h})=>{const u=r.Children.toArray(h).filter(r.isValidElement),[_,g]=n(o&&u.length>=2?2:0),[y,x]=n(!1),[v,w]=n(0),[b,N]=n(0),S=l(null),C=l([]),E=o&&u.length>=2?[...p(u,2,!1),...u.map((e,t)=>r.cloneElement(e,{key:e.key??t,className:e.props.className})),...p(u,2,!0)]:u.map((e,t)=>r.cloneElement(e,{key:e.key??t,className:e.props.className}));C.current.length!==E.length&&(C.current=Array(E.length).fill(null)),i(()=>{g(o&&u.length>=2?2:0)},[o,u.length]);const k=s(()=>{const e=S.current;if(!e)return;const t=C.current[0];if(!t)return;const r=window.getComputedStyle(t);w(t.offsetWidth+parseFloat(r.marginLeft)+parseFloat(r.marginRight)),N(e.offsetWidth)},[]);i(()=>(k(),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)),[k]),i(()=>{const e=v+10;C.current.forEach((t,r)=>{if(t)if(o){const n=(r-_)*e+(b-v)/2;t.style.transition=y?"transform 0.4s cubic-bezier(.4,0,.2,1)":"none",t.style.transform=`translateX(${n}px)`,t.style.left=""}else{const n=e*(r-_)+(b-v)/2;if(y){const e=parseFloat(t.style.left||"0");t.animate([{left:`${e}px`},{left:`${n}px`}],{duration:400,easing:"ease-out",fill:"forwards"}).finished.then(()=>{t.style.left=`${n}px`,x(!1)})}else t.style.left=`${n}px`;t.style.transition="none",t.style.transform=""}})},[_,v,b,y,E.length,o]),i(()=>{if(!o||!y)return;const e=C.current.length,t=C.current[e-1];if(!t)return;const r=()=>{let n=_;1===_?n=e-3:_===e-2&&(n=2),n!==_&&g(n),x(!1),t.removeEventListener("transitionend",r)};return t.addEventListener("transitionend",r),()=>t.removeEventListener("transitionend",r)},[_,o,y]);return e("div",{className:a,children:[e("div",{className:m,children:[t("button",{className:f,onClick:()=>{y||(x(!0),g(o?e=>e-1:e=>Math.max(e-1,0)))},disabled:y,children:"Prev"}),t("button",{className:f,onClick:()=>{y||(x(!0),g(o?e=>e+1:e=>Math.min(e+1,E.length-1)))},disabled:y,children:"Next"})]}),t("div",{className:d,ref:S,children:E.map((e,r)=>t("div",{ref:e=>{C.current[r]=e},className:`${c}`,"aria-hidden":_!==r,children:e},e.key??r))})]})};h.displayName="Slider";export{h as Slider};
package/lib/Textbox.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";var r={morselsTextBox:"TextBox-module_morselsTextBox__h97Ta"};!function(e,t){void 0===t&&(t={});var r=t.insertAt;if("undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===r&&o.firstChild?o.insertBefore(a,o.firstChild):o.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}("@layer najwer23morselsTextBox{.TextBox-module_morselsTextBox__h97Ta{--mobileFontSize:var(--ms);--desktopFontSize:var(--ds);--minViewport:400;--maxViewport:1400;--textBoxFontFamilyDefault:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;--clampMinSize:min(var(--mobileFontSize),var(--desktopFontSize));--clampMaxSize:max(var(--mobileFontSize),var(--desktopFontSize));--fluidStartSize:var(--mobileFontSize);--fluidEndSize:var(--desktopFontSize);--sizeDifference:calc(var(--fluidEndSize) - var(--fluidStartSize));--viewportRange:calc(var(--maxViewport) - var(--minViewport));--slope:calc(var(--sizeDifference)/var(--viewportRange));--intercept:calc(var(--fluidStartSize) - var(--slope)*var(--minViewport));color:var(--najwer23morselsTextBoxColor,var(--c));font-family:var(--najwer23morselsFontFamily,var(--textBoxFontFamilyDefault));font-size:clamp(calc(var(--clampMinSize)/16*1rem),calc(var(--slope)*100vw + var(--intercept)/16*1rem),calc(var(--clampMaxSize)/16*1rem));font-weight:var(--najwer23morselsTextBoxFontWeight,var(--fw));line-height:var(--najwer23morselsTextBoxLineHeight,var(--lh,1.42857));margin:var(--najwer23morselsTextBoxMargin,var(--m));& a{color:var(--najwer23morselsTextBoxColor,var(--c));font-weight:var(--najwer23morselsTextBoxFontWeight,var(--fw));text-decoration:unset;transition:color .3s ease-in-out;&:active,&:focus-visible,&:hover{color:var(--najwer23morselsTextBoxColorHover,var(--ch,var(--c)));font-weight:var(--najwer23morselsTextBoxFontWeightHover,var(--fwh,var(--fw)));text-decoration:underline}}}}");const o=({tag:o="div",children:a,className:i,target:l,rel:n,mobileSize:s,desktopSize:m,lineHeight:c,color:v,href:x,colorHover:d,margin:f,fontWeight:h,fontWeightHover:p,...w})=>e(o,{style:{"--fw":h,"--fwh":p,"--ch":d,"--c":v,"--ms":s,"--ds":m,"--lh":c,...null!=f?{"--m":f}:{}},className:[r.morselsTextBox,"MorselsTextBox",i].filter(Boolean).join(" "),...w,children:[x&&t("a",{className:"MorselsTextBoxLink",href:x,target:l,rel:n,children:a}),!x&&a]});o.displayName="TextBox";export{o as TextBox};
1
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import{s as o}from"./style-inject.es-BnTDb6vU.js";var a={morselsTextBox:"TextBox-module_morselsTextBox__h97Ta"};o("@layer najwer23morselsTextBox{.TextBox-module_morselsTextBox__h97Ta{--mobileFontSize:var(--ms);--desktopFontSize:var(--ds);--minViewport:400;--maxViewport:1400;--textBoxFontFamilyDefault:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;--clampMinSize:min(var(--mobileFontSize),var(--desktopFontSize));--clampMaxSize:max(var(--mobileFontSize),var(--desktopFontSize));--fluidStartSize:var(--mobileFontSize);--fluidEndSize:var(--desktopFontSize);--sizeDifference:calc(var(--fluidEndSize) - var(--fluidStartSize));--viewportRange:calc(var(--maxViewport) - var(--minViewport));--slope:calc(var(--sizeDifference)/var(--viewportRange));--intercept:calc(var(--fluidStartSize) - var(--slope)*var(--minViewport));color:var(--najwer23morselsTextBoxColor,var(--c));font-family:var(--najwer23morselsFontFamily,var(--textBoxFontFamilyDefault));font-size:clamp(calc(var(--clampMinSize)/16*1rem),calc(var(--slope)*100vw + var(--intercept)/16*1rem),calc(var(--clampMaxSize)/16*1rem));font-weight:var(--najwer23morselsTextBoxFontWeight,var(--fw));line-height:var(--najwer23morselsTextBoxLineHeight,var(--lh,1.42857));margin:var(--najwer23morselsTextBoxMargin,var(--m));& a{color:var(--najwer23morselsTextBoxColor,var(--c));font-weight:var(--najwer23morselsTextBoxFontWeight,var(--fw));text-decoration:unset;transition:color .3s ease-in-out;&:active,&:focus-visible,&:hover{color:var(--najwer23morselsTextBoxColorHover,var(--ch,var(--c)));font-weight:var(--najwer23morselsTextBoxFontWeightHover,var(--fwh,var(--fw)));text-decoration:underline}}}}");const t=({tag:o="div",children:t,className:i,target:l,rel:n,mobileSize:s,desktopSize:m,lineHeight:v,color:c,href:x,colorHover:f,margin:h,fontWeight:p,fontWeightHover:w,...d})=>e(o,{style:{"--fw":p,"--fwh":w,"--ch":f,"--c":c,"--ms":s,"--ds":m,"--lh":v,...null!=h?{"--m":h}:{}},className:[a.morselsTextBox,"MorselsTextBox",i].filter(Boolean).join(" "),...d,children:[x&&r("a",{className:"MorselsTextBoxLink",href:x,target:l,rel:n,children:t}),!x&&t]});t.displayName="TextBox";export{t as TextBox};
@@ -0,0 +1,7 @@
1
+ import React, { ReactNode } from 'react';
2
+ type SliderProps = {
3
+ isCircular?: boolean;
4
+ children: ReactNode;
5
+ };
6
+ export declare const Slider: React.FC<SliderProps>;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Slider } from './Slider';
2
+ export { Slider };
@@ -0,0 +1 @@
1
+ function e(e,t){void 0===t&&(t={});var d=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===d&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}export{e as s};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najwer23morsels",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./lib/index.mjs",
6
6
  "types": "./lib/index.d.ts",
Binary file
Binary file
Binary file
Binary file
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="1080" height="1080" viewBox="0 0 1080 1080">
2
- <rect width="1080" height="1080" fill="black"/>
3
- </svg>
Binary file
File without changes
File without changes