Skip to content

Commit

Permalink
upgrade deps && docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank1513 committed Dec 19, 2024
1 parent d872160 commit a4ea745
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
<pre><code class="ts"><span class="hl-3">export</span><span class="hl-1"> </span><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-0">ColorSwitch</span><span class="hl-1"> = ({ </span><span class="hl-4">targetId</span><span class="hl-1">, </span><span class="hl-4">skipSystem</span><span class="hl-1">, </span><span class="hl-4">size</span><span class="hl-1">, ...</span><span class="hl-4">props</span><span class="hl-1"> }: </span><span class="hl-8">ColorSwitchProps</span><span class="hl-1">) </span><span class="hl-6">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">const</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-13">setColorSchemePreference</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">resolvedColorScheme</span><span class="hl-1">: </span><span class="hl-13">rcs</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">colorSchemePreference</span><span class="hl-1">: </span><span class="hl-13">csp</span><span class="hl-1">,</span><br/><span class="hl-1"> } = </span><span class="hl-0">useTheme</span><span class="hl-1">(</span><span class="hl-4">targetId</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-0">toggleColorScheme</span><span class="hl-1"> = () </span><span class="hl-6">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">switch</span><span class="hl-1"> (</span><span class="hl-4">csp</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">case</span><span class="hl-1"> </span><span class="hl-2">&quot;dark&quot;</span><span class="hl-1">:</span><br/><span class="hl-1"> </span><span class="hl-0">setColorSchemePreference</span><span class="hl-1">(</span><span class="hl-2">&quot;light&quot;</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">break</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">case</span><span class="hl-1"> </span><span class="hl-2">&quot;light&quot;</span><span class="hl-1">:</span><br/><span class="hl-1"> </span><span class="hl-0">setColorSchemePreference</span><span class="hl-1">(</span><span class="hl-4">skipSystem</span><span class="hl-1"> ? </span><span class="hl-2">&quot;dark&quot;</span><span class="hl-1"> : </span><span class="hl-2">&quot;system&quot;</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">break</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">case</span><span class="hl-1"> </span><span class="hl-2">&quot;system&quot;</span><span class="hl-1">:</span><br/><span class="hl-1"> </span><span class="hl-3">default</span><span class="hl-1">:</span><br/><span class="hl-1"> </span><span class="hl-0">setColorSchemePreference</span><span class="hl-1">(</span><span class="hl-2">&quot;dark&quot;</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">break</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> };</span><br/><span class="hl-1"> </span><span class="hl-3">return</span><span class="hl-1"> (</span><br/><span class="hl-1"> &lt;</span><span class="hl-4">button</span><br/><span class="hl-1"> </span><span class="hl-4">className</span><span class="hl-1">={</span><span class="hl-4">[</span><span class="hl-2">&quot;nthul--color-switch&quot;</span><span class="hl-4">, rcs, csp </span><span class="hl-1">===</span><span class="hl-4"> </span><span class="hl-2">&quot;system&quot;</span><span class="hl-4"> </span><span class="hl-1">?</span><span class="hl-4"> </span><span class="hl-2">&quot;system&quot;</span><span class="hl-4"> </span><span class="hl-1">:</span><span class="hl-4"> </span><span class="hl-2">&quot;&quot;</span><span class="hl-4">].join(&quot; &quot;)}</span><br/><span class="hl-4"> data-testid=&quot;color-switch&quot;</span><br/><span class="hl-4"> {...props}</span><br/><span class="hl-4"> onClick={toggleColorScheme}</span><br/><span class="hl-4"> </span><span class="hl-5">// @ts-expect-error -- setting custom attribute</span><br/><span class="hl-4"> style={{ &quot;--size&quot;:</span><span class="hl-1"> </span><span class="hl-2">`</span><span class="hl-6">${</span><span class="hl-4">size</span><span class="hl-6">}</span><span class="hl-2">px`</span><span class="hl-1"> }}</span><br/><span class="hl-1"> </span><span class="hl-4">type</span><span class="hl-1">=</span><span class="hl-2">&quot;button&quot;</span><br/><span class="hl-1"> /&gt;</span><br/><span class="hl-1"> );</span><br/><span class="hl-1">};</span>
</code><button type="button">Copy</button></pre>

</div></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="colorswitch" class="tsd-anchor"></a><span class="tsd-kind-call-signature">ColorSwitch</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">__namedParameters</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/client_color-switch_color-switch._internal_.ColorSwitchProps.html" class="tsd-signature-type tsd-kind-interface">ColorSwitchProps</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Element</span><a href="#colorswitch" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">__namedParameters</span>: <a href="../interfaces/client_color-switch_color-switch._internal_.ColorSwitchProps.html" class="tsd-signature-type tsd-kind-interface">ColorSwitchProps</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Element</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/react18-tools/nextjs-themes-ultra/blob/17b90fd8e846504b409aa65f29da055c2d59d321/lib/src/client/color-switch/color-switch.tsx#L30">client/color-switch/color-switch.tsx:30</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">React18 Loaders</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
</div></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="colorswitch" class="tsd-anchor"></a><span class="tsd-kind-call-signature">ColorSwitch</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">__namedParameters</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/client_color-switch_color-switch._internal_.ColorSwitchProps.html" class="tsd-signature-type tsd-kind-interface">ColorSwitchProps</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Element</span><a href="#colorswitch" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">__namedParameters</span>: <a href="../interfaces/client_color-switch_color-switch._internal_.ColorSwitchProps.html" class="tsd-signature-type tsd-kind-interface">ColorSwitchProps</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Element</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/react18-tools/nextjs-themes-ultra/blob/d872160257611fa0c1b2a1630e9e6c86bdb0320b/lib/src/client/color-switch/color-switch.tsx#L30">client/color-switch/color-switch.tsx:30</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">React18 Loaders</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
Loading

0 comments on commit a4ea745

Please sign in to comment.