v1.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace zin;
  3. require_once dirname(__DIR__) . DS . 'checklist' . DS . 'v1.php';
  4. require_once dirname(__DIR__) . DS . 'checkbtn' . DS . 'v1.php';
  5. class checkBtnGroup extends checkList
  6. {
  7. /**
  8. * @var mixed[]
  9. */
  10. protected static $defaultProps = array
  11. (
  12. 'inline' => true,
  13. 'type' => 'radio'
  14. );
  15. public static function getPageCSS()
  16. {
  17. return <<<CSS
  18. .check-btn-group {gap: 1px; border: 1px solid var(--form-control-border); padding: 0; border-radius: var(--radius)}
  19. .check-btn-group > .check-btn {flex: auto; position: relative}
  20. .check-btn-group > .check-btn + .check-btn::before {content: ' '; display: block; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 1px; background: var(--color-border)}
  21. .check-btn-group > .check-btn > label {width: 100%;--tw-ring-color: transparent}
  22. .check-btn-group > .check-btn:not(:first-child) > label {border-top-left-radius: 0; border-bottom-left-radius: 0}
  23. .check-btn-group > .check-btn:not(:last-child) > label {border-top-right-radius: 0; border-bottom-right-radius: 0}
  24. CSS;
  25. }
  26. /**
  27. * @param mixed[] $props
  28. */
  29. public function buildItem($props)
  30. {
  31. return new checkBtn(set($props));
  32. }
  33. protected function build()
  34. {
  35. $div = parent::build();
  36. $div->add(setClass('check-btn-group'));
  37. return $div;
  38. }
  39. }