softable-pixels-web 1.1.13 → 1.1.16
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/{Button-4H6aUA5C.js → Button-DOEMYhEA.js} +3 -3
- package/dist/{Button-4H6aUA5C.js.map → Button-DOEMYhEA.js.map} +1 -1
- package/dist/{CheckItem-DibKGIhC.js → CheckItem-Cnw5hlwV.js} +4 -4
- package/dist/{CheckItem-DibKGIhC.js.map → CheckItem-Cnw5hlwV.js.map} +1 -1
- package/dist/{Checkbox-B4tNv4jt.js → Checkbox-DaRHUBSb.js} +4 -4
- package/dist/{Checkbox-B4tNv4jt.js.map → Checkbox-DaRHUBSb.js.map} +1 -1
- package/dist/{ContextMenu-BTTCFutN.js → ContextMenu-CPjeo0m1.js} +5 -5
- package/dist/{ContextMenu-BTTCFutN.js.map → ContextMenu-CPjeo0m1.js.map} +1 -1
- package/dist/{Icon-D5APBt9w.js → Icon-kjpHbCbF.js} +34 -2
- package/dist/Icon-kjpHbCbF.js.map +1 -0
- package/dist/{IconButton-CdC3tmC8.js → IconButton-DZjuxp2Q.js} +2 -2
- package/dist/{IconButton-CdC3tmC8.js.map → IconButton-DZjuxp2Q.js.map} +1 -1
- package/dist/{InfoSummary-BsAWbXEg.js → InfoSummary-C7mxow-z.js} +3 -3
- package/dist/{InfoSummary-BsAWbXEg.js.map → InfoSummary-C7mxow-z.js.map} +1 -1
- package/dist/{Input-BlnxnTwX.js → Input-B0J7yEux.js} +9 -10
- package/dist/Input-B0J7yEux.js.map +1 -0
- package/dist/{Label-BF8xMYbk.js → Label-BVkidQlv.js} +2 -2
- package/dist/{Label-BF8xMYbk.js.map → Label-BVkidQlv.js.map} +1 -1
- package/dist/{Popover-BupmR_Yj.js → Popover-DI9wSxIa.js} +4 -4
- package/dist/{Popover-BupmR_Yj.js.map → Popover-DI9wSxIa.js.map} +1 -1
- package/dist/Select-DFPwAzYG.js +242 -0
- package/dist/Select-DFPwAzYG.js.map +1 -0
- package/dist/{Switch-Cs5WiyAN.js → Switch-ZmanGt2r.js} +2 -2
- package/dist/{Switch-Cs5WiyAN.js.map → Switch-ZmanGt2r.js.map} +1 -1
- package/dist/{TabSwitch-CPf5sVyP.js → TabSwitch-2WIjQ2Ie.js} +3 -3
- package/dist/{TabSwitch-CPf5sVyP.js.map → TabSwitch-2WIjQ2Ie.js.map} +1 -1
- package/dist/{TextArea-E7PBos0U.js → TextArea-DGCFyZrW.js} +5 -5
- package/dist/{TextArea-E7PBos0U.js.map → TextArea-DGCFyZrW.js.map} +1 -1
- package/dist/{ThemeContext-C4vgT3aV.js → ThemeContext-bVaozqut.js} +7 -4
- package/dist/ThemeContext-bVaozqut.js.map +1 -0
- package/dist/{Typography-C3d8okRT.js → Typography-CHkdzH2K.js} +2 -2
- package/dist/{Typography-C3d8okRT.js.map → Typography-CHkdzH2K.js.map} +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.js +3 -3
- package/dist/check-item.d.ts +1 -1
- package/dist/check-item.js +4 -4
- package/dist/checkbox.d.ts +2 -2
- package/dist/checkbox.js +4 -4
- package/dist/context-menu.d.ts +1 -1
- package/dist/context-menu.js +7 -7
- package/dist/icon-button.d.ts +1 -1
- package/dist/icon-button.js +2 -2
- package/dist/index--Oqbm-1T.d.ts +144 -0
- package/dist/index-B96rw-7n.d.ts +103 -0
- package/dist/{index-CCiP7SPG.d.ts → index-BLvNLvv2.d.ts} +2 -2
- package/dist/{index-DewFmT68.d.ts → index-Bw_XZiTz.d.ts} +1 -1
- package/dist/{index-CMO76g6X.d.ts → index-C5I_cIP2.d.ts} +2 -2
- package/dist/{index-tuCoYmWd.d.ts → index-C9q8d9Md.d.ts} +2 -2
- package/dist/{index-BwB3yoLa.d.ts → index-CM9BXEm3.d.ts} +1 -1
- package/dist/{index-Dd5yjyJK.d.ts → index-CQWwox_y.d.ts} +2 -2
- package/dist/{index-9C4mXvTd.d.ts → index-Cz1S_fwn.d.ts} +4 -4
- package/dist/{index-Ca7r_UeJ.d.ts → index-DDvfWEcX.d.ts} +1 -1
- package/dist/{index-Bcu8I591.d.ts → index-ZGo_xs-Q.d.ts} +4 -4
- package/dist/{index-OWMf00jk.d.ts → index-jLN0CEbk.d.ts} +2 -2
- package/dist/index.d.ts +14 -13
- package/dist/index.js +20 -19
- package/dist/info-summary.js +3 -3
- package/dist/input.d.ts +1 -1
- package/dist/input.js +5 -5
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +4 -4
- package/dist/select.d.ts +2 -0
- package/dist/select.js +7 -0
- package/dist/{styleProps-DUR9j3g2.d.ts → styleProps-DEmfU40p.d.ts} +1 -1
- package/dist/switch.d.ts +1 -1
- package/dist/switch.js +2 -2
- package/dist/tab-switch.d.ts +1 -1
- package/dist/tab-switch.js +3 -3
- package/dist/text-area.d.ts +2 -2
- package/dist/text-area.js +5 -5
- package/dist/theme-context.d.ts +1 -1
- package/dist/theme-context.js +1 -1
- package/dist/{types-DbQDtnbC.d.ts → types-0c2OAbj2.d.ts} +3 -3
- package/dist/{types-BvquWQ1G.d.ts → types-CGI_6rDa.d.ts} +1 -1
- package/dist/typography.d.ts +1 -1
- package/dist/typography.js +2 -2
- package/dist/use-dismiss.js +1 -1
- package/dist/use-floating.d.ts +1 -1
- package/dist/use-floating.js +1 -1
- package/dist/{useDismiss-B13eSwzv.js → useDismiss-o9kMS5dK.js} +1 -1
- package/dist/{useDismiss-B13eSwzv.js.map → useDismiss-o9kMS5dK.js.map} +1 -1
- package/dist/{useFloating-CmbluyFe.js → useFloating-DMJ2SdMi.js} +1 -1
- package/dist/{useFloating-CmbluyFe.js.map → useFloating-DMJ2SdMi.js.map} +1 -1
- package/dist/{useThemedStyles-Y17K6z_P.js → useThemedStyles-D4si38PM.js} +34 -7
- package/dist/useThemedStyles-D4si38PM.js.map +1 -0
- package/dist/{useThemedStyles-Cqb6BuHm.d.ts → useThemedStyles-gOkfhYkd.d.ts} +19 -1
- package/package.json +8 -1
- package/dist/Icon-D5APBt9w.js.map +0 -1
- package/dist/Input-BlnxnTwX.js.map +0 -1
- package/dist/ThemeContext-C4vgT3aV.js.map +0 -1
- package/dist/index-C7Mip6Lj.d.ts +0 -77
- package/dist/useThemedStyles-Y17K6z_P.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input-B0J7yEux.js","names":[],"sources":["../src/components/commons/inputs/Input/hooks/useInput/index.ts","../src/components/commons/inputs/Input/styles.ts","../src/components/commons/inputs/Input/index.tsx"],"sourcesContent":["// External Libraries\nimport { useState, useRef } from 'react'\n\n// Types\nimport type { InputProps } from '../../types'\n\nexport function useInput({ onChange }: InputProps) {\n // Refs\n const inputRef = useRef<HTMLInputElement>(null)\n\n // States\n const [showPassword, setShowPassword] = useState(false)\n\n // Functions\n function togglePasswordVisibility() {\n setShowPassword(prev => !prev)\n }\n\n function handleRefMethods() {\n return { focus: handleFocus, blur: handleBlur }\n }\n\n function handleFocus() {\n inputRef.current?.focus()\n }\n\n function handleBlur() {\n inputRef.current?.blur()\n }\n\n function handleChange(e: React.ChangeEvent<HTMLInputElement>) {\n const value = e.target.value\n onChange?.(value)\n }\n\n return {\n inputRef,\n showPassword,\n handleChange,\n handleRefMethods,\n togglePasswordVisibility\n }\n}\n","// Hooks\nimport { styled } from '@hooks/useThemedStyles/types'\n\n// Types\nimport type { InputProps } from './types'\n\nexport function createInputStyles(props: InputProps) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n\n rowGap: '0.375rem'\n },\n wrapper: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n\n borderWidth: 1,\n columnGap: '0.25rem',\n borderRadius: '0.5rem',\n padding: '0.625rem 0.875rem',\n\n opacity: props.disabled ? 0.5 : 1,\n boxShadow: 'var(--px-shadow-default)',\n borderColor: props.errorMessage\n ? 'var(--px-color-error)'\n : 'var(--px-border-primary)',\n\n __rules: {\n '&:focus-within': {\n outlineOffset: '-1px',\n outline: `2px solid var(${props.errorMessage ? '--px-color-error' : '--px-color-primary'})`\n }\n }\n },\n\n input: {\n flex: 1,\n\n fontWeight: 500,\n fontSize: '1rem',\n lineHeight: '1.5rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-primary)',\n\n __rules: {\n '&:disabled': {\n cursor: 'not-allowed'\n },\n\n '&:focus': {\n outline: 'none'\n },\n\n '&::placeholder': {\n fontWeight: 400,\n color: 'var(--px-text-secondary)'\n }\n }\n },\n\n error: {\n display: 'block',\n fontWeight: 400,\n lineHeight: '1rem',\n fontSize: '0.75rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-error)'\n },\n\n button: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n\n cursor: 'pointer',\n padding: '0.25rem',\n borderRadius: '0.5rem',\n\n __rules: {\n '&:focus': {\n outline: '1px solid var(--px-border-primary)'\n }\n }\n }\n })\n}\n","// External Libraries\nimport { forwardRef, useId, useImperativeHandle, useMemo } from 'react'\n\n// Components\nimport { Label } from '../../Label'\nimport { Icon } from '@components/commons/toolkit/Icon'\n\n// Types\nimport type { InputProps, InputMethods } from './types'\n\n// Hooks\nimport { useInput } from './hooks/useInput'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Styles\nimport { createInputStyles } from './styles'\n\nexport const Input = forwardRef<InputMethods, InputProps>((props, ref) => {\n // Constants\n const reactId = useId()\n const inputId = useMemo(() => {\n return props.id || `input-${reactId}`\n }, [props.id, reactId])\n\n // Hooks\n const {\n inputRef,\n showPassword,\n handleChange,\n handleRefMethods,\n togglePasswordVisibility\n } = useInput(props)\n useImperativeHandle(ref, handleRefMethods)\n\n // Hooks\n const { styles, classes } = useThemedStyles(props, createInputStyles, {\n pick: p => [p.disabled, p.errorMessage],\n override: props.styles,\n applyCommonProps: true,\n commonSlot: 'container'\n })\n\n // Functions\n function getType() {\n if (props.type === 'password' && showPassword) return 'text'\n return props.type\n }\n\n function renderEndContent() {\n if (props.type === 'password') {\n return (\n <button\n type=\"button\"\n style={styles.button}\n className={classes.button}\n onClick={togglePasswordVisibility}\n >\n <Icon\n size=\"sm\"\n name={showPassword ? 'general-eye-off' : 'general-eye'}\n />\n </button>\n )\n }\n\n return props.endIcon ?? null\n }\n\n return (\n <div style={styles.container}>\n {props.hideLabel ? null : (\n <Label\n htmlFor={inputId}\n label={props.label}\n required={props.required}\n requiredColor={props.requiredColor}\n {...props.labelConfig}\n />\n )}\n\n <div style={styles.wrapper} className={classes.wrapper}>\n {props.startIcon}\n\n <input\n ref={inputRef}\n id={inputId}\n type={getType()}\n value={props.value}\n style={styles.input}\n required={props.required}\n disabled={props.disabled}\n className={classes.input}\n minLength={props.minLength}\n maxLength={props.maxLength}\n placeholder={props.placeholder}\n aria-label={!props.hideLabel ? undefined : props.label}\n onChange={handleChange}\n />\n\n {renderEndContent()}\n </div>\n\n {props.errorMessage ? (\n <span style={styles.error}>{props.errorMessage}</span>\n ) : null}\n </div>\n )\n})\n\nInput.displayName = 'Input'\n"],"mappings":";;;;;;;AAMA,SAAgB,SAAS,EAAE,YAAwB;CAEjD,MAAM,WAAW,OAAyB,KAAK;CAG/C,MAAM,CAAC,cAAc,mBAAmB,SAAS,MAAM;CAGvD,SAAS,2BAA2B;AAClC,mBAAgB,SAAQ,CAAC,KAAK;;CAGhC,SAAS,mBAAmB;AAC1B,SAAO;GAAE,OAAO;GAAa,MAAM;GAAY;;CAGjD,SAAS,cAAc;AACrB,WAAS,SAAS,OAAO;;CAG3B,SAAS,aAAa;AACpB,WAAS,SAAS,MAAM;;CAG1B,SAAS,aAAa,GAAwC;EAC5D,MAAM,QAAQ,EAAE,OAAO;AACvB,aAAW,MAAM;;AAGnB,QAAO;EACL;EACA;EACA;EACA;EACA;EACD;;;;;ACnCH,SAAgB,kBAAkB,OAAmB;AACnD,QAAO,OAAO;EACZ,WAAW;GACT,OAAO;GAEP,SAAS;GACT,eAAe;GAEf,QAAQ;GACT;EACD,SAAS;GACP,OAAO;GACP,SAAS;GACT,YAAY;GAEZ,aAAa;GACb,WA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AAS;aAET,oBAAC;IACC,MAAK;IACL,MAAM,eAAe,oBAAoB;KACzC;IACK;AAIb,SAAO,MAAM,WAAW;;AAG1B,QACE,qBAAC;EAAI,OAAO,OAAO;;GAChB,MAAM,YAAY,OACjB,oBAAC;IACC,SAAS;IACT,OAAO,MAAM;IACb,UAAU,MAAM;IAChB,eAAe,MAAM;IACrB,GAAI,MAAM;KACV;GAGJ,qBAAC;IAAI,OAAO,OAAO;IAAS,WAAW,QAAQ;;KAC5C,MAAM;KAEP,oBAAC;MACC,KAAK;MACL,IAAI;MACJ,MAAM,SAAS;MACf,OAAO,MAAM;MACb,OAAO,OAAO;MACd,UAAU,MAAM;MAChB,UAAU,MAAM;MAChB,WAAW,QAAQ;MACnB,WAAW,MAAM;MACjB,WAAW,MAAM;MACjB,aAAa,MAAM;MACnB,cAAY,CAAC,MAAM,YAAY,SAAY,MAAM;MACjD,UAAU;OACV;KAED,kBAAkB;;KACf;GAEL,MAAM,eACL,oBAAC;IAAK,OAAO,OAAO;cAAQ,MAAM;KAAoB,GACpD;;GACA;EAER;AAEF,MAAM,cAAc"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as Typography } from "./Typography-
|
|
1
|
+
import { t as Typography } from "./Typography-CHkdzH2K.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/commons/Label/index.tsx
|
|
@@ -22,4 +22,4 @@ const Label = (props) => {
|
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
24
|
export { Label as t };
|
|
25
|
-
//# sourceMappingURL=Label-
|
|
25
|
+
//# sourceMappingURL=Label-BVkidQlv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label-
|
|
1
|
+
{"version":3,"file":"Label-BVkidQlv.js","names":["Label: React.FC<LabelProps>"],"sources":["../src/components/commons/Label/index.tsx"],"sourcesContent":["// Components\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Types\nimport type { LabelProps } from './types'\n\nexport const Label: React.FC<LabelProps> = props => {\n const {\n label,\n color,\n htmlFor,\n required,\n requiredColor,\n variant = 'b2',\n ...rest\n } = props\n\n return (\n <label htmlFor={htmlFor}>\n <Typography\n variant={variant}\n color={color ?? 'var(px-text-primary)'}\n {...rest}\n >\n {label}\n\n {required ? (\n <Typography\n as=\"span\"\n variant=\"b2\"\n color={requiredColor ?? 'var(--px-text-error)'}\n >\n {' '}\n *\n </Typography>\n ) : null}\n </Typography>\n </label>\n )\n}\n"],"mappings":";;;;AAMA,MAAaA,SAA8B,UAAS;CAClD,MAAM,EACJ,OACA,OACA,SACA,UACA,eACA,UAAU,MACV,GAAG,SACD;AAEJ,QACE,oBAAC;EAAe;YACd,qBAAC;GACU;GACT,OAAO,SAAS;GAChB,GAAI;cAEH,OAEA,WACC,qBAAC;IACC,IAAG;IACH,SAAQ;IACR,OAAO,iBAAiB;eAEvB,KAAI;KAEM,GACX;IACO;GACP"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as styled, t as useThemedStyles } from "./useThemedStyles-
|
|
2
|
-
import { t as useDismiss } from "./useDismiss-
|
|
3
|
-
import { t as useFloating } from "./useFloating-
|
|
1
|
+
import { n as styled, t as useThemedStyles } from "./useThemedStyles-D4si38PM.js";
|
|
2
|
+
import { t as useDismiss } from "./useDismiss-o9kMS5dK.js";
|
|
3
|
+
import { t as useFloating } from "./useFloating-DMJ2SdMi.js";
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
@@ -78,4 +78,4 @@ const Popover = (props) => {
|
|
|
78
78
|
|
|
79
79
|
//#endregion
|
|
80
80
|
export { Popover as t };
|
|
81
|
-
//# sourceMappingURL=Popover-
|
|
81
|
+
//# sourceMappingURL=Popover-DI9wSxIa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover-
|
|
1
|
+
{"version":3,"file":"Popover-DI9wSxIa.js","names":["Popover: React.FC<PopoverProps>"],"sources":["../src/components/commons/toolkit/Popover/styles.ts","../src/components/commons/toolkit/Popover/index.tsx"],"sourcesContent":["// Types\nimport type { PopoverProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createPopoverStyles(_props: PopoverProps) {\n return styled({\n popoverNode: {\n position: 'fixed',\n left: 0,\n top: 0,\n\n zIndex: 10,\n\n padding: '0.25rem',\n\n boxShadow: 'var(--px-ring-1)',\n backgroundColor: 'var(--px-bg)',\n\n borderRadius: 'var(--px-radius-xl)'\n }\n })\n}\n","// External Libraries\n/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\n/** biome-ignore-all lint/correctness/useExhaustiveDependencies: <Not needed> */\nimport type React from 'react'\nimport { createPortal } from 'react-dom'\nimport { useCallback, useEffect, useRef, useState } from 'react'\n\n// Hooks\nimport { useDismiss } from '@hooks/useDismiss'\nimport { useFloating } from '@hooks/useFloating'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { PopoverProps } from './types'\n\n// Styles\nimport { createPopoverStyles } from './styles'\n\nexport const Popover: React.FC<PopoverProps> = props => {\n const {\n anchorRef,\n floatingOptions,\n closeOnEscape = true,\n open: controlledOpen,\n closeOnOutsideClick = true,\n trigger,\n content,\n onOpenChange,\n onMouseEnter,\n onMouseLeave\n } = props\n\n // States\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false)\n\n const open = controlledOpen ?? uncontrolledOpen\n\n // Hooks\n const { styles } = useThemedStyles(props, createPopoverStyles, {\n applyCommonProps: true,\n override: props.styles,\n pick: p => [p.open, p.content]\n })\n\n // Functions\n function setOpen(v: boolean) {\n onOpenChange?.(v)\n if (controlledOpen === undefined) setUncontrolledOpen(v)\n }\n\n const close = useCallback(() => setOpen(false), [setOpen])\n\n const triggerRef = useRef<HTMLElement | null>(null)\n const resolvedAnchorRef = (anchorRef ?? triggerRef) as any\n\n const popoverRef = useRef<HTMLDivElement | null>(null)\n\n const { floatingRef, update } = useFloating(resolvedAnchorRef, {\n offsetY: 6,\n strategy: 'fixed',\n keepInViewport: true,\n placement: 'bottom-start',\n ...floatingOptions\n })\n\n useDismiss({\n open,\n closeOnEscape,\n closeOnOutsideClick,\n refs: [resolvedAnchorRef, popoverRef],\n onClose: close\n })\n\n useEffect(() => {\n if (open) requestAnimationFrame(update)\n }, [open, update])\n\n const triggerNode =\n trigger?.({\n 'aria-expanded': open,\n ref: triggerRef as any,\n onClick: () => setOpen(!open)\n }) ?? null\n\n const popoverNode = open ? (\n <div\n ref={el => {\n popoverRef.current = el\n floatingRef(el)\n }}\n role=\"dialog\"\n style={styles.popoverNode}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onMouseDownCapture={e => e.stopPropagation()}\n onPointerDownCapture={e => e.stopPropagation()}\n >\n {content({ close })}\n </div>\n ) : null\n\n return (\n <>\n {triggerNode}\n {typeof document !== 'undefined'\n ? createPortal(popoverNode, document.body)\n : null}\n </>\n )\n}\n"],"mappings":";;;;;;;;AAIA,SAAgB,oBAAoB,QAAsB;AACxD,QAAO,OAAO,EACZ,aAAa;EACX,UAAU;EACV,MAAM;EACN,KAAK;EAEL,QAAQ;EAER,SAAS;EAET,WAAW;EACX,iBAAiB;EAEjB,cAAc;EACf,EACF,CAAC;;;;;ACFJ,MAAaA,WAAkC,UAAS;CACtD,MAAM,EACJ,WACA,iBACA,gBAAgB,MAChB,MAAM,gBACN,sBAAsB,MACtB,SACA,SACA,cACA,cACA,iBACE;CAGJ,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,MAAM;CAE/D,MAAM,OAAO,kBAAkB;CAG/B,MAAM,EAAE,WAAW,gBAAgB,OAAO,qBAAqB;EAC7D,kBAAkB;EAClB,UAAU,MAAM;EAChB,OAAM,MAAK,CAAC,EAAE,MAAM,EAAE,QAAQ;EAC/B,CAAC;CAGF,SAAS,QAAQ,GAAY;AAC3B,iBAAe,EAAE;AACjB,MAAI,mBAAmB,OAAW,qBAAoB,EAAE;;CAG1D,MAAM,QAAQ,kBAAkB,QAAQ,MAAM,EAAE,CAAC,QAAQ,CAAC;CAE1D,MAAM,aAAa,OAA2B,KAAK;CACnD,MAAM,oBAAqB,aAAa;CAExC,MAAM,aAAa,OAA8B,KAAK;CAEtD,MAAM,EAAE,aAAa,WAAW,YAAY,mBAAmB;EAC7D,SAAS;EACT,UAAU;EACV,gBAAgB;EAChB,WAAW;EACX,GAAG;EACJ,CAAC;AAEF,YAAW;EACT;EACA;EACA;EACA,MAAM,CAAC,mBAAmB,WAAW;EACrC,SAAS;EACV,CAAC;AAEF,iBAAgB;AACd,MAAI,KAAM,uBAAsB,OAAO;IACtC,CAAC,MAAM,OAAO,CAAC;CAElB,MAAM,cACJ,UAAU;EACR,iBAAiB;EACjB,KAAK;EACL,eAAe,QAAQ,CAAC,KAAK;EAC9B,CAAC,IAAI;CAER,MAAM,cAAc,OAClB,oBAAC;EACC,MAAK,OAAM;AACT,cAAW,UAAU;AACrB,eAAY,GAAG;;EAEjB,MAAK;EACL,OAAO,OAAO;EACA;EACA;EACd,qBAAoB,MAAK,EAAE,iBAAiB;EAC5C,uBAAsB,MAAK,EAAE,iBAAiB;YAE7C,QAAQ,EAAE,OAAO,CAAC;GACf,GACJ;AAEJ,QACE,4CACG,aACA,OAAO,aAAa,cACjB,aAAa,aAAa,SAAS,KAAK,GACxC,QACH"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { n as styled, t as useThemedStyles } from "./useThemedStyles-D4si38PM.js";
|
|
2
|
+
import { t as Icon } from "./Icon-kjpHbCbF.js";
|
|
3
|
+
import { t as Label } from "./Label-BVkidQlv.js";
|
|
4
|
+
import { useMemo, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/commons/inputs/Select/components/OptionItem/styles.ts
|
|
8
|
+
function createOptionsStyles(_props) {
|
|
9
|
+
return styled({
|
|
10
|
+
container: {
|
|
11
|
+
width: "100%",
|
|
12
|
+
display: "flex",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
textAlign: "left",
|
|
15
|
+
borderRadius: "0.25rem",
|
|
16
|
+
padding: "0.5rem 0.75rem",
|
|
17
|
+
cursor: "pointer",
|
|
18
|
+
transition: "background-color 0.2s ease-out",
|
|
19
|
+
__rules: {
|
|
20
|
+
"&:hover": { backgroundColor: "var(--px-background-card-hover)" },
|
|
21
|
+
"&:focus": {
|
|
22
|
+
outlineOffset: "-1px",
|
|
23
|
+
outline: "2px solid var(--px-color-primary)"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
text: {
|
|
28
|
+
flex: 1,
|
|
29
|
+
fontSize: "1rem",
|
|
30
|
+
fontWeight: 500,
|
|
31
|
+
lineHeight: "1.5rem",
|
|
32
|
+
fontFamily: "inherit",
|
|
33
|
+
color: "var(--px-text-primary)",
|
|
34
|
+
overflow: "hidden",
|
|
35
|
+
whiteSpace: "nowrap",
|
|
36
|
+
textOverflow: "ellipsis"
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/components/commons/inputs/Select/components/OptionItem/index.tsx
|
|
43
|
+
/** biome-ignore-all lint/a11y/useSemanticElements: It's a custom select component */
|
|
44
|
+
const OptionItem = (props) => {
|
|
45
|
+
const { styles, classes } = useThemedStyles(props, createOptionsStyles);
|
|
46
|
+
function handleClick() {
|
|
47
|
+
props.onClick(props.option.value);
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ jsx("button", {
|
|
50
|
+
type: "button",
|
|
51
|
+
role: "option",
|
|
52
|
+
style: styles.container,
|
|
53
|
+
className: classes.container,
|
|
54
|
+
"aria-label": props.option.label,
|
|
55
|
+
"aria-selected": props.isSelected,
|
|
56
|
+
onClick: handleClick,
|
|
57
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
58
|
+
style: styles.text,
|
|
59
|
+
children: props.option.label
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/components/commons/inputs/Select/hooks/useSelect/index.ts
|
|
66
|
+
function useSelect({ value, multiple, canClear, onChange }) {
|
|
67
|
+
const [open, setOpen] = useState(false);
|
|
68
|
+
function handleOptionClick(option) {
|
|
69
|
+
const isAlreadySelected = value.includes(option);
|
|
70
|
+
if (!multiple) {
|
|
71
|
+
if (isAlreadySelected) {
|
|
72
|
+
if (canClear) onChange([]);
|
|
73
|
+
} else onChange([option]);
|
|
74
|
+
setOpen(false);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (isAlreadySelected) if (value.length === 1) {
|
|
78
|
+
if (canClear) onChange([]);
|
|
79
|
+
} else onChange(value.filter((v) => v !== option));
|
|
80
|
+
else onChange([...value, option]);
|
|
81
|
+
}
|
|
82
|
+
function togglePanel() {
|
|
83
|
+
setOpen((prev) => !prev);
|
|
84
|
+
}
|
|
85
|
+
function closePanel() {
|
|
86
|
+
setOpen(false);
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
open,
|
|
90
|
+
togglePanel,
|
|
91
|
+
closePanel,
|
|
92
|
+
handleOptionClick
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/components/commons/inputs/Select/styles.ts
|
|
98
|
+
function createSelectStyles(props) {
|
|
99
|
+
return styled({
|
|
100
|
+
container: {
|
|
101
|
+
width: "100%",
|
|
102
|
+
display: "flex",
|
|
103
|
+
flexDirection: "column",
|
|
104
|
+
position: "relative",
|
|
105
|
+
rowGap: "0.375rem"
|
|
106
|
+
},
|
|
107
|
+
content: {
|
|
108
|
+
width: "100%",
|
|
109
|
+
display: "flex",
|
|
110
|
+
alignItems: "center",
|
|
111
|
+
justifyContent: "space-between",
|
|
112
|
+
borderWidth: 1,
|
|
113
|
+
columnGap: "0.25rem",
|
|
114
|
+
borderRadius: "0.5rem",
|
|
115
|
+
padding: "0.625rem 0.875rem",
|
|
116
|
+
opacity: props.disabled ? .5 : 1,
|
|
117
|
+
cursor: props.disabled ? "not-allowed" : "pointer",
|
|
118
|
+
boxShadow: "var(--px-shadow-default)",
|
|
119
|
+
borderColor: props.errorMessage ? "var(--px-color-error)" : "var(--px-border-primary)",
|
|
120
|
+
__rules: { "&:focus-within": {
|
|
121
|
+
outlineOffset: "-1px",
|
|
122
|
+
outline: `2px solid var(${props.errorMessage ? "--px-color-error" : "--px-color-primary"})`
|
|
123
|
+
} }
|
|
124
|
+
},
|
|
125
|
+
text: {
|
|
126
|
+
flex: 1,
|
|
127
|
+
textAlign: "left",
|
|
128
|
+
overflow: "hidden",
|
|
129
|
+
whiteSpace: "nowrap",
|
|
130
|
+
textOverflow: "ellipsis",
|
|
131
|
+
fontSize: "1rem",
|
|
132
|
+
lineHeight: "1.5rem",
|
|
133
|
+
fontFamily: "inherit",
|
|
134
|
+
fontWeight: props.value.length ? 500 : 400,
|
|
135
|
+
color: props.value.length ? "var(--px-text-primary)" : "var(--px-text-secondary)"
|
|
136
|
+
},
|
|
137
|
+
error: {
|
|
138
|
+
display: "block",
|
|
139
|
+
fontWeight: 400,
|
|
140
|
+
lineHeight: "1rem",
|
|
141
|
+
fontSize: "0.75rem",
|
|
142
|
+
fontFamily: "inherit",
|
|
143
|
+
color: "var(--px-text-error)"
|
|
144
|
+
},
|
|
145
|
+
panel: {
|
|
146
|
+
width: "100%",
|
|
147
|
+
height: "12rem",
|
|
148
|
+
display: "flex",
|
|
149
|
+
flexDirection: "column",
|
|
150
|
+
position: "absolute",
|
|
151
|
+
top: "calc(100% + 0.25rem)",
|
|
152
|
+
left: "0",
|
|
153
|
+
zIndex: 10,
|
|
154
|
+
overflowY: "auto",
|
|
155
|
+
overscrollBehavior: "contain",
|
|
156
|
+
borderWidth: 1,
|
|
157
|
+
rowGap: "0.25rem",
|
|
158
|
+
padding: "0.25rem",
|
|
159
|
+
borderRadius: "0.5rem",
|
|
160
|
+
backgroundColor: "var(--px-bg)",
|
|
161
|
+
boxShadow: "var(--px-shadow-default)",
|
|
162
|
+
borderColor: "var(--px-border-primary)"
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/components/commons/inputs/Select/index.tsx
|
|
169
|
+
const Select = (props) => {
|
|
170
|
+
const { open, togglePanel, handleOptionClick } = useSelect(props);
|
|
171
|
+
const { styles, classes } = useThemedStyles(props, createSelectStyles, {
|
|
172
|
+
pick: (p) => [
|
|
173
|
+
p.disabled,
|
|
174
|
+
p.errorMessage,
|
|
175
|
+
p.value
|
|
176
|
+
],
|
|
177
|
+
override: props.styles,
|
|
178
|
+
applyCommonProps: true,
|
|
179
|
+
commonSlot: "container"
|
|
180
|
+
});
|
|
181
|
+
const maxVisible = props.maxVisibleItems ?? Infinity;
|
|
182
|
+
const optionsMap = useMemo(() => new Map(props.options.map((option) => [option.value, option.label])), [props.options]);
|
|
183
|
+
function renderContent() {
|
|
184
|
+
if (!props.value?.length) return props.placeholder;
|
|
185
|
+
const resolvedValues = props.value.map((val) => optionsMap.get(val) ?? val);
|
|
186
|
+
const visibleItems = resolvedValues.slice(0, maxVisible);
|
|
187
|
+
const hiddenCount = resolvedValues.length - visibleItems.length;
|
|
188
|
+
let result = visibleItems.join(", ");
|
|
189
|
+
if (hiddenCount > 0) result += ` +${hiddenCount}`;
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
193
|
+
style: styles.container,
|
|
194
|
+
children: [
|
|
195
|
+
props.hideLabel ? null : /* @__PURE__ */ jsx(Label, {
|
|
196
|
+
label: props.label,
|
|
197
|
+
required: props.required,
|
|
198
|
+
requiredColor: props.requiredColor,
|
|
199
|
+
...props.labelConfig
|
|
200
|
+
}),
|
|
201
|
+
/* @__PURE__ */ jsxs("button", {
|
|
202
|
+
dir: "ltr",
|
|
203
|
+
type: "button",
|
|
204
|
+
role: "combobox",
|
|
205
|
+
"aria-expanded": open,
|
|
206
|
+
style: styles.content,
|
|
207
|
+
"aria-autocomplete": "none",
|
|
208
|
+
"aria-label": props.label,
|
|
209
|
+
className: classes.content,
|
|
210
|
+
onClick: togglePanel,
|
|
211
|
+
children: [
|
|
212
|
+
props.startIcon,
|
|
213
|
+
/* @__PURE__ */ jsx("span", {
|
|
214
|
+
id: "text-content",
|
|
215
|
+
style: styles.text,
|
|
216
|
+
children: renderContent()
|
|
217
|
+
}),
|
|
218
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
219
|
+
size: "sm",
|
|
220
|
+
name: "chevrons-down"
|
|
221
|
+
})
|
|
222
|
+
]
|
|
223
|
+
}),
|
|
224
|
+
open ? /* @__PURE__ */ jsx("div", {
|
|
225
|
+
style: styles.panel,
|
|
226
|
+
children: props.options.map((option) => /* @__PURE__ */ jsx(OptionItem, {
|
|
227
|
+
option,
|
|
228
|
+
isSelected: props.value.includes(option.value),
|
|
229
|
+
onClick: handleOptionClick
|
|
230
|
+
}, option.value))
|
|
231
|
+
}) : null,
|
|
232
|
+
props.errorMessage ? /* @__PURE__ */ jsx("span", {
|
|
233
|
+
style: styles.error,
|
|
234
|
+
children: props.errorMessage
|
|
235
|
+
}) : null
|
|
236
|
+
]
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
//#endregion
|
|
241
|
+
export { Select as t };
|
|
242
|
+
//# sourceMappingURL=Select-DFPwAzYG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select-DFPwAzYG.js","names":["OptionItem: React.FC<OptionItemProps>","Select: React.FC<SelectProps>"],"sources":["../src/components/commons/inputs/Select/components/OptionItem/styles.ts","../src/components/commons/inputs/Select/components/OptionItem/index.tsx","../src/components/commons/inputs/Select/hooks/useSelect/index.ts","../src/components/commons/inputs/Select/styles.ts","../src/components/commons/inputs/Select/index.tsx"],"sourcesContent":["import { styled } from '@hooks/useThemedStyles/types'\nimport type { OptionItemProps } from './types'\n\nexport function createOptionsStyles(_props: OptionItemProps) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n alignItems: 'center',\n textAlign: 'left',\n\n borderRadius: '0.25rem',\n padding: '0.5rem 0.75rem',\n\n cursor: 'pointer',\n transition: 'background-color 0.2s ease-out',\n\n __rules: {\n '&:hover': {\n backgroundColor: 'var(--px-background-card-hover)'\n },\n\n '&:focus': {\n outlineOffset: '-1px',\n outline: '2px solid var(--px-color-primary)'\n }\n }\n },\n\n text: {\n flex: 1,\n\n fontSize: '1rem',\n fontWeight: 500,\n lineHeight: '1.5rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-primary)',\n\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis'\n }\n })\n}\n","/** biome-ignore-all lint/a11y/useSemanticElements: It's a custom select component */\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { OptionItemProps } from './types'\n\n// Styles\nimport { createOptionsStyles } from './styles'\n\nexport const OptionItem: React.FC<OptionItemProps> = props => {\n // Hooks\n const { styles, classes } = useThemedStyles(props, createOptionsStyles)\n\n // Functions\n function handleClick() {\n props.onClick(props.option.value)\n }\n\n return (\n <button\n type=\"button\"\n role=\"option\"\n style={styles.container}\n className={classes.container}\n aria-label={props.option.label}\n aria-selected={props.isSelected}\n onClick={handleClick}\n >\n <span style={styles.text}>{props.option.label}</span>\n </button>\n )\n}\n","// External Libraries\nimport { useState } from 'react'\n\n// Types\nimport type { SelectProps } from '../../types'\n\nexport function useSelect({\n value,\n multiple,\n canClear,\n onChange\n}: SelectProps) {\n // States\n const [open, setOpen] = useState(false)\n\n // Functions\n function handleOptionClick(option: string) {\n const isAlreadySelected = value.includes(option)\n\n if (!multiple) {\n if (isAlreadySelected) {\n if (canClear) onChange([])\n } else onChange([option])\n\n setOpen(false)\n return\n }\n\n if (isAlreadySelected) {\n if (value.length === 1) {\n if (canClear) onChange([])\n } else onChange(value.filter(v => v !== option))\n } else onChange([...value, option])\n }\n\n function togglePanel() {\n setOpen(prev => !prev)\n }\n\n function closePanel() {\n setOpen(false)\n }\n\n return { open, togglePanel, closePanel, handleOptionClick }\n}\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { SelectProps } from './types'\n\nexport function createSelectStyles(props: SelectProps) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n\n position: 'relative',\n\n rowGap: '0.375rem'\n },\n\n content: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n\n borderWidth: 1,\n columnGap: '0.25rem',\n borderRadius: '0.5rem',\n padding: '0.625rem 0.875rem',\n\n opacity: props.disabled ? 0.5 : 1,\n cursor: props.disabled ? 'not-allowed' : 'pointer',\n boxShadow: 'var(--px-shadow-default)',\n borderColor: props.errorMessage\n ? 'var(--px-color-error)'\n : 'var(--px-border-primary)',\n\n __rules: {\n '&:focus-within': {\n outlineOffset: '-1px',\n outline: `2px solid var(${props.errorMessage ? '--px-color-error' : '--px-color-primary'})`\n }\n }\n },\n\n text: {\n flex: 1,\n\n textAlign: 'left',\n\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n\n fontSize: '1rem',\n lineHeight: '1.5rem',\n fontFamily: 'inherit',\n fontWeight: props.value.length ? 500 : 400,\n color: props.value.length\n ? 'var(--px-text-primary)'\n : 'var(--px-text-secondary)'\n },\n\n error: {\n display: 'block',\n fontWeight: 400,\n lineHeight: '1rem',\n fontSize: '0.75rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-error)'\n },\n\n panel: {\n width: '100%',\n height: '12rem',\n\n display: 'flex',\n flexDirection: 'column',\n\n position: 'absolute',\n top: 'calc(100% + 0.25rem)',\n left: '0',\n zIndex: 10,\n\n overflowY: 'auto',\n overscrollBehavior: 'contain',\n\n borderWidth: 1,\n rowGap: '0.25rem',\n padding: '0.25rem',\n borderRadius: '0.5rem',\n\n backgroundColor: 'var(--px-bg)',\n boxShadow: 'var(--px-shadow-default)',\n borderColor: 'var(--px-border-primary)'\n }\n })\n}\n","/** biome-ignore-all lint/a11y/useSemanticElements: It's a custom select component */\n// External Libraries\nimport type React from 'react'\nimport { useMemo } from 'react'\n\n// Components\nimport { Label } from '@components/commons/Label'\nimport { OptionItem } from './components/OptionItem'\nimport { Icon } from '@components/commons/toolkit/Icon'\n\n// Hooks\nimport { useSelect } from './hooks/useSelect'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { SelectProps } from './types'\n\n// Styles\nimport { createSelectStyles } from './styles'\n\nexport const Select: React.FC<SelectProps> = props => {\n // Hooks\n const { open, togglePanel, handleOptionClick } = useSelect(props)\n const { styles, classes } = useThemedStyles(props, createSelectStyles, {\n pick: p => [p.disabled, p.errorMessage, p.value],\n override: props.styles,\n applyCommonProps: true,\n commonSlot: 'container'\n })\n\n // Constants\n const maxVisible = props.maxVisibleItems ?? Infinity\n const optionsMap = useMemo(\n () => new Map(props.options.map(option => [option.value, option.label])),\n [props.options]\n )\n\n // Functions\n function renderContent() {\n if (!props.value?.length) return props.placeholder\n\n const resolvedValues = props.value.map(val => optionsMap.get(val) ?? val)\n\n const visibleItems = resolvedValues.slice(0, maxVisible)\n const hiddenCount = resolvedValues.length - visibleItems.length\n\n let result = visibleItems.join(', ')\n if (hiddenCount > 0) result += ` +${hiddenCount}`\n\n return result\n }\n\n return (\n <div style={styles.container}>\n {props.hideLabel ? null : (\n <Label\n label={props.label}\n required={props.required}\n requiredColor={props.requiredColor}\n {...props.labelConfig}\n />\n )}\n\n <button\n dir=\"ltr\"\n type=\"button\"\n role=\"combobox\"\n aria-expanded={open}\n style={styles.content}\n aria-autocomplete=\"none\"\n aria-label={props.label}\n className={classes.content}\n onClick={togglePanel}\n >\n {props.startIcon}\n\n <span id=\"text-content\" style={styles.text}>\n {renderContent()}\n </span>\n\n <Icon size=\"sm\" name=\"chevrons-down\" />\n </button>\n\n {open ? (\n <div style={styles.panel}>\n {props.options.map(option => (\n <OptionItem\n key={option.value}\n option={option}\n isSelected={props.value.includes(option.value)}\n onClick={handleOptionClick}\n />\n ))}\n </div>\n ) : null}\n\n {props.errorMessage ? (\n <span style={styles.error}>{props.errorMessage}</span>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;;;;AAGA,SAAgB,oBAAoB,QAAyB;AAC3D,QAAO,OAAO;EACZ,WAAW;GACT,OAAO;GAEP,SAAS;GACT,YAAY;GACZ,WAAW;GAEX,cAAc;GACd,SAAS;GAET,QAAQ;GACR,YAAY;GAEZ,SAAS;IACP,WAAW,EACT,iBAAiB,mCAClB;IAED,WAAW;KACT,eAAe;KACf,SAAS;KACV;IACF;GACF;EAED,MAAM;GACJ,MAAM;GAEN,UAAU;GACV,YAAY;GACZ,YAAY;GACZ,YAAY;GACZ,OAAO;GAEP,UAAU;GACV,YAAY;GACZ,cAAc;GACf;EACF,CAAC;;;;;;ACjCJ,MAAaA,cAAwC,UAAS;CAE5D,MAAM,EAAE,QAAQ,YAAY,gBAAgB,OAAO,oBAAoB;CAGvE,SAAS,cAAc;AACrB,QAAM,QAAQ,MAAM,OAAO,MAAM;;AAGnC,QACE,oBAAC;EACC,MAAK;EACL,MAAK;EACL,OAAO,OAAO;EACd,WAAW,QAAQ;EACnB,cAAY,MAAM,OAAO;EACzB,iBAAe,MAAM;EACrB,SAAS;YAET,oBAAC;GAAK,OAAO,OAAO;aAAO,MAAM,OAAO;IAAa;GAC9C;;;;;ACxBb,SAAgB,UAAU,EACxB,OACA,UACA,UACA,YACc;CAEd,MAAM,CAAC,MAAM,WAAW,SAAS,MAAM;CAGvC,SAAS,kBAAkB,QAAgB;EACzC,MAAM,oBAAoB,MAAM,SAAS,OAAO;AAEhD,MAAI,CAAC,UAAU;AACb,OAAI,mBACF;QAAI,SAAU,UAAS,EAAE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O,OAAO;cAChB,MAAM,QAAQ,KAAI,WACjB,oBAAC;KAES;KACR,YAAY,MAAM,MAAM,SAAS,OAAO,MAAM;KAC9C,SAAS;OAHJ,OAAO,MAIZ,CACF;KACE,GACJ;GAEH,MAAM,eACL,oBAAC;IAAK,OAAO,OAAO;cAAQ,MAAM;KAAoB,GACpD;;GACA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as styled, t as useThemedStyles } from "./useThemedStyles-
|
|
1
|
+
import { n as styled, t as useThemedStyles } from "./useThemedStyles-D4si38PM.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/commons/toolkit/Switch/styles.ts
|
|
@@ -46,4 +46,4 @@ const Switch = (props) => {
|
|
|
46
46
|
|
|
47
47
|
//#endregion
|
|
48
48
|
export { Switch as t };
|
|
49
|
-
//# sourceMappingURL=Switch-
|
|
49
|
+
//# sourceMappingURL=Switch-ZmanGt2r.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch-
|
|
1
|
+
{"version":3,"file":"Switch-ZmanGt2r.js","names":["Switch: React.FC<SwitchThumbProps>"],"sources":["../src/components/commons/toolkit/Switch/styles.ts","../src/components/commons/toolkit/Switch/index.tsx"],"sourcesContent":["// Types\nimport type { SwitchThumbProps } from './types'\n\n// Styles\nimport { styled } from '@hooks/useThemedStyles/types'\nexport function createSwitchThumbStyles({\n checked,\n colorActive,\n colorInactive,\n colorIndicator\n}: SwitchThumbProps) {\n return styled({\n container: {\n width: '2.5rem',\n height: '1.25rem',\n\n position: 'relative',\n\n display: 'inline-flex',\n alignItems: 'center',\n marginLeft: '0.5rem',\n\n borderRadius: '2rem',\n padding: '0.125rem',\n\n transition: 'background-color 0.5s',\n backgroundColor: checked\n ? (colorActive ?? 'var(--px-color-success)')\n : (colorInactive ?? 'var(--px-color-disabled)')\n },\n\n indicator: {\n height: '1rem',\n width: '1rem',\n\n position: 'absolute',\n left: '0.125rem',\n top: '0.125rem',\n\n borderRadius: '9999px',\n backgroundColor: colorIndicator ?? 'var(--px-surface)',\n\n transition: 'transform 0.5s',\n transform: checked ? 'translateX(1.25rem)' : 'translateX(0)',\n willChange: 'transform'\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { SwitchThumbProps } from './types'\n\n// Styles\nimport { createSwitchThumbStyles } from './styles'\n\nexport const Switch: React.FC<SwitchThumbProps> = props => {\n // Hooks\n const { styles } = useThemedStyles(props, createSwitchThumbStyles, {\n applyCommonProps: true,\n pick: p => [p.checked]\n })\n\n return (\n <span style={styles.container}>\n <span style={styles.indicator} />\n </span>\n )\n}\n"],"mappings":";;;;AAKA,SAAgB,wBAAwB,EACtC,SACA,aACA,eACA,kBACmB;AACnB,QAAO,OAAO;EACZ,WAAW;GACT,OAAO;GACP,QAAQ;GAER,UAAU;GAEV,SAAS;GACT,YAAY;GACZ,YAAY;GAEZ,cAAc;GACd,SAAS;GAET,YAAY;GACZ,iBAAiB,UACZ,eAAe,4BACf,iBAAiB;GACvB;EAED,WAAW;GACT,QAAQ;GACR,OAAO;GAEP,UAAU;GACV,MAAM;GACN,KAAK;GAEL,cAAc;GACd,iBAAiB,kBAAkB;GAEnC,YAAY;GACZ,WAAW,UAAU,wBAAwB;GAC7C,YAAY;GACb;EACF,CAAC;;;;;AClCJ,MAAaA,UAAqC,UAAS;CAEzD,MAAM,EAAE,WAAW,gBAAgB,OAAO,yBAAyB;EACjE,kBAAkB;EAClB,OAAM,MAAK,CAAC,EAAE,QAAQ;EACvB,CAAC;AAEF,QACE,oBAAC;EAAK,OAAO,OAAO;YAClB,oBAAC,UAAK,OAAO,OAAO,YAAa;GAC5B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as styled, t as useThemedStyles } from "./useThemedStyles-
|
|
2
|
-
import { t as Typography } from "./Typography-
|
|
1
|
+
import { n as styled, t as useThemedStyles } from "./useThemedStyles-D4si38PM.js";
|
|
2
|
+
import { t as Typography } from "./Typography-CHkdzH2K.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { motion } from "framer-motion";
|
|
5
5
|
|
|
@@ -120,4 +120,4 @@ const TabSwitch = (props) => {
|
|
|
120
120
|
|
|
121
121
|
//#endregion
|
|
122
122
|
export { TabSwitch as t };
|
|
123
|
-
//# sourceMappingURL=TabSwitch-
|
|
123
|
+
//# sourceMappingURL=TabSwitch-2WIjQ2Ie.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabSwitch-
|
|
1
|
+
{"version":3,"file":"TabSwitch-2WIjQ2Ie.js","names":[],"sources":["../src/components/commons/toolkit/TabSwitch/components/TabSwitchItem/styles.ts","../src/components/commons/toolkit/TabSwitch/components/TabSwitchItem/index.tsx","../src/components/commons/toolkit/TabSwitch/styles.ts","../src/components/commons/toolkit/TabSwitch/index.tsx"],"sourcesContent":["// External Libraries\nimport { styled } from '@hooks/useThemedStyles/types'\n\ninterface Params {\n disabled?: boolean\n selected?: boolean\n selectedColor?: string\n variant: 'default' | 'underline'\n}\n\nexport function createTabSwitchItemStyles({\n variant,\n disabled,\n selected,\n selectedColor\n}: Params) {\n const accent = selectedColor ?? 'var(--px-color-primary)'\n\n return styled({\n item: {\n minHeight: '1.25rem',\n position: 'relative',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 4,\n background: 'transparent',\n border: 0,\n padding: '8px 10px',\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: disabled ? 0.5 : 1,\n userSelect: 'none',\n whiteSpace: 'nowrap',\n __rules: { '& > p': { zIndex: 1 } }\n },\n\n selectedBg:\n variant === 'default'\n ? {\n position: 'absolute',\n inset: 0,\n borderRadius: 6,\n border: '1px solid var(--px-border-primary)',\n background: selected ? accent : 'transparent'\n }\n : {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: -2,\n height: 2,\n background: selected ? accent : 'transparent'\n }\n })\n}\n","// External Libraries\nimport { motion } from 'framer-motion'\n\n// Components\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { SwitchOption } from '../../types'\n\n// Styles\nimport { createTabSwitchItemStyles } from './styles'\n\ntype Props<T> = {\n option: SwitchOption<T>\n selected: boolean\n layoutId?: string\n disabled?: boolean\n selectedColor?: string\n selectedLabelColor?: string\n variant: 'default' | 'underline'\n onClick: (value: T) => void\n}\n\nexport const SwitchItem = <T,>(props: Props<T>) => {\n const { option, disabled, selected, layoutId, onClick } = props\n\n const { styles, classes } = useThemedStyles(\n props,\n createTabSwitchItemStyles,\n {\n pick: p => [p.variant, p.selectedColor, p.selectedLabelColor, p.selected]\n }\n )\n\n const isDisabled = disabled || option.disabled\n\n return (\n <button\n type=\"button\"\n style={styles.item}\n className={classes.item}\n tabIndex={isDisabled ? -1 : 0}\n onClick={() => !isDisabled && onClick(option.value)}\n >\n {selected ? (\n <motion.div\n layoutId={layoutId || 'pixel-tabswitch-selected'}\n style={styles.selectedBg}\n />\n ) : null}\n\n {option.icon ? (\n <span style={{ display: 'inline-flex' }}>{option.icon}</span>\n ) : null}\n\n <Typography variant=\"b1\" fontWeight=\"bold\">\n {option.label}\n </Typography>\n </button>\n )\n}\n","// Types\nimport type { TabSwitchProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createTabSwitchStyles<T>(props: TabSwitchProps<T>) {\n const { fitContent } = props\n\n return styled({\n container: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n color: 'var(--px-text-primary, #4b5563)',\n width: fitContent ? 'fit-content' : '100%',\n borderBottom: '1px solid var(--px-border-primary, #e5e7eb)',\n gap: 0,\n __rules: { '& svg': { zIndex: 1 } }\n }\n })\n}\n","// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Components\nimport { SwitchItem } from './components/TabSwitchItem'\n\n// Types\nimport type { TabSwitchProps } from './types'\n\n// Styles\nimport { createTabSwitchStyles } from './styles'\n\nexport * from './types'\n\nexport const TabSwitch = <T,>(props: TabSwitchProps<T>) => {\n {\n const {\n options,\n disabled,\n layoutId,\n currentValue,\n variant = 'default',\n onChange\n } = props\n\n const { styles, classes } = useThemedStyles(props, createTabSwitchStyles, {\n pick: p => [p.disabled, p.currentValue],\n override: props.styles,\n applyCommonProps: true\n })\n\n return (\n <div style={styles.container} className={classes.container}>\n {options.map(opt => (\n <SwitchItem\n key={String(opt.value)}\n option={opt}\n variant={variant}\n layoutId={layoutId}\n disabled={disabled}\n selectedColor={props.selectedColor}\n selected={currentValue === opt.value}\n selectedLabelColor={props.selectedLabelColor}\n onClick={onChange}\n />\n ))}\n </div>\n )\n }\n}\n"],"mappings":";;;;;;AAUA,SAAgB,0BAA0B,EACxC,SACA,UACA,UACA,iBACS;CACT,MAAM,SAAS,iBAAiB;AAEhC,QAAO,OAAO;EACZ,MAAM;GACJ,WAAW;GACX,UAAU;GACV,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,KAAK;GACL,YAAY;GACZ,QAAQ;GACR,SAAS;GACT,QAAQ,WAAW,gBAAgB;GACnC,SAAS,WAAW,KAAM;GAC1B,YAAY;GACZ,YAAY;GACZ,SAAS,EAAE,SAAS,EAAE,QAAQ,GAAG,EAAE;GACpC;EAED,YACE,YAAY,YACR;GACE,UAAU;GACV,OAAO;GACP,cAAc;GACd,QAAQ;GACR,YAAY,WAAW,SAAS;GACjC,GACD;GACE,UAAU;GACV,MAAM;GACN,OAAO;GACP,QAAQ;GACR,QAAQ;GACR,YAAY,WAAW,SAAS;GACjC;EACR,CAAC;;;;;AC3BJ,MAAa,cAAkB,UAAoB;CACjD,MAAM,EAAE,QAAQ,UAAU,UAAU,UAAU,YAAY;CAE1D,MAAM,EAAE,QAAQ,YAAY,gBAC1B,OACA,2BACA,EACE,OAAM,MAAK;EAAC,EAAE;EAAS,EAAE;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on } from "./Icon-
|
|
3
|
-
import { t as Typography } from "./Typography-
|
|
4
|
-
import { t as Label } from "./Label-
|
|
1
|
+
import { n as styled, t as useThemedStyles } from "./useThemedStyles-D4si38PM.js";
|
|
2
|
+
import { t as Icon } from "./Icon-kjpHbCbF.js";
|
|
3
|
+
import { t as Typography } from "./Typography-CHkdzH2K.js";
|
|
4
|
+
import { t as Label } from "./Label-BVkidQlv.js";
|
|
5
5
|
import { useId } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
|
|
@@ -110,4 +110,4 @@ const TextArea = (props) => {
|
|
|
110
110
|
|
|
111
111
|
//#endregion
|
|
112
112
|
export { TextArea as t };
|
|
113
|
-
//# sourceMappingURL=TextArea-
|
|
113
|
+
//# sourceMappingURL=TextArea-DGCFyZrW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea-
|
|
1
|
+
{"version":3,"file":"TextArea-DGCFyZrW.js","names":[],"sources":["../src/components/commons/inputs/TextArea/styles.ts","../src/components/commons/inputs/TextArea/index.tsx"],"sourcesContent":["// Types\nimport { styled } from '@hooks/useThemedStyles/types'\nimport type { TextAreaProps } from './types'\n\nexport function createTextAreaStyles(props: TextAreaProps) {\n const { height = '8rem', readOnly, startIcon } = props\n\n const focusRingColor = props.focusedRingColor || 'var(--px-color-info)'\n const placeHolderColor =\n props.placeholderColor || 'var(--px-text-placeholder)'\n\n return styled({\n iconContainer: {\n position: 'absolute',\n left: '0.75rem',\n top: '1.375rem',\n transform: 'translateY(-50%)'\n },\n textArea: {\n height,\n width: '100%',\n paddingBlock: '0.75rem',\n paddingInline: '0.875rem',\n borderRadius: '0.5rem',\n resize: 'none',\n\n fontWeight: '400',\n fontSize: '1rem',\n color: 'var(--px-text-primary)',\n\n border: '1px solid red',\n outlineOffset: '-1px',\n\n cursor: readOnly ? 'default' : undefined,\n paddingLeft: startIcon ? '2.5rem' : undefined,\n\n __rules: {\n '&::placeholder': {\n color: `${placeHolderColor}`\n },\n '&:focus': readOnly\n ? { outline: 'none' }\n : { outline: `2px solid ${focusRingColor}` }\n }\n }\n })\n}\n","// External Libraries\nimport { useId } from 'react'\n\n// Types\nimport type { TextAreaProps } from './types'\n\n// Components\nimport { Label } from '@components/commons/Label'\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Styles\nimport { createTextAreaStyles } from './styles'\n\nexport const TextArea = (props: TextAreaProps) => {\n const {\n value,\n disabled,\n readOnly,\n maxLength,\n hideMaxLength,\n textMaxLength,\n placeholder,\n\n label,\n required,\n requiredColor,\n labelColor,\n labelVariant,\n\n startIcon,\n iconColor\n } = props\n\n // Hooks\n const inputId = useId()\n\n const { styles, classes } = useThemedStyles(props, createTextAreaStyles, {\n pick: p => [\n p.height,\n p.readOnly,\n p.startIcon,\n p.placeholderColor,\n p.focusedRingColor\n ],\n override: props.styles,\n applyCommonProps: true\n })\n\n // Functions\n function handleChange(e: React.ChangeEvent<HTMLTextAreaElement>) {\n if (disabled || readOnly) return\n props.onChange?.(e.target.value)\n }\n\n function renderLabel() {\n if (!label) return null\n\n return (\n <div className=\"flex items-center gap-3\">\n <Label\n label={label}\n htmlFor={inputId}\n color={labelColor}\n required={required}\n variant={labelVariant}\n requiredColor={requiredColor}\n />\n </div>\n )\n }\n\n return (\n <div>\n {renderLabel()}\n\n <div style={{ position: 'relative' }}>\n {startIcon && (\n <div style={styles.iconContainer}>\n <Icon\n name={startIcon}\n color={iconColor ? iconColor : 'var(--px-text-primary)'}\n />\n </div>\n )}\n\n <textarea\n value={value}\n disabled={disabled}\n readOnly={readOnly}\n maxLength={maxLength}\n placeholder={placeholder}\n style={styles.textArea}\n className={classes.textArea}\n onChange={handleChange}\n />\n </div>\n\n {maxLength && !hideMaxLength ? (\n <Typography variant=\"b2\" styles={{ text: { marginLeft: 'auto' } }}>\n {value.length}/{maxLength}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AAY;cACjC,aACC,oBAAC;IAAI,OAAO,OAAO;cACjB,oBAAC;KACC,MAAM;KACN,OAAO,YAAY,YAAY;MAC/B;KACE,EAGR,oBAAC;IACQ;IACG;IACA;IACC;IACE;IACb,OAAO,OAAO;IACd,WAAW,QAAQ;IACnB,UAAU;KACV;IACE;EAEL,aAAa,CAAC,gBACb,qBAAC;GAAW,SAAQ;GAAK,QAAQ,EAAE,MAAM,EAAE,YAAY,QAAQ,EAAE;;IAC9D,MAAM;IAAO;IAAE;IAAU;IAAE;;IACjB,GACX;KACA"}
|
|
@@ -125,7 +125,8 @@ const defaultThemes = {
|
|
|
125
125
|
lg: "0 10px 15px -3px rgba(0, 0, 0, 0.10)",
|
|
126
126
|
xl: "0 20px 25px -5px rgba(0, 0, 0, 0.10)",
|
|
127
127
|
"2xl": "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
|
|
128
|
-
"ring-1": "0 0 0 1px rgba(0, 0, 0, 0.05)"
|
|
128
|
+
"ring-1": "0 0 0 1px rgba(0, 0, 0, 0.05)",
|
|
129
|
+
default: "0px 1px 2px 0px #0A0D120D"
|
|
129
130
|
}
|
|
130
131
|
},
|
|
131
132
|
dark: {
|
|
@@ -180,7 +181,8 @@ const defaultThemes = {
|
|
|
180
181
|
lg: "0 10px 15px -3px rgba(0, 0, 0, 0.50)",
|
|
181
182
|
xl: "0 20px 25px -5px rgba(0, 0, 0, 0.55)",
|
|
182
183
|
"2xl": "0 25px 50px -12px rgba(0, 0, 0, 0.65)",
|
|
183
|
-
"ring-1": "0 0 0 1px rgba(0, 0, 0, 0.05)"
|
|
184
|
+
"ring-1": "0 0 0 1px rgba(0, 0, 0, 0.05)",
|
|
185
|
+
default: "0px 1px 2px 0px #0A0D120D"
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
};
|
|
@@ -424,7 +426,8 @@ function themeToCssVars(theme) {
|
|
|
424
426
|
"--px-shadow-lg": theme.shadows.lg,
|
|
425
427
|
"--px-shadow-xl": theme.shadows.xl,
|
|
426
428
|
"--px-shadow-2xl": theme.shadows["2xl"],
|
|
427
|
-
"--px-ring-1": theme.shadows["ring-1"]
|
|
429
|
+
"--px-ring-1": theme.shadows["ring-1"],
|
|
430
|
+
"--px-shadow-default": theme.shadows.default
|
|
428
431
|
};
|
|
429
432
|
}
|
|
430
433
|
|
|
@@ -536,4 +539,4 @@ function useTheme() {
|
|
|
536
539
|
|
|
537
540
|
//#endregion
|
|
538
541
|
export { useTheme as n, ThemeProvider as t };
|
|
539
|
-
//# sourceMappingURL=ThemeContext-
|
|
542
|
+
//# sourceMappingURL=ThemeContext-bVaozqut.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeContext-bVaozqut.js","names":["result: any","out: any","defaultThemes: ThemeRegistry","ThemeProvider: React.FC<ThemeProviderProps>"],"sources":["../src/utils/functions/deepMerge.ts","../src/contexts/ThemeContext/constants.ts","../src/contexts/ThemeContext/utils/general.ts","../src/contexts/ThemeContext/utils/themeToCSSVars.ts","../src/contexts/ThemeContext/index.tsx"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends Array<infer U>\n ? Array<DeepPartial<U>>\n : T[P] extends object\n ? DeepPartial<T[P]>\n : T[P]\n}\n\nexport function deepMerge<T>(base: T, override?: DeepPartial<T>): T {\n if (override === undefined) return clone(base)\n\n if (!isPlainObject(base) || !isPlainObject(override)) {\n return clone(override as T)\n }\n\n const result: any = Array.isArray(base) ? [] : {}\n\n const baseKeys = Object.keys(base as any) as (keyof T)[]\n const overrideKeys = Object.keys(override as any) as (keyof T)[]\n\n const allKeys = Array.from(new Set([...baseKeys, ...overrideKeys]))\n\n for (const k of allKeys) {\n const baseVal = (base as any)[k]\n const overrideVal = (override as any)[k]\n\n if (overrideVal === undefined) {\n result[k] = clone(baseVal)\n continue\n }\n\n if (isPlainObject(baseVal) && isPlainObject(overrideVal)) {\n result[k] = deepMerge(baseVal, overrideVal)\n continue\n }\n\n result[k] = clone(overrideVal)\n }\n\n return result as T\n}\n\nfunction isPlainObject(x: any): x is Record<string, any> {\n return !!x && typeof x === 'object' && !Array.isArray(x)\n}\n\nfunction clone<T>(v: T): T {\n if (v === undefined || v === null) return v\n if (Array.isArray(v)) return v.map(item => clone(item)) as unknown as T\n if (isPlainObject(v)) {\n const out: any = {}\n for (const k of Object.keys(v)) out[k] = clone((v as any)[k])\n return out\n }\n return v\n}\n","// theme/defaultThemes.ts\nimport type { ThemeRegistry } from './types'\n\nconst COMMON_MAP = {\n spacing: {\n xs: '0.25rem', // 4px\n sm: '0.5rem', // 8px\n md: '1rem', // 16px\n lg: '1.5rem', // 24px\n xl: '2rem', // 32px\n '2xl': '3rem' // 48px\n },\n borderRadius: {\n none: '0rem', // 0px\n sm: '0.25rem', // 4px\n md: '0.375rem', // 6px\n lg: '0.5rem', // 8px\n xl: '0.75rem', // 12px\n full: '9999rem' // \"infinite\" radius equivalent\n },\n fontSize: {\n xs: '0.75rem', // 12px\n sm: '0.875rem', // 14px\n md: '1rem', // 16px\n lg: '1.125rem', // 18px\n xl: '1.25rem', // 20px\n '2xl': '1.5rem' // 24px\n },\n fontWeight: { normal: 400, medium: 500, semibold: 600, bold: 700 }\n} as const\n\nexport const defaultThemes: ThemeRegistry = {\n light: {\n colors: {\n scrollbar: '#0000001a',\n disabled: '#D5D7DA',\n\n primary: '#0EB24C',\n secondary: '#6C6C6C',\n success: '#0EB24C',\n warning: '#f59e0b',\n error: '#ef4444',\n destructive: '#ef4444',\n invalid: '#f87171',\n info: '#06b6d4',\n\n background: {\n primary: '#FFFFFF',\n card: {\n primary: '#F4F4F4',\n secondary: '#F3F6F9',\n hover: '#f2f2f2'\n }\n },\n button: {\n filled: {\n label: '#FFFFFF',\n background: '#0EB24C'\n },\n\n outlined: {\n label: '#222222',\n borderColor: '#DDDDDD'\n },\n\n ghost: {\n label: '#6C6C6C'\n }\n },\n\n surface: '#FBFBFB',\n border: {\n primary: '#E8E8E9',\n secondary: '#E8E8E9'\n },\n\n text: {\n primary: '#222222',\n secondary: '#6C6C6C',\n disabled: '#A0A0A0',\n inverse: '#FFFFFF',\n error: '#EC3030'\n }\n },\n\n ...COMMON_MAP,\n\n shadows: {\n xs: '0px -1px 0px #0A0D120D inset, 0px 1px 2px #0A0D120D',\n sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',\n md: '0 4px 6px -1px rgba(0, 0, 0, 0.10)',\n lg: '0 10px 15px -3px rgba(0, 0, 0, 0.10)',\n xl: '0 20px 25px -5px rgba(0, 0, 0, 0.10)',\n '2xl': '0 25px 50px -12px rgba(0, 0, 0, 0.25)',\n 'ring-1': '0 0 0 1px rgba(0, 0, 0, 0.05)',\n default: '0px 1px 2px 0px #0A0D120D'\n }\n },\n\n dark: {\n colors: {\n scrollbar: '#858585',\n disabled: '#D5D7DA',\n\n primary: '#0EB24C',\n secondary: '#C7CFD8',\n success: '#0EB24C',\n warning: '#f59e0b',\n error: '#ef4444',\n destructive: '#ef4444',\n invalid: '#f87171',\n info: '#06b6d4',\n\n background: {\n primary: '#090909',\n card: {\n primary: '#F4F4F4',\n secondary: '#202020',\n hover: '#e7e7e7'\n }\n },\n button: {\n filled: {\n label: '#FFFFFF',\n background: '#0EB24C'\n },\n\n outlined: {\n label: '#ECECEC',\n borderColor: '#DDDDDD'\n },\n\n ghost: {\n label: '#6C6C6C'\n }\n },\n\n surface: '#090909',\n\n border: {\n primary: '#27282D',\n secondary: '#27282D'\n },\n\n text: {\n primary: '#ECECEC',\n secondary: '#C7CFD8',\n disabled: '#8B93A0',\n inverse: '#090909',\n error: '#EC3030'\n }\n },\n\n ...COMMON_MAP,\n\n shadows: {\n xs: '0px -1px 0px #0A0D120D inset, 0px 1px 2px #0A0D120D',\n sm: '0 1px 2px 0 rgba(0, 0, 0, 0.35)',\n md: '0 4px 6px -1px rgba(0, 0, 0, 0.45)',\n lg: '0 10px 15px -3px rgba(0, 0, 0, 0.50)',\n xl: '0 20px 25px -5px rgba(0, 0, 0, 0.55)',\n '2xl': '0 25px 50px -12px rgba(0, 0, 0, 0.65)',\n 'ring-1': '0 0 0 1px rgba(0, 0, 0, 0.05)',\n default: '0px 1px 2px 0px #0A0D120D'\n }\n }\n}\n","// Utils\n/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\nimport { deepMerge } from '@utils/functions'\nimport { defaultThemes } from '../constants'\n\n// Types\nimport type { ThemeMode, ThemeRegistry, ThemeTokens } from '../types'\n\n/**\n * Theme Utilities\n * ===============\n * Small DOM utilities used by the ThemeProvider to:\n * - toggle dark mode class for Tailwind compatibility\n * - inject CSS variables (`--px-*`) into the document root\n * - read/watch the OS/browser theme preference (`prefers-color-scheme`)\n *\n * These helpers are:\n * - **client-safe** (guarded for SSR)\n * - **framework-agnostic** (only touch `documentElement`)\n * - **tiny** (no dependencies)\n */\n\n/**\n * CSSVarMap\n * ---------\n * A map of CSS custom properties to be applied on the document root.\n *\n * Notes:\n * - Keys must be valid CSS variable names (e.g. `\"--px-bg\"`, `\"--px-text-primary\"`).\n * - Values can be strings or numbers.\n * - If you store numbers (e.g. 16), you decide at consumption time whether it means px.\n *\n * You can keep it generic:\n * Record<`--${string}`, string | number>\n *\n * Or restrict to your library prefix:\n * Record<`--px-${string}`, string | number>\n */\nexport type CSSVarMap = Partial<Record<`--${string}`, string | number>>\n\n/**\n * applyThemeClass(themeName)\n * -------------------------\n * Applies the light/dark mode class to the `<html>` element.\n *\n * Tailwind’s dark mode (in the common \"class\" strategy) typically relies on a\n * `.dark` class. This function toggles ONLY the `dark` class:\n *\n * - themeName `\"dark\"` => adds `.dark`\n * - themeName `\"light\"` => removes `.dark`\n *\n * SSR:\n * - No-op on the server (when `document` is undefined).\n */\nexport function applyThemeClass(themeName: 'light' | 'dark') {\n if (typeof document === 'undefined') return\n const root = document.documentElement\n root.classList.toggle('dark', themeName === 'dark')\n}\n\n/**\n * applyCssVars(vars)\n * ------------------\n * Injects CSS variables into the document root (`<html>`).\n *\n * This is how the library exposes theme tokens as CSS variables.\n * Components can then use `var(--px-...)` in styles.\n *\n * Example:\n * ```ts\n * applyCssVars({ '--px-bg': '#fff', '--px-text-primary': '#111' })\n * ```\n *\n * Behavior:\n * - Ignores `null` / `undefined` values.\n * - Converts all values to string before applying.\n *\n * SSR:\n * - No-op on the server (when `document` is undefined).\n */\nexport function applyCssVars(vars: CSSVarMap) {\n if (typeof document === 'undefined') return\n const root = document.documentElement\n\n for (const [key, value] of Object.entries(vars)) {\n if (value == null) continue\n root.style.setProperty(key, String(value))\n }\n}\n\n/**\n * getSystemThemeName()\n * --------------------\n * Returns the current OS/browser color scheme preference.\n *\n * It reads `prefers-color-scheme: dark` using `window.matchMedia`.\n *\n * Returns:\n * - `\"dark\"` if the user prefers dark mode\n * - `\"light\"` otherwise\n *\n * SSR:\n * - Returns `\"light\"` on the server (safe default).\n */\nexport function getSystemThemeName(): 'light' | 'dark' {\n if (typeof window === 'undefined') return 'light'\n const prefersDark =\n window.matchMedia?.('(prefers-color-scheme: dark)').matches ?? false\n return prefersDark ? 'dark' : 'light'\n}\n\n/**\n * watchSystemTheme(onChange)\n * --------------------------\n * Subscribes to changes in OS/browser theme preference.\n *\n * Use this when your selected mode is `\"system\"` so the app immediately reacts\n * when the user changes their OS theme.\n *\n * - Calls `onChange('light' | 'dark')` whenever the preference changes.\n * - Returns an `unsubscribe()` function.\n *\n * Implementation details:\n * - Uses `matchMedia('(prefers-color-scheme: dark)')`.\n * - Supports both modern `addEventListener('change', ...)` and legacy Safari\n * `addListener(...)` APIs.\n *\n * SSR:\n * - Returns a no-op unsubscribe function on the server.\n */\nexport function watchSystemTheme(onChange: (name: 'light' | 'dark') => void) {\n if (typeof window === 'undefined') return () => {}\n\n const mq = window.matchMedia('(prefers-color-scheme: dark)')\n\n const handler = () => onChange(mq.matches ? 'dark' : 'light')\n\n handler()\n\n if (mq.addEventListener) {\n mq.addEventListener('change', handler)\n return () => mq.removeEventListener('change', handler)\n }\n\n mq.addListener(handler as any)\n return () => mq.removeListener(handler as any)\n}\n\n/**\n * Resolves an effective theme name from a mode.\n */\nexport function resolveName(mode: ThemeMode): string {\n if (mode !== 'system') return mode\n return getSystemThemeName()\n}\n\n/**\n * Builds a registry of user theme patches.\n */\nexport function buildRegistry(\n userThemes?: Partial<ThemeRegistry>\n): ThemeRegistry {\n return {\n light: {},\n dark: {},\n ...(userThemes ?? {})\n } as ThemeRegistry\n}\n\n/**\n * Builds the final resolved theme tokens.\n */\nexport function buildTheme(\n registry: ThemeRegistry,\n resolvedName: string,\n override?: Partial<ThemeTokens>\n): ThemeTokens {\n const base: ThemeTokens =\n resolvedName === 'dark'\n ? (defaultThemes.dark as ThemeTokens)\n : (defaultThemes.light as ThemeTokens)\n\n const selectedPatch = (registry[resolvedName] ?? registry.light) as any\n\n const merged = deepMerge(base, selectedPatch)\n return deepMerge(merged, override)\n}\n\nexport function isThemeMode(value: unknown): value is ThemeMode {\n return typeof value === 'string' && value.length > 0\n}\n\nexport function getLocalStorageSafe(): Storage | null {\n if (typeof window === 'undefined') return null\n try {\n return window.localStorage\n } catch {\n return null\n }\n}\n","// Types\nimport type { CSSVarMap } from './general'\nimport type { ThemeTokens } from '../types'\n\n/**\n * themeToCssVars(theme)\n * ---------------------\n * Converts a resolved `ThemeTokens` object into a CSS variable map (`CSSVarMap`).\n *\n * The ThemeProvider uses this function to inject `--px-*` variables into the\n * document root (`<html>`). Components can then rely on stable CSS variables,\n * making them framework-agnostic and compatible with Tailwind (via `.dark`).\n *\n * Why CSS variables?\n * - They are fast (native to the browser)\n * - They work across any styling strategy (inline styles, CSS modules, Tailwind, etc.)\n * - They enable dynamic theme switching without rerendering every component\n *\n * Requirements / Assumptions:\n * - The input `theme` must be **fully resolved** (i.e. complete `ThemeTokens`).\n * The ThemeProvider is responsible for merging partial theme patches on top\n * of a complete base theme (light/dark defaults).\n *\n * Variable naming:\n * - All variables are prefixed with `--px-` to avoid collisions.\n * - Tokens are grouped by category (colors, surfaces, borders, text, spacing, radius, typography, shadows).\n *\n * Notes:\n * - Spacing/radius/fontSize tokens are stored as numbers (e.g. `16`), which is valid\n * for CSS variables. When consuming them, you can:\n * - append `px` in JS (`${var}px`), or\n * - store them as strings here (e.g. `\"16px\"`) if you prefer.\n *\n * Example usage (component styles):\n * ```ts\n * const styles = {\n * background: 'var(--px-bg)',\n * color: 'var(--px-text-primary)',\n * borderColor: 'var(--px-border-primary)',\n * }\n * ```\n *\n * Example usage (Tailwind config / CSS):\n * ```css\n * .card {\n * background: var(--px-surface);\n * color: var(--px-text-primary);\n * border: 1px solid var(--px-border-primary);\n * }\n * ```\n */\nexport function themeToCssVars(theme: ThemeTokens): CSSVarMap {\n return {\n /**\n * Brand & intent colors\n */\n '--px-color-primary': theme.colors.primary,\n '--px-color-secondary': theme.colors.secondary,\n '--px-color-success': theme.colors.success,\n '--px-color-warning': theme.colors.warning,\n '--px-color-error': theme.colors.error,\n '--px-color-destructive': theme.colors.destructive,\n '--px-color-invalid': theme.colors.invalid,\n '--px-color-info': theme.colors.info,\n '--px-color-disabled': theme.colors.disabled,\n\n /**\n * Scrollbar\n */\n '--px-scrollbar': theme.colors.scrollbar,\n\n /**\n * Surfaces / backgrounds\n */\n '--px-bg': theme.colors.background.primary,\n '--px-surface': theme.colors.surface,\n '--px-background-card-primary': theme.colors.background.card.primary,\n '--px-background-card-secondary': theme.colors.background.card.secondary,\n '--px-background-card-hover': theme.colors.background.card.hover,\n\n /**\n * Borders\n * -------\n * Divider and outline colors.\n */\n '--px-border-primary': theme.colors.border.primary,\n '--px-border-secondary': theme.colors.border.secondary,\n\n /**\n * Text\n * ----\n * Text colors for different emphasis levels.\n */\n '--px-text-primary': theme.colors.text.primary,\n '--px-text-secondary': theme.colors.text.secondary,\n '--px-text-disabled': theme.colors.text.disabled,\n '--px-text-inverse': theme.colors.text.inverse,\n '--px-text-error': theme.colors.text.error,\n\n /**\n * Buttons – Filled\n * ----------------\n * Filled button colors\n */\n '--px-btn-filled-bg': theme.colors.button.filled.background,\n '--px-btn-filled-label': theme.colors.button.filled.label,\n\n /**\n * Buttons – Outlined\n * ------------------\n * Outlined button colors\n */\n '--px-btn-outlined-border': theme.colors.button.outlined.borderColor,\n '--px-btn-outlined-label': theme.colors.button.outlined.label,\n\n /**\n * Buttons – Ghost\n * --------------\n * Ghost button colors\n */\n '--px-btn-ghost-label': theme.colors.button.ghost.label,\n /**\n * Spacing\n * -------------\n * Numeric spacing tokens (commonly used as px).\n */\n '--px-space-xs': theme.spacing.xs,\n '--px-space-sm': theme.spacing.sm,\n '--px-space-md': theme.spacing.md,\n '--px-space-lg': theme.spacing.lg,\n '--px-space-xl': theme.spacing.xl,\n '--px-space-2xl': theme.spacing['2xl'],\n\n /**\n * Border radius scale\n * -------------------\n * Numeric radius tokens (commonly used as px).\n */\n '--px-radius-none': theme.borderRadius.none,\n '--px-radius-sm': theme.borderRadius.sm,\n '--px-radius-md': theme.borderRadius.md,\n '--px-radius-lg': theme.borderRadius.lg,\n '--px-radius-xl': theme.borderRadius.xl,\n '--px-radius-full': theme.borderRadius.full,\n\n /**\n * Typography scale\n * ----------------\n * Font sizes and font weights.\n */\n '--px-fs-xs': theme.fontSize.xs,\n '--px-fs-sm': theme.fontSize.sm,\n '--px-fs-md': theme.fontSize.md,\n '--px-fs-lg': theme.fontSize.lg,\n '--px-fs-xl': theme.fontSize.xl,\n '--px-fs-2xl': theme.fontSize['2xl'],\n\n '--px-fw-normal': theme.fontWeight.normal,\n '--px-fw-medium': theme.fontWeight.medium,\n '--px-fw-semibold': theme.fontWeight.semibold,\n '--px-fw-bold': theme.fontWeight.bold,\n\n /**\n * Shadows\n * -------\n * CSS shadow strings for elevation.\n */\n '--px-shadow-xs': theme.shadows.xs,\n '--px-shadow-sm': theme.shadows.sm,\n '--px-shadow-md': theme.shadows.md,\n '--px-shadow-lg': theme.shadows.lg,\n '--px-shadow-xl': theme.shadows.xl,\n '--px-shadow-2xl': theme.shadows['2xl'],\n '--px-ring-1': theme.shadows['ring-1'],\n '--px-shadow-default': theme.shadows.default\n }\n}\n","/** biome-ignore-all lint/suspicious/noExplicitAny: <Not needed> */\n\n'use client'\n\n// External Libraries\nimport {\n useMemo,\n useState,\n useEffect,\n useContext,\n createContext,\n useLayoutEffect\n} from 'react'\n\n// Utils\nimport {\n buildTheme,\n isThemeMode,\n resolveName,\n applyCssVars,\n buildRegistry,\n themeToCssVars,\n applyThemeClass,\n watchSystemTheme,\n getLocalStorageSafe\n} from './utils'\n\n// Types\nimport type { ThemeMode, ThemeContextData, ThemeProviderProps } from './types'\n\nexport * from './types'\n\nconst ThemeContext = createContext<ThemeContextData | null>(null)\n\n/**\n * useIsomorphicLayoutEffect\n * - On client: runs before paint (layout effect)\n * - On server: falls back to useEffect (no warnings)\n */\nconst useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({\n themes,\n children,\n override,\n persistence,\n persist = false,\n defaultMode = 'system',\n storageKey = 'px-theme',\n fallback = null\n}) => {\n const registry = useMemo(() => buildRegistry(themes), [themes])\n\n function makeInitialMode(): ThemeMode {\n if (persistence) {\n try {\n const saved = persistence.get()\n return (saved ?? defaultMode) as ThemeMode\n } catch {\n return defaultMode\n }\n }\n\n const ls = getLocalStorageSafe()\n if (!ls) return defaultMode\n const raw = ls.getItem(storageKey)?.replaceAll('\"', '')\n return isThemeMode(raw) ? raw : defaultMode\n }\n\n const [mode, setMode] = useState<ThemeMode>(makeInitialMode)\n\n /**\n * Gate: only render children after we applied class + vars at least once.\n * This prevents \"unstyled flash\" for your components.\n */\n const [isReady, setReady] = useState(false)\n\n const resolvedName = useMemo(() => {\n if (typeof window === 'undefined') return mode === 'system' ? 'light' : mode\n return resolveName(mode)\n }, [mode])\n\n const theme = useMemo(\n () => buildTheme(registry, resolvedName, override),\n [registry, resolvedName, override]\n )\n\n // keep in sync with OS when mode === \"system\"\n useEffect(() => {\n if (typeof window === 'undefined') return\n if (mode !== 'system') return\n\n return watchSystemTheme(() => {\n setMode('system')\n })\n }, [mode])\n\n /**\n * Apply theme BEFORE paint (client) and then unlock rendering.\n */\n useIsomorphicLayoutEffect(() => {\n if (typeof window === 'undefined') return\n\n applyThemeClass(resolvedName === 'dark' ? 'dark' : 'light')\n applyCssVars(themeToCssVars(theme))\n\n // unlock after first successful application\n setReady(true)\n }, [resolvedName, theme])\n\n /**\n * Persist mode changes (optional).\n */\n useEffect(() => {\n if (persistence) {\n try {\n persistence.set(mode)\n } catch {}\n return\n }\n\n if (!persist) return\n const ls = getLocalStorageSafe()\n if (!ls) return\n\n try {\n ls.setItem(storageKey, mode)\n } catch {}\n }, [mode, persist, storageKey, persistence])\n\n function setTheme(next: ThemeMode) {\n setMode(next)\n }\n\n function toggleTheme(a: string = 'light', b: string = 'dark') {\n setMode(resolvedName === a ? b : a)\n }\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: <Not needed>\n const ctxValue = useMemo(\n () => ({\n mode,\n resolvedName,\n theme,\n isLoading: !isReady,\n setTheme,\n toggleTheme\n }),\n [mode, resolvedName, theme, isReady]\n )\n\n return (\n <ThemeContext.Provider value={ctxValue}>\n {isReady ? children : fallback}\n </ThemeContext.Provider>\n )\n}\n\nexport function useTheme(): ThemeContextData {\n const ctx = useContext(ThemeContext)\n if (!ctx) throw new Error('useTheme must be used within a ThemeProvider')\n return ctx\n}\n"],"mappings":";;;;AASA,SAAgB,UAAa,MAAS,UAA8B;AAClE,KAAI,aAAa,OAAW,QAAO,MAAM,KAAK;AAE9C,KAAI,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc,SAAS,CAClD,QAAO,MAAM,SAAc;CAG7B,MAAMA,SAAc,MAAM,QAAQ,KAAK,GAAG,EAAE,GAAG,EAAE;CAEjD,MAAM,WAAW,OAAO,KAAK,KAAY;CACzC,MAAM,eAAe,OAAO,KAAK,SAAgB;CAEjD,MAAM,UAAU,MAAM,KAAK,IAAI,IAAI,CAAC,GAAG,UAAU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AAQ,cACN,WAAW,UAAU,cAAc,SAAS,EAClD;EAAC;EAAU;EAAc;EAAS,CACnC;AAGD,iBAAgB;AACd,MAAI,OAAO,WAAW,YAAa;AACnC,MAAI,SAAS,SAAU;AAEvB,SAAO,uBAAuB;AAC5B,WAAQ,SAAS;IACjB;IACD,CAAC,KAAK,CAAC;;;;AAKV,iCAAgC;AAC9B,MAAI,OAAO,WAAW,YAAa;AAEnC,kBAAgB,iBAAiB,SAAS,SAAS,QAAQ;AAC3D,eAAa,eAAe,MAAM,CAAC;AAGnC,WAAS,KAAK;IACb,CAAC,cAAc,MAAM,CAAC;;;;AAKzB,iBAAgB;AACd,MAAI,aAAa;AACf,OAAI;AACF,gBAAY,IAAI,KAAK;WACf;AACR;;AAGF,MAAI,CAAC,QAAS;EACd,MAAM,KAAK,qBAAqB;AAChC,MAAI,CAAC,GAAI;AAET,MAAI;AACF,MAAG,QAAQ,YAAY,KAAK;UACtB;IACP;EAAC;EAAM;EAAS;EAAY;EAAY,CAAC;CAE5C,SAAS,SAAS,MAAiB;AACjC,UAAQ,KAAK;;CAGf,SAAS,YAAY,IAAY,SAAS,IAAY,QAAQ;AAC5D,UAAQ,iBAAiB,IAAI,IAAI,EAAE;;CAIrC,MAAM,WAAW,eACR;EACL;EACA;EACA;EACA,WAAW,CAAC;EACZ;EACA;EACD,GACD;EAAC;EAAM;EAAc;EAAO;EAAQ,CACrC;AAED,QACE,oBAAC,aAAa;EAAS,OAAO;YAC3B,UAAU,WAAW;GACA;;AAI5B,SAAgB,WAA6B;CAC3C,MAAM,MAAM,WAAW,aAAa;AACpC,KAAI,CAAC,IAAK,OAAM,IAAI,MAAM,+CAA+C;AACzE,QAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as styled, r as WEIGHTS, t as useThemedStyles } from "./useThemedStyles-
|
|
1
|
+
import { n as styled, r as WEIGHTS, t as useThemedStyles } from "./useThemedStyles-D4si38PM.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/commons/toolkit/Typography/config.ts
|
|
@@ -159,4 +159,4 @@ function Typography(props) {
|
|
|
159
159
|
|
|
160
160
|
//#endregion
|
|
161
161
|
export { Typography as t };
|
|
162
|
-
//# sourceMappingURL=Typography-
|
|
162
|
+
//# sourceMappingURL=Typography-CHkdzH2K.js.map
|