@malilion/block-ui-react 0.1.0 → 0.3.0
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/components/actions/BlockMenu/BlockMenu.d.ts +9 -0
- package/dist/components/actions/BlockMenu/BlockMenu.d.ts.map +1 -0
- package/dist/components/actions/BlockMenu/BlockMenu.js +211 -0
- package/dist/components/actions/BlockMenu/BlockMenu.js.map +1 -0
- package/dist/components/actions/BlockMenu/BlockMenu.module.js +23 -0
- package/dist/components/actions/BlockMenu/BlockMenu.module.js.map +1 -0
- package/dist/components/actions/BlockMenu/BlockMenu.types.d.ts +42 -0
- package/dist/components/actions/BlockMenu/BlockMenu.types.d.ts.map +1 -0
- package/dist/components/actions/BlockMenu/BlockMenu.utils.d.ts +10 -0
- package/dist/components/actions/BlockMenu/BlockMenu.utils.d.ts.map +1 -0
- package/dist/components/actions/BlockMenu/BlockMenu.utils.js +26 -0
- package/dist/components/actions/BlockMenu/BlockMenu.utils.js.map +1 -0
- package/dist/components/actions/BlockMenu/index.d.ts +3 -0
- package/dist/components/actions/BlockMenu/index.d.ts.map +1 -0
- package/dist/components/actions/index.d.ts +1 -0
- package/dist/components/actions/index.d.ts.map +1 -1
- package/dist/components/cards/ServerBrowser/ServerBrowser.d.ts +7 -0
- package/dist/components/cards/ServerBrowser/ServerBrowser.d.ts.map +1 -0
- package/dist/components/cards/ServerBrowser/ServerBrowser.js +106 -0
- package/dist/components/cards/ServerBrowser/ServerBrowser.js.map +1 -0
- package/dist/components/cards/ServerBrowser/ServerBrowser.types.d.ts +22 -0
- package/dist/components/cards/ServerBrowser/ServerBrowser.types.d.ts.map +1 -0
- package/dist/components/cards/ServerBrowser/ServerBrowser.utils.d.ts +8 -0
- package/dist/components/cards/ServerBrowser/ServerBrowser.utils.d.ts.map +1 -0
- package/dist/components/cards/ServerBrowser/ServerBrowser.utils.js +16 -0
- package/dist/components/cards/ServerBrowser/ServerBrowser.utils.js.map +1 -0
- package/dist/components/cards/ServerBrowser/index.d.ts +4 -0
- package/dist/components/cards/ServerBrowser/index.d.ts.map +1 -0
- package/dist/components/cards/WorldBrowser/WorldBrowser.d.ts +4 -0
- package/dist/components/cards/WorldBrowser/WorldBrowser.d.ts.map +1 -0
- package/dist/components/cards/WorldBrowser/WorldBrowser.js +101 -0
- package/dist/components/cards/WorldBrowser/WorldBrowser.js.map +1 -0
- package/dist/components/cards/WorldBrowser/WorldBrowser.types.d.ts +22 -0
- package/dist/components/cards/WorldBrowser/WorldBrowser.types.d.ts.map +1 -0
- package/dist/components/cards/WorldBrowser/WorldBrowser.utils.d.ts +10 -0
- package/dist/components/cards/WorldBrowser/WorldBrowser.utils.d.ts.map +1 -0
- package/dist/components/cards/WorldBrowser/WorldBrowser.utils.js +12 -0
- package/dist/components/cards/WorldBrowser/WorldBrowser.utils.js.map +1 -0
- package/dist/components/cards/WorldBrowser/index.d.ts +4 -0
- package/dist/components/cards/WorldBrowser/index.d.ts.map +1 -0
- package/dist/components/cards/browser.module.js +23 -0
- package/dist/components/cards/browser.module.js.map +1 -0
- package/dist/components/cards/index.d.ts +2 -0
- package/dist/components/cards/index.d.ts.map +1 -1
- package/dist/components/crafting/Anvil/Anvil.d.ts +7 -0
- package/dist/components/crafting/Anvil/Anvil.d.ts.map +1 -0
- package/dist/components/crafting/Anvil/Anvil.js +94 -0
- package/dist/components/crafting/Anvil/Anvil.js.map +1 -0
- package/dist/components/crafting/Anvil/Anvil.module.js +21 -0
- package/dist/components/crafting/Anvil/Anvil.module.js.map +1 -0
- package/dist/components/crafting/Anvil/Anvil.types.d.ts +25 -0
- package/dist/components/crafting/Anvil/Anvil.types.d.ts.map +1 -0
- package/dist/components/crafting/Anvil/Anvil.utils.d.ts +3 -0
- package/dist/components/crafting/Anvil/Anvil.utils.d.ts.map +1 -0
- package/dist/components/crafting/Anvil/Anvil.utils.js +11 -0
- package/dist/components/crafting/Anvil/Anvil.utils.js.map +1 -0
- package/dist/components/crafting/Anvil/index.d.ts +5 -0
- package/dist/components/crafting/Anvil/index.d.ts.map +1 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.d.ts +7 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.d.ts.map +1 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.js +116 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.js.map +1 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.module.js +29 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.module.js.map +1 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.types.d.ts +22 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.types.d.ts.map +1 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.types.js +11 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.types.js.map +1 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.utils.d.ts +6 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.utils.d.ts.map +1 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.utils.js +13 -0
- package/dist/components/crafting/BrewingStand/BrewingStand.utils.js.map +1 -0
- package/dist/components/crafting/BrewingStand/index.d.ts +5 -0
- package/dist/components/crafting/BrewingStand/index.d.ts.map +1 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.d.ts +7 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.d.ts.map +1 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.js +105 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.js.map +1 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.module.js +32 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.module.js.map +1 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.types.d.ts +29 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.types.d.ts.map +1 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.utils.d.ts +11 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.utils.d.ts.map +1 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.utils.js +14 -0
- package/dist/components/crafting/EnchantingTable/EnchantingTable.utils.js.map +1 -0
- package/dist/components/crafting/EnchantingTable/index.d.ts +3 -0
- package/dist/components/crafting/EnchantingTable/index.d.ts.map +1 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.d.ts +7 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.d.ts.map +1 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.js +149 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.js.map +1 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.module.js +39 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.module.js.map +1 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.types.d.ts +36 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.types.d.ts.map +1 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.utils.d.ts +9 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.utils.d.ts.map +1 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.utils.js +21 -0
- package/dist/components/crafting/RecipeBook/RecipeBook.utils.js.map +1 -0
- package/dist/components/crafting/RecipeBook/index.d.ts +4 -0
- package/dist/components/crafting/RecipeBook/index.d.ts.map +1 -0
- package/dist/components/crafting/TradingUI/TradingUI.d.ts +7 -0
- package/dist/components/crafting/TradingUI/TradingUI.d.ts.map +1 -0
- package/dist/components/crafting/TradingUI/TradingUI.js +181 -0
- package/dist/components/crafting/TradingUI/TradingUI.js.map +1 -0
- package/dist/components/crafting/TradingUI/TradingUI.module.js +39 -0
- package/dist/components/crafting/TradingUI/TradingUI.module.js.map +1 -0
- package/dist/components/crafting/TradingUI/TradingUI.types.d.ts +36 -0
- package/dist/components/crafting/TradingUI/TradingUI.types.d.ts.map +1 -0
- package/dist/components/crafting/TradingUI/TradingUI.types.js +12 -0
- package/dist/components/crafting/TradingUI/TradingUI.types.js.map +1 -0
- package/dist/components/crafting/TradingUI/TradingUI.utils.d.ts +3 -0
- package/dist/components/crafting/TradingUI/TradingUI.utils.d.ts.map +1 -0
- package/dist/components/crafting/TradingUI/TradingUI.utils.js +8 -0
- package/dist/components/crafting/TradingUI/TradingUI.utils.js.map +1 -0
- package/dist/components/crafting/TradingUI/index.d.ts +4 -0
- package/dist/components/crafting/TradingUI/index.d.ts.map +1 -0
- package/dist/components/crafting/index.d.ts +5 -0
- package/dist/components/crafting/index.d.ts.map +1 -1
- package/dist/components/display/BlockTable/BlockTable.d.ts +8 -0
- package/dist/components/display/BlockTable/BlockTable.d.ts.map +1 -0
- package/dist/components/display/BlockTable/BlockTable.js +92 -0
- package/dist/components/display/BlockTable/BlockTable.js.map +1 -0
- package/dist/components/display/BlockTable/BlockTable.module.js +31 -0
- package/dist/components/display/BlockTable/BlockTable.module.js.map +1 -0
- package/dist/components/display/BlockTable/BlockTable.types.d.ts +49 -0
- package/dist/components/display/BlockTable/BlockTable.types.d.ts.map +1 -0
- package/dist/components/display/BlockTable/BlockTable.utils.d.ts +8 -0
- package/dist/components/display/BlockTable/BlockTable.utils.d.ts.map +1 -0
- package/dist/components/display/BlockTable/BlockTable.utils.js +48 -0
- package/dist/components/display/BlockTable/BlockTable.utils.js.map +1 -0
- package/dist/components/display/BlockTable/index.d.ts +3 -0
- package/dist/components/display/BlockTable/index.d.ts.map +1 -0
- package/dist/components/display/BlockTooltip/BlockTooltip.d.ts +8 -0
- package/dist/components/display/BlockTooltip/BlockTooltip.d.ts.map +1 -0
- package/dist/components/display/BlockTooltip/BlockTooltip.js +83 -0
- package/dist/components/display/BlockTooltip/BlockTooltip.js.map +1 -0
- package/dist/components/display/BlockTooltip/BlockTooltip.module.js +11 -0
- package/dist/components/display/BlockTooltip/BlockTooltip.module.js.map +1 -0
- package/dist/components/display/BlockTooltip/BlockTooltip.types.d.ts +20 -0
- package/dist/components/display/BlockTooltip/BlockTooltip.types.d.ts.map +1 -0
- package/dist/components/display/BlockTooltip/BlockTooltip.types.js +11 -0
- package/dist/components/display/BlockTooltip/BlockTooltip.types.js.map +1 -0
- package/dist/components/display/BlockTooltip/index.d.ts +4 -0
- package/dist/components/display/BlockTooltip/index.d.ts.map +1 -0
- package/dist/components/display/SkillTree/SkillTree.d.ts +8 -0
- package/dist/components/display/SkillTree/SkillTree.d.ts.map +1 -0
- package/dist/components/display/SkillTree/SkillTree.js +138 -0
- package/dist/components/display/SkillTree/SkillTree.js.map +1 -0
- package/dist/components/display/SkillTree/SkillTree.module.js +33 -0
- package/dist/components/display/SkillTree/SkillTree.module.js.map +1 -0
- package/dist/components/display/SkillTree/SkillTree.types.d.ts +29 -0
- package/dist/components/display/SkillTree/SkillTree.types.d.ts.map +1 -0
- package/dist/components/display/SkillTree/SkillTree.utils.d.ts +8 -0
- package/dist/components/display/SkillTree/SkillTree.utils.d.ts.map +1 -0
- package/dist/components/display/SkillTree/SkillTree.utils.js +16 -0
- package/dist/components/display/SkillTree/SkillTree.utils.js.map +1 -0
- package/dist/components/display/SkillTree/index.d.ts +4 -0
- package/dist/components/display/SkillTree/index.d.ts.map +1 -0
- package/dist/components/display/index.d.ts +3 -0
- package/dist/components/display/index.d.ts.map +1 -1
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.d.ts +4 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.d.ts.map +1 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.js +39 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.js.map +1 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.module.js +11 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.module.js.map +1 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.types.d.ts +16 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.types.d.ts.map +1 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.types.js +18 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.types.js.map +1 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.utils.d.ts +8 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.utils.d.ts.map +1 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.utils.js +55 -0
- package/dist/components/hud/BiomeIndicator/BiomeIndicator.utils.js.map +1 -0
- package/dist/components/hud/BiomeIndicator/index.d.ts +4 -0
- package/dist/components/hud/BiomeIndicator/index.d.ts.map +1 -0
- package/dist/components/hud/BossBar/BossBar.d.ts +4 -0
- package/dist/components/hud/BossBar/BossBar.d.ts.map +1 -0
- package/dist/components/hud/BossBar/BossBar.js +56 -0
- package/dist/components/hud/BossBar/BossBar.js.map +1 -0
- package/dist/components/hud/BossBar/BossBar.module.js +19 -0
- package/dist/components/hud/BossBar/BossBar.module.js.map +1 -0
- package/dist/components/hud/BossBar/BossBar.types.d.ts +22 -0
- package/dist/components/hud/BossBar/BossBar.types.d.ts.map +1 -0
- package/dist/components/hud/BossBar/BossBar.types.js +21 -0
- package/dist/components/hud/BossBar/BossBar.types.js.map +1 -0
- package/dist/components/hud/BossBar/index.d.ts +4 -0
- package/dist/components/hud/BossBar/index.d.ts.map +1 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.d.ts +4 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.d.ts.map +1 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.js +96 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.js.map +1 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.module.js +17 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.module.js.map +1 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.types.d.ts +19 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.types.d.ts.map +1 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.types.js +11 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.types.js.map +1 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.utils.d.ts +7 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.utils.d.ts.map +1 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.utils.js +24 -0
- package/dist/components/hud/CoordinatesHUD/CoordinatesHUD.utils.js.map +1 -0
- package/dist/components/hud/CoordinatesHUD/index.d.ts +4 -0
- package/dist/components/hud/CoordinatesHUD/index.d.ts.map +1 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.d.ts +4 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.d.ts.map +1 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.js +70 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.js.map +1 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.module.js +19 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.module.js.map +1 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.types.d.ts +17 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.types.d.ts.map +1 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.utils.d.ts +15 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.utils.d.ts.map +1 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.utils.js +43 -0
- package/dist/components/hud/DayNightIndicator/DayNightIndicator.utils.js.map +1 -0
- package/dist/components/hud/DayNightIndicator/index.d.ts +4 -0
- package/dist/components/hud/DayNightIndicator/index.d.ts.map +1 -0
- package/dist/components/hud/MiniMap/MiniMap.d.ts +8 -0
- package/dist/components/hud/MiniMap/MiniMap.d.ts.map +1 -0
- package/dist/components/hud/MiniMap/MiniMap.js +76 -0
- package/dist/components/hud/MiniMap/MiniMap.js.map +1 -0
- package/dist/components/hud/MiniMap/MiniMap.module.js +17 -0
- package/dist/components/hud/MiniMap/MiniMap.module.js.map +1 -0
- package/dist/components/hud/MiniMap/MiniMap.types.d.ts +43 -0
- package/dist/components/hud/MiniMap/MiniMap.types.d.ts.map +1 -0
- package/dist/components/hud/MiniMap/MiniMap.types.js +26 -0
- package/dist/components/hud/MiniMap/MiniMap.types.js.map +1 -0
- package/dist/components/hud/MiniMap/MiniMap.utils.d.ts +14 -0
- package/dist/components/hud/MiniMap/MiniMap.utils.d.ts.map +1 -0
- package/dist/components/hud/MiniMap/MiniMap.utils.js +47 -0
- package/dist/components/hud/MiniMap/MiniMap.utils.js.map +1 -0
- package/dist/components/hud/MiniMap/index.d.ts +5 -0
- package/dist/components/hud/MiniMap/index.d.ts.map +1 -0
- package/dist/components/hud/Scoreboard/Scoreboard.d.ts +7 -0
- package/dist/components/hud/Scoreboard/Scoreboard.d.ts.map +1 -0
- package/dist/components/hud/Scoreboard/Scoreboard.js +89 -0
- package/dist/components/hud/Scoreboard/Scoreboard.js.map +1 -0
- package/dist/components/hud/Scoreboard/Scoreboard.module.js +25 -0
- package/dist/components/hud/Scoreboard/Scoreboard.module.js.map +1 -0
- package/dist/components/hud/Scoreboard/Scoreboard.types.d.ts +23 -0
- package/dist/components/hud/Scoreboard/Scoreboard.types.d.ts.map +1 -0
- package/dist/components/hud/Scoreboard/Scoreboard.utils.d.ts +5 -0
- package/dist/components/hud/Scoreboard/Scoreboard.utils.d.ts.map +1 -0
- package/dist/components/hud/Scoreboard/Scoreboard.utils.js +15 -0
- package/dist/components/hud/Scoreboard/Scoreboard.utils.js.map +1 -0
- package/dist/components/hud/Scoreboard/index.d.ts +3 -0
- package/dist/components/hud/Scoreboard/index.d.ts.map +1 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.d.ts +4 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.d.ts.map +1 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.js +52 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.js.map +1 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.module.js +15 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.module.js.map +1 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.types.d.ts +17 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.types.d.ts.map +1 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.types.js +12 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.types.js.map +1 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.utils.d.ts +5 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.utils.d.ts.map +1 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.utils.js +22 -0
- package/dist/components/hud/WeatherIndicator/WeatherIndicator.utils.js.map +1 -0
- package/dist/components/hud/WeatherIndicator/index.d.ts +4 -0
- package/dist/components/hud/WeatherIndicator/index.d.ts.map +1 -0
- package/dist/components/hud/hudChip.module.js +15 -0
- package/dist/components/hud/hudChip.module.js.map +1 -0
- package/dist/components/hud/index.d.ts +7 -0
- package/dist/components/hud/index.d.ts.map +1 -1
- package/dist/components/layout/BlockDivider/BlockDivider.d.ts +7 -0
- package/dist/components/layout/BlockDivider/BlockDivider.d.ts.map +1 -0
- package/dist/components/layout/BlockDivider/BlockDivider.js +54 -0
- package/dist/components/layout/BlockDivider/BlockDivider.js.map +1 -0
- package/dist/components/layout/BlockDivider/BlockDivider.module.js +13 -0
- package/dist/components/layout/BlockDivider/BlockDivider.module.js.map +1 -0
- package/dist/components/layout/BlockDivider/BlockDivider.types.d.ts +14 -0
- package/dist/components/layout/BlockDivider/BlockDivider.types.d.ts.map +1 -0
- package/dist/components/layout/BlockDivider/BlockDivider.types.js +10 -0
- package/dist/components/layout/BlockDivider/BlockDivider.types.js.map +1 -0
- package/dist/components/layout/BlockDivider/index.d.ts +4 -0
- package/dist/components/layout/BlockDivider/index.d.ts.map +1 -0
- package/dist/components/layout/BlockStack/BlockStack.d.ts +4 -0
- package/dist/components/layout/BlockStack/BlockStack.d.ts.map +1 -0
- package/dist/components/layout/BlockStack/BlockStack.js +22 -0
- package/dist/components/layout/BlockStack/BlockStack.js.map +1 -0
- package/dist/components/layout/BlockStack/BlockStack.module.js +7 -0
- package/dist/components/layout/BlockStack/BlockStack.module.js.map +1 -0
- package/dist/components/layout/BlockStack/BlockStack.types.d.ts +24 -0
- package/dist/components/layout/BlockStack/BlockStack.types.d.ts.map +1 -0
- package/dist/components/layout/BlockStack/BlockStack.types.js +18 -0
- package/dist/components/layout/BlockStack/BlockStack.types.js.map +1 -0
- package/dist/components/layout/BlockStack/index.d.ts +4 -0
- package/dist/components/layout/BlockStack/index.d.ts.map +1 -0
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/navigation/BlockPagination/BlockPagination.d.ts +7 -0
- package/dist/components/navigation/BlockPagination/BlockPagination.d.ts.map +1 -0
- package/dist/components/navigation/BlockPagination/BlockPagination.js +83 -0
- package/dist/components/navigation/BlockPagination/BlockPagination.js.map +1 -0
- package/dist/components/navigation/BlockPagination/BlockPagination.module.js +19 -0
- package/dist/components/navigation/BlockPagination/BlockPagination.module.js.map +1 -0
- package/dist/components/navigation/BlockPagination/BlockPagination.types.d.ts +22 -0
- package/dist/components/navigation/BlockPagination/BlockPagination.types.d.ts.map +1 -0
- package/dist/components/navigation/BlockPagination/BlockPagination.utils.d.ts +7 -0
- package/dist/components/navigation/BlockPagination/BlockPagination.utils.d.ts.map +1 -0
- package/dist/components/navigation/BlockPagination/BlockPagination.utils.js +26 -0
- package/dist/components/navigation/BlockPagination/BlockPagination.utils.js.map +1 -0
- package/dist/components/navigation/BlockPagination/index.d.ts +5 -0
- package/dist/components/navigation/BlockPagination/index.d.ts.map +1 -0
- package/dist/components/navigation/index.d.ts +1 -0
- package/dist/components/navigation/index.d.ts.map +1 -1
- package/dist/components/social/ChatWindow/ChatWindow.d.ts +8 -0
- package/dist/components/social/ChatWindow/ChatWindow.d.ts.map +1 -0
- package/dist/components/social/ChatWindow/ChatWindow.js +146 -0
- package/dist/components/social/ChatWindow/ChatWindow.js.map +1 -0
- package/dist/components/social/ChatWindow/ChatWindow.module.js +27 -0
- package/dist/components/social/ChatWindow/ChatWindow.module.js.map +1 -0
- package/dist/components/social/ChatWindow/ChatWindow.types.d.ts +29 -0
- package/dist/components/social/ChatWindow/ChatWindow.types.d.ts.map +1 -0
- package/dist/components/social/ChatWindow/ChatWindow.types.js +12 -0
- package/dist/components/social/ChatWindow/ChatWindow.types.js.map +1 -0
- package/dist/components/social/ChatWindow/index.d.ts +4 -0
- package/dist/components/social/ChatWindow/index.d.ts.map +1 -0
- package/dist/components/social/CommandConsole/CommandConsole.d.ts +7 -0
- package/dist/components/social/CommandConsole/CommandConsole.d.ts.map +1 -0
- package/dist/components/social/CommandConsole/CommandConsole.js +187 -0
- package/dist/components/social/CommandConsole/CommandConsole.js.map +1 -0
- package/dist/components/social/CommandConsole/CommandConsole.module.js +31 -0
- package/dist/components/social/CommandConsole/CommandConsole.module.js.map +1 -0
- package/dist/components/social/CommandConsole/CommandConsole.types.d.ts +28 -0
- package/dist/components/social/CommandConsole/CommandConsole.types.d.ts.map +1 -0
- package/dist/components/social/CommandConsole/CommandConsole.types.js +11 -0
- package/dist/components/social/CommandConsole/CommandConsole.types.js.map +1 -0
- package/dist/components/social/CommandConsole/CommandConsole.utils.d.ts +4 -0
- package/dist/components/social/CommandConsole/CommandConsole.utils.d.ts.map +1 -0
- package/dist/components/social/CommandConsole/CommandConsole.utils.js +11 -0
- package/dist/components/social/CommandConsole/CommandConsole.utils.js.map +1 -0
- package/dist/components/social/CommandConsole/index.d.ts +5 -0
- package/dist/components/social/CommandConsole/index.d.ts.map +1 -0
- package/dist/components/social/index.d.ts +3 -0
- package/dist/components/social/index.d.ts.map +1 -0
- package/dist/hooks/useAnchoredPosition.d.ts +17 -0
- package/dist/hooks/useAnchoredPosition.d.ts.map +1 -0
- package/dist/hooks/useAnchoredPosition.js +62 -0
- package/dist/hooks/useAnchoredPosition.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -1
- package/dist/styles.css +2452 -354
- package/dist/utils/position.d.ts +41 -0
- package/dist/utils/position.d.ts.map +1 -0
- package/dist/utils/position.js +48 -0
- package/dist/utils/position.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BlockMenuProps } from "./BlockMenu.types";
|
|
2
|
+
/**
|
|
3
|
+
* Dropdown menu button following the WAI-ARIA menu button pattern: arrow keys
|
|
4
|
+
* move with wrap-around, Home/End jump, letters type-ahead, Enter/Space choose
|
|
5
|
+
* and Escape closes — focus always returns to the trigger. The menu renders in
|
|
6
|
+
* the provider's overlay layer, so scroll containers (tables) never clip it.
|
|
7
|
+
*/
|
|
8
|
+
export declare const BlockMenu: import("react").ForwardRefExoticComponent<BlockMenuProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
//# sourceMappingURL=BlockMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/BlockMenu/BlockMenu.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKvE;;;;;GAKG;AACH,eAAO,MAAM,SAAS,2GAqPpB,CAAC"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { cx } from "../../../utils/cx.js";
|
|
2
|
+
import { usePortalContainer } from "../../../provider/context.js";
|
|
3
|
+
import { BlockButton } from "../BlockButton/BlockButton.js";
|
|
4
|
+
import IconButton_module_default from "../IconButton/IconButton.module.js";
|
|
5
|
+
import { useAnchoredPosition } from "../../../hooks/useAnchoredPosition.js";
|
|
6
|
+
import { mergeRefs } from "../../../utils/refs.js";
|
|
7
|
+
import BlockMenu_module_default from "./BlockMenu.module.js";
|
|
8
|
+
import { isMenuItem, typeaheadIndex } from "./BlockMenu.utils.js";
|
|
9
|
+
import { forwardRef, useEffect, useId, useRef, useState } from "react";
|
|
10
|
+
import { createPortal } from "react-dom";
|
|
11
|
+
import { ChevronDownIcon } from "@malilion/block-ui-icons";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
//#region src/components/actions/BlockMenu/BlockMenu.tsx
|
|
14
|
+
/**
|
|
15
|
+
* Dropdown menu button following the WAI-ARIA menu button pattern: arrow keys
|
|
16
|
+
* move with wrap-around, Home/End jump, letters type-ahead, Enter/Space choose
|
|
17
|
+
* and Escape closes — focus always returns to the trigger. The menu renders in
|
|
18
|
+
* the provider's overlay layer, so scroll containers (tables) never clip it.
|
|
19
|
+
*/
|
|
20
|
+
var BlockMenu = forwardRef(function BlockMenu({ label, items, onSelect, variant = "stone", size = "md", icon, iconOnly = false, align = "start", placement = "bottom", disabled = false, onOpenChange, className, ...rest }, ref) {
|
|
21
|
+
const baseId = useId();
|
|
22
|
+
const triggerId = `${baseId}-trigger`;
|
|
23
|
+
const menuId = `${baseId}-menu`;
|
|
24
|
+
const container = usePortalContainer();
|
|
25
|
+
const rootRef = useRef(null);
|
|
26
|
+
const menuRef = useRef(null);
|
|
27
|
+
const triggerRef = useRef(null);
|
|
28
|
+
const itemRefs = useRef(/* @__PURE__ */ new Map());
|
|
29
|
+
const [open, setOpenState] = useState(false);
|
|
30
|
+
const [focusTarget, setFocusTarget] = useState(null);
|
|
31
|
+
const position = useAnchoredPosition(triggerRef, menuRef, open, {
|
|
32
|
+
side: placement,
|
|
33
|
+
align: align === "end" ? "end" : "start",
|
|
34
|
+
gap: 4
|
|
35
|
+
});
|
|
36
|
+
const isInside = (node) => Boolean(node && (rootRef.current?.contains(node) || menuRef.current?.contains(node)));
|
|
37
|
+
const menuItems = items.filter(isMenuItem);
|
|
38
|
+
const enabledIndexes = menuItems.flatMap((item, index) => item.disabled ? [] : [index]);
|
|
39
|
+
const setOpen = (next) => {
|
|
40
|
+
setOpenState(next);
|
|
41
|
+
onOpenChange?.(next);
|
|
42
|
+
};
|
|
43
|
+
const openMenu = (target) => {
|
|
44
|
+
if (disabled || enabledIndexes.length === 0) return;
|
|
45
|
+
setOpen(true);
|
|
46
|
+
setFocusTarget(target);
|
|
47
|
+
};
|
|
48
|
+
const closeMenu = (returnFocus) => {
|
|
49
|
+
setOpen(false);
|
|
50
|
+
setFocusTarget(null);
|
|
51
|
+
if (returnFocus) triggerRef.current?.focus();
|
|
52
|
+
};
|
|
53
|
+
const focusItem = (index) => {
|
|
54
|
+
const item = menuItems[index];
|
|
55
|
+
if (item) itemRefs.current.get(item.id)?.focus();
|
|
56
|
+
};
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!open || focusTarget === null || !position) return;
|
|
59
|
+
const index = focusTarget === "first" ? enabledIndexes[0] : focusTarget === "last" ? enabledIndexes[enabledIndexes.length - 1] : focusTarget;
|
|
60
|
+
if (index !== void 0) focusItem(index);
|
|
61
|
+
}, [
|
|
62
|
+
open,
|
|
63
|
+
focusTarget,
|
|
64
|
+
position !== null
|
|
65
|
+
]);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!open) return;
|
|
68
|
+
const onPointerDown = (event) => {
|
|
69
|
+
if (!isInside(event.target)) closeMenu(false);
|
|
70
|
+
};
|
|
71
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
72
|
+
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
73
|
+
}, [open]);
|
|
74
|
+
const choose = (item) => {
|
|
75
|
+
if (item.disabled) return;
|
|
76
|
+
closeMenu(true);
|
|
77
|
+
item.onSelect?.();
|
|
78
|
+
onSelect?.(item.id);
|
|
79
|
+
};
|
|
80
|
+
const onTriggerKeyDown = (event) => {
|
|
81
|
+
if (event.key === "ArrowDown" || event.key === "Enter" || event.key === " ") {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
openMenu("first");
|
|
84
|
+
} else if (event.key === "ArrowUp") {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
openMenu("last");
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const onMenuKeyDown = (event) => {
|
|
90
|
+
const current = menuItems.findIndex((item) => itemRefs.current.get(item.id) === document.activeElement);
|
|
91
|
+
const position = enabledIndexes.indexOf(current);
|
|
92
|
+
const count = enabledIndexes.length;
|
|
93
|
+
let next;
|
|
94
|
+
switch (event.key) {
|
|
95
|
+
case "ArrowDown":
|
|
96
|
+
next = enabledIndexes[(position + 1) % count];
|
|
97
|
+
break;
|
|
98
|
+
case "ArrowUp":
|
|
99
|
+
next = enabledIndexes[(position - 1 + count) % count];
|
|
100
|
+
break;
|
|
101
|
+
case "Home":
|
|
102
|
+
next = enabledIndexes[0];
|
|
103
|
+
break;
|
|
104
|
+
case "End":
|
|
105
|
+
next = enabledIndexes[count - 1];
|
|
106
|
+
break;
|
|
107
|
+
case "Escape":
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
event.stopPropagation();
|
|
110
|
+
closeMenu(true);
|
|
111
|
+
return;
|
|
112
|
+
case "Tab":
|
|
113
|
+
closeMenu(true);
|
|
114
|
+
return;
|
|
115
|
+
default: if (event.key.length === 1 && /\S/.test(event.key) && !event.ctrlKey && !event.metaKey) {
|
|
116
|
+
const match = typeaheadIndex(menuItems, current, event.key);
|
|
117
|
+
if (match >= 0) next = match;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (next === void 0) return;
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
focusItem(next);
|
|
123
|
+
};
|
|
124
|
+
const onMenuBlur = (event) => {
|
|
125
|
+
if (!isInside(event.relatedTarget)) closeMenu(false);
|
|
126
|
+
};
|
|
127
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
128
|
+
ref: mergeRefs(ref, rootRef),
|
|
129
|
+
className: cx(BlockMenu_module_default.root, className),
|
|
130
|
+
"data-open": open || void 0,
|
|
131
|
+
...rest,
|
|
132
|
+
children: [/* @__PURE__ */ jsx(BlockButton, {
|
|
133
|
+
ref: triggerRef,
|
|
134
|
+
id: triggerId,
|
|
135
|
+
variant,
|
|
136
|
+
size,
|
|
137
|
+
disabled,
|
|
138
|
+
"aria-haspopup": "menu",
|
|
139
|
+
"aria-expanded": open,
|
|
140
|
+
"aria-controls": menuId,
|
|
141
|
+
"aria-label": iconOnly ? label : void 0,
|
|
142
|
+
title: iconOnly ? label : void 0,
|
|
143
|
+
startIcon: iconOnly ? void 0 : icon,
|
|
144
|
+
endIcon: iconOnly ? void 0 : /* @__PURE__ */ jsx("span", {
|
|
145
|
+
className: BlockMenu_module_default.chevron,
|
|
146
|
+
"aria-hidden": "true",
|
|
147
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: 16 })
|
|
148
|
+
}),
|
|
149
|
+
className: cx(iconOnly && IconButton_module_default.iconButton),
|
|
150
|
+
onClick: () => open ? closeMenu(false) : openMenu("first"),
|
|
151
|
+
onKeyDown: onTriggerKeyDown,
|
|
152
|
+
children: iconOnly ? /* @__PURE__ */ jsx("span", {
|
|
153
|
+
className: IconButton_module_default.icon,
|
|
154
|
+
"aria-hidden": "true",
|
|
155
|
+
children: icon
|
|
156
|
+
}) : label
|
|
157
|
+
}), container ? createPortal(/* @__PURE__ */ jsx("div", {
|
|
158
|
+
ref: menuRef,
|
|
159
|
+
id: menuId,
|
|
160
|
+
role: "menu",
|
|
161
|
+
tabIndex: -1,
|
|
162
|
+
"aria-labelledby": triggerId,
|
|
163
|
+
hidden: !open,
|
|
164
|
+
"data-align": align,
|
|
165
|
+
"data-placement": position?.side ?? placement,
|
|
166
|
+
className: BlockMenu_module_default.menu,
|
|
167
|
+
style: position?.style,
|
|
168
|
+
onKeyDown: onMenuKeyDown,
|
|
169
|
+
onBlur: onMenuBlur,
|
|
170
|
+
children: items.map((entry, index) => {
|
|
171
|
+
if (!isMenuItem(entry)) return /* @__PURE__ */ jsx("div", {
|
|
172
|
+
role: "separator",
|
|
173
|
+
className: BlockMenu_module_default.separator
|
|
174
|
+
}, entry.id ?? `separator-${index}`);
|
|
175
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
176
|
+
ref: (element) => {
|
|
177
|
+
if (element) itemRefs.current.set(entry.id, element);
|
|
178
|
+
else itemRefs.current.delete(entry.id);
|
|
179
|
+
},
|
|
180
|
+
type: "button",
|
|
181
|
+
role: "menuitem",
|
|
182
|
+
tabIndex: -1,
|
|
183
|
+
"aria-disabled": entry.disabled || void 0,
|
|
184
|
+
"data-danger": entry.danger || void 0,
|
|
185
|
+
className: BlockMenu_module_default.item,
|
|
186
|
+
onClick: () => choose(entry),
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ jsx("span", {
|
|
189
|
+
className: BlockMenu_module_default.icon,
|
|
190
|
+
"aria-hidden": "true",
|
|
191
|
+
children: entry.icon
|
|
192
|
+
}),
|
|
193
|
+
/* @__PURE__ */ jsx("span", {
|
|
194
|
+
className: BlockMenu_module_default.label,
|
|
195
|
+
children: entry.label
|
|
196
|
+
}),
|
|
197
|
+
entry.shortcut ? /* @__PURE__ */ jsx("kbd", {
|
|
198
|
+
className: BlockMenu_module_default.shortcut,
|
|
199
|
+
"aria-hidden": "true",
|
|
200
|
+
children: entry.shortcut
|
|
201
|
+
}) : null
|
|
202
|
+
]
|
|
203
|
+
}, entry.id);
|
|
204
|
+
})
|
|
205
|
+
}), container) : null]
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
//#endregion
|
|
209
|
+
export { BlockMenu };
|
|
210
|
+
|
|
211
|
+
//# sourceMappingURL=BlockMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockMenu.js","names":["styles","iconButtonStyles"],"sources":["../../../../src/components/actions/BlockMenu/BlockMenu.tsx"],"sourcesContent":["import { ChevronDownIcon } from \"@malilion/block-ui-icons\";\nimport {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEvent,\n type KeyboardEvent,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useAnchoredPosition } from \"../../../hooks/useAnchoredPosition\";\nimport { usePortalContainer } from \"../../../provider/context\";\nimport { cx } from \"../../../utils/cx\";\nimport { mergeRefs } from \"../../../utils/refs\";\nimport { BlockButton } from \"../BlockButton/BlockButton\";\nimport iconButtonStyles from \"../IconButton/IconButton.module.css\";\nimport styles from \"./BlockMenu.module.css\";\nimport type { BlockMenuItem, BlockMenuProps } from \"./BlockMenu.types\";\nimport { isMenuItem, typeaheadIndex } from \"./BlockMenu.utils\";\n\ntype FocusTarget = \"first\" | \"last\" | number;\n\n/**\n * Dropdown menu button following the WAI-ARIA menu button pattern: arrow keys\n * move with wrap-around, Home/End jump, letters type-ahead, Enter/Space choose\n * and Escape closes — focus always returns to the trigger. The menu renders in\n * the provider's overlay layer, so scroll containers (tables) never clip it.\n */\nexport const BlockMenu = forwardRef<HTMLDivElement, BlockMenuProps>(function BlockMenu(\n {\n label,\n items,\n onSelect,\n variant = \"stone\",\n size = \"md\",\n icon,\n iconOnly = false,\n align = \"start\",\n placement = \"bottom\",\n disabled = false,\n onOpenChange,\n className,\n ...rest\n },\n ref,\n) {\n const baseId = useId();\n const triggerId = `${baseId}-trigger`;\n const menuId = `${baseId}-menu`;\n const container = usePortalContainer();\n const rootRef = useRef<HTMLDivElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const itemRefs = useRef(new Map<string, HTMLButtonElement>());\n const [open, setOpenState] = useState(false);\n const [focusTarget, setFocusTarget] = useState<FocusTarget | null>(null);\n\n const position = useAnchoredPosition(triggerRef, menuRef, open, {\n side: placement,\n align: align === \"end\" ? \"end\" : \"start\",\n gap: 4,\n });\n const isInside = (node: Node | null) =>\n Boolean(node && (rootRef.current?.contains(node) || menuRef.current?.contains(node)));\n\n const menuItems = items.filter(isMenuItem);\n const enabledIndexes = menuItems.flatMap((item, index) => (item.disabled ? [] : [index]));\n\n const setOpen = (next: boolean) => {\n setOpenState(next);\n onOpenChange?.(next);\n };\n\n const openMenu = (target: FocusTarget) => {\n if (disabled || enabledIndexes.length === 0) return;\n setOpen(true);\n setFocusTarget(target);\n };\n\n const closeMenu = (returnFocus: boolean) => {\n setOpen(false);\n setFocusTarget(null);\n if (returnFocus) triggerRef.current?.focus();\n };\n\n const focusItem = (index: number) => {\n const item = menuItems[index];\n if (item) itemRefs.current.get(item.id)?.focus();\n };\n\n useEffect(() => {\n if (!open || focusTarget === null || !position) return;\n const index =\n focusTarget === \"first\"\n ? enabledIndexes[0]\n : focusTarget === \"last\"\n ? enabledIndexes[enabledIndexes.length - 1]\n : focusTarget;\n if (index !== undefined) focusItem(index);\n // Focus once the menu is open and positioned, or when the target changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, focusTarget, position !== null]);\n\n useEffect(() => {\n if (!open) return;\n const onPointerDown = (event: PointerEvent) => {\n if (!isInside(event.target as Node)) closeMenu(false);\n };\n document.addEventListener(\"pointerdown\", onPointerDown);\n return () => document.removeEventListener(\"pointerdown\", onPointerDown);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open]);\n\n const choose = (item: BlockMenuItem) => {\n if (item.disabled) return;\n closeMenu(true);\n item.onSelect?.();\n onSelect?.(item.id);\n };\n\n const onTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === \"ArrowDown\" || event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n openMenu(\"first\");\n } else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n openMenu(\"last\");\n }\n };\n\n const onMenuKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const current = menuItems.findIndex(\n (item) => itemRefs.current.get(item.id) === document.activeElement,\n );\n const position = enabledIndexes.indexOf(current);\n const count = enabledIndexes.length;\n let next: number | undefined;\n\n switch (event.key) {\n case \"ArrowDown\":\n next = enabledIndexes[(position + 1) % count];\n break;\n case \"ArrowUp\":\n next = enabledIndexes[(position - 1 + count) % count];\n break;\n case \"Home\":\n next = enabledIndexes[0];\n break;\n case \"End\":\n next = enabledIndexes[count - 1];\n break;\n case \"Escape\":\n event.preventDefault();\n event.stopPropagation();\n closeMenu(true);\n return;\n case \"Tab\":\n // The menu lives in the overlay layer at the end of the page: hand focus back to the\n // trigger first so the browser's Tab continues from the trigger's place in the page.\n closeMenu(true);\n return;\n default:\n if (event.key.length === 1 && /\\S/.test(event.key) && !event.ctrlKey && !event.metaKey) {\n const match = typeaheadIndex(menuItems, current, event.key);\n if (match >= 0) next = match;\n }\n }\n if (next === undefined) return;\n event.preventDefault();\n focusItem(next);\n };\n\n const onMenuBlur = (event: FocusEvent<HTMLDivElement>) => {\n if (!isInside(event.relatedTarget as Node | null)) closeMenu(false);\n };\n\n return (\n <div\n ref={mergeRefs(ref, rootRef)}\n className={cx(styles.root, className)}\n data-open={open || undefined}\n {...rest}\n >\n <BlockButton\n ref={triggerRef}\n id={triggerId}\n variant={variant}\n size={size}\n disabled={disabled}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={menuId}\n aria-label={iconOnly ? label : undefined}\n title={iconOnly ? label : undefined}\n startIcon={iconOnly ? undefined : icon}\n endIcon={\n iconOnly ? undefined : (\n <span className={styles.chevron} aria-hidden=\"true\">\n <ChevronDownIcon size={16} />\n </span>\n )\n }\n className={cx(iconOnly && iconButtonStyles.iconButton)}\n onClick={() => (open ? closeMenu(false) : openMenu(\"first\"))}\n onKeyDown={onTriggerKeyDown}\n >\n {iconOnly ? (\n <span className={iconButtonStyles.icon} aria-hidden=\"true\">\n {icon}\n </span>\n ) : (\n label\n )}\n </BlockButton>\n {container\n ? createPortal(\n <div\n ref={menuRef}\n id={menuId}\n role=\"menu\"\n tabIndex={-1}\n aria-labelledby={triggerId}\n hidden={!open}\n data-align={align}\n data-placement={position?.side ?? placement}\n className={styles.menu}\n style={position?.style}\n onKeyDown={onMenuKeyDown}\n onBlur={onMenuBlur}\n >\n {items.map((entry, index) => {\n if (!isMenuItem(entry)) {\n return (\n <div\n key={entry.id ?? `separator-${index}`}\n role=\"separator\"\n className={styles.separator}\n />\n );\n }\n return (\n <button\n key={entry.id}\n ref={(element) => {\n if (element) itemRefs.current.set(entry.id, element);\n else itemRefs.current.delete(entry.id);\n }}\n type=\"button\"\n role=\"menuitem\"\n tabIndex={-1}\n aria-disabled={entry.disabled || undefined}\n data-danger={entry.danger || undefined}\n className={styles.item}\n onClick={() => choose(entry)}\n >\n <span className={styles.icon} aria-hidden=\"true\">\n {entry.icon}\n </span>\n <span className={styles.label}>{entry.label}</span>\n {entry.shortcut ? (\n <kbd className={styles.shortcut} aria-hidden=\"true\">\n {entry.shortcut}\n </kbd>\n ) : null}\n </button>\n );\n })}\n </div>,\n container,\n )\n : null}\n </div>\n );\n});\n"],"mappings":"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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/components/actions/BlockMenu/BlockMenu.module.css
|
|
2
|
+
var root = "block-root-YWJbx";
|
|
3
|
+
var chevron = "block-chevron-KdTgQ";
|
|
4
|
+
var menu = "block-menu-KgvDw";
|
|
5
|
+
var item = "block-item-u39c-";
|
|
6
|
+
var icon = "block-icon-OVCC3";
|
|
7
|
+
var label = "block-label-r-rZl";
|
|
8
|
+
var shortcut = "block-shortcut-5Sekq";
|
|
9
|
+
var separator = "block-separator-xmDN6";
|
|
10
|
+
var BlockMenu_module_default = {
|
|
11
|
+
root,
|
|
12
|
+
chevron,
|
|
13
|
+
menu,
|
|
14
|
+
item,
|
|
15
|
+
icon,
|
|
16
|
+
label,
|
|
17
|
+
shortcut,
|
|
18
|
+
separator
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { chevron, BlockMenu_module_default as default, icon, item, label, menu, root, separator, shortcut };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=BlockMenu.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockMenu.module.js","names":[],"sources":["../../../../src/components/actions/BlockMenu/BlockMenu.module.css"],"sourcesContent":[".root {\n position: relative;\n display: inline-flex;\n}\n\n.chevron {\n display: inline-flex;\n transition: transform var(--block-duration-instant) var(--block-ease-step);\n}\n\n.root[data-open] .chevron {\n transform: rotate(180deg);\n}\n\n.menu {\n position: fixed;\n top: var(--block-float-y, 0);\n left: var(--block-float-x, 0);\n z-index: var(--block-z-dropdown);\n display: flex;\n flex-direction: column;\n min-width: max(var(--block-float-anchor-width, 0px), 200px);\n max-width: min(320px, calc(100vw - var(--block-space-4)));\n max-height: calc(100vh - var(--block-space-4));\n overflow-y: auto;\n padding: var(--block-space-1);\n background-color: var(--block-surface);\n border: var(--block-border-width) solid var(--block-border);\n box-shadow: var(--block-shadow-bevel), var(--block-shadow-drop);\n}\n\n.menu[hidden] {\n display: none;\n}\n\n.item {\n display: flex;\n align-items: center;\n gap: var(--block-space-2);\n width: 100%;\n min-height: var(--block-size-control-sm);\n padding: var(--block-space-1) var(--block-space-2);\n font: inherit;\n font-size: var(--block-font-size-sm);\n font-weight: var(--block-font-weight-medium);\n text-align: left;\n color: var(--block-text);\n background: transparent;\n border: var(--block-border-width-thin) solid transparent;\n cursor: pointer;\n}\n\n.item:hover:not([aria-disabled]),\n.item:focus-visible {\n background-color: var(--block-slot-hover);\n border-color: var(--block-border);\n}\n\n.item:focus-visible {\n outline: 3px solid var(--block-focus);\n outline-offset: -3px;\n}\n\n.item[aria-disabled] {\n color: var(--block-text-muted);\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.item[data-danger] {\n color: var(--block-redstone-light);\n}\n\n.icon {\n display: inline-flex;\n flex-shrink: 0;\n width: 16px;\n}\n\n.label {\n flex: 1;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n\n.shortcut {\n flex-shrink: 0;\n margin-left: var(--block-space-3);\n font-family: var(--block-font-mono);\n font-size: var(--block-font-size-xs);\n color: var(--block-text-muted);\n}\n\n.separator {\n height: 4px;\n margin: var(--block-space-1) 0;\n background-color: var(--block-shadow-bevel-dark);\n box-shadow: inset -2px -2px 0 var(--block-shadow-bevel-light);\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import type { BlockButtonSize, BlockButtonVariant } from "../BlockButton/BlockButton.types";
|
|
3
|
+
export interface BlockMenuItem {
|
|
4
|
+
id: string;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
/** Keyboard shortcut hint shown on the right (display only). */
|
|
8
|
+
shortcut?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Redstone-colored destructive action. */
|
|
11
|
+
danger?: boolean;
|
|
12
|
+
onSelect?: () => void;
|
|
13
|
+
/** Text used for type-ahead when `label` is not a string. */
|
|
14
|
+
textValue?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface BlockMenuSeparator {
|
|
17
|
+
type: "separator";
|
|
18
|
+
id?: string;
|
|
19
|
+
}
|
|
20
|
+
export type BlockMenuEntry = BlockMenuItem | BlockMenuSeparator;
|
|
21
|
+
export interface BlockMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
22
|
+
/** Trigger button text — also the menu's accessible name. */
|
|
23
|
+
label: string;
|
|
24
|
+
items: BlockMenuEntry[];
|
|
25
|
+
/** Called with the item id after any item is chosen. */
|
|
26
|
+
onSelect?: (id: string) => void;
|
|
27
|
+
/** Trigger material. @default "stone" */
|
|
28
|
+
variant?: BlockButtonVariant;
|
|
29
|
+
/** Trigger size. @default "md" */
|
|
30
|
+
size?: BlockButtonSize;
|
|
31
|
+
/** Icon before the trigger text, or the whole trigger when `iconOnly`. */
|
|
32
|
+
icon?: ReactNode;
|
|
33
|
+
/** Square icon trigger; `label` becomes its `aria-label`. */
|
|
34
|
+
iconOnly?: boolean;
|
|
35
|
+
/** Align the menu with the trigger's start or end edge. @default "start" */
|
|
36
|
+
align?: "start" | "end";
|
|
37
|
+
/** Open below or above the trigger. @default "bottom" */
|
|
38
|
+
placement?: "bottom" | "top";
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
onOpenChange?: (open: boolean) => void;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=BlockMenu.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockMenu.types.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/BlockMenu/BlockMenu.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE5F,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAEhE,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACtF,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,yCAAyC;IACzC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,kCAAkC;IAClC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACxB,yDAAyD;IACzD,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BlockMenuEntry, BlockMenuItem } from "./BlockMenu.types";
|
|
2
|
+
export declare function isMenuItem(entry: BlockMenuEntry): entry is BlockMenuItem;
|
|
3
|
+
/** Text an item answers to for type-ahead. */
|
|
4
|
+
export declare function itemText(item: BlockMenuItem): string;
|
|
5
|
+
/**
|
|
6
|
+
* Index of the next enabled item whose text starts with `char`, searching
|
|
7
|
+
* forward from the item after `from` and wrapping around.
|
|
8
|
+
*/
|
|
9
|
+
export declare function typeaheadIndex(items: BlockMenuItem[], from: number, char: string): number;
|
|
10
|
+
//# sourceMappingURL=BlockMenu.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockMenu.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/BlockMenu/BlockMenu.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvE,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,IAAI,aAAa,CAExE;AAED,8CAA8C;AAC9C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAGpD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQzF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/components/actions/BlockMenu/BlockMenu.utils.ts
|
|
2
|
+
function isMenuItem(entry) {
|
|
3
|
+
return !("type" in entry && entry.type === "separator");
|
|
4
|
+
}
|
|
5
|
+
/** Text an item answers to for type-ahead. */
|
|
6
|
+
function itemText(item) {
|
|
7
|
+
if (item.textValue !== void 0) return item.textValue;
|
|
8
|
+
return typeof item.label === "string" || typeof item.label === "number" ? String(item.label) : "";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Index of the next enabled item whose text starts with `char`, searching
|
|
12
|
+
* forward from the item after `from` and wrapping around.
|
|
13
|
+
*/
|
|
14
|
+
function typeaheadIndex(items, from, char) {
|
|
15
|
+
const needle = char.toLowerCase();
|
|
16
|
+
for (let step = 1; step <= items.length; step += 1) {
|
|
17
|
+
const index = (from + step) % items.length;
|
|
18
|
+
const item = items[index];
|
|
19
|
+
if (item && !item.disabled && itemText(item).toLowerCase().startsWith(needle)) return index;
|
|
20
|
+
}
|
|
21
|
+
return -1;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { isMenuItem, itemText, typeaheadIndex };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=BlockMenu.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockMenu.utils.js","names":[],"sources":["../../../../src/components/actions/BlockMenu/BlockMenu.utils.ts"],"sourcesContent":["import type { BlockMenuEntry, BlockMenuItem } from \"./BlockMenu.types\";\n\nexport function isMenuItem(entry: BlockMenuEntry): entry is BlockMenuItem {\n return !(\"type\" in entry && entry.type === \"separator\");\n}\n\n/** Text an item answers to for type-ahead. */\nexport function itemText(item: BlockMenuItem): string {\n if (item.textValue !== undefined) return item.textValue;\n return typeof item.label === \"string\" || typeof item.label === \"number\" ? String(item.label) : \"\";\n}\n\n/**\n * Index of the next enabled item whose text starts with `char`, searching\n * forward from the item after `from` and wrapping around.\n */\nexport function typeaheadIndex(items: BlockMenuItem[], from: number, char: string): number {\n const needle = char.toLowerCase();\n for (let step = 1; step <= items.length; step += 1) {\n const index = (from + step) % items.length;\n const item = items[index];\n if (item && !item.disabled && itemText(item).toLowerCase().startsWith(needle)) return index;\n }\n return -1;\n}\n"],"mappings":";AAEA,SAAgB,WAAW,OAA+C;CACxE,OAAO,EAAE,UAAU,SAAS,MAAM,SAAS;AAC7C;;AAGA,SAAgB,SAAS,MAA6B;CACpD,IAAI,KAAK,cAAc,KAAA,GAAW,OAAO,KAAK;CAC9C,OAAO,OAAO,KAAK,UAAU,YAAY,OAAO,KAAK,UAAU,WAAW,OAAO,KAAK,KAAK,IAAI;AACjG;;;;;AAMA,SAAgB,eAAe,OAAwB,MAAc,MAAsB;CACzF,MAAM,SAAS,KAAK,YAAY;CAChC,KAAK,IAAI,OAAO,GAAG,QAAQ,MAAM,QAAQ,QAAQ,GAAG;EAClD,MAAM,SAAS,OAAO,QAAQ,MAAM;EACpC,MAAM,OAAO,MAAM;EACnB,IAAI,QAAQ,CAAC,KAAK,YAAY,SAAS,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,WAAW,MAAM,GAAG,OAAO;CACxF;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/BlockMenu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,GACnB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ServerBrowserProps } from "./ServerBrowser.types";
|
|
2
|
+
/**
|
|
3
|
+
* Multiplayer server list: search, sort and an "online only" switch over
|
|
4
|
+
* `ServerCard`s, with optional Refresh and Add server actions.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ServerBrowser: import("react").ForwardRefExoticComponent<ServerBrowserProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
//# sourceMappingURL=ServerBrowser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerBrowser.d.ts","sourceRoot":"","sources":["../../../../src/components/cards/ServerBrowser/ServerBrowser.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,uBAAuB,CAAC;AAS5E;;;GAGG;AACH,eAAO,MAAM,aAAa,+GAuExB,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { cx } from "../../../utils/cx.js";
|
|
2
|
+
import { BlockButton } from "../../actions/BlockButton/BlockButton.js";
|
|
3
|
+
import { BlockInput } from "../../forms/BlockInput/BlockInput.js";
|
|
4
|
+
import { BlockSelect } from "../../forms/BlockSelect/BlockSelect.js";
|
|
5
|
+
import { BlockToggle } from "../../forms/BlockToggle/BlockToggle.js";
|
|
6
|
+
import { ServerCard } from "../ServerCard/ServerCard.js";
|
|
7
|
+
import browser_module_default from "../browser.module.js";
|
|
8
|
+
import { browseServers } from "./ServerBrowser.utils.js";
|
|
9
|
+
import { forwardRef, useState } from "react";
|
|
10
|
+
import { PlusIcon, SearchIcon } from "@malilion/block-ui-icons";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
//#region src/components/cards/ServerBrowser/ServerBrowser.tsx
|
|
13
|
+
var SORT_OPTIONS = [
|
|
14
|
+
{
|
|
15
|
+
value: "players",
|
|
16
|
+
label: "Most players"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: "ping",
|
|
20
|
+
label: "Lowest ping"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: "name",
|
|
24
|
+
label: "Name"
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* Multiplayer server list: search, sort and an "online only" switch over
|
|
29
|
+
* `ServerCard`s, with optional Refresh and Add server actions.
|
|
30
|
+
*/
|
|
31
|
+
var ServerBrowser = forwardRef(function ServerBrowser({ servers, onJoin, onRefresh, onAddServer, defaultSort = "players", emptyText = "No servers found", label = "Server browser", className, ...rest }, ref) {
|
|
32
|
+
const [query, setQuery] = useState("");
|
|
33
|
+
const [onlineOnly, setOnlineOnly] = useState(false);
|
|
34
|
+
const [sort, setSort] = useState(defaultSort);
|
|
35
|
+
const visible = browseServers(servers, {
|
|
36
|
+
query,
|
|
37
|
+
onlineOnly,
|
|
38
|
+
sort
|
|
39
|
+
});
|
|
40
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
41
|
+
ref,
|
|
42
|
+
role: "region",
|
|
43
|
+
"aria-label": label,
|
|
44
|
+
className: cx(browser_module_default.browser, className),
|
|
45
|
+
...rest,
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsxs("div", {
|
|
48
|
+
className: browser_module_default.toolbar,
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx(BlockInput, {
|
|
51
|
+
type: "search",
|
|
52
|
+
label: "Search servers",
|
|
53
|
+
value: query,
|
|
54
|
+
onChange: (event) => setQuery(event.target.value),
|
|
55
|
+
startIcon: /* @__PURE__ */ jsx(SearchIcon, { size: 16 }),
|
|
56
|
+
wrapperClassName: browser_module_default.search
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsx(BlockSelect, {
|
|
59
|
+
label: "Sort by",
|
|
60
|
+
value: sort,
|
|
61
|
+
onChange: (event) => setSort(event.target.value),
|
|
62
|
+
options: SORT_OPTIONS,
|
|
63
|
+
wrapperClassName: browser_module_default.filter
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ jsx(BlockToggle, {
|
|
66
|
+
label: "Online only",
|
|
67
|
+
checked: onlineOnly,
|
|
68
|
+
onCheckedChange: setOnlineOnly
|
|
69
|
+
}),
|
|
70
|
+
onRefresh || onAddServer ? /* @__PURE__ */ jsxs("div", {
|
|
71
|
+
className: browser_module_default.actions,
|
|
72
|
+
children: [onRefresh ? /* @__PURE__ */ jsx(BlockButton, {
|
|
73
|
+
onClick: onRefresh,
|
|
74
|
+
children: "Refresh"
|
|
75
|
+
}) : null, onAddServer ? /* @__PURE__ */ jsx(BlockButton, {
|
|
76
|
+
variant: "grass",
|
|
77
|
+
startIcon: /* @__PURE__ */ jsx(PlusIcon, { size: 16 }),
|
|
78
|
+
onClick: onAddServer,
|
|
79
|
+
children: "Add server"
|
|
80
|
+
}) : null]
|
|
81
|
+
}) : null
|
|
82
|
+
]
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ jsx("p", {
|
|
85
|
+
className: browser_module_default.count,
|
|
86
|
+
role: "status",
|
|
87
|
+
children: visible.length === 1 ? "1 server" : `${visible.length} servers`
|
|
88
|
+
}),
|
|
89
|
+
visible.length > 0 ? /* @__PURE__ */ jsx("ul", {
|
|
90
|
+
className: browser_module_default.list,
|
|
91
|
+
"aria-label": "Servers",
|
|
92
|
+
children: visible.map(({ id, ...server }) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(ServerCard, {
|
|
93
|
+
...server,
|
|
94
|
+
onJoin: onJoin ? () => onJoin(id) : void 0
|
|
95
|
+
}) }, id))
|
|
96
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
97
|
+
className: browser_module_default.empty,
|
|
98
|
+
children: emptyText
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
//#endregion
|
|
104
|
+
export { ServerBrowser };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=ServerBrowser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerBrowser.js","names":["styles"],"sources":["../../../../src/components/cards/ServerBrowser/ServerBrowser.tsx"],"sourcesContent":["import { PlusIcon, SearchIcon } from \"@malilion/block-ui-icons\";\nimport { forwardRef, useState } from \"react\";\nimport { cx } from \"../../../utils/cx\";\nimport { BlockButton } from \"../../actions/BlockButton/BlockButton\";\nimport { BlockInput } from \"../../forms/BlockInput/BlockInput\";\nimport { BlockSelect } from \"../../forms/BlockSelect/BlockSelect\";\nimport { BlockToggle } from \"../../forms/BlockToggle/BlockToggle\";\nimport styles from \"../browser.module.css\";\nimport { ServerCard } from \"../ServerCard/ServerCard\";\nimport type { ServerBrowserProps, ServerSort } from \"./ServerBrowser.types\";\nimport { browseServers } from \"./ServerBrowser.utils\";\n\nconst SORT_OPTIONS = [\n { value: \"players\", label: \"Most players\" },\n { value: \"ping\", label: \"Lowest ping\" },\n { value: \"name\", label: \"Name\" },\n];\n\n/**\n * Multiplayer server list: search, sort and an \"online only\" switch over\n * `ServerCard`s, with optional Refresh and Add server actions.\n */\nexport const ServerBrowser = forwardRef<HTMLDivElement, ServerBrowserProps>(function ServerBrowser(\n {\n servers,\n onJoin,\n onRefresh,\n onAddServer,\n defaultSort = \"players\",\n emptyText = \"No servers found\",\n label = \"Server browser\",\n className,\n ...rest\n },\n ref,\n) {\n const [query, setQuery] = useState(\"\");\n const [onlineOnly, setOnlineOnly] = useState(false);\n const [sort, setSort] = useState<ServerSort>(defaultSort);\n const visible = browseServers(servers, { query, onlineOnly, sort });\n\n return (\n <div\n ref={ref}\n role=\"region\"\n aria-label={label}\n className={cx(styles.browser, className)}\n {...rest}\n >\n <div className={styles.toolbar}>\n <BlockInput\n type=\"search\"\n label=\"Search servers\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n startIcon={<SearchIcon size={16} />}\n wrapperClassName={styles.search}\n />\n <BlockSelect\n label=\"Sort by\"\n value={sort}\n onChange={(event) => setSort(event.target.value as ServerSort)}\n options={SORT_OPTIONS}\n wrapperClassName={styles.filter}\n />\n <BlockToggle label=\"Online only\" checked={onlineOnly} onCheckedChange={setOnlineOnly} />\n {onRefresh || onAddServer ? (\n <div className={styles.actions}>\n {onRefresh ? <BlockButton onClick={onRefresh}>Refresh</BlockButton> : null}\n {onAddServer ? (\n <BlockButton variant=\"grass\" startIcon={<PlusIcon size={16} />} onClick={onAddServer}>\n Add server\n </BlockButton>\n ) : null}\n </div>\n ) : null}\n </div>\n <p className={styles.count} role=\"status\">\n {visible.length === 1 ? \"1 server\" : `${visible.length} servers`}\n </p>\n {visible.length > 0 ? (\n <ul className={styles.list} aria-label=\"Servers\">\n {visible.map(({ id, ...server }) => (\n <li key={id}>\n <ServerCard {...server} onJoin={onJoin ? () => onJoin(id) : undefined} />\n </li>\n ))}\n </ul>\n ) : (\n <p className={styles.empty}>{emptyText}</p>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;;AAYA,IAAM,eAAe;CACnB;EAAE,OAAO;EAAW,OAAO;CAAe;CAC1C;EAAE,OAAO;EAAQ,OAAO;CAAc;CACtC;EAAE,OAAO;EAAQ,OAAO;CAAO;AACjC;;;;;AAMA,IAAa,gBAAgB,WAA+C,SAAS,cACnF,EACE,SACA,QACA,WACA,aACA,cAAc,WACd,YAAY,oBACZ,QAAQ,kBACR,WACA,GAAG,QAEL,KACA;CACA,MAAM,CAAC,OAAO,YAAY,SAAS,EAAE;CACrC,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,CAAC,MAAM,WAAW,SAAqB,WAAW;CACxD,MAAM,UAAU,cAAc,SAAS;EAAE;EAAO;EAAY;CAAK,CAAC;CAElE,OACE,qBAAC,OAAD;EACO;EACL,MAAK;EACL,cAAY;EACZ,WAAW,GAAGA,uBAAO,SAAS,SAAS;EACvC,GAAI;EALN,UAAA;GAOE,qBAAC,OAAD;IAAK,WAAWA,uBAAO;IAAvB,UAAA;KACE,oBAAC,YAAD;MACE,MAAK;MACL,OAAM;MACN,OAAO;MACP,WAAW,UAAU,SAAS,MAAM,OAAO,KAAK;MAChD,WAAW,oBAAC,YAAD,EAAY,MAAM,GAAK,CAAA;MAClC,kBAAkBA,uBAAO;KAC1B,CAAA;KACD,oBAAC,aAAD;MACE,OAAM;MACN,OAAO;MACP,WAAW,UAAU,QAAQ,MAAM,OAAO,KAAmB;MAC7D,SAAS;MACT,kBAAkBA,uBAAO;KAC1B,CAAA;KACD,oBAAC,aAAD;MAAa,OAAM;MAAc,SAAS;MAAY,iBAAiB;KAAgB,CAAA;KACtF,aAAa,cACZ,qBAAC,OAAD;MAAK,WAAWA,uBAAO;MAAvB,UAAA,CACG,YAAY,oBAAC,aAAD;OAAa,SAAS;OAAW,UAAA;MAAoB,CAAA,IAAI,MACrE,cACC,oBAAC,aAAD;OAAa,SAAQ;OAAQ,WAAW,oBAAC,UAAD,EAAU,MAAM,GAAK,CAAA;OAAG,SAAS;OAAa,UAAA;MAEzE,CAAA,IACX,IACD;KACH,CAAA,IAAA;IACD;;GACL,oBAAC,KAAD;IAAG,WAAWA,uBAAO;IAAO,MAAK;IAC9B,UAAA,QAAQ,WAAW,IAAI,aAAa,GAAG,QAAQ,OAAO;GACtD,CAAA;GACF,QAAQ,SAAS,IAChB,oBAAC,MAAD;IAAI,WAAWA,uBAAO;IAAM,cAAW;IACpC,UAAA,QAAQ,KAAK,EAAE,IAAI,GAAG,aACrB,oBAAC,MAAD,EAAA,UACE,oBAAC,YAAD;KAAY,GAAI;KAAQ,QAAQ,eAAe,OAAO,EAAE,IAAI,KAAA;IAAY,CAAA,EACtE,GAFK,EAEL,CACL;GACC,CAAA,IAEJ,oBAAC,KAAD;IAAG,WAAWA,uBAAO;IAAQ,UAAA;GAAa,CAAA;EAEzC;;AAET,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import type { ServerCardProps } from "../ServerCard/ServerCard.types";
|
|
3
|
+
export interface ServerEntry extends Omit<ServerCardProps, "onJoin" | "id"> {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export type ServerSort = "name" | "players" | "ping";
|
|
7
|
+
export interface ServerBrowserProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
servers: ServerEntry[];
|
|
9
|
+
/** Called with the server id when its Join button is pressed. */
|
|
10
|
+
onJoin?: (id: string) => void;
|
|
11
|
+
/** Renders a Refresh button. */
|
|
12
|
+
onRefresh?: () => void;
|
|
13
|
+
/** Renders an "Add server" button. */
|
|
14
|
+
onAddServer?: () => void;
|
|
15
|
+
/** Initial sort. @default "players" */
|
|
16
|
+
defaultSort?: ServerSort;
|
|
17
|
+
/** Shown when no server matches. @default "No servers found" */
|
|
18
|
+
emptyText?: ReactNode;
|
|
19
|
+
/** Accessible name. @default "Server browser" */
|
|
20
|
+
label?: string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ServerBrowser.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerBrowser.types.d.ts","sourceRoot":"","sources":["../../../../src/components/cards/ServerBrowser/ServerBrowser.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,IAAI,CAAC;IACzE,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,kBAAmB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACxE,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,iEAAiE;IACjE,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,uCAAuC;IACvC,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,gEAAgE;IAChE,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ServerEntry, ServerSort } from "./ServerBrowser.types";
|
|
2
|
+
/** Filters by name / MOTD and the online switch, then sorts (offline servers last). */
|
|
3
|
+
export declare function browseServers(servers: ServerEntry[], { query, onlineOnly, sort }: {
|
|
4
|
+
query: string;
|
|
5
|
+
onlineOnly: boolean;
|
|
6
|
+
sort: ServerSort;
|
|
7
|
+
}): ServerEntry[];
|
|
8
|
+
//# sourceMappingURL=ServerBrowser.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerBrowser.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/cards/ServerBrowser/ServerBrowser.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAErE,uFAAuF;AACvF,wBAAgB,aAAa,CAC3B,OAAO,EAAE,WAAW,EAAE,EACtB,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GACpF,WAAW,EAAE,CAgBf"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/components/cards/ServerBrowser/ServerBrowser.utils.ts
|
|
2
|
+
/** Filters by name / MOTD and the online switch, then sorts (offline servers last). */
|
|
3
|
+
function browseServers(servers, { query, onlineOnly, sort }) {
|
|
4
|
+
const needle = query.trim().toLowerCase();
|
|
5
|
+
return [...servers.filter((server) => (!onlineOnly || server.online !== false) && (needle === "" || server.name.toLowerCase().includes(needle) || (server.motd ?? "").toLowerCase().includes(needle)))].sort((a, b) => {
|
|
6
|
+
const offline = Number(a.online === false) - Number(b.online === false);
|
|
7
|
+
if (offline !== 0) return offline;
|
|
8
|
+
if (sort === "players") return (b.onlinePlayers ?? 0) - (a.onlinePlayers ?? 0);
|
|
9
|
+
if (sort === "ping") return (a.ping ?? Infinity) - (b.ping ?? Infinity);
|
|
10
|
+
return a.name.localeCompare(b.name);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { browseServers };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=ServerBrowser.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerBrowser.utils.js","names":[],"sources":["../../../../src/components/cards/ServerBrowser/ServerBrowser.utils.ts"],"sourcesContent":["import type { ServerEntry, ServerSort } from \"./ServerBrowser.types\";\n\n/** Filters by name / MOTD and the online switch, then sorts (offline servers last). */\nexport function browseServers(\n servers: ServerEntry[],\n { query, onlineOnly, sort }: { query: string; onlineOnly: boolean; sort: ServerSort },\n): ServerEntry[] {\n const needle = query.trim().toLowerCase();\n const visible = servers.filter(\n (server) =>\n (!onlineOnly || server.online !== false) &&\n (needle === \"\" ||\n server.name.toLowerCase().includes(needle) ||\n (server.motd ?? \"\").toLowerCase().includes(needle)),\n );\n return [...visible].sort((a, b) => {\n const offline = Number(a.online === false) - Number(b.online === false);\n if (offline !== 0) return offline;\n if (sort === \"players\") return (b.onlinePlayers ?? 0) - (a.onlinePlayers ?? 0);\n if (sort === \"ping\") return (a.ping ?? Infinity) - (b.ping ?? Infinity);\n return a.name.localeCompare(b.name);\n });\n}\n"],"mappings":";;AAGA,SAAgB,cACd,SACA,EAAE,OAAO,YAAY,QACN;CACf,MAAM,SAAS,MAAM,KAAK,CAAC,CAAC,YAAY;CAQxC,OAAO,CAAC,GAPQ,QAAQ,QACrB,YACE,CAAC,cAAc,OAAO,WAAW,WACjC,WAAW,MACV,OAAO,KAAK,YAAY,CAAC,CAAC,SAAS,MAAM,MACxC,OAAO,QAAQ,GAAA,CAAI,YAAY,CAAC,CAAC,SAAS,MAAM,EAE5C,CAAO,CAAC,CAAC,MAAM,GAAG,MAAM;EACjC,MAAM,UAAU,OAAO,EAAE,WAAW,KAAK,IAAI,OAAO,EAAE,WAAW,KAAK;EACtE,IAAI,YAAY,GAAG,OAAO;EAC1B,IAAI,SAAS,WAAW,QAAQ,EAAE,iBAAiB,MAAM,EAAE,iBAAiB;EAC5E,IAAI,SAAS,QAAQ,QAAQ,EAAE,QAAQ,aAAa,EAAE,QAAQ;EAC9D,OAAO,EAAE,KAAK,cAAc,EAAE,IAAI;CACpC,CAAC;AACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/cards/ServerBrowser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WorldBrowserProps } from "./WorldBrowser.types";
|
|
2
|
+
/** Singleplayer world list: search, game-mode filter and sort over `WorldCard`s. */
|
|
3
|
+
export declare const WorldBrowser: import("react").ForwardRefExoticComponent<WorldBrowserProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
+
//# sourceMappingURL=WorldBrowser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorldBrowser.d.ts","sourceRoot":"","sources":["../../../../src/components/cards/WorldBrowser/WorldBrowser.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAa,MAAM,sBAAsB,CAAC;AAQzE,oFAAoF;AACpF,eAAO,MAAM,YAAY,8GA+EvB,CAAC"}
|