@shefing/quickfilter 1.0.6 → 1.0.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-filter.d.ts","sourceRoot":"","sources":["../../../src/filters/components/checkbox-filter.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAKpE,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,aAAa,EACb,KAAuB,EACvB,QAAQ,EACR,MAAyC,EACzC,SAAS,GACV,EAAE,mBAAmB,+
|
|
1
|
+
{"version":3,"file":"checkbox-filter.d.ts","sourceRoot":"","sources":["../../../src/filters/components/checkbox-filter.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAKpE,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,aAAa,EACb,KAAuB,EACvB,QAAQ,EACR,MAAyC,EACzC,SAAS,GACV,EAAE,mBAAmB,+BA4IrB"}
|
|
@@ -31,7 +31,7 @@ export function CheckboxFilter({ label, checkboxLabel, value = 'indeterminate',
|
|
|
31
31
|
no: isHebrew ? 'לא' : 'NO'
|
|
32
32
|
};
|
|
33
33
|
return /*#__PURE__*/ _jsxs("div", {
|
|
34
|
-
className: cn('space-y-1', className),
|
|
34
|
+
className: cn('useTW space-y-1', className),
|
|
35
35
|
dir: locale.direction,
|
|
36
36
|
children: [
|
|
37
37
|
label && /*#__PURE__*/ _jsx(Label, {
|
|
@@ -50,7 +50,7 @@ export function CheckboxFilter({ label, checkboxLabel, value = 'indeterminate',
|
|
|
50
50
|
/*#__PURE__*/ _jsx(Button, {
|
|
51
51
|
variant: internalState === 'checked' ? 'default' : 'ghost',
|
|
52
52
|
size: "sm",
|
|
53
|
-
className: cn('useTW px-3 py-1 text-xs rounded-none border-0', internalState === 'checked' ? 'bg-green-600 text-white hover:bg-
|
|
53
|
+
className: cn('useTW px-3 py-1 text-xs rounded-none border-0', internalState === 'checked' ? 'bg-green-600 text-white hover:bg-[#12345678]' : 'bg-background text-muted-foreground hover:bg-muted'),
|
|
54
54
|
onClick: ()=>handleToggle('checked'),
|
|
55
55
|
children: labels_toggle.yes
|
|
56
56
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/filters/components/checkbox-filter.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { X } from 'lucide-react';\nimport { CheckboxFilterState, Locale } from '../types/filters-type';\nimport { Label } from '../../ui/label';\nimport { cn } from '../../lib/utils';\nimport { Button } from '../../ui/button';\n\ninterface CheckboxFilterProps {\n label?: string;\n checkboxLabel: string;\n value?: CheckboxFilterState;\n onChange: (state: CheckboxFilterState) => void;\n locale?: Locale;\n className?: string;\n}\n\nexport function CheckboxFilter({\n label,\n checkboxLabel,\n value = 'indeterminate',\n onChange,\n locale = { code: 'he', direction: 'rtl' },\n className,\n}: CheckboxFilterProps) {\n const [internalState, setInternalState] = useState<CheckboxFilterState>(value);\n\n const isHebrew = locale.code === 'he';\n\n // Sync internal state with external value prop\n useEffect(() => {\n setInternalState(value);\n }, [value]);\n\n const handleToggle = (newState: 'checked' | 'unchecked') => {\n setInternalState(newState);\n onChange(newState);\n };\n\n const handleClear = () => {\n setInternalState('indeterminate');\n onChange('indeterminate');\n };\n\n const isActive = internalState === 'checked' || internalState === 'unchecked';\n\n const labels_toggle = {\n yes: isHebrew ? 'כן' : 'YES',\n no: isHebrew ? 'לא' : 'NO',\n };\n\n return (\n <div className={cn('space-y-1', className)} dir={locale.direction}>\n {label && (\n <Label className={cn('useTw text-sm font-medium', isHebrew && 'text-right block')}>\n {label}\n </Label>\n )}\n
|
|
1
|
+
{"version":3,"sources":["../../../src/filters/components/checkbox-filter.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { X } from 'lucide-react';\nimport { CheckboxFilterState, Locale } from '../types/filters-type';\nimport { Label } from '../../ui/label';\nimport { cn } from '../../lib/utils';\nimport { Button } from '../../ui/button';\n\ninterface CheckboxFilterProps {\n label?: string;\n checkboxLabel: string;\n value?: CheckboxFilterState;\n onChange: (state: CheckboxFilterState) => void;\n locale?: Locale;\n className?: string;\n}\n\nexport function CheckboxFilter({\n label,\n checkboxLabel,\n value = 'indeterminate',\n onChange,\n locale = { code: 'he', direction: 'rtl' },\n className,\n}: CheckboxFilterProps) {\n const [internalState, setInternalState] = useState<CheckboxFilterState>(value);\n\n const isHebrew = locale.code === 'he';\n\n // Sync internal state with external value prop\n useEffect(() => {\n setInternalState(value);\n }, [value]);\n\n const handleToggle = (newState: 'checked' | 'unchecked') => {\n setInternalState(newState);\n onChange(newState);\n };\n\n const handleClear = () => {\n setInternalState('indeterminate');\n onChange('indeterminate');\n };\n\n const isActive = internalState === 'checked' || internalState === 'unchecked';\n\n const labels_toggle = {\n yes: isHebrew ? 'כן' : 'YES',\n no: isHebrew ? 'לא' : 'NO',\n };\n\n return (\n <div className={cn('useTW space-y-1', className)} dir={locale.direction}>\n {label && (\n <Label className={cn('useTw text-sm font-medium', isHebrew && 'text-right block')}>\n {label}\n </Label>\n )}\n <div\n className={cn(\n 'flex items-center gap-3 transition-colors py-px',\n locale.direction === 'rtl' && 'justify-start',\n )}\n >\n <div className={cn('flex items-center', locale.direction === 'rtl' && 'order-first')}>\n {/* Two Button Toggle */}\n <div className='flex rounded-md border overflow-hidden'>\n {/* In RTL, YES comes first, in LTR, NO comes first */}\n {locale.direction === 'rtl' ? (\n <>\n <Button\n variant={internalState === 'checked' ? 'default' : 'ghost'}\n size='sm'\n className={cn(\n 'useTW px-3 py-1 text-xs rounded-none border-0',\n internalState === 'checked'\n ? 'bg-green-600 text-white hover:bg-[#12345678]'\n : 'bg-background text-muted-foreground hover:bg-muted',\n )}\n onClick={() => handleToggle('checked')}\n >\n {labels_toggle.yes}\n </Button>\n <Button\n variant={internalState === 'unchecked' ? 'default' : 'ghost'}\n size='sm'\n className={cn(\n 'useTW px-3 py-1 text-xs rounded-none border-0 border-l',\n internalState === 'unchecked'\n ? 'bg-red-600 text-white hover:bg-red-700'\n : 'bg-background text-muted-foreground hover:bg-muted',\n )}\n onClick={() => handleToggle('unchecked')}\n >\n {labels_toggle.no}\n </Button>\n </>\n ) : (\n <>\n <Button\n variant={internalState === 'unchecked' ? 'default' : 'ghost'}\n size='sm'\n className={cn(\n 'px-3 py-1 text-xs rounded-none border-0',\n internalState === 'unchecked'\n ? 'bg-red-600 text-white hover:bg-red-700'\n : 'bg-background text-muted-foreground hover:bg-muted',\n )}\n onClick={() => handleToggle('unchecked')}\n >\n {labels_toggle.no}\n </Button>\n <Button\n variant={internalState === 'checked' ? 'default' : 'ghost'}\n size='sm'\n className={cn(\n 'px-3 py-1 text-xs rounded-none border-0 border-l',\n internalState === 'checked'\n ? 'bg-green-600 text-white hover:bg-green-700'\n : 'bg-background text-muted-foreground hover:bg-muted',\n )}\n onClick={() => handleToggle('checked')}\n >\n {labels_toggle.yes}\n </Button>\n </>\n )}\n </div>\n </div>\n\n {checkboxLabel && (\n <Label\n className={cn(\n 'useTw cursor-pointer select-none text-sm',\n isHebrew && 'text-right',\n locale.direction === 'rtl' && 'order-2',\n )}\n >\n {checkboxLabel}\n </Label>\n )}\n\n {(internalState === 'checked' || internalState === 'unchecked') && (\n <Button\n variant='ghost'\n size='sm'\n className={cn(\n 'h-5 w-5 p-0 hover:bg-muted rounded-full -mt-1',\n checkboxLabel\n ? locale.direction === 'rtl'\n ? 'order-last -ml-1'\n : 'order-last -mr-1'\n : locale.direction === 'rtl'\n ? 'ml-[80px] order-last'\n : 'mr-[80px] order-last',\n )}\n onClick={handleClear}\n >\n <X className='h-3 w-3' />\n </Button>\n )}\n </div>\n </div>\n );\n}\n"],"names":["useEffect","useState","X","Label","cn","Button","CheckboxFilter","label","checkboxLabel","value","onChange","locale","code","direction","className","internalState","setInternalState","isHebrew","handleToggle","newState","handleClear","isActive","labels_toggle","yes","no","div","dir","variant","size","onClick"],"mappings":"AAAA;;AAEA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAE5C,SAASC,CAAC,QAAQ,eAAe;AAEjC,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,EAAE,QAAQ,kBAAkB;AACrC,SAASC,MAAM,QAAQ,kBAAkB;AAWzC,OAAO,SAASC,eAAe,EAC7BC,KAAK,EACLC,aAAa,EACbC,QAAQ,eAAe,EACvBC,QAAQ,EACRC,SAAS;IAAEC,MAAM;IAAMC,WAAW;AAAM,CAAC,EACzCC,SAAS,EACW;IACpB,MAAM,CAACC,eAAeC,iBAAiB,GAAGf,SAA8BQ;IAExE,MAAMQ,WAAWN,OAAOC,IAAI,KAAK;IAEjC,+CAA+C;IAC/CZ,UAAU;QACRgB,iBAAiBP;IACnB,GAAG;QAACA;KAAM;IAEV,MAAMS,eAAe,CAACC;QACpBH,iBAAiBG;QACjBT,SAASS;IACX;IAEA,MAAMC,cAAc;QAClBJ,iBAAiB;QACjBN,SAAS;IACX;IA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