# typed: false # frozen_string_literal: true module Ariadne module UI module Shortcut class Component < Ariadne::BaseComponent SPECIAL_KEYS = ["alt", "shift", "ctrl"] option :text, default: proc { "" } option :keys option :size, default: proc { :base } def special_keys = SPECIAL_KEYS accepts_html_attributes do |html_attrs| html_attrs[:class] = Ariadne::ViewComponents.tailwind_merger.merge([style(:key, size:), html_attrs[:class]].join(" ")) end style do base do [ "ariadne-inline-flex", "ariadne-items-baseline", "ariadne-select-none", "*:ariadne-px-0", ] end end style :key do base do ["ariadne-font-mono"] end variants do size do xs do ["ariadne-text-xs", "ariadne-px-1", "ariadne-rounded-sm"] end sm do ["ariadne-text-sm", "ariadne-px-1.5", "ariadne-rounded"] end base do ["ariadne-text-base", "ariadne-px-1.5", "ariadne-rounded-md"] end end end end end end end end