@nocode-factory/sanity-kit 2.33.1 → 2.33.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocode-factory/sanity-kit",
3
- "version": "2.33.1",
3
+ "version": "2.33.3",
4
4
  "description": "Outils Studio de NoCode Factory : Pages (liste + board), Composants, Historique",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -1,5 +1,5 @@
1
1
  import {useMemo, useState, type ComponentType} from 'react'
2
- import {Box, Card, Flex, Select, Spinner, Stack, Text, TextInput} from '@sanity/ui'
2
+ import {Box, Button, Card, Flex, Spinner, Stack, Text, TextInput} from '@sanity/ui'
3
3
  import {SearchIcon} from '@sanity/icons/Search'
4
4
  import {usePresentationNavigate, usePresentationParams} from 'sanity/presentation'
5
5
  import type {NcfKitConfig} from '../../config/types'
@@ -54,27 +54,35 @@ function PagesNavigator() {
54
54
  <Text size={1} weight="semibold">
55
55
  Pages
56
56
  </Text>
57
- <Flex gap={2}>
58
- <Box flex={1}>
59
- <TextInput
60
- icon={SearchIcon}
61
- fontSize={1}
62
- padding={2}
63
- placeholder="Search"
64
- value={search}
65
- onChange={(e) => setSearch(e.currentTarget.value)}
66
- />
67
- </Box>
68
- {i18n && i18n.locales.length > 1 && (
69
- <Select fontSize={1} padding={2} value={activeLocale} onChange={(e) => setLocale(e.currentTarget.value)} style={{width: 88}}>
70
- {i18n.locales.map((code) => (
71
- <option key={code} value={code}>
72
- {code.toUpperCase()}
73
- </option>
74
- ))}
75
- </Select>
76
- )}
77
- </Flex>
57
+ <TextInput
58
+ icon={SearchIcon}
59
+ fontSize={1}
60
+ padding={2}
61
+ placeholder="Search"
62
+ value={search}
63
+ onChange={(e) => setSearch(e.currentTarget.value)}
64
+ />
65
+ {/* Langues : boutons sous la recherche (un menu déroulant se décalait dans
66
+ ce panneau étroit). */}
67
+ {i18n && i18n.locales.length > 1 && (
68
+ <Flex gap={1} wrap="wrap">
69
+ {i18n.locales.map((code) => {
70
+ const active = code === activeLocale
71
+ return (
72
+ <Button
73
+ key={code}
74
+ text={code.toUpperCase()}
75
+ fontSize={1}
76
+ padding={2}
77
+ mode={active ? 'default' : 'ghost'}
78
+ tone={active ? 'primary' : 'default'}
79
+ aria-pressed={active}
80
+ onClick={() => setLocale(code)}
81
+ />
82
+ )
83
+ })}
84
+ </Flex>
85
+ )}
78
86
  </Stack>
79
87
  <Box flex={1} style={{overflowY: 'auto', minHeight: 0}}>
80
88
  {loading && !rows.length ? (
@@ -55,28 +55,28 @@ export function NcfPresentationHeader(props: PreviewHeaderProps) {
55
55
  }
56
56
  })
57
57
 
58
- // Panneau d'édition masqué : panneaux à droite de l'aperçu cachés, aperçu élargi.
58
+ // Panneau d'édition masqué : lui et sa poignée cachés, l'aperçu prend la place.
59
59
  useEffect(() => {
60
60
  const panel = previewPanel()
61
61
  const content = contentPanel()
62
- if (!panel || !content || !hideForm) return
62
+ if (!content || !hideForm) return
63
63
  // Le panneau d'édition et sa poignée de redimensionnement (juste avant lui).
64
64
  const hidden: HTMLElement[] = [content]
65
65
  const handle = content.previousElementSibling as HTMLElement | null
66
66
  if (handle && handle !== panel && !handle.id) hidden.push(handle)
67
+ // Seulement masquer : jamais toucher aux largeurs gérées par Presentation (les
68
+ // forcer puis les rendre faussait la répartition au réaffichage).
67
69
  const apply = () => {
68
70
  for (const h of hidden) if (h.style.getPropertyValue('display') !== 'none') h.style.setProperty('display', 'none', 'important')
69
- if (panel.style.getPropertyPriority('flex-grow') !== 'important') panel.style.setProperty('flex-grow', '1000', 'important')
70
71
  }
71
72
  apply()
72
- // Presentation réécrit les largeurs de ses panneaux (redimensionnement) : on
73
+ // Presentation réécrit le style de ses panneaux (redimensionnement) : on
73
74
  // réapplique, sans boucle (rien n'est réécrit si c'est déjà en place).
74
75
  const observer = new MutationObserver(apply)
75
- for (const el of [panel, ...hidden]) observer.observe(el, {attributes: true, attributeFilter: ['style']})
76
+ for (const el of hidden) observer.observe(el, {attributes: true, attributeFilter: ['style']})
76
77
  return () => {
77
78
  observer.disconnect()
78
79
  for (const h of hidden) h.style.removeProperty('display')
79
- panel.style.removeProperty('flex-grow')
80
80
  }
81
81
  })
82
82
 
package/src/version.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  * quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
4
4
  * le vérifie.
5
5
  */
6
- export const KIT_VERSION = '2.33.1'
6
+ export const KIT_VERSION = '2.33.3'