@fluxwp/ui 0.0.0-stage → 0.3.2

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.
Files changed (44) hide show
  1. package/README.md +4 -2
  2. package/package.json +44 -4
  3. package/src/Avatar.tsx +12 -0
  4. package/src/Check.tsx +66 -0
  5. package/src/DatePicker.tsx +620 -0
  6. package/src/Empty.tsx +16 -0
  7. package/src/Icon.tsx +76 -0
  8. package/src/MenuIcon.tsx +36 -0
  9. package/src/Modal.tsx +19 -0
  10. package/src/index.ts +10 -0
  11. package/src/menu-icons/flx-admin.svg +13 -0
  12. package/src/menu-icons/flx-ai.svg +15 -0
  13. package/src/menu-icons/flx-analytics.svg +14 -0
  14. package/src/menu-icons/flx-app.svg +17 -0
  15. package/src/menu-icons/flx-backup.svg +13 -0
  16. package/src/menu-icons/flx-certificates.svg +13 -0
  17. package/src/menu-icons/flx-chat.svg +13 -0
  18. package/src/menu-icons/flx-donate.svg +13 -0
  19. package/src/menu-icons/flx-forms.svg +13 -0
  20. package/src/menu-icons/flx-lang.svg +13 -0
  21. package/src/menu-icons/flx-mail.svg +13 -0
  22. package/src/menu-icons/flx-qr-menu.svg +21 -0
  23. package/src/menu-icons/flx-roles.svg +17 -0
  24. package/src/menu-icons/flx-seo.svg +13 -0
  25. package/src/menu-icons/flx-setup.svg +2 -0
  26. package/src/menu-icons/flx-social.svg +19 -0
  27. package/src/menu-icons/flx-speed.svg +12 -0
  28. package/src/menu-icons/flx-studio.svg +16 -0
  29. package/src/menu-icons/flx-tasks.svg +13 -0
  30. package/src/menu-icons/flx-tv-board.svg +14 -0
  31. package/src/menu-icons/flx-tv-remote.svg +18 -0
  32. package/src/overlay.ts +15 -0
  33. package/src/sanitize.ts +91 -0
  34. package/src/styles.css +396 -0
  35. package/types/Avatar.d.ts +6 -0
  36. package/types/Check.d.ts +30 -0
  37. package/types/DatePicker.d.ts +65 -0
  38. package/types/Empty.d.ts +7 -0
  39. package/types/Icon.d.ts +5 -0
  40. package/types/MenuIcon.d.ts +6 -0
  41. package/types/Modal.d.ts +7 -0
  42. package/types/index.d.ts +9 -0
  43. package/types/overlay.d.ts +6 -0
  44. package/types/sanitize.d.ts +6 -0
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
- # Temporary Holding Version
1
+ # @fluxwp/ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ @fluxwp/ui (FluxWP)
4
+
5
+ Part of [FluxWP](https://fluxwp.com). Plugin screens: [@fluxwp/plugin-kit](https://www.npmjs.com/package/@fluxwp/plugin-kit).
package/package.json CHANGED
@@ -1,6 +1,46 @@
1
1
  {
2
2
  "name": "@fluxwp/ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.2",
4
+ "description": "@fluxwp/ui (FluxWP)",
5
+ "type": "module",
6
+ "license": "GPL-2.0-or-later",
7
+ "homepage": "https://fluxwp.com",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/FluxWP/FluxWP.git",
11
+ "directory": "packages/ui"
12
+ },
13
+ "bugs": {
14
+ "email": "info@fluxwp.com"
15
+ },
16
+ "exports": {
17
+ ".": {
18
+ "types": "./types/index.d.ts",
19
+ "default": "./src/index.ts"
20
+ },
21
+ "./styles.css": "./src/styles.css"
22
+ },
23
+ "types": "./types/index.d.ts",
24
+ "files": [
25
+ "src",
26
+ "types",
27
+ "dist",
28
+ "schema",
29
+ "runtime-exports.json",
30
+ "README.md"
31
+ ],
32
+ "sideEffects": [
33
+ "*.css"
34
+ ],
35
+ "dependencies": {
36
+ "@fluxwp/core": "^0.4.5",
37
+ "@fluxwp/tokens": "^0.4.0",
38
+ "lucide-react": "^1.66.0",
39
+ "react": "19.3.0",
40
+ "zustand": "^5.0.16"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public",
44
+ "provenance": true
45
+ }
46
+ }
package/src/Avatar.tsx ADDED
@@ -0,0 +1,12 @@
1
+ export function Avatar({ src, name, size = 28, square }: { src?: string; name: string; size?: number; square?: boolean }) {
2
+ const words = name.split(/\s+/).filter((w) => /^\p{L}/u.test(w));
3
+ const initials = (words.length ? words.map((w) => w[0]).slice(0, 2).join('') : '#').toLocaleUpperCase('tr');
4
+ const style = { width: size, height: size, borderRadius: square ? 8 : size };
5
+ return src ? (
6
+ <img className="avatar" src={src} alt="" style={style} />
7
+ ) : (
8
+ <span className="avatar avatar-fallback" style={{ ...style, fontSize: size * 0.4 }}>
9
+ {initials}
10
+ </span>
11
+ );
12
+ }
package/src/Check.tsx ADDED
@@ -0,0 +1,66 @@
1
+ import { useEffect, useRef, type ReactNode } from 'react';
2
+
3
+ type Props = {
4
+ checked: boolean;
5
+ onChange: (checked: boolean) => void;
6
+ /** Etiket (düz metin ya da düğüm). */
7
+ children?: ReactNode;
8
+ /** Etiketin altındaki küçük açıklama. */
9
+ note?: ReactNode;
10
+ /** Anahtar görünümü (role="switch"). */
11
+ switch?: boolean;
12
+ /** Radyo (tek seçim); `name` ile gruplanır. */
13
+ radio?: boolean;
14
+ /** Kısmen seçili (yalnız onay kutusu). */
15
+ indeterminate?: boolean;
16
+ disabled?: boolean;
17
+ /** Hata iletisi; verilirse kutu hata durumunda gösterilir. */
18
+ error?: string;
19
+ name?: string;
20
+ value?: string;
21
+ id?: string;
22
+ /** Etiket yoksa ekran okuyucu için ad. */
23
+ 'aria-label'?: string;
24
+ className?: string;
25
+ };
26
+
27
+ /**
28
+ * Ortak onay kutusu / radyo / anahtar. Gerçek `<input>` korunur (klavye, form, ekran okuyucu);
29
+ * görünüm @fluxwp/ui stilleri ve flx-brand `flx_check` ile aynıdır.
30
+ */
31
+ export function Check({ checked, onChange, children, note, switch: asSwitch, radio, indeterminate, disabled, error, name, value, id, className, ...rest }: Props) {
32
+ const ref = useRef<HTMLInputElement>(null);
33
+ useEffect(() => {
34
+ if (ref.current) ref.current.indeterminate = !!indeterminate && !checked && !radio;
35
+ }, [indeterminate, checked, radio]);
36
+ return (
37
+ <>
38
+ <label className={['chk', disabled ? 'is-disabled' : '', className ?? ''].filter(Boolean).join(' ')}>
39
+ <input
40
+ ref={ref}
41
+ id={id}
42
+ name={name}
43
+ value={value}
44
+ type={radio ? 'radio' : 'checkbox'}
45
+ role={asSwitch && !radio ? 'switch' : undefined}
46
+ checked={checked}
47
+ disabled={disabled}
48
+ aria-invalid={error ? true : undefined}
49
+ aria-label={rest['aria-label']}
50
+ onChange={(e) => onChange(e.target.checked)}
51
+ />
52
+ {children != null || note != null ? (
53
+ <span className="chk__text">
54
+ {children}
55
+ {note != null ? <small>{note}</small> : null}
56
+ </span>
57
+ ) : null}
58
+ </label>
59
+ {error ? (
60
+ <p className="chk__msg" role="alert">
61
+ {error}
62
+ </p>
63
+ ) : null}
64
+ </>
65
+ );
66
+ }